@@ -28,8 +28,7 @@ local uInt longest_match(s, cur_match)
28
28
register Bytef * scan = s -> window + s -> strstart ; /* current string */
29
29
register Bytef * match ; /* matched string */
30
30
register int len ; /* length of current match */
31
- int best_len = s -> prev_length ; /* ignore strings, shorter or of the same length; rename ?? */
32
- int real_len = best_len ; /* length of longest found match */
31
+ int best_len = s -> prev_length ; /* ignore strings, shorter or of the same length */
33
32
int nice_match = s -> nice_match ; /* stop if match long enough */
34
33
int offset = 0 ; /* offset of current hash chain */
35
34
IPos limit_base = s -> strstart > (IPos )MAX_DIST (s ) ?
@@ -57,8 +56,7 @@ local uInt longest_match(s, cur_match)
57
56
register Bytef * strend = s -> window + s -> strstart + MAX_MATCH - 1 ;
58
57
/* points to last byte for maximal-length scan */
59
58
register ush scan_start = * (ushf * )scan ; /* 1st 2 bytes of scan */
60
- typedef ulg FAR ulgf ; /*?? should be declared in zutil.h */
61
- ulg scan_start_l = * (ulgf * )scan ; /* 1st 4 bytes of scan */
59
+ uInt scan_start32 = * (uIntf * )scan ; /* 1st 4 bytes of scan */
62
60
register ush scan_end ; /* last byte of scan + next one */
63
61
64
62
#if (MIN_MATCH != 3 ) || (MAX_MATCH != 258 )
@@ -140,13 +138,13 @@ local uInt longest_match(s, cur_match)
140
138
/* current len > MIN_MATCH (>= 4 bytes); compare 1st 4 bytes and last 2 bytes */
141
139
for (;;) {
142
140
if (* (ushf * )(match_base2 + cur_match ) == scan_end &&
143
- * (ulgf * )(match_base + cur_match ) == scan_start_l ) break ;
141
+ * (uIntf * )(match_base + cur_match ) == scan_start32 ) break ;
144
142
NEXT_CHAIN ;
145
143
}
146
144
} else {
147
145
/* current len is exactly MIN_MATCH (3 bytes); compare 4 bytes */
148
146
for (;;) {
149
- if (* (ulgf * )(match_base + cur_match ) == scan_start_l ) break ;
147
+ if (* (uIntf * )(match_base + cur_match ) == scan_start32 ) break ;
150
148
NEXT_CHAIN ;
151
149
}
152
150
}
@@ -177,7 +175,7 @@ local uInt longest_match(s, cur_match)
177
175
#endif
178
176
/* new string is longer than previous - remember it */
179
177
s -> match_start = cur_match - offset ;
180
- real_len = best_len = len ;
178
+ best_len = len ;
181
179
if (len >= nice_match ) break ;
182
180
UPDATE_SCAN_END ;
183
181
/* look for better string offset */
@@ -251,18 +249,18 @@ local uInt longest_match(s, cur_match)
251
249
warned = 1 ;
252
250
printf ("WARNING: compiled with PARANOID_CHECK\n" );
253
251
}
254
- if (real_len > s -> lookahead ) real_len = s -> lookahead ;
255
- if (real_len > MAX_MATCH ) {
252
+ if (best_len > s -> lookahead ) best_len = s -> lookahead ;
253
+ if (best_len > MAX_MATCH ) {
256
254
error = 1 ;
257
255
printf ("match too long\n" );
258
256
}
259
257
if (s -> match_start < limit_base ) {
260
258
error = 1 ;
261
- printf ("too far $%X -> $%X [%d] (dist+=%X)\n" , s -> strstart , s -> match_start , real_len , limit_base - s -> match_start );
259
+ printf ("too far $%X -> $%X [%d] (dist+=%X)\n" , s -> strstart , s -> match_start , best_len , limit_base - s -> match_start );
262
260
}
263
- if (zmemcmp (s -> window + s -> strstart , s -> window + s -> match_start , real_len )) {
261
+ if (zmemcmp (s -> window + s -> strstart , s -> window + s -> match_start , best_len )) {
264
262
error = 1 ;
265
- printf ("invalid match $%X -- $%X [%d]\n" , s -> strstart , s -> match_start , real_len );
263
+ printf ("invalid match $%X -- $%X [%d]\n" , s -> strstart , s -> match_start , best_len );
266
264
}
267
265
if (error ) {
268
266
FILE * f = fopen ("match.dmp" , "wb" );
@@ -276,6 +274,6 @@ local uInt longest_match(s, cur_match)
276
274
}
277
275
}
278
276
#endif /* PARANOID_CHECK */
279
- if ((uInt )real_len <= s -> lookahead ) return (uInt )real_len ;
277
+ if ((uInt )best_len <= s -> lookahead ) return (uInt )best_len ;
280
278
return s -> lookahead ;
281
279
}
0 commit comments