@@ -95,10 +95,10 @@ extern "C" {
9595}
9696
9797const LZ_NORM : c_int = 0x80 ; // LZ with 128 probes, "normal"
98- const TINFL_FLAG_PARSE_ZLIB_HEADER : c_int = 0x1 ; // parse zlib header and adler32 checksum
99- const TDEFL_WRITE_ZLIB_HEADER : c_int = 0x01000 ; // write zlib header and adler32 checksum
10098
101- fn deflate_bytes_internal ( bytes : & [ u8 ] , flags : c_int ) -> Bytes {
99+ /// Compress a buffer without writing any sort of header on the output.
100+ pub fn deflate_bytes ( bytes : & [ u8 ] ) -> Bytes {
101+ let flags = LZ_NORM ;
102102 unsafe {
103103 let mut outsz: size_t = 0 ;
104104 let res = tdefl_compress_mem_to_heap ( bytes. as_ptr ( ) as * const _ ,
@@ -113,17 +113,9 @@ fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Bytes {
113113 }
114114}
115115
116- /// Compress a buffer, without writing any sort of header on the output.
117- pub fn deflate_bytes ( bytes : & [ u8 ] ) -> Bytes {
118- deflate_bytes_internal ( bytes, LZ_NORM )
119- }
120-
121- /// Compress a buffer, using a header that zlib can understand.
122- pub fn deflate_bytes_zlib ( bytes : & [ u8 ] ) -> Bytes {
123- deflate_bytes_internal ( bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER )
124- }
125-
126- fn inflate_bytes_internal ( bytes : & [ u8 ] , flags : c_int ) -> Result < Bytes , Error > {
116+ /// Decompress a buffer without parsing any sort of header on the input.
117+ pub fn inflate_bytes ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
118+ let flags = 0 ;
127119 unsafe {
128120 let mut outsz: size_t = 0 ;
129121 let res = tinfl_decompress_mem_to_heap ( bytes. as_ptr ( ) as * const _ ,
@@ -141,16 +133,6 @@ fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result<Bytes, Error> {
141133 }
142134}
143135
144- /// Decompress a buffer, without parsing any sort of header on the input.
145- pub fn inflate_bytes ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
146- inflate_bytes_internal ( bytes, 0 )
147- }
148-
149- /// Decompress a buffer that starts with a zlib header.
150- pub fn inflate_bytes_zlib ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
151- inflate_bytes_internal ( bytes, TINFL_FLAG_PARSE_ZLIB_HEADER )
152- }
153-
154136#[ cfg( test) ]
155137mod tests {
156138 #![ allow( deprecated) ]
0 commit comments