@@ -212,7 +212,7 @@ impl Compress {
212212 /// # Panics
213213 ///
214214 /// If `window_bits` does not fall into the range 9 ..= 15,
215- /// `new_with_window_bits` will panic.
215+ /// this function will panic.
216216 #[ cfg( feature = "any_zlib" ) ]
217217 pub fn new_with_window_bits (
218218 level : Compression ,
@@ -239,7 +239,7 @@ impl Compress {
239239 /// # Panics
240240 ///
241241 /// If `window_bits` does not fall into the range 9 ..= 15,
242- /// `new_with_window_bits` will panic.
242+ /// this function will panic.
243243 #[ cfg( feature = "any_zlib" ) ]
244244 pub fn new_gzip ( level : Compression , window_bits : u8 ) -> Compress {
245245 assert ! (
@@ -266,7 +266,7 @@ impl Compress {
266266 /// Specifies the compression dictionary to use.
267267 ///
268268 /// Returns the Adler-32 checksum of the dictionary.
269- #[ cfg( feature = "any_zlib " ) ]
269+ #[ cfg( feature = "any_c_zlib " ) ]
270270 pub fn set_dictionary ( & mut self , dictionary : & [ u8 ] ) -> Result < u32 , CompressError > {
271271 // SAFETY: The field `inner` must always be accessed as a raw pointer,
272272 // since it points to a cyclic structure. No copies of `inner` can be
@@ -289,7 +289,7 @@ impl Compress {
289289 /// Specifies the compression dictionary to use.
290290 ///
291291 /// Returns the Adler-32 checksum of the dictionary.
292- #[ cfg( all( not( feature = "any_zlib " ) , feature = "zlib-rs" ) ) ]
292+ #[ cfg( all( not( feature = "any_c_zlib " ) , feature = "zlib-rs" ) ) ]
293293 pub fn set_dictionary ( & mut self , dictionary : & [ u8 ] ) -> Result < u32 , CompressError > {
294294 self . inner . set_dictionary ( dictionary)
295295 }
@@ -311,14 +311,14 @@ impl Compress {
311311 /// the compression of the available input data before changing the
312312 /// compression level. Flushing the stream before calling this method
313313 /// ensures that the function will succeed on the first call.
314- #[ cfg( any ( feature = "any_zlib" , feature = "zlib-rs" ) ) ]
314+ #[ cfg( feature = "any_zlib" ) ]
315315 pub fn set_level ( & mut self , level : Compression ) -> Result < ( ) , CompressError > {
316- #[ cfg( all( not( feature = "any_zlib " ) , feature = "zlib-rs" ) ) ]
316+ #[ cfg( all( not( feature = "any_c_zlib " ) , feature = "zlib-rs" ) ) ]
317317 {
318318 self . inner . set_level ( level)
319319 }
320320
321- #[ cfg( feature = "any_zlib " ) ]
321+ #[ cfg( feature = "any_c_zlib " ) ]
322322 {
323323 use std:: os:: raw:: c_int;
324324 // SAFETY: The field `inner` must always be accessed as a raw pointer,
@@ -415,7 +415,7 @@ impl Decompress {
415415 /// # Panics
416416 ///
417417 /// If `window_bits` does not fall into the range 9 ..= 15,
418- /// `new_with_window_bits` will panic.
418+ /// this function will panic.
419419 #[ cfg( feature = "any_zlib" ) ]
420420 pub fn new_with_window_bits ( zlib_header : bool , window_bits : u8 ) -> Decompress {
421421 assert ! (
@@ -435,7 +435,7 @@ impl Decompress {
435435 /// # Panics
436436 ///
437437 /// If `window_bits` does not fall into the range 9 ..= 15,
438- /// `new_with_window_bits` will panic.
438+ /// this function will panic.
439439 #[ cfg( feature = "any_zlib" ) ]
440440 pub fn new_gzip ( window_bits : u8 ) -> Decompress {
441441 assert ! (
@@ -536,7 +536,7 @@ impl Decompress {
536536 }
537537
538538 /// Specifies the decompression dictionary to use.
539- #[ cfg( feature = "any_zlib " ) ]
539+ #[ cfg( feature = "any_c_zlib " ) ]
540540 pub fn set_dictionary ( & mut self , dictionary : & [ u8 ] ) -> Result < u32 , DecompressError > {
541541 // SAFETY: The field `inner` must always be accessed as a raw pointer,
542542 // since it points to a cyclic structure. No copies of `inner` can be
@@ -558,7 +558,7 @@ impl Decompress {
558558 }
559559
560560 /// Specifies the decompression dictionary to use.
561- #[ cfg( all( not( feature = "any_zlib " ) , feature = "zlib-rs" ) ) ]
561+ #[ cfg( all( not( feature = "any_c_zlib " ) , feature = "zlib-rs" ) ) ]
562562 pub fn set_dictionary ( & mut self , dictionary : & [ u8 ] ) -> Result < u32 , DecompressError > {
563563 self . inner . set_dictionary ( dictionary)
564564 }
@@ -723,86 +723,6 @@ mod tests {
723723 assert ! ( dst. starts_with( string) ) ;
724724 }
725725
726- #[ cfg( feature = "any_zlib" ) ]
727- #[ test]
728- fn set_dictionary_with_zlib_header ( ) {
729- let string = "hello, hello!" . as_bytes ( ) ;
730- let dictionary = "hello" . as_bytes ( ) ;
731-
732- let mut encoded = Vec :: with_capacity ( 1024 ) ;
733-
734- let mut encoder = Compress :: new ( Compression :: default ( ) , true ) ;
735-
736- let dictionary_adler = encoder. set_dictionary ( & dictionary) . unwrap ( ) ;
737-
738- encoder
739- . compress_vec ( string, & mut encoded, FlushCompress :: Finish )
740- . unwrap ( ) ;
741-
742- assert_eq ! ( encoder. total_in( ) , string. len( ) as u64 ) ;
743- assert_eq ! ( encoder. total_out( ) , encoded. len( ) as u64 ) ;
744-
745- let mut decoder = Decompress :: new ( true ) ;
746- let mut decoded = [ 0 ; 1024 ] ;
747- let decompress_error = decoder
748- . decompress ( & encoded, & mut decoded, FlushDecompress :: Finish )
749- . expect_err ( "decompression should fail due to requiring a dictionary" ) ;
750-
751- let required_adler = decompress_error. needs_dictionary ( )
752- . expect ( "the first call to decompress should indicate a dictionary is required along with the required Adler-32 checksum" ) ;
753-
754- assert_eq ! ( required_adler, dictionary_adler,
755- "the Adler-32 checksum should match the value when the dictionary was set on the compressor" ) ;
756-
757- let actual_adler = decoder. set_dictionary ( & dictionary) . unwrap ( ) ;
758-
759- assert_eq ! ( required_adler, actual_adler) ;
760-
761- // Decompress the rest of the input to the remainder of the output buffer
762- let total_in = decoder. total_in ( ) ;
763- let total_out = decoder. total_out ( ) ;
764-
765- let decompress_result = decoder. decompress (
766- & encoded[ total_in as usize ..] ,
767- & mut decoded[ total_out as usize ..] ,
768- FlushDecompress :: Finish ,
769- ) ;
770- assert ! ( decompress_result. is_ok( ) ) ;
771-
772- assert_eq ! ( & decoded[ ..decoder. total_out( ) as usize ] , string) ;
773- }
774-
775- #[ cfg( feature = "any_zlib" ) ]
776- #[ test]
777- fn set_dictionary_raw ( ) {
778- let string = "hello, hello!" . as_bytes ( ) ;
779- let dictionary = "hello" . as_bytes ( ) ;
780-
781- let mut encoded = Vec :: with_capacity ( 1024 ) ;
782-
783- let mut encoder = Compress :: new ( Compression :: default ( ) , false ) ;
784-
785- encoder. set_dictionary ( & dictionary) . unwrap ( ) ;
786-
787- encoder
788- . compress_vec ( string, & mut encoded, FlushCompress :: Finish )
789- . unwrap ( ) ;
790-
791- assert_eq ! ( encoder. total_in( ) , string. len( ) as u64 ) ;
792- assert_eq ! ( encoder. total_out( ) , encoded. len( ) as u64 ) ;
793-
794- let mut decoder = Decompress :: new ( false ) ;
795-
796- decoder. set_dictionary ( & dictionary) . unwrap ( ) ;
797-
798- let mut decoded = [ 0 ; 1024 ] ;
799- let decompress_result = decoder. decompress ( & encoded, & mut decoded, FlushDecompress :: Finish ) ;
800-
801- assert ! ( decompress_result. is_ok( ) ) ;
802-
803- assert_eq ! ( & decoded[ ..decoder. total_out( ) as usize ] , string) ;
804- }
805-
806726 #[ cfg( feature = "any_zlib" ) ]
807727 #[ test]
808728 fn test_gzip_flate ( ) {
@@ -829,15 +749,15 @@ mod tests {
829749 assert_eq ! ( & decoded[ ..decoder. total_out( ) as usize ] , string) ;
830750 }
831751
832- #[ cfg( any ( feature = "any_zlib" , feature = "zlib-rs" ) ) ]
752+ #[ cfg( feature = "any_zlib" ) ]
833753 #[ test]
834754 fn test_error_message ( ) {
835755 let mut decoder = Decompress :: new ( false ) ;
836756 let mut decoded = [ 0 ; 128 ] ;
837757 let garbage = b"xbvxzi" ;
838758
839759 let err = decoder
840- . decompress ( & * garbage, & mut decoded, FlushDecompress :: Finish )
760+ . decompress ( garbage, & mut decoded, FlushDecompress :: Finish )
841761 . unwrap_err ( ) ;
842762
843763 assert_eq ! ( err. message( ) , Some ( "invalid stored block lengths" ) ) ;
0 commit comments