Something went wrong. Try again.
websocket
Something went wrong. Try again.
2.4 kB · 100 lines
Zig
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101//! Minimal bindings for the pinned zlib dependency.//!//! Zig 0.17 removed `@cImport`. Keeping the small ABI surface used by//! `deflate.zig` here avoids running translate-c over all of zlib.h on every//! clean build.
pub const uInt = c_uint;pub const uLong = c_ulong;pub const Bytef = u8;pub const voidpf = ?*anyopaque;
pub const alloc_func = ?*const fn ( @"opaque": voidpf, items: uInt, size: uInt,) callconv(.c) voidpf;
pub const free_func = ?*const fn ( @"opaque": voidpf, address: voidpf,) callconv(.c) void;
const internal_state = opaque {};
pub const z_stream = extern struct { next_in: [*c]Bytef, avail_in: uInt, total_in: uLong, next_out: [*c]Bytef, avail_out: uInt, total_out: uLong, msg: [*c]u8, state: ?*internal_state, zalloc: alloc_func, zfree: free_func, @"opaque": voidpf, data_type: c_int, adler: uLong, reserved: uLong,};
pub const Z_NO_FLUSH: c_int = 0;pub const Z_SYNC_FLUSH: c_int = 2;pub const Z_OK: c_int = 0;pub const Z_BUF_ERROR: c_int = -5;pub const Z_DEFAULT_COMPRESSION: c_int = -1;pub const Z_DEFAULT_STRATEGY: c_int = 0;pub const Z_DEFLATED: c_int = 8;pub const MAX_WBITS: c_int = 15;
const ZLIB_VERSION: [*:0]const u8 = "1.3.2";
pub fn deflateInit2( stream: *z_stream, level: c_int, method: c_int, window_bits: c_int, mem_level: c_int, strategy: c_int,) c_int { return deflateInit2_( stream, level, method, window_bits, mem_level, strategy, ZLIB_VERSION, @sizeOf(z_stream), );}
pub fn inflateInit2(stream: *z_stream, window_bits: c_int) c_int { return inflateInit2_(stream, window_bits, ZLIB_VERSION, @sizeOf(z_stream));}
extern fn deflateInit2_( stream: *z_stream, level: c_int, method: c_int, window_bits: c_int, mem_level: c_int, strategy: c_int, version: [*:0]const u8, stream_size: c_int,) c_int;
extern fn inflateInit2_( stream: *z_stream, window_bits: c_int, version: [*:0]const u8, stream_size: c_int,) c_int;
pub extern fn deflate(stream: *z_stream, flush: c_int) c_int;pub extern fn deflateEnd(stream: *z_stream) c_int;pub extern fn deflateReset(stream: *z_stream) c_int;pub extern fn inflate(stream: *z_stream, flush: c_int) c_int;pub extern fn inflateEnd(stream: *z_stream) c_int;pub extern fn inflateReset(stream: *z_stream) c_int;