@@ -54,7 +54,7 @@ pub fn deflate_slow(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSta
5454 dist = state. strstart as isize - hash_head as isize ;
5555
5656 if valid_distance_range. contains ( & dist)
57- && state. prev_length < state. max_lazy_match as usize
57+ && state. prev_length < state. max_lazy_match
5858 && hash_head != 0
5959 {
6060 // To simplify the code, we prevent matches with the string
@@ -76,15 +76,15 @@ pub fn deflate_slow(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSta
7676
7777 // If there was a match at the previous step and the current
7878 // match is not better, output the previous match:
79- if state. prev_length >= STD_MIN_MATCH && match_len <= state. prev_length {
79+ if state. prev_length as usize >= STD_MIN_MATCH && match_len <= state. prev_length as usize {
8080 let max_insert = state. strstart + state. lookahead - STD_MIN_MATCH ;
8181 /* Do not insert strings in hash table beyond this. */
8282
8383 // check_match(s, state.strstart-1, state.prev_match, state.prev_length);
8484
8585 bflush = state. tally_dist (
8686 state. strstart - 1 - state. prev_match as usize ,
87- state. prev_length - STD_MIN_MATCH ,
87+ state. prev_length as usize - STD_MIN_MATCH ,
8888 ) ;
8989
9090 /* Insert in hash table all strings up to the end of the match.
@@ -93,9 +93,9 @@ pub fn deflate_slow(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSta
9393 * the hash table.
9494 */
9595 state. prev_length -= 1 ;
96- state. lookahead -= state. prev_length ;
96+ state. lookahead -= state. prev_length as usize ;
9797
98- let mov_fwd = state. prev_length - 1 ;
98+ let mov_fwd = state. prev_length as usize - 1 ;
9999 if max_insert > state. strstart {
100100 let insert_cnt = Ord :: min ( mov_fwd, max_insert - state. strstart ) ;
101101 state. insert_string ( state. strstart + 1 , insert_cnt) ;
@@ -118,7 +118,7 @@ pub fn deflate_slow(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSta
118118 flush_block_only ( stream, false ) ;
119119 }
120120
121- stream. state . prev_length = match_len;
121+ stream. state . prev_length = match_len as u16 ;
122122 stream. state . strstart += 1 ;
123123 stream. state . lookahead -= 1 ;
124124 if stream. avail_out == 0 {
@@ -127,7 +127,7 @@ pub fn deflate_slow(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSta
127127 } else {
128128 // There is no previous match to compare with, wait for
129129 // the next step to decide.
130- state. prev_length = match_len;
130+ state. prev_length = match_len as u16 ;
131131 state. match_available = true ;
132132 match_available = true ;
133133 state. strstart += 1 ;
0 commit comments