diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-20 13:08:51 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-20 13:56:52 +1100 |
| commit | feefe77125b3b68d12f08ea5dd606d9542e509e0 (patch) | |
| tree | 0469a4062fa6b26d6bd4ae3d96565e7e1375c885 | |
| parent | 0c429872a32c3005cf2b347025163361218634a4 (diff) | |
| download | rust-feefe77125b3b68d12f08ea5dd606d9542e509e0.tar.gz rust-feefe77125b3b68d12f08ea5dd606d9542e509e0.zip | |
Remove `{in,de}flate_bytes_zlib`.
These functions are unused.
| -rw-r--r-- | src/libflate/lib.rs | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 63913f2878c..89df931da02 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -95,10 +95,10 @@ extern "C" { } const LZ_NORM: c_int = 0x80; // LZ with 128 probes, "normal" -const TINFL_FLAG_PARSE_ZLIB_HEADER: c_int = 0x1; // parse zlib header and adler32 checksum -const TDEFL_WRITE_ZLIB_HEADER: c_int = 0x01000; // write zlib header and adler32 checksum -fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Bytes { +/// Compress a buffer without writing any sort of header on the output. +pub fn deflate_bytes(bytes: &[u8]) -> Bytes { + let flags = LZ_NORM; unsafe { let mut outsz: size_t = 0; 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 { } } -/// Compress a buffer, without writing any sort of header on the output. -pub fn deflate_bytes(bytes: &[u8]) -> Bytes { - deflate_bytes_internal(bytes, LZ_NORM) -} - -/// Compress a buffer, using a header that zlib can understand. -pub fn deflate_bytes_zlib(bytes: &[u8]) -> Bytes { - deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER) -} - -fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result<Bytes, Error> { +/// Decompress a buffer without parsing any sort of header on the input. +pub fn inflate_bytes(bytes: &[u8]) -> Result<Bytes, Error> { + let flags = 0; unsafe { let mut outsz: size_t = 0; 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> { } } -/// Decompress a buffer, without parsing any sort of header on the input. -pub fn inflate_bytes(bytes: &[u8]) -> Result<Bytes, Error> { - inflate_bytes_internal(bytes, 0) -} - -/// Decompress a buffer that starts with a zlib header. -pub fn inflate_bytes_zlib(bytes: &[u8]) -> Result<Bytes, Error> { - inflate_bytes_internal(bytes, TINFL_FLAG_PARSE_ZLIB_HEADER) -} - #[cfg(test)] mod tests { #![allow(deprecated)] |
