mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 18:59:11 +02:00
renamed DEBUG to ZLIB_DEBUG
git-svn-id: trunk@3221 -
This commit is contained in:
parent
ed225b10b3
commit
f4d1d704d6
@ -118,7 +118,7 @@ begin
|
|||||||
s.check := s.checkfn(cardinal(0), Pbyte(NIL), 0);
|
s.check := s.checkfn(cardinal(0), Pbyte(NIL), 0);
|
||||||
z.adler := s.check;
|
z.adler := s.check;
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: blocks reset');
|
Tracev('inflate: blocks reset');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -158,7 +158,7 @@ begin
|
|||||||
Inc(s^.zend, w);
|
Inc(s^.zend, w);
|
||||||
s^.checkfn := c;
|
s^.checkfn := c;
|
||||||
s^.mode := ZTYPE;
|
s^.mode := ZTYPE;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: blocks allocated');
|
Tracev('inflate: blocks allocated');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inflate_blocks_reset(s^, z, nil);
|
inflate_blocks_reset(s^, z, nil);
|
||||||
@ -240,7 +240,7 @@ begin
|
|||||||
case (t shr 1) of
|
case (t shr 1) of
|
||||||
0: { stored }
|
0: { stored }
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if s.last then
|
if s.last then
|
||||||
Tracev('inflate: stored block (last)')
|
Tracev('inflate: stored block (last)')
|
||||||
else
|
else
|
||||||
@ -260,7 +260,7 @@ begin
|
|||||||
1: { fixed }
|
1: { fixed }
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if s.last then
|
if s.last then
|
||||||
Tracev('inflate: fixed codes blocks (last)')
|
Tracev('inflate: fixed codes blocks (last)')
|
||||||
else
|
else
|
||||||
@ -290,7 +290,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
2: { dynamic }
|
2: { dynamic }
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if s.last then
|
if s.last then
|
||||||
Tracev('inflate: dynamic codes block (last)')
|
Tracev('inflate: dynamic codes block (last)')
|
||||||
else
|
else
|
||||||
@ -367,7 +367,7 @@ begin
|
|||||||
s.sub.left := cardinal(b) and $ffff;
|
s.sub.left := cardinal(b) and $ffff;
|
||||||
k := 0;
|
k := 0;
|
||||||
b := 0; { dump bits }
|
b := 0; { dump bits }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: stored length '+IntToStr(s.sub.left));
|
Tracev('inflate: stored length '+IntToStr(s.sub.left));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if s.sub.left <> 0 then
|
if s.sub.left <> 0 then
|
||||||
@ -453,7 +453,7 @@ begin
|
|||||||
dec(s.sub.left, t);
|
dec(s.sub.left, t);
|
||||||
if (s.sub.left = 0) then
|
if (s.sub.left = 0) then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if (ptrint(q) >= ptrint(s.read)) then
|
if (ptrint(q) >= ptrint(s.read)) then
|
||||||
Tracev('inflate: stored end '+
|
Tracev('inflate: stored end '+
|
||||||
IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
|
IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
|
||||||
@ -533,7 +533,7 @@ begin
|
|||||||
dec(k, 14);
|
dec(k, 14);
|
||||||
|
|
||||||
s.sub.trees.index := 0;
|
s.sub.trees.index := 0;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: table sizes ok');
|
Tracev('inflate: table sizes ok');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
s.mode := BTREE;
|
s.mode := BTREE;
|
||||||
@ -601,7 +601,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
s.sub.trees.index := 0;
|
s.sub.trees.index := 0;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: bits tree ok');
|
Tracev('inflate: bits tree ok');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
s.mode := DTREE;
|
s.mode := DTREE;
|
||||||
@ -756,7 +756,7 @@ begin
|
|||||||
inflate_blocks := inflate_flush(s,z,r);
|
inflate_blocks := inflate_flush(s,z,r);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: trees ok');
|
Tracev('inflate: trees ok');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ c renamed to cs }
|
{ c renamed to cs }
|
||||||
@ -809,7 +809,7 @@ begin
|
|||||||
m := cardinal(ptrint(s.read)-ptrint(q)-1)
|
m := cardinal(ptrint(s.read)-ptrint(q)-1)
|
||||||
else
|
else
|
||||||
m := cardinal(ptrint(s.zend)-ptrint(q));
|
m := cardinal(ptrint(s.zend)-ptrint(q));
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if (ptrint(q) >= ptrint(s.read)) then
|
if (ptrint(q) >= ptrint(s.read)) then
|
||||||
Tracev('inflate: codes end '+
|
Tracev('inflate: codes end '+
|
||||||
IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
|
IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
|
||||||
@ -826,7 +826,7 @@ begin
|
|||||||
{$ifndef patch112}
|
{$ifndef patch112}
|
||||||
if (k > 7) then { return unused byte, if any }
|
if (k > 7) then { return unused byte, if any }
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(k < 16, 'inflate_codes grabbed too many bytes');
|
Assert(k < 16, 'inflate_codes grabbed too many bytes');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
dec(k, 8);
|
dec(k, 8);
|
||||||
@ -920,7 +920,7 @@ begin
|
|||||||
ZFREE(z, s^.window);
|
ZFREE(z, s^.window);
|
||||||
ZFREE(z, s^.hufts);
|
ZFREE(z, s^.hufts);
|
||||||
ZFREE(z, s);
|
ZFREE(z, s);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Trace('inflate: blocks freed');
|
Trace('inflate: blocks freed');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inflate_blocks_free := Z_OK;
|
inflate_blocks_free := Z_OK;
|
||||||
|
@ -50,7 +50,7 @@ begin
|
|||||||
c^.dbits := Byte(bd);
|
c^.dbits := Byte(bd);
|
||||||
c^.ltree := tl;
|
c^.ltree := tl;
|
||||||
c^.dtree := td;
|
c^.dtree := td;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: codes new');
|
Tracev('inflate: codes new');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -167,7 +167,7 @@ begin
|
|||||||
if (e = 0) then { literal }
|
if (e = 0) then { literal }
|
||||||
begin
|
begin
|
||||||
c^.sub.lit := t^.base;
|
c^.sub.lit := t^.base;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if (t^.base >= $20) and (t^.base < $7f) then
|
if (t^.base >= $20) and (t^.base < $7f) then
|
||||||
Tracevv('inflate: literal '+char(t^.base))
|
Tracevv('inflate: literal '+char(t^.base))
|
||||||
else
|
else
|
||||||
@ -191,7 +191,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (e and 32 <> 0) then { end of block }
|
if (e and 32 <> 0) then { end of block }
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv('inflate: end of block');
|
Tracevv('inflate: end of block');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
c^.mode := WASH;
|
c^.mode := WASH;
|
||||||
@ -243,7 +243,7 @@ begin
|
|||||||
|
|
||||||
c^.sub.code.need := c^.dbits;
|
c^.sub.code.need := c^.dbits;
|
||||||
c^.sub.code.tree := c^.dtree;
|
c^.sub.code.tree := c^.dtree;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv('inflate: length '+IntToStr(c^.len));
|
Tracevv('inflate: length '+IntToStr(c^.len));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
c^.mode := DIST;
|
c^.mode := DIST;
|
||||||
@ -337,7 +337,7 @@ begin
|
|||||||
{DUMPBITS(j);}
|
{DUMPBITS(j);}
|
||||||
b := b shr j;
|
b := b shr j;
|
||||||
dec(k, j);
|
dec(k, j);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv('inflate: distance '+ IntToStr(c^.sub.copy.dist));
|
Tracevv('inflate: distance '+ IntToStr(c^.sub.copy.dist));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
c^.mode := COPY;
|
c^.mode := COPY;
|
||||||
@ -483,7 +483,7 @@ begin
|
|||||||
{$ifdef patch112}
|
{$ifdef patch112}
|
||||||
if (k > 7) then { return unused byte, if any }
|
if (k > 7) then { return unused byte, if any }
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(k < 16, 'inflate_codes grabbed too many bytes');
|
Assert(k < 16, 'inflate_codes grabbed too many bytes');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
dec(k, 8);
|
dec(k, 8);
|
||||||
@ -565,7 +565,7 @@ procedure inflate_codes_free(c : pInflate_codes_state;
|
|||||||
var z : z_stream);
|
var z : z_stream);
|
||||||
begin
|
begin
|
||||||
ZFREE(z, c);
|
ZFREE(z, c);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: codes free');
|
Tracev('inflate: codes free');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
@ -94,7 +94,7 @@ begin
|
|||||||
{DUMPBITS(t^.bits);}
|
{DUMPBITS(t^.bits);}
|
||||||
b := b shr t^.bits;
|
b := b shr t^.bits;
|
||||||
dec(k, t^.bits);
|
dec(k, t^.bits);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if (t^.base >= $20) and (t^.base < $7f) then
|
if (t^.base >= $20) and (t^.base < $7f) then
|
||||||
Tracevv('inflate: * literal '+char(t^.base))
|
Tracevv('inflate: * literal '+char(t^.base))
|
||||||
else
|
else
|
||||||
@ -118,7 +118,7 @@ begin
|
|||||||
{DUMPBITS(e);}
|
{DUMPBITS(e);}
|
||||||
b := b shr e;
|
b := b shr e;
|
||||||
dec(k, e);
|
dec(k, e);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv('inflate: * length ' + IntToStr(c));
|
Tracevv('inflate: * length ' + IntToStr(c));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ decode distance base of block to copy }
|
{ decode distance base of block to copy }
|
||||||
@ -156,7 +156,7 @@ begin
|
|||||||
b := b shr e;
|
b := b shr e;
|
||||||
dec(k, e);
|
dec(k, e);
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv('inflate: * distance '+IntToStr(d));
|
Tracevv('inflate: * distance '+IntToStr(d));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ do the copy }
|
{ do the copy }
|
||||||
@ -236,7 +236,7 @@ begin
|
|||||||
b := b shr t^.bits;
|
b := b shr t^.bits;
|
||||||
dec(k, t^.bits);
|
dec(k, t^.bits);
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
if (t^.base >= $20) and (t^.base < $7f) then
|
if (t^.base >= $20) and (t^.base < $7f) then
|
||||||
Tracevv('inflate: * literal '+char(t^.base))
|
Tracevv('inflate: * literal '+char(t^.base))
|
||||||
else
|
else
|
||||||
@ -251,7 +251,7 @@ begin
|
|||||||
else
|
else
|
||||||
if (e and 32 <> 0) then
|
if (e and 32 <> 0) then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv('inflate: * end of block');
|
Tracevv('inflate: * end of block');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{UNGRAB}
|
{UNGRAB}
|
||||||
|
@ -30,7 +30,7 @@ const
|
|||||||
MANY = 1440;
|
MANY = 1440;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
var
|
var
|
||||||
inflate_hufts : cardinal;
|
inflate_hufts : cardinal;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
@ -42,10 +42,10 @@ interface
|
|||||||
{$I zconf.inc}
|
{$I zconf.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
zbase
|
{$ifdef ZLIB_DEBUG}
|
||||||
{$ifdef DEBUG}
|
sysutils,
|
||||||
,sysutils {for inttostr}
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
zbase
|
||||||
;
|
;
|
||||||
|
|
||||||
{ ===========================================================================
|
{ ===========================================================================
|
||||||
@ -287,7 +287,7 @@ type
|
|||||||
matches : cardinal; { number of string matches in current block }
|
matches : cardinal; { number of string matches in current block }
|
||||||
last_eob_len : integer; { bit length of EOB code for last block }
|
last_eob_len : integer; { bit length of EOB code for last block }
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
bits_sent : longint; { bit length of the compressed data }
|
bits_sent : longint; { bit length of the compressed data }
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -783,7 +783,7 @@ procedure send_bits(var s : deflate_state;
|
|||||||
value : integer; { value to send }
|
value : integer; { value to send }
|
||||||
length : integer); { number of bits }
|
length : integer); { number of bits }
|
||||||
begin
|
begin
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevv(' l '+IntToStr(length)+ ' v '+IntToStr(value));
|
Tracevv(' l '+IntToStr(length)+ ' v '+IntToStr(value));
|
||||||
Assert((length > 0) and (length <= 15), 'invalid length');
|
Assert((length > 0) and (length <= 15), 'invalid length');
|
||||||
inc(s.bits_sent, longint(length));
|
inc(s.bits_sent, longint(length));
|
||||||
@ -815,7 +815,7 @@ begin
|
|||||||
{$IFDEF NoRangeCheck} {$Q+} {$UNDEF NoRangeCheck} {$ENDIF}
|
{$IFDEF NoRangeCheck} {$Q+} {$UNDEF NoRangeCheck} {$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$else} { !DEBUG }
|
{$else} { !ZLIB_DEBUG }
|
||||||
|
|
||||||
|
|
||||||
macro send_code(s, c, tree)
|
macro send_code(s, c, tree)
|
||||||
@ -842,7 +842,7 @@ begin integer len := length;\
|
|||||||
s^.bi_valid += len;\
|
s^.bi_valid += len;\
|
||||||
end\
|
end\
|
||||||
end;
|
end;
|
||||||
{$endif} { DEBUG }
|
{$endif} { ZLIB_DEBUG }
|
||||||
|
|
||||||
{ ===========================================================================
|
{ ===========================================================================
|
||||||
Reverse the first len bits of a code, using straightforward code (a faster
|
Reverse the first len bits of a code, using straightforward code (a faster
|
||||||
@ -900,7 +900,7 @@ begin
|
|||||||
{ Check that the bit counts in bl_count are consistent. The last code
|
{ Check that the bit counts in bl_count are consistent. The last code
|
||||||
must be all ones. }
|
must be all ones. }
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert (code + bl_count[MAX_BITS]-1 = (1 shl MAX_BITS)-1,
|
Assert (code + bl_count[MAX_BITS]-1 = (1 shl MAX_BITS)-1,
|
||||||
'inconsistent bit counts');
|
'inconsistent bit counts');
|
||||||
Tracev(#13'gen_codes: max_code '+IntToStr(max_code));
|
Tracev(#13'gen_codes: max_code '+IntToStr(max_code));
|
||||||
@ -914,7 +914,7 @@ begin
|
|||||||
{ Now reverse the bits }
|
{ Now reverse the bits }
|
||||||
tree^[n].fc.Code := bi_reverse(next_code[len], len);
|
tree^[n].fc.Code := bi_reverse(next_code[len], len);
|
||||||
inc(next_code[len]);
|
inc(next_code[len]);
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
if (n>31) and (n<128) then
|
if (n>31) and (n<128) then
|
||||||
Tracecv(tree <> tree_ptr(@static_ltree),
|
Tracecv(tree <> tree_ptr(@static_ltree),
|
||||||
(^M'n #'+IntToStr(n)+' '+char(n)+' l '+IntToStr(len)+' c '+
|
(^M'n #'+IntToStr(n)+' '+char(n)+' l '+IntToStr(len)+' c '+
|
||||||
@ -1159,7 +1159,7 @@ begin
|
|||||||
s.bi_buf := 0;
|
s.bi_buf := 0;
|
||||||
s.bi_valid := 0;
|
s.bi_valid := 0;
|
||||||
s.last_eob_len := 8; { enough lookahead for inflate }
|
s.last_eob_len := 8; { enough lookahead for inflate }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
s.bits_sent := 0;
|
s.bits_sent := 0;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -1301,7 +1301,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (overflow = 0) then
|
if (overflow = 0) then
|
||||||
exit;
|
exit;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'bit length overflow');
|
Tracev(^M'bit length overflow');
|
||||||
{$endif}
|
{$endif}
|
||||||
{ This happens for example on obj2 and pic of the Calgary corpus }
|
{ This happens for example on obj2 and pic of the Calgary corpus }
|
||||||
@ -1336,7 +1336,7 @@ begin
|
|||||||
continue;
|
continue;
|
||||||
if (tree^[m].dl.Len <> cardinal(bits)) then
|
if (tree^[m].dl.Len <> cardinal(bits)) then
|
||||||
begin
|
begin
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Trace('code '+IntToStr(m)+' bits '+IntToStr(tree^[m].dl.Len)
|
Trace('code '+IntToStr(m)+' bits '+IntToStr(tree^[m].dl.Len)
|
||||||
+'.'+IntToStr(bits));
|
+'.'+IntToStr(bits));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1599,7 +1599,7 @@ begin
|
|||||||
if (count < min_count) then
|
if (count < min_count) then
|
||||||
begin
|
begin
|
||||||
repeat
|
repeat
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(curlen));
|
Tracevvv(#13'cd '+IntToStr(curlen));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, s.bl_tree[curlen].fc.Code, s.bl_tree[curlen].dl.Len);
|
send_bits(s, s.bl_tree[curlen].fc.Code, s.bl_tree[curlen].dl.Len);
|
||||||
@ -1611,16 +1611,16 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (curlen <> prevlen) then
|
if (curlen <> prevlen) then
|
||||||
begin
|
begin
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(curlen));
|
Tracevvv(#13'cd '+IntToStr(curlen));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, s.bl_tree[curlen].fc.Code, s.bl_tree[curlen].dl.Len);
|
send_bits(s, s.bl_tree[curlen].fc.Code, s.bl_tree[curlen].dl.Len);
|
||||||
dec(count);
|
dec(count);
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert((count >= 3) and (count <= 6), ' 3_6?');
|
Assert((count >= 3) and (count <= 6), ' 3_6?');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(REP_3_6));
|
Tracevvv(#13'cd '+IntToStr(REP_3_6));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, s.bl_tree[REP_3_6].fc.Code, s.bl_tree[REP_3_6].dl.Len);
|
send_bits(s, s.bl_tree[REP_3_6].fc.Code, s.bl_tree[REP_3_6].dl.Len);
|
||||||
@ -1629,7 +1629,7 @@ begin
|
|||||||
else
|
else
|
||||||
if (count <= 10) then
|
if (count <= 10) then
|
||||||
begin
|
begin
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(REPZ_3_10));
|
Tracevvv(#13'cd '+IntToStr(REPZ_3_10));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, s.bl_tree[REPZ_3_10].fc.Code, s.bl_tree[REPZ_3_10].dl.Len);
|
send_bits(s, s.bl_tree[REPZ_3_10].fc.Code, s.bl_tree[REPZ_3_10].dl.Len);
|
||||||
@ -1637,7 +1637,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(REPZ_11_138));
|
Tracevvv(#13'cd '+IntToStr(REPZ_11_138));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, s.bl_tree[REPZ_11_138].fc.Code, s.bl_tree[REPZ_11_138].dl.Len);
|
send_bits(s, s.bl_tree[REPZ_11_138].fc.Code, s.bl_tree[REPZ_11_138].dl.Len);
|
||||||
@ -1693,7 +1693,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{ Update opt_len to include the bit length tree and counts }
|
{ Update opt_len to include the bit length tree and counts }
|
||||||
inc(s.opt_len, 3*(max_blindex+1) + 5+5+4);
|
inc(s.opt_len, 3*(max_blindex+1) + 5+5+4);
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'dyn trees: dyn %ld, stat %ld {s.opt_len, s.static_len}');
|
Tracev(^M'dyn trees: dyn %ld, stat %ld {s.opt_len, s.static_len}');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -1713,7 +1713,7 @@ procedure send_all_trees(var s : deflate_state;
|
|||||||
var
|
var
|
||||||
rank : integer; { index in bl_order }
|
rank : integer; { index in bl_order }
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert ((lcodes >= 257) and (dcodes >= 1) and (blcodes >= 4),
|
Assert ((lcodes >= 257) and (dcodes >= 1) and (blcodes >= 4),
|
||||||
'not enough codes');
|
'not enough codes');
|
||||||
Assert ((lcodes <= L_CODES) and (dcodes <= D_CODES)
|
Assert ((lcodes <= L_CODES) and (dcodes <= D_CODES)
|
||||||
@ -1725,22 +1725,22 @@ begin
|
|||||||
send_bits(s, blcodes-4, 4); { not -3 as stated in appnote.txt }
|
send_bits(s, blcodes-4, 4); { not -3 as stated in appnote.txt }
|
||||||
for rank := 0 to blcodes-1 do
|
for rank := 0 to blcodes-1 do
|
||||||
begin
|
begin
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'bl code '+IntToStr(bl_order[rank]));
|
Tracev(^M'bl code '+IntToStr(bl_order[rank]));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, s.bl_tree[bl_order[rank]].dl.Len, 3);
|
send_bits(s, s.bl_tree[bl_order[rank]].dl.Len, 3);
|
||||||
end;
|
end;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'bl tree: sent '+IntToStr(s.bits_sent));
|
Tracev(^M'bl tree: sent '+IntToStr(s.bits_sent));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
send_tree(s, s.dyn_ltree, lcodes-1); { literal tree }
|
send_tree(s, s.dyn_ltree, lcodes-1); { literal tree }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'lit tree: sent '+IntToStr(s.bits_sent));
|
Tracev(^M'lit tree: sent '+IntToStr(s.bits_sent));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
send_tree(s, s.dyn_dtree, dcodes-1); { distance tree }
|
send_tree(s, s.dyn_dtree, dcodes-1); { distance tree }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'dist tree: sent '+IntToStr(s.bits_sent));
|
Tracev(^M'dist tree: sent '+IntToStr(s.bits_sent));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -1768,7 +1768,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
s.bi_buf := 0;
|
s.bi_buf := 0;
|
||||||
s.bi_valid := 0;
|
s.bi_valid := 0;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
s.bits_sent := (s.bits_sent+7) and (not 7);
|
s.bits_sent := (s.bits_sent+7) and (not 7);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
@ -1799,11 +1799,11 @@ begin
|
|||||||
s.pending_buf^[s.pending] := byte(word(not len) shr 8);;
|
s.pending_buf^[s.pending] := byte(word(not len) shr 8);;
|
||||||
inc(s.pending);
|
inc(s.pending);
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
inc(s.bits_sent, 2*16);
|
inc(s.bits_sent, 2*16);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
inc(s.bits_sent, longint(len shl 3));
|
inc(s.bits_sent, longint(len shl 3));
|
||||||
{$endif}
|
{$endif}
|
||||||
while (len <> 0) do
|
while (len <> 0) do
|
||||||
@ -1877,7 +1877,7 @@ end;
|
|||||||
procedure _tr_align(var s : deflate_state);
|
procedure _tr_align(var s : deflate_state);
|
||||||
begin
|
begin
|
||||||
send_bits(s, STATIC_TREES shl 1, 3);
|
send_bits(s, STATIC_TREES shl 1, 3);
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(END_BLOCK));
|
Tracevvv(#13'cd '+IntToStr(END_BLOCK));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, static_ltree[END_BLOCK].fc.Code, static_ltree[END_BLOCK].dl.Len);
|
send_bits(s, static_ltree[END_BLOCK].fc.Code, static_ltree[END_BLOCK].dl.Len);
|
||||||
@ -1890,7 +1890,7 @@ begin
|
|||||||
if (1 + s.last_eob_len + 10 - s.bi_valid < 9) then
|
if (1 + s.last_eob_len + 10 - s.bi_valid < 9) then
|
||||||
begin
|
begin
|
||||||
send_bits(s, STATIC_TREES shl 1, 3);
|
send_bits(s, STATIC_TREES shl 1, 3);
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(END_BLOCK));
|
Tracevvv(#13'cd '+IntToStr(END_BLOCK));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, static_ltree[END_BLOCK].fc.Code, static_ltree[END_BLOCK].dl.Len);
|
send_bits(s, static_ltree[END_BLOCK].fc.Code, static_ltree[END_BLOCK].dl.Len);
|
||||||
@ -1961,7 +1961,7 @@ begin
|
|||||||
if (dist = 0) then
|
if (dist = 0) then
|
||||||
begin
|
begin
|
||||||
{ send a literal byte }
|
{ send a literal byte }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(lc));
|
Tracevvv(#13'cd '+IntToStr(lc));
|
||||||
Tracecv((lc > 31) and (lc < 128), ' '+char(lc)+' ');
|
Tracecv((lc > 31) and (lc < 128), ' '+char(lc)+' ');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1972,7 +1972,7 @@ begin
|
|||||||
{ Here, lc is the match length - MIN_MATCH }
|
{ Here, lc is the match length - MIN_MATCH }
|
||||||
code := _length_code[lc];
|
code := _length_code[lc];
|
||||||
{ send the length code }
|
{ send the length code }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(code+LITERALS+1));
|
Tracevvv(#13'cd '+IntToStr(code+LITERALS+1));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, ltree[code+LITERALS+1].fc.Code, ltree[code+LITERALS+1].dl.Len);
|
send_bits(s, ltree[code+LITERALS+1].fc.Code, ltree[code+LITERALS+1].dl.Len);
|
||||||
@ -1989,12 +1989,12 @@ begin
|
|||||||
else
|
else
|
||||||
code := _dist_code[256+(dist shr 7)];
|
code := _dist_code[256+(dist shr 7)];
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert (code < D_CODES, 'bad d_code');
|
Assert (code < D_CODES, 'bad d_code');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{ send the distance code }
|
{ send the distance code }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(code));
|
Tracevvv(#13'cd '+IntToStr(code));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, dtree[code].fc.Code, dtree[code].dl.Len);
|
send_bits(s, dtree[code].fc.Code, dtree[code].dl.Len);
|
||||||
@ -2007,12 +2007,12 @@ begin
|
|||||||
end; { literal or match pair ? }
|
end; { literal or match pair ? }
|
||||||
|
|
||||||
{ Check that the overlay between pending_buf and d_buf+l_buf is ok: }
|
{ Check that the overlay between pending_buf and d_buf+l_buf is ok: }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(s.pending < s.lit_bufsize + 2*lx, 'pendingBuf overflow');
|
Assert(s.pending < s.lit_bufsize + 2*lx, 'pendingBuf overflow');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
until (lx >= s.last_lit);
|
until (lx >= s.last_lit);
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracevvv(#13'cd '+IntToStr(END_BLOCK));
|
Tracevvv(#13'cd '+IntToStr(END_BLOCK));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
send_bits(s, ltree[END_BLOCK].fc.Code, ltree[END_BLOCK].dl.Len);
|
send_bits(s, ltree[END_BLOCK].fc.Code, ltree[END_BLOCK].dl.Len);
|
||||||
@ -2044,12 +2044,12 @@ begin
|
|||||||
|
|
||||||
{ Construct the literal and distance trees }
|
{ Construct the literal and distance trees }
|
||||||
build_tree(s, s.l_desc);
|
build_tree(s, s.l_desc);
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'lit data: dyn %ld, stat %ld {s.opt_len, s.static_len}');
|
Tracev(^M'lit data: dyn %ld, stat %ld {s.opt_len, s.static_len}');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
build_tree(s, s.d_desc);
|
build_tree(s, s.d_desc);
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'dist data: dyn %ld, stat %ld {s.opt_len, s.static_len}');
|
Tracev(^M'dist data: dyn %ld, stat %ld {s.opt_len, s.static_len}');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ At this point, opt_len and static_len are the total bit lengths of
|
{ At this point, opt_len and static_len are the total bit lengths of
|
||||||
@ -2063,7 +2063,7 @@ begin
|
|||||||
opt_lenb := (s.opt_len+3+7) shr 3;
|
opt_lenb := (s.opt_len+3+7) shr 3;
|
||||||
static_lenb := (s.static_len+3+7) shr 3;
|
static_lenb := (s.static_len+3+7) shr 3;
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'opt %lu(%lu) stat %lu(%lu) stored %lu lit %u '+
|
Tracev(^M'opt %lu(%lu) stat %lu(%lu) stored %lu lit %u '+
|
||||||
'{opt_lenb, s.opt_len, static_lenb, s.static_len, stored_len,'+
|
'{opt_lenb, s.opt_len, static_lenb, s.static_len, stored_len,'+
|
||||||
's.last_lit}');
|
's.last_lit}');
|
||||||
@ -2075,7 +2075,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(buf <> nil, 'lost buf');
|
Assert(buf <> nil, 'lost buf');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
static_lenb := stored_len + 5;
|
static_lenb := stored_len + 5;
|
||||||
@ -2145,7 +2145,7 @@ begin
|
|||||||
compress_block(s, s.dyn_ltree, s.dyn_dtree);
|
compress_block(s, s.dyn_ltree, s.dyn_dtree);
|
||||||
inc(s.compressed_len, 3 + s.opt_len);
|
inc(s.compressed_len, 3 + s.opt_len);
|
||||||
end;
|
end;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Assert (s.compressed_len = s.bits_sent, 'bad compressed size');
|
Assert (s.compressed_len = s.bits_sent, 'bad compressed size');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
init_block(s);
|
init_block(s);
|
||||||
@ -2155,7 +2155,7 @@ begin
|
|||||||
bi_windup(s);
|
bi_windup(s);
|
||||||
inc(s.compressed_len, 7); { align on byte boundary }
|
inc(s.compressed_len, 7); { align on byte boundary }
|
||||||
end;
|
end;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(#13'comprlen %lu(%lu) {s.compressed_len shr 3,'+
|
Tracev(#13'comprlen %lu(%lu) {s.compressed_len shr 3,'+
|
||||||
's.compressed_len-7*ord(eof)}');
|
's.compressed_len-7*ord(eof)}');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -2172,7 +2172,7 @@ function _tr_tally (var s : deflate_state;
|
|||||||
dist : cardinal; { distance of matched string }
|
dist : cardinal; { distance of matched string }
|
||||||
lc : cardinal) : boolean; { match length-MIN_MATCH or unmatched char (if dist=0) }
|
lc : cardinal) : boolean; { match length-MIN_MATCH or unmatched char (if dist=0) }
|
||||||
var
|
var
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
MAX_DIST : word;
|
MAX_DIST : word;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
code : word;
|
code : word;
|
||||||
@ -2202,7 +2202,7 @@ begin
|
|||||||
code := _dist_code[dist]
|
code := _dist_code[dist]
|
||||||
else
|
else
|
||||||
code := _dist_code[256+(dist shr 7)];
|
code := _dist_code[256+(dist shr 7)];
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
{macro MAX_DIST(s) <=> ((s)^.w_size-MIN_LOOKAHEAD)
|
{macro MAX_DIST(s) <=> ((s)^.w_size-MIN_LOOKAHEAD)
|
||||||
In order to simplify the code, particularly on 16 bit machines, match
|
In order to simplify the code, particularly on 16 bit machines, match
|
||||||
distances are limited to MAX_DIST instead of WSIZE. }
|
distances are limited to MAX_DIST instead of WSIZE. }
|
||||||
@ -2229,7 +2229,7 @@ begin
|
|||||||
(cardinal(5)+extra_dbits[dcode])) );
|
(cardinal(5)+extra_dbits[dcode])) );
|
||||||
end;
|
end;
|
||||||
out_length := out_length shr 3;
|
out_length := out_length shr 3;
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
Tracev(^M'last_lit %u, in %ld, out ~%ld(%ld%%) ');
|
Tracev(^M'last_lit %u, in %ld, out ~%ld(%ld%%) ');
|
||||||
{ s.last_lit, in_length, out_length,
|
{ s.last_lit, in_length, out_length,
|
||||||
cardinal(100) - out_length*100 div in_length)); }
|
cardinal(100) - out_length*100 div in_length)); }
|
||||||
|
@ -399,7 +399,7 @@ const
|
|||||||
PRESET_DICT = $20; { preset dictionary flag in zlib header }
|
PRESET_DICT = $20; { preset dictionary flag in zlib header }
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
procedure Assert(cond : boolean; msg : string);
|
procedure Assert(cond : boolean; msg : string);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ const
|
|||||||
const
|
const
|
||||||
z_verbose : integer = 1;
|
z_verbose : integer = 1;
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
procedure z_error (m : string);
|
procedure z_error (m : string);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ function longest_match(var s : deflate_state; cur_match : IPos) : cardinal;
|
|||||||
forward;
|
forward;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
{local}
|
{local}
|
||||||
procedure check_match(var s : deflate_state;
|
procedure check_match(var s : deflate_state;
|
||||||
start, match : IPos;
|
start, match : IPos;
|
||||||
@ -994,7 +994,7 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(strm.avail_out > 0, 'bug2');
|
Assert(strm.avail_out > 0, 'bug2');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if (flush <> Z_FINISH) then
|
if (flush <> Z_FINISH) then
|
||||||
@ -1271,7 +1271,7 @@ distances are limited to MAX_DIST instead of WSIZE. }
|
|||||||
|
|
||||||
{ The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
{ The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
||||||
It is easy to get rid of this optimization if necessary. }
|
It is easy to get rid of this optimization if necessary. }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert((s.hash_bits >= 8) and (MAX_MATCH = 258), 'Code too clever');
|
Assert((s.hash_bits >= 8) and (MAX_MATCH = 258), 'Code too clever');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ Do not waste too much time if we already have a good match: }
|
{ Do not waste too much time if we already have a good match: }
|
||||||
@ -1285,11 +1285,11 @@ distances are limited to MAX_DIST instead of WSIZE. }
|
|||||||
|
|
||||||
if (cardinal(nice_match) > s.lookahead) then
|
if (cardinal(nice_match) > s.lookahead) then
|
||||||
nice_match := s.lookahead;
|
nice_match := s.lookahead;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(longint(s.strstart) <= s.window_size-MIN_LOOKAHEAD, 'need lookahead');
|
Assert(longint(s.strstart) <= s.window_size-MIN_LOOKAHEAD, 'need lookahead');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
repeat
|
repeat
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(cur_match < s.strstart, 'no future');
|
Assert(cur_match < s.strstart, 'no future');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
match := @(s.window^[cur_match]);
|
match := @(s.window^[cur_match]);
|
||||||
@ -1321,7 +1321,7 @@ distances are limited to MAX_DIST instead of WSIZE. }
|
|||||||
at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
|
at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
|
||||||
necessary to put more guard bytes at the end of the window, or
|
necessary to put more guard bytes at the end of the window, or
|
||||||
to check more often for insufficient lookahead. }
|
to check more often for insufficient lookahead. }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(pzByteArray(scan)^[2] = pzByteArray(match)^[2], 'scan[2]?');
|
Assert(pzByteArray(scan)^[2] = pzByteArray(match)^[2], 'scan[2]?');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inc(scan);
|
inc(scan);
|
||||||
@ -1336,7 +1336,7 @@ distances are limited to MAX_DIST instead of WSIZE. }
|
|||||||
{ The funny "do while" generates better code on most compilers }
|
{ The funny "do while" generates better code on most compilers }
|
||||||
|
|
||||||
{ Here, scan <= window+strstart+257 }
|
{ Here, scan <= window+strstart+257 }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
{$ifopt R+} {$define RangeCheck} {$endif} {$R-}
|
{$ifopt R+} {$define RangeCheck} {$endif} {$R-}
|
||||||
Assert(ptrint(scan) <=
|
Assert(ptrint(scan) <=
|
||||||
ptrint(@(s.window^[cardinal(s.window_size-1)])),
|
ptrint(@(s.window^[cardinal(s.window_size-1)])),
|
||||||
@ -1370,7 +1370,7 @@ distances are limited to MAX_DIST instead of WSIZE. }
|
|||||||
|
|
||||||
inc(scan, 2);
|
inc(scan, 2);
|
||||||
inc(match);
|
inc(match);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert( scan^ = match^, 'match[2]?');
|
Assert( scan^ = match^, 'match[2]?');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ We check for insufficient lookahead only every 8th comparison;
|
{ We check for insufficient lookahead only every 8th comparison;
|
||||||
@ -1387,7 +1387,7 @@ distances are limited to MAX_DIST instead of WSIZE. }
|
|||||||
inc(scan); inc(match); if (scan^ <> match^) then break;
|
inc(scan); inc(match); if (scan^ <> match^) then break;
|
||||||
until (ptrint(scan) >= ptrint(strend));
|
until (ptrint(scan) >= ptrint(strend));
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(ptrint(scan) <=
|
Assert(ptrint(scan) <=
|
||||||
ptrint(@(s.window^[cardinal(s.window_size-1)])),
|
ptrint(@(s.window^[cardinal(s.window_size-1)])),
|
||||||
'wild scan');
|
'wild scan');
|
||||||
@ -1446,7 +1446,7 @@ begin
|
|||||||
|
|
||||||
{ The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
{ The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
||||||
It is easy to get rid of this optimization if necessary. }
|
It is easy to get rid of this optimization if necessary. }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert((s.hash_bits >= 8) and (MAX_MATCH = 258), 'Code too clever');
|
Assert((s.hash_bits >= 8) and (MAX_MATCH = 258), 'Code too clever');
|
||||||
|
|
||||||
Assert(longint(s.strstart) <= s.window_size-MIN_LOOKAHEAD, 'need lookahead');
|
Assert(longint(s.strstart) <= s.window_size-MIN_LOOKAHEAD, 'need lookahead');
|
||||||
@ -1504,7 +1504,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$endif} { FASTEST }
|
{$endif} { FASTEST }
|
||||||
|
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
{ ===========================================================================
|
{ ===========================================================================
|
||||||
Check that the match at match_start is indeed a match. }
|
Check that the match at match_start is indeed a match. }
|
||||||
|
|
||||||
@ -1631,7 +1631,7 @@ begin
|
|||||||
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
||||||
* If there was sliding, more >= WSIZE. So in all cases, more >= 2. }
|
* If there was sliding, more >= WSIZE. So in all cases, more >= 2. }
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(more >= 2, 'more < 2');
|
Assert(more >= 2, 'more < 2');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -1671,7 +1671,7 @@ begin
|
|||||||
|
|
||||||
s.block_start := s.strstart;
|
s.block_start := s.strstart;
|
||||||
flush_pending(s.strm^);
|
flush_pending(s.strm^);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('[FLUSH]');
|
Tracev('[FLUSH]');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -1721,7 +1721,7 @@ begin
|
|||||||
{ Fill the window as much as possible: }
|
{ Fill the window as much as possible: }
|
||||||
if (s.lookahead <= 1) then
|
if (s.lookahead <= 1) then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert( (s.strstart < s.w_size + {MAX_DIST}s.w_size-MIN_LOOKAHEAD) or
|
Assert( (s.strstart < s.w_size + {MAX_DIST}s.w_size-MIN_LOOKAHEAD) or
|
||||||
(s.block_start >= longint(s.w_size)), 'slide too late');
|
(s.block_start >= longint(s.w_size)), 'slide too late');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1735,7 +1735,7 @@ begin
|
|||||||
if (s.lookahead = 0) then
|
if (s.lookahead = 0) then
|
||||||
break; { flush the current block }
|
break; { flush the current block }
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert(s.block_start >= 0, 'block gone');
|
Assert(s.block_start >= 0, 'block gone');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inc(s.strstart, s.lookahead);
|
inc(s.strstart, s.lookahead);
|
||||||
@ -1847,7 +1847,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (s.match_length >= MIN_MATCH) then
|
if (s.match_length >= MIN_MATCH) then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
check_match(s, s.strstart, s.match_start, s.match_length);
|
check_match(s, s.strstart, s.match_start, s.match_length);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -1898,7 +1898,7 @@ end;
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ No match, output a literal byte }
|
{ No match, output a literal byte }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv(char(s.window^[s.strstart]));
|
Tracevv(char(s.window^[s.strstart]));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{_tr_tally_lit (s, 0, s.window^[s.strstart], bflush);}
|
{_tr_tally_lit (s, 0, s.window^[s.strstart], bflush);}
|
||||||
@ -2009,7 +2009,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
max_insert := s.strstart + s.lookahead - MIN_MATCH;
|
max_insert := s.strstart + s.lookahead - MIN_MATCH;
|
||||||
{ Do not insert strings in hash table beyond this. }
|
{ Do not insert strings in hash table beyond this. }
|
||||||
{$ifdef DEBUG}
|
{$ifdef ZLIB_DEBUG}
|
||||||
check_match(s, s.strstart-1, s.prev_match, s.prev_length);
|
check_match(s, s.strstart-1, s.prev_match, s.prev_length);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -2023,7 +2023,7 @@ begin
|
|||||||
enough lookahead, the last two strings are not inserted in
|
enough lookahead, the last two strings are not inserted in
|
||||||
the hash table. }
|
the hash table. }
|
||||||
|
|
||||||
{$ifdef debug}
|
{$ifdef ZLIB_DEBUG}
|
||||||
if s.lookahead<s.prev_length-1 then
|
if s.lookahead<s.prev_length-1 then
|
||||||
runerror(255);
|
runerror(255);
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -2055,7 +2055,7 @@ begin
|
|||||||
{ If there was no match at the previous position, output a
|
{ If there was no match at the previous position, output a
|
||||||
single literal. If there was a match but the current match
|
single literal. If there was a match but the current match
|
||||||
is longer, truncate the previous match to a single literal. }
|
is longer, truncate the previous match to a single literal. }
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv(char(s.window^[s.strstart-1]));
|
Tracevv(char(s.window^[s.strstart-1]));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
bflush := _tr_tally (s, 0, s.window^[s.strstart-1]);
|
bflush := _tr_tally (s, 0, s.window^[s.strstart-1]);
|
||||||
@ -2063,7 +2063,7 @@ begin
|
|||||||
if bflush then
|
if bflush then
|
||||||
FLUSH_BLOCK_ONLY(s, FALSE);
|
FLUSH_BLOCK_ONLY(s, FALSE);
|
||||||
inc(s.strstart);
|
inc(s.strstart);
|
||||||
{$ifdef debug}
|
{$ifdef ZLIB_DEBUG}
|
||||||
if s.lookahead=0 then
|
if s.lookahead=0 then
|
||||||
runerror(255);
|
runerror(255);
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -2081,7 +2081,7 @@ begin
|
|||||||
|
|
||||||
s.match_available := TRUE;
|
s.match_available := TRUE;
|
||||||
inc(s.strstart);
|
inc(s.strstart);
|
||||||
{$ifdef debug}
|
{$ifdef ZLIB_DEBUG}
|
||||||
if s.lookahead=0 then
|
if s.lookahead=0 then
|
||||||
runerror(255);
|
runerror(255);
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -2089,12 +2089,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
until false;
|
until false;
|
||||||
|
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Assert (flush <> Z_NO_FLUSH, 'no flush?');
|
Assert (flush <> Z_NO_FLUSH, 'no flush?');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if (s.match_available) then
|
if (s.match_available) then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracevv(char(s.window^[s.strstart-1]));
|
Tracevv(char(s.window^[s.strstart-1]));
|
||||||
bflush :=
|
bflush :=
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
@ -219,7 +219,7 @@ begin
|
|||||||
else
|
else
|
||||||
z.state^.mode := METHOD;
|
z.state^.mode := METHOD;
|
||||||
inflate_blocks_reset(z.state^.blocks^, z, Z_NULL);
|
inflate_blocks_reset(z.state^.blocks^, z, Z_NULL);
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: reset');
|
Tracev('inflate: reset');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inflateReset := Z_OK;
|
inflateReset := Z_OK;
|
||||||
@ -237,7 +237,7 @@ begin
|
|||||||
inflate_blocks_free(z.state^.blocks, z);
|
inflate_blocks_free(z.state^.blocks, z);
|
||||||
ZFREE(z, z.state);
|
ZFREE(z, z.state);
|
||||||
z.state := Z_NULL;
|
z.state := Z_NULL;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: end');
|
Tracev('inflate: end');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inflateEnd := Z_OK;
|
inflateEnd := Z_OK;
|
||||||
@ -296,7 +296,7 @@ begin
|
|||||||
inflateInit2_ := Z_MEM_ERROR;
|
inflateInit2_ := Z_MEM_ERROR;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: allocated');
|
Tracev('inflate: allocated');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{ reset state }
|
{ reset state }
|
||||||
@ -447,7 +447,7 @@ begin
|
|||||||
z.state^.sub.marker := 5; { can't try inflateSync }
|
z.state^.sub.marker := 5; { can't try inflateSync }
|
||||||
continue; { break C-switch }
|
continue; { break C-switch }
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: zlib check ok');
|
Tracev('inflate: zlib check ok');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
z.state^.mode := DONE; { falltrough }
|
z.state^.mode := DONE; { falltrough }
|
||||||
@ -512,7 +512,7 @@ begin
|
|||||||
z.state^.sub.marker := 5; { can't try inflateSync }
|
z.state^.sub.marker := 5; { can't try inflateSync }
|
||||||
continue; { break C-switch }
|
continue; { break C-switch }
|
||||||
end;
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF ZLIB_DEBUG}
|
||||||
Tracev('inflate: zlib header ok');
|
Tracev('inflate: zlib header ok');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if ((b and PRESET_DICT) = 0) then
|
if ((b and PRESET_DICT) = 0) then
|
||||||
|
Loading…
Reference in New Issue
Block a user