core/compress/gzip
compress_gzip
Types
12Compression
Compression :: enum u8 {
DEFLATE = 8,
}SourceCompression_Flags
Compression_Flags :: enum u8 {
Maximum_Compression = 2,
Fastest_Compression = 4,
}SourceE_Deflate
E_Deflate :: Deflate_ErrorSourceE_GZIP
E_GZIP :: GZIP_ErrorSourceE_General
E_General :: General_ErrorSourceE_ZLIB
E_ZLIB :: ZLIB_ErrorSourceError
Error :: ErrorSourceHeader
Header :: struct #packed {
magic: Magic,
compression_method: Compression,
flags: Header_Flags,
modification_time: u32le,
xfl: Compression_Flags,
os: OS,
}SourceHeader_Flag
Header_Flag :: enum u8 {
// Order is important
text = 0,
header_crc = 1,
extra = 2,
name = 3,
comment = 4,
reserved_1 = 5,
reserved_2 = 6,
reserved_3 = 7,
}SourceHeader_Flags
Header_Flags :: bit_set[Header_Flag; u8]SourceMagic
Magic :: enum u16le {
GZIP = 0x8b << 8 | 0x1f,
}SourceOS
OS :: enum u8 {
FAT = 0,
Amiga = 1,
VMS = 2,
Unix = 3,
VM_CMS = 4,
Atari_TOS = 5,
HPFS = 6,
Macintosh = 7,
Z_System = 8,
CP_M = 9,
TOPS_20 = 10,
NTFS = 11,
QDOS = 12,
Acorn_RISCOS = 13,
_Unknown = 14,
Unknown = 255,
}SourceConstants
2GZIP_MAX_PAYLOAD_SIZE
GZIP_MAX_PAYLOAD_SIZE :: i64 = i64(max(u32le))SourceOS_Name
OS_Name :: _ = #sparse[OS]string{
._Unknown = "",
.FAT = "FAT",
.Amiga = "Amiga",
.VMS = "VMS/OpenVMS",
.Unix = "Unix",
.VM_CMS = "VM/CMS",
.Atari_TOS = "Atari TOS",
.HPFS = "HPFS",
.Macintosh = "MacintoshSourceProcedures
3load_from_bytes
load_from_bytes :: proc(data: []u8, buf: ^bytes.Buffer, known_gzip_size: untyped integer = -1, expected_output_size: untyped integer = -1, allocator: mem.Allocator = context.allocator) -> (err: Error)Sourceload_from_context
load_from_context :: proc(z: ^C, buf: ^bytes.Buffer, known_gzip_size: untyped integer = -1, expected_output_size: untyped integer = -1, allocator: mem.Allocator = context.allocator) -> (err: Error)Sourceload_from_file
load_from_file :: proc(filename: string, buf: ^bytes.Buffer, expected_output_size: untyped integer = -1, allocator: mem.Allocator = context.allocator) -> (err: Error)Source