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.
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.
lib.deflate.src.test.conformance.expectRaw[function] — private source atlib/deflate/src/test.zig:33in nearest public ownerlib.deflate.src.testlib.deflate.src.test.conformance.test_libdeflate_b122c8b_rejects_excessive_code_lengths[function] — test source atlib/deflate/src/test.zig:191in nearest public ownerlib.deflate.src.testlib.deflate.src.test.test_decoder_rejects_every_truncation_of_a_framed_stream[function] — test source atlib/deflate/src/test.zig:266in nearest public ownerlib.deflate.src.testlib.deflate.src.test.test_decoder_rejects_malformed_headers_and_blocks[function] — test source atlib/deflate/src/test.zig:245in nearest public ownerlib.deflate.src.testlib.deflate.src.test.test_framing_rejects_checksum_mismatch,_trailing_input,_and_short_output[function] — test source atlib/deflate/src/test.zig:221in nearest public ownerlib.deflate.src.testlib.deflate.src.test.test_gzip_optional_fields_and_header_checksum_are_bounded[function] — test source atlib/deflate/src/test.zig:279in nearest public ownerlib.deflate.src.testlib.deflate.src.test.test_zlib_and_gzip_conformance_fixtures[function] — test source atlib/deflate/src/test.zig:201in nearest public ownerlib.deflate.src.test
Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |