def lh.err
bend-kit-archive@0.5.1.0 · archive.bend:142
import bend-kit-archive@0.5.1.0/archive.bend as Archive
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
142
143def lh.err(+l: List<&2, U32>, +method: U32, +nlen: U32, +packed: U32, +cdoff: U32, +lname: U32, +extra: U32) -> Maybe<&2, String>:
144 +data = (lname + extra : U32)
145 why(U32.is_eq(u32(l, 0), 67324752), "bad local header signature",
146 why(Bool.not(encrypted(u16(l, 6))), "encrypted entries are unsupported",
147 why(U32.is_eq(u16(l, 8), method), "local header method differs from the central directory",
148 why(U32.is_eq(u16(l, 26), nlen), "local header name differs from the central directory",
149 why(Bytes.fits(cdoff, lname, extra), "local header runs past the central directory",
150 why(Bytes.fits(cdoff, data, packed), "entry data runs past the central directory", None{}))))))