//! Does the capture-proven offset validate for the resource that should own it? use sylpheed_formats::mesh::debug_try_anchor; fn main() { let a: Vec = std::env::args().collect(); let bytes = std::fs::read(&a[1]).unwrap(); // The production scan tries pads 0..=3; pass a bigger one to ask whether the // block would validate at all with a wider index/vertex gap. let max_pad: usize = std::env::var("MAX_PAD").ok().and_then(|v| v.parse().ok()).unwrap_or(3); for pair in a[2..].iter() { let (name, off) = pair.split_once('@').unwrap(); let off = usize::from_str_radix(off.trim_start_matches("0x"), 16).unwrap(); match debug_try_anchor(&bytes, name, off, max_pad) { Some((v, i, pad)) => println!("{name:22} @ 0x{off:x} ACCEPTED v={v} idx={i} pad={pad}"), None => println!("{name:22} @ 0x{off:x} rejected"), } } }