@@ -3,8 +3,7 @@ use simd_adler32::Adler32;
3
3
use crate :: {
4
4
huffman:: { self , build_table} ,
5
5
tables:: {
6
- self , CLCL_ORDER , DIST_SYM_TO_DIST_BASE , DIST_SYM_TO_DIST_EXTRA ,
7
- FDEFLATE_DIST_DECODE_TABLE , FDEFLATE_LITLEN_DECODE_TABLE , FIXED_CODE_LENGTHS ,
6
+ self , CLCL_ORDER , DIST_SYM_TO_DIST_BASE , DIST_SYM_TO_DIST_EXTRA , FIXED_CODE_LENGTHS ,
8
7
LEN_SYM_TO_LEN_BASE , LEN_SYM_TO_LEN_EXTRA , LITLEN_TABLE_ENTRIES ,
9
8
} ,
10
9
} ;
@@ -77,16 +76,6 @@ struct CompressedBlock {
77
76
eof_bits : u8 ,
78
77
}
79
78
80
- const FDEFLATE_COMPRESSED_BLOCK : CompressedBlock = CompressedBlock {
81
- litlen_table : FDEFLATE_LITLEN_DECODE_TABLE ,
82
- secondary_table : Vec :: new ( ) ,
83
- dist_table : FDEFLATE_DIST_DECODE_TABLE ,
84
- dist_secondary_table : Vec :: new ( ) ,
85
- eof_code : 0x8ff ,
86
- eof_mask : 0xfff ,
87
- eof_bits : 0xc ,
88
- } ;
89
-
90
79
#[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
91
80
enum State {
92
81
ZlibHeader ,
@@ -360,18 +349,11 @@ impl Decompressor {
360
349
self . header . code_lengths [ i] = 0 ;
361
350
}
362
351
363
- if self . header . hdist == 1
364
- && self . header . code_lengths [ ..286 ] == tables:: HUFFMAN_LENGTHS
365
- && self . header . code_lengths [ 288 ] == 1
366
- {
367
- self . compression = FDEFLATE_COMPRESSED_BLOCK ;
368
- } else {
369
- Self :: build_tables (
370
- self . header . hlit ,
371
- & self . header . code_lengths ,
372
- & mut self . compression ,
373
- ) ?;
374
- }
352
+ Self :: build_tables (
353
+ self . header . hlit ,
354
+ & self . header . code_lengths ,
355
+ & mut self . compression ,
356
+ ) ?;
375
357
self . state = State :: CompressedData ;
376
358
Ok ( ( ) )
377
359
}
@@ -998,30 +980,6 @@ mod tests {
998
980
}
999
981
}
1000
982
1001
- #[ test]
1002
- fn fdeflate_table ( ) {
1003
- let mut compression = CompressedBlock {
1004
- litlen_table : [ 0 ; 4096 ] ,
1005
- dist_table : [ 0 ; 512 ] ,
1006
- secondary_table : Vec :: new ( ) ,
1007
- dist_secondary_table : Vec :: new ( ) ,
1008
- eof_code : 0 ,
1009
- eof_mask : 0 ,
1010
- eof_bits : 0 ,
1011
- } ;
1012
- let mut lengths = tables:: HUFFMAN_LENGTHS . to_vec ( ) ;
1013
- lengths. resize ( 288 , 0 ) ;
1014
- lengths. push ( 1 ) ;
1015
- lengths. resize ( 320 , 0 ) ;
1016
- Decompressor :: build_tables ( 286 , & lengths, & mut compression) . unwrap ( ) ;
1017
-
1018
- assert_eq ! (
1019
- compression, FDEFLATE_COMPRESSED_BLOCK ,
1020
- "{:#x?}" ,
1021
- compression
1022
- ) ;
1023
- }
1024
-
1025
983
#[ test]
1026
984
fn it_works ( ) {
1027
985
roundtrip ( b"Hello world!" ) ;
0 commit comments