Skip to content

Commit

Permalink
release: 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Sep 5, 2024
2 parents 916291a + 04db5d6 commit db086c8
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 88 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@



## [0.5.0](https://github.com/Blobfolio/cdtoc/releases/tag/v0.5.0) - 2024-09-05

### Changed

* Miscellaneous code cleanup and lints
* Improved documentation
* Bump MSRV to `1.81`
* Bump `brunch` to `0.6`



## [0.4.0](https://github.com/Blobfolio/cdtoc/releases/tag/v0.4.0) - 2024-07-29

### Changed
Expand Down
8 changes: 4 additions & 4 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Project Dependencies
Package: cdtoc
Version: 0.4.0
Generated: 2024-07-29 19:36:09 UTC
Version: 0.5.0
Generated: 2024-09-05 19:43:40 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [block-buffer](https://github.com/RustCrypto/utils) | 0.10.4 | RustCrypto Developers | Apache-2.0 or MIT |
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [crypto-common](https://github.com/RustCrypto/traits) | 0.1.6 | RustCrypto Developers | Apache-2.0 or MIT |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.2 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.3 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [digest](https://github.com/RustCrypto/traits) | 0.10.7 | RustCrypto Developers | Apache-2.0 or MIT |
| [faster-hex](https://github.com/NervosFoundation/faster-hex) | 0.9.0 | [zhangsoledad](mailto:[email protected]) | MIT |
| [generic-array](https://github.com/fizyk20/generic-array.git) | 0.14.7 | [Bartłomiej Kamiński](mailto:[email protected]) and [Aaron Trent](mailto:[email protected]) | MIT |
| [itoa](https://github.com/dtolnay/itoa) | 1.0.11 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [sha1](https://github.com/RustCrypto/hashes) | 0.10.6 | RustCrypto Developers | Apache-2.0 or MIT |
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.3.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.3.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [typenum](https://github.com/paholg/typenum) | 1.17.0 | [Paho Lurie-Gregg](mailto:[email protected]) and [Andre Bogus](mailto:[email protected]) | Apache-2.0 or MIT |
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "cdtoc"
version = "0.4.0"
version = "0.5.0"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.80"
rust-version = "1.81"
description = "Parser and tools for CDTOC metadata tags."
license = "WTFPL"
repository = "https://github.com/Blobfolio/cdtoc"
Expand All @@ -30,7 +30,7 @@ features = [ "accuraterip", "cddb", "ctdb", "musicbrainz", "serde" ]
default-target = "x86_64-unknown-linux-gnu"

[dev-dependencies]
brunch = "0.5.*"
brunch = "0.6.*"
serde_json = "1.0.*"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ Add `cdtoc` to your `dependencies` in `Cargo.toml`, like:

```toml
[dependencies]
cdtoc = "0.4.*"
cdtoc = "0.5.*"
```

The disc ID helpers require additional dependencies, so if you aren't using them, be sure to disable the default features (adding back any you _do_ want) to skip the overhead.

```toml
[dependencies.cdtoc]
version = "0.4.*"
version = "0.5.*"
default-features = false
```

Expand Down
17 changes: 13 additions & 4 deletions src/accuraterip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl fmt::Display for AccurateRip {
}

impl From<&Toc> for AccurateRip {
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation, reason = "False positive.")]
fn from(src: &Toc) -> Self {
let mut b: u32 = 0;
let mut c: u32 = 0;
Expand Down Expand Up @@ -332,7 +332,15 @@ impl AccurateRip {
/// empty.
pub fn parse_drive_offsets(raw: &[u8])
-> Result<BTreeMap<(&str, &str), i16>, TocError> {
/// # Block Size.
///
/// The size of each raw entry, in bytes.
const BLOCK_SIZE: usize = 69;

/// # Trim Callback.
///
/// This is used to trim both ASCII whitespace and control characters,
/// as the raw data isn't afraid to null-pad its entries.
const fn trim_vm(c: char) -> bool { c.is_ascii_whitespace() || c.is_ascii_control() }

// There should be thousands of blocks, but we _need_ at least one!
Expand All @@ -342,7 +350,7 @@ impl AccurateRip {
// little-endian offset; the next 32 hold the vendor/model; the rest
// we can ignore!
let mut out = BTreeMap::default();
for chunk in raw.chunks_exact(69) {
for chunk in raw.chunks_exact(BLOCK_SIZE) {
// The offset is easy!
let offset = i16::from_le_bytes([chunk[0], chunk[1]]);

Expand Down Expand Up @@ -387,7 +395,7 @@ impl AccurateRip {
else { Ok(out) }
}

#[allow(unsafe_code)]
#[expect(unsafe_code, reason = "For performance.")]
#[must_use]
/// # Pretty Print.
///
Expand Down Expand Up @@ -421,8 +429,9 @@ impl AccurateRip {
faster_hex::hex_encode_fallback(&[self.0[8], self.0[7], self.0[6], self.0[5]], &mut out[13..21]);
faster_hex::hex_encode_fallback(&[self.0[12], self.0[11], self.0[10], self.0[9]], &mut out[22..]);

// Safety: all bytes are ASCII.
debug_assert!(out.is_ascii(), "Bug: AccurateRip checksum is not ASCII?!");

// Safety: all bytes are ASCII.
unsafe { String::from_utf8_unchecked(out) }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cddb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl From<Cddb> for u32 {
}

impl From<&Toc> for Cddb {
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation, reason = "False positive.")]
fn from(src: &Toc) -> Self {
let mut len = src.audio_len();
let mut a: u32 = 0;
Expand Down
8 changes: 6 additions & 2 deletions src/ctdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ use std::collections::BTreeMap;



/// # Stereo Sample Chunk Size.
///
/// Each CDDA sample has a 16-bit left and 16-bit right value; combined they're
/// four bytes.
const CHUNK_SIZE: usize = 4;



impl Toc {
#[cfg_attr(docsrs, doc(cfg(feature = "ctdb")))]
#[allow(clippy::missing_panics_doc)]
#[expect(clippy::missing_panics_doc, reason = "Panic is unreachable.")]
#[must_use]
/// # CUETools Database ID.
///
Expand Down Expand Up @@ -114,7 +118,7 @@ impl Toc {
/// );
/// ```
pub fn ctdb_checksum_url(&self) -> String {
let mut url = "http://db.cuetools.net/lookup2.php?version=3&ctdb=1&fuzzy=1&toc=".to_string();
let mut url = "http://db.cuetools.net/lookup2.php?version=3&ctdb=1&fuzzy=1&toc=".to_owned();
let mut buf = itoa::Buffer::new();

// Leading data?
Expand Down
Loading

0 comments on commit db086c8

Please sign in to comment.