80 findings, not the 14 the first run showed -- clippy stops at the first failing compilation unit, so `--keep-going` is what makes the list complete. 60 were machine-applicable (`cargo clippy --fix`). The rest by hand: * five descending `sort_by` -> `sort_by_key(Reverse(..))` * `chunks_exact(4)` on both sides of four zips, so the compared items stay `[u8; 4]` rather than one array against one slice * three `type` aliases for the census maps and the captured-quad tuple * `&PathBuf` -> `&Path` in two disc tests * two range loops; one of them keeps `#[allow(needless_range_loop)]` with the reason -- the index is into a map's value, which changes each iteration * the module doc list in `invert_capture` re-indented to markdown's rules * `blit`'s eight arguments get `#[allow(too_many_arguments)]`, not a struct One dead `let off = b.len();` in a `ratc` test is dropped rather than renamed. The sibling test at :162 is the one that asserts an offset; if this one was meant to as well, that is a test change and not a lint fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
34 lines
1.3 KiB
Rust
34 lines
1.3 KiB
Rust
//! How many `.slb` banks would a "leading headerless stream" rule affect?
|
|
//!
|
|
//! The rule fires when the first `RIFF` sits at exactly
|
|
//! `HEADERLESS_DATA_OFFSET + n*XMA1_PACKET` with a non-zero leading region.
|
|
//! Before trusting it, count how many banks it would change — including the
|
|
//! `RT*` movie banks that already decode correctly today.
|
|
use sylpheed_formats::{slb, PakArchive};
|
|
|
|
fn main() {
|
|
let disc = std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC");
|
|
let snd = PakArchive::open(format!("{disc}/dat/sound.pak")).expect("sound.pak");
|
|
let (mut total, mut has_riff, mut hybrid, mut hybrid_nonzero) = (0, 0, 0, 0);
|
|
for e in snd.entries() {
|
|
let Ok(b) = snd.read(e) else { continue };
|
|
total += 1;
|
|
let Some(ri) = b.windows(4).position(|w| w == b"RIFF") else {
|
|
continue;
|
|
};
|
|
has_riff += 1;
|
|
if ri > slb::HEADERLESS_DATA_OFFSET
|
|
&& (ri - slb::HEADERLESS_DATA_OFFSET).is_multiple_of(slb::XMA1_PACKET)
|
|
{
|
|
hybrid += 1;
|
|
if b[slb::HEADERLESS_DATA_OFFSET..ri].iter().any(|x| *x != 0) {
|
|
hybrid_nonzero += 1;
|
|
}
|
|
}
|
|
}
|
|
println!(
|
|
"sound.pak entries {total}; with a RIFF {has_riff}; \
|
|
first RIFF at 1392+n*2048 {hybrid}; of those with a NON-ZERO leading region {hybrid_nonzero}"
|
|
);
|
|
}
|