Skip to content

IterCarve

Description

Carve a child iterator from a parent. The child starts at the parent’s current position with length n (so its valid range is the parent’s [pos, pos + n)), pos 0, inheriting the parent’s alignment and direction. The parent is unchanged – after the sub-read returns, the parent can keep iterating from where it left off.

Parameters

Name Direction Description
parent in Source iterator. Must outlive the child read.
n in Number of elements the child can read.

Usage example (Cross-references)

Usage examples (Cross-references)
                return false;
            }
            BufIter      sec_it = IterCarve(cmd, SECT64_SIZE);
            MachoSection sec;
            MemSet(&sec, 0, sizeof(sec));
            }
            // Peek the prefix (cmd, cmdsize) without advancing the walker.
            BufIter prefix = IterCarve(&walker, 8);
            u32     cmd, cmdsize;
            if (!BufReadFmt(&prefix, FMT_MACHO_LC_PREFIX_LE, cmd, cmdsize)) {
            // Carve a view of this entire command (including the 8-byte
            // prefix) for the sub-decoder. The walker stays put.
            BufIter cmd_view = IterCarve(&walker, cmdsize);
            u32     type     = cmd & ~LC_REQ_DYLD;
            switch (type) {
Last updated on