Skip to documentation
SLOP

tiny.deflate.decompress

Reference tiny.deflate decompress

Defined in tiny.deflate.

Expands one compressed stream with whatever header and trailer its format adds (a frame of input), in the container that format names, into the front of output, so callers can expand a compressed buffer, such as a PDF content stream, into memory they already own.

Called byCallsprivate sourcelib.deflate.src.test.conformanceexpectRawtest sourcelib.deflate.src.test.conformancetest: libdeflate b122c8b rejects exce...test sourcelib.deflate.src.testtest: decoder rejects every truncatio...test sourcelib.deflate.src.testtest: decoder rejects malformed heade...test sourcelib.deflate.src.testtest: framing rejects checksum mismat...+2 moreprivate sourcelib.deflate.src.decoderawprivate sourcelib.deflate.src.framegzipprivate sourcelib.deflate.src.framezlibtiny.deflatedecompress
Static calls · unresolved targets: 0 · external targets: 0.

Source

Source: lib/deflate/src/frame.zig:108

zig
/// Expands one compressed stream with whatever header and trailer its format adds (a frame of/// `input`), in the container that `format` names, into the front of `output`, so callers can/// expand a compressed buffer, such as a PDF content stream, into memory they already own. The call/// allocates nothing. The call returns the number of input bytes the frame used and the number of/// bytes written to `output`. After a success, only the first `result.written` bytes of `output`/// hold expanded data. After a failure, `output` may hold part of the expanded data. The zlib and/// gzip checksums, and the gzip length, are checked before the call returns. The exact-input and/// exact-output checks run after the frame and its checksum pass. With exact input on, which is the/// default, bytes left after the frame fail with `error.TrailingInput`. With exact output on,/// expanded data shorter than `output` fails with `error.BadSize`. A stream that needs more room/// than `output` has fails with `error.OutputTooSmall`. Every other failure is one tag of `Error`/// that describes the input. The PDF reader calls `decompress` with the zlib container and the/// default options, and treats `error.OutputTooSmall` as its own capacity error.pub fn decompress(    input: []const u8,    output: []u8,    format: model.Format,    options: model.Options,) model.Error!model.Result {    const result = switch (format) {        .raw => try decode.raw(input, output),        .zlib => try zlib(input, output),        .gzip => try gzip(input, output),    };    if (options.exact_input and result.consumed != input.len) {        return error.TrailingInput;    }    if (options.exact_output and result.written != output.len) {        return error.BadSize;    }    return result;}

Source: lib/deflate/src/root.zig:53

zig
pub const decompress = frame.decompress;

Complete caller list

7 direct callers.

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433