Files
bun.sh/src/deps/zlib.shared.zig
Jarred Sumner e44911d4eb fetch works
2023-09-05 22:19:48 -08:00

53 lines
2.9 KiB
Zig

// #define Z_BINARY 0
// #define Z_TEXT 1
// #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
// #define Z_UNKNOWN 2
pub const DataType = enum(c_int) {
Binary = 0,
Text = 1,
Unknown = 2,
};
// #define Z_OK 0
// #define Z_STREAM_END 1
// #define Z_NEED_DICT 2
// #define Z_ERRNO (-1)
// #define Z_STREAM_ERROR (-2)
// #define Z_DATA_ERROR (-3)
// #define Z_MEM_ERROR (-4)
// #define Z_BUF_ERROR (-5)
// #define Z_VERSION_ERROR (-6)
pub const ReturnCode = enum(c_int) {
Ok = 0,
StreamEnd = 1,
NeedDict = 2,
ErrNo = -1,
StreamError = -2,
DataError = -3,
MemError = -4,
BufError = -5,
VersionError = -6,
};
// #define Z_NO_FLUSH 0
// #define Z_PARTIAL_FLUSH 1
// #define Z_SYNC_FLUSH 2
// #define Z_FULL_FLUSH 3
// #define Z_FINISH 4
// #define Z_BLOCK 5
// #define Z_TREES 6
pub const FlushValue = enum(c_int) {
NoFlush = 0,
PartialFlush = 1,
/// Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer
SyncFlush = 2,
FullFlush = 3,
Finish = 4,
/// Z_BLOCK requests that inflate() stop if and when it gets to the next / deflate block boundary When decoding the zlib or gzip format, this will / cause inflate() to return immediately after the header and before the / first block. When doing a raw inflate, inflate() will go ahead and / process the first block, and will return when it gets to the end of that / block, or when it runs out of data. / The Z_BLOCK option assists in appending to or combining deflate streams. / To assist in this, on return inflate() always sets strm->data_type to the / number of unused bits in the last byte taken from strm->next_in, plus 64 / if inflate() is currently decoding the last block in the deflate stream, / plus 128 if inflate() returned immediately after decoding an end-of-block / code or decoding the complete header up to just before the first byte of / the deflate stream. The end-of-block will not be indicated until all of / the uncompressed data from that block has been written to strm->next_out. / The number of unused bits may in general be greater than seven, except / when bit 7 of data_type is set, in which case the number of unused bits / will be less than eight. data_type is set as noted here every time / inflate() returns for all flush options, and so can be used to determine / the amount of currently consumed input in bits.
Block = 5,
/// The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header.
Trees = 6,
};