patterns/includes: More misc cleanups (#353)

* patterns/zip: simplify find_sequence_in_range check

hex(340282366920938463463374607431768211455) =
0xffffffffffffffffffffffffffffffff

* patterns/7z: use Magic<> for signature, add pragma

* patterns/{nro, ogg}: use Magic<> for signature

* patterns/ttf: refactor, check magic

Use the "Field field @ position;" syntax instead of saving and restoring
the cursor position.

* readme: fix copy-paste error in pattern listing
This commit is contained in:
Mrmaxmeier
2025-03-22 13:46:06 +01:00
committed by GitHub
parent 3ad263783d
commit df97fc7257
6 changed files with 21 additions and 45 deletions

View File

@@ -5,6 +5,7 @@
import std.core;
import std.mem;
import type.magic;
bitfield HeaderType {
Continuation : 1;
@@ -17,7 +18,7 @@ struct SegmentData {
};
struct Ogg {
char capturePattern[4];
type::Magic<"OggS"> capturePattern;
u8 version;
HeaderType headerType;
u64 granulePosition;
@@ -29,4 +30,4 @@ struct Ogg {
SegmentData data[pageSegments];
};
Ogg ogg[while(!std::mem::eof())] @ 0x00;
Ogg ogg[while(!std::mem::eof())] @ 0x00;