Function endUnflushed [src]

Prototype

pub fn endUnflushed(c: *Compress) !void

Parameters

c: *Compress

Source

pub fn endUnflushed(c: *Compress) !void { while (c.writer.end != 0) _ = try drain(&c.writer, &.{""}, 1); c.state = .ended; const out = c.block_writer.output; // TODO flush tokens switch (c.hasher) { .gzip => |*gzip| { // GZIP 8 bytes footer // - 4 bytes, CRC32 (CRC-32) // - 4 bytes, ISIZE (Input SIZE) - size of the original (uncompressed) input data modulo 2^32 const footer = try out.writableArray(8); std.mem.writeInt(u32, footer[0..4], gzip.crc.final(), .little); std.mem.writeInt(u32, footer[4..8], @truncate(gzip.count), .little); }, .zlib => |*zlib| { // ZLIB (RFC 1950) is big-endian, unlike GZIP (RFC 1952). // 4 bytes of ADLER32 (Adler-32 checksum) // Checksum value of the uncompressed data (excluding any // dictionary data) computed according to Adler-32 // algorithm. std.mem.writeInt(u32, try out.writableArray(4), zlib.adler, .big); }, .raw => {}, } }