357
355
{ Compression function. Returns the block state after the call. }
359
compress_func = function(var s : deflate_state; flush : int) : block_state;
357
compress_func = function(var s : deflate_state; flush : integer) : block_state;
362
360
procedure fill_window(var s : deflate_state); forward;
364
function deflate_stored(var s : deflate_state; flush : int) : block_state;{$ifndef fpc}far;{$endif} forward;
366
function deflate_fast(var s : deflate_state; flush : int) : block_state;{$ifndef fpc}far;{$endif} forward;
368
function deflate_slow(var s : deflate_state; flush : int) : block_state;{$ifndef fpc}far;{$endif} forward;
362
function deflate_stored(var s : deflate_state; flush : integer) : block_state; far; forward;
364
function deflate_fast(var s : deflate_state; flush : integer) : block_state; far; forward;
366
function deflate_slow(var s : deflate_state; flush : integer) : block_state; far; forward;
370
368
procedure lm_init(var s : deflate_state); forward;
373
procedure putShortMSB(var s : deflate_state; b : uInt); forward;
371
procedure putShortMSB(var s : deflate_state; b : cardinal); forward;
375
373
procedure flush_pending (var strm : z_stream); forward;
377
375
function read_buf(strm : z_streamp;
379
size : unsigned) : int; forward;
377
size : cardinal) : cardinal; forward;
381
379
procedure match_init; { asm code initialization }
382
function longest_match(var deflate_state; cur_match : IPos) : uInt; forward;
380
function longest_match(var deflate_state; cur_match : IPos) : cardinal; forward;
385
function longest_match(var s : deflate_state; cur_match : IPos) : uInt;
383
function longest_match(var s : deflate_state; cur_match : IPos) : cardinal;
391
389
procedure check_match(var s : deflate_state;
392
390
start, match : IPos;
393
length : int); forward;
391
length : integer); forward;
396
394
{ ==========================================================================
592
576
s^.hash_mask := s^.hash_size - 1;
593
577
s^.hash_shift := ((s^.hash_bits+MIN_MATCH-1) div MIN_MATCH);
595
s^.window := pzByteArray (ZALLOC(strm, s^.w_size, 2*sizeof(Byte)));
579
s^.window := Pbytearray (ZALLOC(strm, s^.w_size, 2*sizeof(Byte)));
596
580
s^.prev := pzPosfArray (ZALLOC(strm, s^.w_size, sizeof(Pos)));
597
581
s^.head := pzPosfArray (ZALLOC(strm, s^.hash_size, sizeof(Pos)));
599
583
s^.lit_bufsize := 1 shl (memLevel + 6); { 16K elements by default }
601
overlay := pushfArray (ZALLOC(strm, s^.lit_bufsize, sizeof(ush)+2));
602
s^.pending_buf := pzByteArray (overlay);
603
s^.pending_buf_size := ulg(s^.lit_bufsize) * (sizeof(ush)+Long(2));
585
overlay := Pwordarray (ZALLOC(strm, s^.lit_bufsize, sizeof(word)+2));
586
s^.pending_buf := Pbytearray(overlay);
587
s^.pending_buf_size := longint(s^.lit_bufsize) * (sizeof(word)+longint(2));
605
589
if (s^.window = Z_NULL) or (s^.prev = Z_NULL) or (s^.head = Z_NULL)
606
590
or (s^.pending_buf = Z_NULL) then
843
824
if (len = 0) then
846
zmemcpy(strm.next_out, s^.pending_out, len);
847
Inc(strm.next_out, len);
848
Inc(s^.pending_out, len);
849
Inc(strm.total_out, len);
850
Dec(strm.avail_out, len);
851
Dec(s^.pending, len);
827
move(s^.pending_out^,strm.next_out^,len);
828
inc(strm.next_out, len);
829
inc(s^.pending_out, len);
830
inc(strm.total_out, len);
831
dec(strm.avail_out, len);
832
dec(s^.pending, len);
852
833
if (s^.pending = 0) then
854
s^.pending_out := pBytef(s^.pending_buf);
835
s^.pending_out := Pbyte(s^.pending_buf);
858
839
{ ========================================================================= }
859
function deflate (var strm : z_stream; flush : int) : int;
840
function deflate (var strm : z_stream; flush : integer) : integer;
861
old_flush : int; { value of flush param for previous deflate call }
842
old_flush : integer; { value of flush param for previous deflate call }
862
843
s : deflate_state_ptr;
846
level_flags : cardinal;
867
848
bstate : block_state;
1129
1110
deflateCopy := Z_MEM_ERROR;
1132
{ following zmemcpy do not work for 16-bit MSDOS }
1133
zmemcpy(pBytef(ds^.window), pBytef(ss^.window), ds^.w_size * 2 * sizeof(Byte));
1134
zmemcpy(pBytef(ds^.prev), pBytef(ss^.prev), ds^.w_size * sizeof(Pos));
1135
zmemcpy(pBytef(ds^.head), pBytef(ss^.head), ds^.hash_size * sizeof(Pos));
1136
zmemcpy(pBytef(ds^.pending_buf), pBytef(ss^.pending_buf), uInt(ds^.pending_buf_size));
1138
ds^.pending_out := @ds^.pending_buf^[ptr2int(ss^.pending_out) - ptr2int(ss^.pending_buf)];
1139
ds^.d_buf := pushfArray (@overlay^[ds^.lit_bufsize div sizeof(ush)] );
1140
ds^.l_buf := puchfArray (@ds^.pending_buf^[(1+sizeof(ush))*ds^.lit_bufsize]);
1114
move(Pbyte(ss^.window)^,Pbyte(ds^.window)^,ds^.w_size * 2 * sizeof(byte));
1115
move(Pbyte(ss^.prev)^,Pbyte(ds^.prev)^,ds^.w_size * sizeof(pos));
1116
move(Pbyte(ss^.head)^,Pbyte(ds^.head)^,ds^.hash_size * sizeof(pos));
1117
move(Pbyte(ss^.pending_buf)^,Pbyte(ds^.pending_buf)^,cardinal(ds^.pending_buf_size));
1119
ds^.pending_out := @ds^.pending_buf^[ptrint(ss^.pending_out) - ptrint(ss^.pending_buf)];
1120
ds^.d_buf := Pwordarray(@overlay^[ds^.lit_bufsize div sizeof(word)] );
1121
ds^.l_buf := Pbytearray(@ds^.pending_buf^[(1+sizeof(word))*ds^.lit_bufsize]);
1142
1123
ds^.l_desc.dyn_tree := tree_ptr(@ds^.dyn_ltree);
1143
1124
ds^.d_desc.dyn_tree := tree_ptr(@ds^.dyn_dtree);
1156
1137
(See also flush_pending()). }
1159
function read_buf(strm : z_streamp; buf : pBytef; size : unsigned) : int;
1140
function read_buf(strm:z_streamp;buf:Pbyte;size:cardinal):cardinal;
1163
len := strm^.avail_in;
1165
if (len > size) then
1173
Dec(strm^.avail_in, len);
1175
if deflate_state_ptr(strm^.state)^.noheader = 0 then
1177
strm^.adler := adler32(strm^.adler, strm^.next_in, len);
1179
zmemcpy(buf, strm^.next_in, len);
1180
Inc(strm^.next_in, len);
1181
Inc(strm^.total_in, len);
1183
read_buf := int(len);
1145
len:=strm^.avail_in;
1148
dec(strm^.avail_in, len);
1152
if deflate_state_ptr(strm^.state)^.noheader=0 then
1153
strm^.adler:=adler32(strm^.adler,strm^.next_in,len);
1154
move(strm^.next_in^,buf^,len);
1155
inc(strm^.next_in,len);
1156
inc(strm^.total_in,len);
1186
1161
{ ===========================================================================
1234
1209
function longest_match(var s : deflate_state;
1235
1210
cur_match : IPos { current match }
1240
chain_length : unsigned; { max hash chain length }
1241
{register} scan : pBytef; { current string }
1242
{register} match : pBytef; { matched string }
1243
{register} len : int; { length of current match }
1244
best_len : int; { best match length so far }
1245
nice_match : int; { stop if match long enough }
1215
chain_length : cardinal; { max hash chain length }
1216
{register} scan : Pbyte; { current string }
1217
{register} match : Pbyte; { matched string }
1218
{register} len : integer; { length of current match }
1219
best_len : integer; { best match length so far }
1220
nice_match : integer; { stop if match longint enough }
1248
1223
prev : pzPosfArray;
1250
1225
{$ifdef UNALIGNED_OK}
1251
{register} strend : pBytef;
1252
{register} scan_start : ush;
1253
{register} scan_end : ush;
1226
{register} strend : Pbyte;
1227
{register} scan_start : word;
1228
{register} scan_end : word;
1255
{register} strend : pBytef;
1230
{register} strend : Pbyte;
1256
1231
{register} scan_end1 : Byte;
1257
1232
{register} scan_end : Byte;
1235
MAX_DIST : cardinal;
1262
1237
chain_length := s.max_chain_length; { max hash chain length }
1263
1238
scan := @(s.window^[s.strstart]);
1264
1239
best_len := s.prev_length; { best match length so far }
1265
nice_match := s.nice_match; { stop if match long enough }
1240
nice_match := s.nice_match; { stop if match longint enough }
1268
1243
MAX_DIST := s.w_size - MIN_LOOKAHEAD;
1283
1258
{ Compare two bytes at a time. Note: this is not always beneficial.
1284
1259
Try with and without -DUNALIGNED_OK to check. }
1286
strend := pBytef(@(s.window^[s.strstart + MAX_MATCH - 1]));
1261
strend := Pbyte(@(s.window^[s.strstart + MAX_MATCH - 1]));
1287
1262
scan_start := pushf(scan)^;
1288
scan_end := pushfArray(scan)^[best_len-1]; { fix }
1263
scan_end := Pwordarray(scan)^[best_len-1]; { fix }
1290
strend := pBytef(@(s.window^[s.strstart + MAX_MATCH]));
1265
strend := Pbyte(@(s.window^[s.strstart + MAX_MATCH]));
1291
1266
{$IFOPT R+} {$R-} {$DEFINE NoRangeCheck} {$ENDIF}
1292
scan_end1 := pzByteArray(scan)^[best_len-1];
1267
scan_end1 := Pbytearray(scan)^[best_len-1];
1293
1268
{$IFDEF NoRangeCheck} {$R+} {$UNDEF NoRangeCheck} {$ENDIF}
1294
scan_end := pzByteArray(scan)^[best_len];
1269
scan_end := Pbytearray(scan)^[best_len];
1297
1272
{ The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
1298
1273
It is easy to get rid of this optimization if necessary. }
1300
1275
Assert((s.hash_bits >= 8) and (MAX_MATCH = 258), 'Code too clever');
1302
1277
{ Do not waste too much time if we already have a good match: }
1346
1321
at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
1347
1322
necessary to put more guard bytes at the end of the window, or
1348
1323
to check more often for insufficient lookahead. }
1350
1325
Assert(pzByteArray(scan)^[2] = pzByteArray(match)^[2], 'scan[2]?');
1356
Inc(scan,2); Inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1357
Inc(scan,2); Inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1358
Inc(scan,2); Inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1359
Inc(scan,2); Inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1360
until (ptr2int(scan) >= ptr2int(strend));
1331
inc(scan,2); inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1332
inc(scan,2); inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1333
inc(scan,2); inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1334
inc(scan,2); inc(match,2); if (pushf(scan)^<>pushf(match)^) then break;
1335
until (ptrint(scan) >= ptrint(strend));
1361
1336
{ The funny "do while" generates better code on most compilers }
1363
1338
{ Here, scan <= window+strstart+257 }
1365
Assert(ptr2int(scan) <=
1366
ptr2int(@(s.window^[unsigned(s.window_size-1)])),
1340
{$ifopt R+} {$define RangeCheck} {$endif} {$R-}
1341
Assert(ptrint(scan) <=
1342
ptrint(@(s.window^[cardinal(s.window_size-1)])),
1344
{$ifdef RangeCheck} {$R+} {$undef RangeCheck} {$endif}
1369
1346
if (scan^ = match^) then
1372
len := (MAX_MATCH - 1) - int(ptr2int(strend)-ptr2int(scan));
1349
len := (MAX_MATCH - 1) - integer(ptrint(strend)) + integer(ptrint(scan));
1373
1350
scan := strend;
1374
Dec(scan, (MAX_MATCH-1));
1351
dec(scan, (MAX_MATCH-1));
1376
1353
{$else} { UNALIGNED_OK }
1378
1355
{$IFOPT R+} {$R-} {$DEFINE NoRangeCheck} {$ENDIF}
1379
if (pzByteArray(match)^[best_len] <> scan_end) or
1380
(pzByteArray(match)^[best_len-1] <> scan_end1) or
1356
if (Pbytearray(match)^[best_len] <> scan_end) or
1357
(Pbytearray(match)^[best_len-1] <> scan_end1) or
1381
1358
(match^ <> scan^) then
1382
1359
goto nextstep; {continue;}
1383
1360
{$IFDEF NoRangeCheck} {$R+} {$UNDEF NoRangeCheck} {$ENDIF}
1385
if (match^ <> pzByteArray(scan)^[1]) then
1362
if (match^ <> Pbytearray(scan)^[1]) then
1386
1363
goto nextstep; {continue;}
1388
1365
{ The check at best_len-1 can be removed because it will be made
1391
1368
are always equal when the other bytes match, given that
1392
1369
the hash keys are equal and that HASH_BITS >= 8. }
1397
1374
Assert( scan^ = match^, 'match[2]?');
1399
1376
{ We check for insufficient lookahead only every 8th comparison;
1400
1377
the 256th check will be made at strstart+258. }
1403
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1404
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1405
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1406
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1407
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1408
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1409
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1410
Inc(scan); Inc(match); if (scan^ <> match^) then break;
1411
until (ptr2int(scan) >= ptr2int(strend));
1380
inc(scan); inc(match); if (scan^ <> match^) then break;
1381
inc(scan); inc(match); if (scan^ <> match^) then break;
1382
inc(scan); inc(match); if (scan^ <> match^) then break;
1383
inc(scan); inc(match); if (scan^ <> match^) then break;
1384
inc(scan); inc(match); if (scan^ <> match^) then break;
1385
inc(scan); inc(match); if (scan^ <> match^) then break;
1386
inc(scan); inc(match); if (scan^ <> match^) then break;
1387
inc(scan); inc(match); if (scan^ <> match^) then break;
1388
until (ptrint(scan) >= ptrint(strend));
1414
Assert(ptr2int(scan) <=
1415
ptr2int(@(s.window^[unsigned(s.window_size-1)])),
1391
Assert(ptrint(scan) <=
1392
ptrint(@(s.window^[cardinal(s.window_size-1)])),
1419
len := MAX_MATCH - int(ptr2int(strend) - ptr2int(scan));
1396
len := MAX_MATCH - integer(ptrint(strend) - ptrint(scan));
1420
1397
scan := strend;
1421
Dec(scan, MAX_MATCH);
1398
dec(scan, MAX_MATCH);
1423
1400
{$endif} { UNALIGNED_OK }
1499
1476
the 256th check will be made at strstart+258. }
1502
Inc(scan); Inc(match); if scan^<>match^ then break;
1503
Inc(scan); Inc(match); if scan^<>match^ then break;
1504
Inc(scan); Inc(match); if scan^<>match^ then break;
1505
Inc(scan); Inc(match); if scan^<>match^ then break;
1506
Inc(scan); Inc(match); if scan^<>match^ then break;
1507
Inc(scan); Inc(match); if scan^<>match^ then break;
1508
Inc(scan); Inc(match); if scan^<>match^ then break;
1509
Inc(scan); Inc(match); if scan^<>match^ then break;
1510
until (ptr2int(scan) >= ptr2int(strend));
1512
Assert(scan <= s.window+unsigned(s.window_size-1), 'wild scan');
1514
len := MAX_MATCH - int(strend - scan);
1479
inc(scan); inc(match); if scan^<>match^ then break;
1480
inc(scan); inc(match); if scan^<>match^ then break;
1481
inc(scan); inc(match); if scan^<>match^ then break;
1482
inc(scan); inc(match); if scan^<>match^ then break;
1483
inc(scan); inc(match); if scan^<>match^ then break;
1484
inc(scan); inc(match); if scan^<>match^ then break;
1485
inc(scan); inc(match); if scan^<>match^ then break;
1486
inc(scan); inc(match); if scan^<>match^ then break;
1487
until (ptrint(scan) >= ptrint(strend));
1489
Assert(scan <= s.window+cardinal(s.window_size-1), 'wild scan');
1491
len := MAX_MATCH - integer(strend - scan);
1516
1493
if (len < MIN_MATCH) then
1576
1553
procedure fill_window(var s : deflate_state);
1578
{register} n, m : unsigned;
1555
{register} n, m : cardinal;
1579
1556
{register} p : pPosf;
1580
more : unsigned; { Amount of free space at the end of the window. }
1557
more : cardinal; { Amount of free space at the end of the window. }
1583
1560
wsize := s.w_size;
1585
more := unsigned(s.window_size -ulg(s.lookahead) -ulg(s.strstart));
1562
more := cardinal(s.window_size -longint(s.lookahead) -longint(s.strstart));
1587
1564
{ Deal with !@#$% 64K limit: }
1588
1565
if (more = 0) and (s.strstart = 0) and (s.lookahead = 0) then
1591
if (more = unsigned(-1)) then
1568
if (more = cardinal(-1)) then
1593
1570
{ Very unlikely, but possible on 16 bit machine if strstart = 0
1594
1571
and lookahead = 1 (input done one byte at time) }
1597
1574
{ If the window is almost full and there is insufficient lookahead,
1598
1575
move the upper half to the lower one to make room in the upper half.}
1601
if (s.strstart >= wsize+ {MAX_DIST}wsize-MIN_LOOKAHEAD) then
1578
if (s.strstart >= wsize+ {MAX_DIST}(wsize-MIN_LOOKAHEAD)) then
1603
zmemcpy( pBytef(s.window), pBytef(@(s.window^[wsize])),
1605
Dec(s.match_start, wsize);
1606
Dec(s.strstart, wsize); { we now have strstart >= MAX_DIST }
1607
Dec(s.block_start, long(wsize));
1580
move(s.window^[wsize],Pbyte(s.window)^,wsize);
1581
dec(s.match_start, wsize);
1582
dec(s.strstart, wsize); { we now have strstart >= MAX_DIST }
1583
dec(s.block_start, longint(wsize));
1609
1585
{ Slide the hash table (could be avoided with 32 bit values
1610
1586
at the expense of memory usage). We slide even when level = 0
1759
1735
if (s.lookahead = 0) then
1760
1736
break; { flush the current block }
1763
Assert(s.block_start >= long(0), 'block gone');
1739
Assert(s.block_start >= 0, 'block gone');
1765
Inc(s.strstart, s.lookahead);
1741
inc(s.strstart, s.lookahead);
1766
1742
s.lookahead := 0;
1768
1744
{ Emit a stored block if pending_buf will be full: }
1769
1745
max_start := s.block_start + max_block_size;
1770
if (s.strstart = 0) or (ulg(s.strstart) >= max_start) then
1746
if (s.strstart = 0) or (longint(s.strstart) >= max_start) then
1772
1748
{ strstart = 0 is possible when wraparound on 16-bit machine }
1773
s.lookahead := uInt(s.strstart - max_start);
1774
s.strstart := uInt(max_start);
1749
s.lookahead := cardinal(s.strstart) - cardinal(max_start);
1750
s.strstart := cardinal(max_start);
1775
1751
{FLUSH_BLOCK(s, FALSE);}
1776
1752
FLUSH_BLOCK_ONLY(s, FALSE);
1777
1753
if (s.strm^.avail_out = 0) then
1966
1940
no better match at the next window position. }
1969
function deflate_slow(var s : deflate_state; flush : int) : block_state;
1943
function deflate_slow(var s : deflate_state; flush : integer) : block_state;
1971
1945
hash_head : IPos; { head of hash chain }
1972
1946
bflush : boolean; { set if current block must be flushed }
1948
max_insert : cardinal;
1976
1950
hash_head := ZNIL;
1978
1952
{ Process the input block. }
1981
1954
{ Make sure that we always have enough lookahead, except
1982
1955
at the end of the input file. We need MAX_MATCH bytes
1983
1956
for the next match, plus MIN_MATCH bytes to insert the
1984
1957
string following the next match. }
1986
1959
if (s.lookahead < MIN_LOOKAHEAD) then
1989
if (s.lookahead < MIN_LOOKAHEAD) and (flush = Z_NO_FLUSH) then
1991
deflate_slow := need_more;
1962
if (s.lookahead < MIN_LOOKAHEAD) and (flush = Z_NO_FLUSH) then
1964
deflate_slow := need_more;
1968
if s.lookahead=0 then
1969
break; { flush the current block }
1995
if (s.lookahead = 0) then
1996
break; { flush the current block }
1999
1972
{ Insert the string window[strstart .. strstart+2] in the
2000
1973
dictionary, and set hash_head to the head of the hash chain: }
2002
1975
if (s.lookahead >= MIN_MATCH) then
2004
1976
INSERT_STRING(s, s.strstart, hash_head);
2007
1978
{ Find the longest match, discarding those <= prev_length. }
2013
1984
if (hash_head <> ZNIL) and (s.prev_length < s.max_lazy_match) and
2014
1985
(s.strstart - hash_head <= {MAX_DIST}(s.w_size-MIN_LOOKAHEAD)) then
2016
1987
{ To simplify the code, we prevent matches with the string
2017
1988
of window index 0 (in particular we have to avoid a match
2018
1989
of the string with itself at the start of the input file). }
2020
1991
if (s.strategy <> Z_HUFFMAN_ONLY) then
2022
1992
s.match_length := longest_match (s, hash_head);
2024
1993
{ longest_match() sets match_start }
2026
1995
if (s.match_length <= 5) and ((s.strategy = Z_FILTERED) or
2027
1996
((s.match_length = MIN_MATCH) and
2028
1997
(s.strstart - s.match_start > TOO_FAR))) then
2030
1999
{ If prev_match is also MIN_MATCH, match_start is garbage
2031
2000
but we will ignore the current match anyway. }
2033
2002
s.match_length := MIN_MATCH-1;
2036
2005
{ If there was a match at the previous step and the current
2037
2006
match is not better, output the previous match: }
2039
if (s.prev_length >= MIN_MATCH)
2040
and (s.match_length <= s.prev_length) then
2042
max_insert := s.strstart + s.lookahead - MIN_MATCH;
2043
{ Do not insert strings in hash table beyond this. }
2045
check_match(s, s.strstart-1, s.prev_match, s.prev_length);
2008
if (s.prev_length>=MIN_MATCH) and (s.match_length<=s.prev_length) then
2010
max_insert := s.strstart + s.lookahead - MIN_MATCH;
2011
{ Do not insert strings in hash table beyond this. }
2013
check_match(s, s.strstart-1, s.prev_match, s.prev_length);
2048
{_tr_tally_dist(s, s->strstart -1 - s->prev_match,
2049
s->prev_length - MIN_MATCH, bflush);}
2050
bflush := _tr_tally(s, s.strstart -1 - s.prev_match,
2051
s.prev_length - MIN_MATCH);
2016
{_tr_tally_dist(s, s->strstart -1 - s->prev_match,
2017
s->prev_length - MIN_MATCH, bflush);}
2018
bflush := _tr_tally(s, s.strstart -1 - s.prev_match,
2019
s.prev_length - MIN_MATCH);
2053
2021
{ Insert in hash table all strings up to the end of the match.
2054
2022
strstart-1 and strstart are already inserted. If there is not
2055
2023
enough lookahead, the last two strings are not inserted in
2056
2024
the hash table. }
2058
Dec(s.lookahead, s.prev_length-1);
2059
Dec(s.prev_length, 2);
2062
if (s.strstart <= max_insert) then
2064
INSERT_STRING(s, s.strstart, hash_head);
2067
until (s.prev_length = 0);
2068
s.match_available := FALSE;
2069
s.match_length := MIN_MATCH-1;
2027
if s.lookahead<s.prev_length-1 then
2030
dec(s.lookahead, s.prev_length-1);
2031
dec(s.prev_length, 2);
2034
if s.strstart<=max_insert then
2035
INSERT_STRING(s, s.strstart, hash_head);
2037
until s.prev_length = 0;
2038
s.match_available := false;
2039
s.match_length := MIN_MATCH-1;
2072
if (bflush) then {FLUSH_BLOCK(s, FALSE);}
2074
FLUSH_BLOCK_ONLY(s, FALSE);
2075
if (s.strm^.avail_out = 0) then
2077
deflate_slow := need_more;
2042
if bflush then {FLUSH_BLOCK(s, FALSE);}
2044
FLUSH_BLOCK_ONLY(s,false);
2045
if s.strm^.avail_out=0 then
2047
deflate_slow := need_more;
2083
if (s.match_available) then
2085
{ If there was no match at the previous position, output a
2086
single literal. If there was a match but the current match
2087
is longer, truncate the previous match to a single literal. }
2089
Tracevv(char(s.window^[s.strstart-1]));
2091
bflush := _tr_tally (s, 0, s.window^[s.strstart-1]);
2053
if s.match_available then
2055
{ If there was no match at the previous position, output a
2056
single literal. If there was a match but the current match
2057
is longer, truncate the previous match to a single literal. }
2059
Tracevv(char(s.window^[s.strstart-1]));
2061
bflush := _tr_tally (s, 0, s.window^[s.strstart-1]);
2095
FLUSH_BLOCK_ONLY(s, FALSE);
2099
if (s.strm^.avail_out = 0) then
2101
deflate_slow := need_more;
2064
FLUSH_BLOCK_ONLY(s, FALSE);
2067
if s.lookahead=0 then
2071
if (s.strm^.avail_out = 0) then
2073
deflate_slow := need_more;
2107
2079
{ There is no previous match to compare with, wait for
2108
2080
the next step to decide. }
2110
s.match_available := TRUE;
2082
s.match_available := TRUE;
2085
if s.lookahead=0 then
2117
2093
Assert (flush <> Z_NO_FLUSH, 'no flush?');
2119
2095
if (s.match_available) then
2122
2098
Tracevv(char(s.window^[s.strstart-1]));