29 std::optional<std::string> firstDivergenceBlp(
const FileBuffer& original,
32 if (original == rewritten)
return std::nullopt;
34 const std::size_t
common = std::min(original.size(), rewritten.size());
36 while (at <
common && original[at] == rewritten[at]) ++at;
38 std::string inside =
"gap/tail";
39 if (at < 0x94) inside =
"header";
45 if (offset != 0 && size != 0 && at >= offset && at < std::uint64_t{offset} + size) {
46 inside = std::format(
"mip {}", level);
50 return std::format(
"first divergence at {:#x} inside {} (sizes {} vs {})", at, inside, original.size(),
60 const auto raw =
fs.readFile(
FileKey{path});
66 const auto rewritten = entity.
write();
70 report,
"compare", *divergence);
77 return guarded([&] {
return roundtripBlp(
fs, path); });
The BLP entity (namespace wowlib::formats::blp): Blizzard's texture format.
Internals of the round-trip audit (namespace wowlib::audit::detail): the per-format driver class — on...
RoundtripReport failWith(RoundtripReport &report, std::string stage, std::string error)
Mark report failed in place and hand it back — keeps the unknown-chunk tally gathered before the fail...
std::optional< RoundtripReport > classifyRead(RoundtripReport &report, std::string stage, const Result< FileBuffer > &result)
Classify a client-file read for the audit: content behind an unknown TACT key and zero-byte archive e...
RoundtripReport guarded(F &&f)
Run one file's driver, converting any escaping exception into a failed outcome — one pathological fil...
std::vector< std::byte > FileBuffer
Owning byte buffer for file contents read out of a client storage.