Browse Source

renamed DEBUG to ZLIB_DEBUG

git-svn-id: trunk@3221 -
armin 19 years ago
parent
commit
f4d1d704d6

+ 13 - 13
packages/base/paszlib/infblock.pas

@@ -118,7 +118,7 @@ begin
     s.check := s.checkfn(cardinal(0), Pbyte(NIL), 0);
     z.adler := s.check;
   end;
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Tracev('inflate:   blocks reset');
   {$ENDIF}
 end;
@@ -158,7 +158,7 @@ begin
   Inc(s^.zend, w);
   s^.checkfn := c;
   s^.mode := ZTYPE;
-  {$IFDEF DEBUG}  
+  {$IFDEF ZLIB_DEBUG}  
   Tracev('inflate:   blocks allocated');
   {$ENDIF}
   inflate_blocks_reset(s^, z, nil);
@@ -240,7 +240,7 @@ begin
         case (t shr 1) of
           0:                         { stored }
             begin
-              {$IFDEF DEBUG}
+              {$IFDEF ZLIB_DEBUG}
               if s.last then
                 Tracev('inflate:     stored block (last)')
               else
@@ -260,7 +260,7 @@ begin
           1:                         { fixed }
             begin
               begin
-                {$IFDEF DEBUG}
+                {$IFDEF ZLIB_DEBUG}
                 if s.last then
                   Tracev('inflate:     fixed codes blocks (last)')
                 else
@@ -290,7 +290,7 @@ begin
             end;
           2:                         { dynamic }
             begin
-              {$IFDEF DEBUG}
+              {$IFDEF ZLIB_DEBUG}
               if s.last then
                 Tracev('inflate:     dynamic codes block (last)')
               else
@@ -367,7 +367,7 @@ begin
         s.sub.left := cardinal(b) and $ffff;
         k := 0;
         b := 0;                      { dump bits }
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracev('inflate:       stored length '+IntToStr(s.sub.left));
         {$ENDIF}
         if s.sub.left <> 0 then
@@ -453,7 +453,7 @@ begin
         dec(s.sub.left, t);
         if (s.sub.left = 0) then
         begin
-          {$IFDEF DEBUG}
+          {$IFDEF ZLIB_DEBUG}
           if (ptrint(q) >= ptrint(s.read)) then
             Tracev('inflate:       stored end '+
                 IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
@@ -533,7 +533,7 @@ begin
         dec(k, 14);
 
         s.sub.trees.index := 0;
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracev('inflate:       table sizes ok');
         {$ENDIF}
         s.mode := BTREE;
@@ -601,7 +601,7 @@ begin
           exit;
         end;
         s.sub.trees.index := 0;
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracev('inflate:       bits tree ok');
         {$ENDIF}
         s.mode := DTREE;
@@ -756,7 +756,7 @@ begin
             inflate_blocks := inflate_flush(s,z,r);
             exit;
           end;
-          {$IFDEF DEBUG}
+          {$IFDEF ZLIB_DEBUG}
           Tracev('inflate:       trees ok');
           {$ENDIF}          
           { c renamed to cs }
@@ -809,7 +809,7 @@ begin
           m := cardinal(ptrint(s.read)-ptrint(q)-1)
         else
           m := cardinal(ptrint(s.zend)-ptrint(q));
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         if (ptrint(q) >= ptrint(s.read)) then
           Tracev('inflate:       codes end '+
               IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
@@ -826,7 +826,7 @@ begin
         {$ifndef patch112}
         if (k > 7) then           { return unused byte, if any }
         begin
-          {$IFDEF DEBUG}
+          {$IFDEF ZLIB_DEBUG}
           Assert(k < 16, 'inflate_codes grabbed too many bytes');
           {$ENDIF}
           dec(k, 8);
@@ -920,7 +920,7 @@ begin
   ZFREE(z, s^.window);
   ZFREE(z, s^.hufts);
   ZFREE(z, s);
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Trace('inflate:   blocks freed');
   {$ENDIF}  
   inflate_blocks_free := Z_OK;

+ 7 - 7
packages/base/paszlib/infcodes.pas

@@ -50,7 +50,7 @@ begin
     c^.dbits := Byte(bd);
     c^.ltree := tl;
     c^.dtree := td;
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
     Tracev('inflate:       codes new');
     {$ENDIF}
   end;
@@ -167,7 +167,7 @@ begin
       if (e = 0) then            { literal }
       begin
         c^.sub.lit := t^.base;
-       {$IFDEF DEBUG}
+       {$IFDEF ZLIB_DEBUG}
         if (t^.base >= $20) and (t^.base < $7f) then
           Tracevv('inflate:         literal '+char(t^.base))
         else
@@ -191,7 +191,7 @@ begin
       end;
       if (e and 32 <> 0) then            { end of block }
       begin
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracevv('inflate:         end of block');
         {$ENDIF}        
         c^.mode := WASH;
@@ -243,7 +243,7 @@ begin
 
       c^.sub.code.need := c^.dbits;
       c^.sub.code.tree := c^.dtree;
-      {$IFDEF DEBUG}
+      {$IFDEF ZLIB_DEBUG}
       Tracevv('inflate:         length '+IntToStr(c^.len));
       {$ENDIF}
       c^.mode := DIST;
@@ -337,7 +337,7 @@ begin
       {DUMPBITS(j);}
       b := b shr j;
       dec(k, j);
-      {$IFDEF DEBUG}
+      {$IFDEF ZLIB_DEBUG}
       Tracevv('inflate:         distance '+ IntToStr(c^.sub.copy.dist));
       {$ENDIF}
       c^.mode := COPY;
@@ -483,7 +483,7 @@ begin
       {$ifdef patch112}
       if (k > 7) then           { return unused byte, if any }
       begin
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Assert(k < 16, 'inflate_codes grabbed too many bytes');
         {$ENDIF}
         dec(k, 8);
@@ -565,7 +565,7 @@ procedure inflate_codes_free(c : pInflate_codes_state;
                              var z : z_stream);
 begin
   ZFREE(z, c);
-  {$IFDEF DEBUG}  
+  {$IFDEF ZLIB_DEBUG}  
   Tracev('inflate:       codes free');
   {$ENDIF}
 end;

+ 5 - 5
packages/base/paszlib/inffast.pas

@@ -94,7 +94,7 @@ begin
       {DUMPBITS(t^.bits);}
       b := b shr t^.bits;
       dec(k, t^.bits);
-     {$IFDEF DEBUG}
+     {$IFDEF ZLIB_DEBUG}
       if (t^.base >= $20) and (t^.base < $7f) then
         Tracevv('inflate:         * literal '+char(t^.base))
       else
@@ -118,7 +118,7 @@ begin
         {DUMPBITS(e);}
         b := b shr e;
         dec(k, e);
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracevv('inflate:         * length ' + IntToStr(c));
         {$ENDIF}
         { decode distance base of block to copy }
@@ -156,7 +156,7 @@ begin
             b := b shr e;
             dec(k, e);
 
-            {$IFDEF DEBUG}
+            {$IFDEF ZLIB_DEBUG}
             Tracevv('inflate:         * distance '+IntToStr(d));
             {$ENDIF}
             { do the copy }
@@ -236,7 +236,7 @@ begin
           b := b shr t^.bits;
           dec(k, t^.bits);
 
-         {$IFDEF DEBUG}
+         {$IFDEF ZLIB_DEBUG}
           if (t^.base >= $20) and (t^.base < $7f) then
             Tracevv('inflate:         * literal '+char(t^.base))
           else
@@ -251,7 +251,7 @@ begin
       else
         if (e and 32 <> 0) then
         begin
-          {$IFDEF DEBUG}
+          {$IFDEF ZLIB_DEBUG}
           Tracevv('inflate:         * end of block');
           {$ENDIF}
           {UNGRAB}

+ 1 - 1
packages/base/paszlib/inftrees.pas

@@ -30,7 +30,7 @@ const
   MANY = 1440;
 
 
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
 var
   inflate_hufts : cardinal;
 {$endif}

+ 44 - 44
packages/base/paszlib/trees.pas

@@ -42,10 +42,10 @@ interface
 {$I zconf.inc}
 
 uses
-  zbase
-  {$ifdef DEBUG} 
-  ,sysutils   {for inttostr}
+  {$ifdef ZLIB_DEBUG}
+  sysutils,
   {$endif}
+  zbase
   ;
 
 { ===========================================================================
@@ -287,7 +287,7 @@ type
     matches : cardinal;       { number of string matches in current 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 }
 {$endif}
 
@@ -783,7 +783,7 @@ procedure send_bits(var s : deflate_state;
                     value : integer;   { value to send }
                     length : integer); { number of bits }
 begin
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracevv(' l '+IntToStr(length)+ ' v '+IntToStr(value));
   Assert((length > 0) and (length <= 15), 'invalid length');
   inc(s.bits_sent, longint(length));
@@ -815,7 +815,7 @@ begin
   {$IFDEF NoRangeCheck} {$Q+} {$UNDEF NoRangeCheck} {$ENDIF}
 end;
 
-{$else} { !DEBUG }
+{$else} { !ZLIB_DEBUG }
 
 
 macro send_code(s, c, tree)
@@ -842,7 +842,7 @@ begin integer len := length;\
     s^.bi_valid += len;\
   end\
 end;
-{$endif} { DEBUG }
+{$endif} { ZLIB_DEBUG }
 
 { ===========================================================================
   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
     must be all ones. }
 
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Assert (code + bl_count[MAX_BITS]-1 = (1 shl MAX_BITS)-1,
           'inconsistent bit counts');
   Tracev(#13'gen_codes: max_code '+IntToStr(max_code));
@@ -914,7 +914,7 @@ begin
     { Now reverse the bits }
     tree^[n].fc.Code := bi_reverse(next_code[len], len);
     inc(next_code[len]);
-    {$ifdef DEBUG}
+    {$ifdef ZLIB_DEBUG}
     if (n>31) and (n<128) then
       Tracecv(tree <> tree_ptr(@static_ltree),
        (^M'n #'+IntToStr(n)+' '+char(n)+' l '+IntToStr(len)+' c '+
@@ -1159,7 +1159,7 @@ begin
   s.bi_buf := 0;
   s.bi_valid := 0;
   s.last_eob_len := 8; { enough lookahead for inflate }
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
   s.bits_sent := 0;
 {$endif}
 
@@ -1301,7 +1301,7 @@ begin
   end;
   if (overflow = 0) then
     exit;
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracev(^M'bit length overflow');
   {$endif}
   { This happens for example on obj2 and pic of the Calgary corpus }
@@ -1336,7 +1336,7 @@ begin
         continue;
       if (tree^[m].dl.Len <> cardinal(bits)) then
       begin
-        {$ifdef DEBUG}
+        {$ifdef ZLIB_DEBUG}
         Trace('code '+IntToStr(m)+' bits '+IntToStr(tree^[m].dl.Len)
               +'.'+IntToStr(bits));
         {$ENDIF}
@@ -1599,7 +1599,7 @@ begin
       if (count < min_count) then
       begin
         repeat
-          {$ifdef DEBUG}
+          {$ifdef ZLIB_DEBUG}
           Tracevvv(#13'cd '+IntToStr(curlen));
           {$ENDIF}
           send_bits(s, s.bl_tree[curlen].fc.Code, s.bl_tree[curlen].dl.Len);
@@ -1611,16 +1611,16 @@ begin
         begin
           if (curlen <> prevlen) then
           begin
-            {$ifdef DEBUG}
+            {$ifdef ZLIB_DEBUG}
             Tracevvv(#13'cd '+IntToStr(curlen));
             {$ENDIF}
             send_bits(s, s.bl_tree[curlen].fc.Code, s.bl_tree[curlen].dl.Len);
             dec(count);
           end;
-          {$IFDEF DEBUG}
+          {$IFDEF ZLIB_DEBUG}
           Assert((count >= 3) and (count <= 6), ' 3_6?');
           {$ENDIF}
-          {$ifdef DEBUG}
+          {$ifdef ZLIB_DEBUG}
           Tracevvv(#13'cd '+IntToStr(REP_3_6));
           {$ENDIF}
           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
           if (count <= 10) then
           begin
-            {$ifdef DEBUG}
+            {$ifdef ZLIB_DEBUG}
             Tracevvv(#13'cd '+IntToStr(REPZ_3_10));
             {$ENDIF}
             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
           else
           begin
-            {$ifdef DEBUG}
+            {$ifdef ZLIB_DEBUG}
             Tracevvv(#13'cd '+IntToStr(REPZ_11_138));
             {$ENDIF}
             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;
   { Update opt_len to include the bit length tree and counts }
   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}');
   {$ENDIF}
 
@@ -1713,7 +1713,7 @@ procedure send_all_trees(var s : deflate_state;
 var
   rank : integer;                    { index in bl_order }
 begin
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Assert ((lcodes >= 257) and (dcodes >= 1) and (blcodes >= 4),
           'not enough 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 }
   for rank := 0 to blcodes-1 do
   begin
-    {$ifdef DEBUG}
+    {$ifdef ZLIB_DEBUG}
     Tracev(^M'bl code '+IntToStr(bl_order[rank]));
     {$ENDIF}
     send_bits(s, s.bl_tree[bl_order[rank]].dl.Len, 3);
   end;
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracev(^M'bl tree: sent '+IntToStr(s.bits_sent));
   {$ENDIF}
 
   send_tree(s, s.dyn_ltree, lcodes-1); { literal tree }
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracev(^M'lit tree: sent '+IntToStr(s.bits_sent));
   {$ENDIF}
 
   send_tree(s, s.dyn_dtree, dcodes-1); { distance tree }
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracev(^M'dist tree: sent '+IntToStr(s.bits_sent));
   {$ENDIF}
 end;
@@ -1768,7 +1768,7 @@ begin
     end;
   s.bi_buf := 0;
   s.bi_valid := 0;
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
   s.bits_sent := (s.bits_sent+7) and (not 7);
 {$endif}
 end;
@@ -1799,11 +1799,11 @@ begin
     s.pending_buf^[s.pending] := byte(word(not len) shr 8);;
     inc(s.pending);
 
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
     inc(s.bits_sent, 2*16);
 {$endif}
   end;
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
   inc(s.bits_sent, longint(len shl 3));
 {$endif}
   while (len <> 0) do
@@ -1877,7 +1877,7 @@ end;
 procedure _tr_align(var s : deflate_state);
 begin
   send_bits(s, STATIC_TREES shl 1, 3);
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracevvv(#13'cd '+IntToStr(END_BLOCK));
   {$ENDIF}
   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
   begin
     send_bits(s, STATIC_TREES shl 1, 3);
-    {$ifdef DEBUG}
+    {$ifdef ZLIB_DEBUG}
     Tracevvv(#13'cd '+IntToStr(END_BLOCK));
     {$ENDIF}
     send_bits(s, static_ltree[END_BLOCK].fc.Code, static_ltree[END_BLOCK].dl.Len);
@@ -1961,7 +1961,7 @@ begin
     if (dist = 0) then
     begin
       { send a literal byte }
-      {$ifdef DEBUG}
+      {$ifdef ZLIB_DEBUG}
       Tracevvv(#13'cd '+IntToStr(lc));
       Tracecv((lc > 31) and (lc < 128), ' '+char(lc)+' ');
       {$ENDIF}
@@ -1972,7 +1972,7 @@ begin
       { Here, lc is the match length - MIN_MATCH }
       code := _length_code[lc];
       { send the length code }
-      {$ifdef DEBUG}
+      {$ifdef ZLIB_DEBUG}
       Tracevvv(#13'cd '+IntToStr(code+LITERALS+1));
       {$ENDIF}
       send_bits(s, ltree[code+LITERALS+1].fc.Code, ltree[code+LITERALS+1].dl.Len);
@@ -1989,12 +1989,12 @@ begin
       else
         code := _dist_code[256+(dist shr 7)];
 
-      {$IFDEF DEBUG}
+      {$IFDEF ZLIB_DEBUG}
       Assert (code < D_CODES, 'bad d_code');
       {$ENDIF}
 
       { send the distance code }
-      {$ifdef DEBUG}
+      {$ifdef ZLIB_DEBUG}
       Tracevvv(#13'cd '+IntToStr(code));
       {$ENDIF}
       send_bits(s, dtree[code].fc.Code, dtree[code].dl.Len);
@@ -2007,12 +2007,12 @@ begin
     end; { literal or match pair ? }
 
     { 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');
     {$ENDIF}
   until (lx >= s.last_lit);
 
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracevvv(#13'cd '+IntToStr(END_BLOCK));
   {$ENDIF}
   send_bits(s, ltree[END_BLOCK].fc.Code, ltree[END_BLOCK].dl.Len);
@@ -2044,12 +2044,12 @@ begin
 
     { Construct the literal and distance trees }
     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}');
     {$ENDIF}
 
     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}');
     {$ENDIF}
     { 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;
     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 '+
 	    '{opt_lenb, s.opt_len, static_lenb, s.static_len, stored_len,'+
 	    's.last_lit}');
@@ -2075,7 +2075,7 @@ begin
   end
   else
   begin
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
     Assert(buf <> nil, 'lost buf');
     {$ENDIF}
     static_lenb := stored_len + 5;
@@ -2145,7 +2145,7 @@ begin
       compress_block(s, s.dyn_ltree, s.dyn_dtree);
       inc(s.compressed_len, 3 + s.opt_len);
     end;
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Assert (s.compressed_len = s.bits_sent, 'bad compressed size');
   {$ENDIF}
   init_block(s);
@@ -2155,7 +2155,7 @@ begin
     bi_windup(s);
     inc(s.compressed_len, 7);  { align on byte boundary }
   end;
-  {$ifdef DEBUG}
+  {$ifdef ZLIB_DEBUG}
   Tracev(#13'comprlen %lu(%lu) {s.compressed_len shr 3,'+
          's.compressed_len-7*ord(eof)}');
   {$ENDIF}
@@ -2172,7 +2172,7 @@ function _tr_tally (var s : deflate_state;
    dist : cardinal;          { distance of matched string }
    lc : cardinal) : boolean; { match length-MIN_MATCH or unmatched char (if dist=0) }
 var
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   MAX_DIST : word;
   {$ENDIF}
   code : word;
@@ -2202,7 +2202,7 @@ begin
       code := _dist_code[dist]
     else
       code := _dist_code[256+(dist shr 7)];
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
 {macro  MAX_DIST(s) <=> ((s)^.w_size-MIN_LOOKAHEAD)
    In order to simplify the code, particularly on 16 bit machines, match
    distances are limited to MAX_DIST instead of WSIZE. }
@@ -2229,7 +2229,7 @@ begin
             (cardinal(5)+extra_dbits[dcode])) );
     end;
     out_length := out_length shr 3;
-    {$ifdef DEBUG}
+    {$ifdef ZLIB_DEBUG}
     Tracev(^M'last_lit %u, in %ld, out ~%ld(%ld%%) ');
           { s.last_lit, in_length, out_length,
            cardinal(100) - out_length*100 div in_length)); }

+ 2 - 2
packages/base/paszlib/zbase.pas

@@ -399,7 +399,7 @@ const
   PRESET_DICT = $20; { preset dictionary flag in zlib header }
 
 
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   procedure Assert(cond : boolean; msg : string);
   {$ENDIF}
 
@@ -443,7 +443,7 @@ const
 const
   z_verbose : integer = 1;
 
-{$IFDEF DEBUG}
+{$IFDEF ZLIB_DEBUG}
 procedure z_error (m : string);
 {$ENDIF}
 

+ 24 - 24
packages/base/paszlib/zdeflate.pas

@@ -384,7 +384,7 @@ function longest_match(var s : deflate_state; cur_match : IPos) : cardinal;
   forward;
 {$endif}
 
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
 {local}
 procedure check_match(var s : deflate_state;
                       start, match : IPos;
@@ -994,7 +994,7 @@ begin
 
     end;
   end;
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Assert(strm.avail_out > 0, 'bug2');
   {$ENDIF}
   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.
       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');
     {$ENDIF}
     { 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
       nice_match := s.lookahead;
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
     Assert(longint(s.strstart) <= s.window_size-MIN_LOOKAHEAD, 'need lookahead');
     {$ENDIF}
     repeat
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Assert(cur_match < s.strstart, 'no future');
         {$ENDIF}
         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
           necessary to put more guard bytes at the end of the window, or
           to check more often for insufficient lookahead. }
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Assert(pzByteArray(scan)^[2] = pzByteArray(match)^[2], 'scan[2]?');
         {$ENDIF}
         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 }
 
         { Here, scan <= window+strstart+257 }
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         {$ifopt R+} {$define RangeCheck} {$endif} {$R-}
         Assert(ptrint(scan) <=
                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(match);
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Assert( scan^ = match^, 'match[2]?');
         {$ENDIF}
         { 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;
         until (ptrint(scan) >= ptrint(strend));
 
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Assert(ptrint(scan) <=
                ptrint(@(s.window^[cardinal(s.window_size-1)])),
                'wild scan');
@@ -1446,7 +1446,7 @@ begin
 
     { 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. }
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
     Assert((s.hash_bits >= 8) and (MAX_MATCH = 258), 'Code too clever');
 
     Assert(longint(s.strstart) <= s.window_size-MIN_LOOKAHEAD, 'need lookahead');
@@ -1504,7 +1504,7 @@ begin
 end;
 {$endif} { FASTEST }
 
-{$ifdef DEBUG}
+{$ifdef ZLIB_DEBUG}
 { ===========================================================================
   Check that the match at match_start is indeed a match. }
 
@@ -1631,7 +1631,7 @@ begin
       * Otherwise, window_size == 2*WSIZE so more >= 2.
       * If there was sliding, more >= WSIZE. So in all cases, more >= 2. }
 
-     {$IFDEF DEBUG}
+     {$IFDEF ZLIB_DEBUG}
      Assert(more >= 2, 'more < 2');
      {$ENDIF}
 
@@ -1671,7 +1671,7 @@ begin
 
   s.block_start := s.strstart;
   flush_pending(s.strm^);
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Tracev('[FLUSH]');
   {$ENDIF}
 end;
@@ -1721,7 +1721,7 @@ begin
     { Fill the window as much as possible: }
     if (s.lookahead <= 1) then
     begin
-      {$IFDEF DEBUG}
+      {$IFDEF ZLIB_DEBUG}
       Assert( (s.strstart < s.w_size + {MAX_DIST}s.w_size-MIN_LOOKAHEAD) or
               (s.block_start >= longint(s.w_size)), 'slide too late');
       {$ENDIF}
@@ -1735,7 +1735,7 @@ begin
       if (s.lookahead = 0) then
         break; { flush the current block }
     end;
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
     Assert(s.block_start >= 0, 'block gone');
     {$ENDIF}
     inc(s.strstart, s.lookahead);
@@ -1847,7 +1847,7 @@ begin
     end;
     if (s.match_length >= MIN_MATCH) then
     begin
-      {$IFDEF DEBUG}
+      {$IFDEF ZLIB_DEBUG}
       check_match(s, s.strstart, s.match_start, s.match_length);
       {$ENDIF}
 
@@ -1898,7 +1898,7 @@ end;
     else
     begin
       { No match, output a literal byte }
-      {$IFDEF DEBUG}
+      {$IFDEF ZLIB_DEBUG}
       Tracevv(char(s.window^[s.strstart]));
       {$ENDIF}
       {_tr_tally_lit (s, 0, s.window^[s.strstart], bflush);}
@@ -2009,7 +2009,7 @@ begin
       begin
         max_insert := s.strstart + s.lookahead - MIN_MATCH;
         { 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);
         {$endif}
 
@@ -2023,7 +2023,7 @@ begin
         enough lookahead, the last two strings are not inserted in
         the hash table. }
 
-{$ifdef debug}
+{$ifdef ZLIB_DEBUG}
         if s.lookahead<s.prev_length-1 then
            runerror(255);
 {$endif}
@@ -2055,7 +2055,7 @@ begin
           { If there was no match at the previous position, output a
             single literal. If there was a match but the current match
             is longer, truncate the previous match to a single literal. }
-          {$IFDEF DEBUG}
+          {$IFDEF ZLIB_DEBUG}
           Tracevv(char(s.window^[s.strstart-1]));
           {$ENDIF}
           bflush := _tr_tally (s, 0, s.window^[s.strstart-1]);
@@ -2063,7 +2063,7 @@ begin
           if bflush then
             FLUSH_BLOCK_ONLY(s, FALSE);
           inc(s.strstart);
-{$ifdef debug}
+{$ifdef ZLIB_DEBUG}
           if s.lookahead=0 then
              runerror(255);
 {$endif}
@@ -2081,7 +2081,7 @@ begin
 
           s.match_available := TRUE;
           inc(s.strstart);
-{$ifdef debug}
+{$ifdef ZLIB_DEBUG}
           if s.lookahead=0 then
              runerror(255);
 {$endif}
@@ -2089,12 +2089,12 @@ begin
         end;
   until false;
 
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Assert (flush <> Z_NO_FLUSH, 'no flush?');
   {$ENDIF}
   if (s.match_available) then
   begin
-    {$IFDEF DEBUG}
+    {$IFDEF ZLIB_DEBUG}
     Tracevv(char(s.window^[s.strstart-1]));
     bflush :=
     {$ENDIF}

+ 5 - 5
packages/base/paszlib/zinflate.pas

@@ -219,7 +219,7 @@ begin
   else
     z.state^.mode := METHOD;
   inflate_blocks_reset(z.state^.blocks^, z, Z_NULL);
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Tracev('inflate: reset');
   {$ENDIF}
   inflateReset :=  Z_OK;
@@ -237,7 +237,7 @@ begin
     inflate_blocks_free(z.state^.blocks, z);
   ZFREE(z, z.state);
   z.state := Z_NULL;
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Tracev('inflate: end');
   {$ENDIF}
   inflateEnd :=  Z_OK;
@@ -296,7 +296,7 @@ begin
     inflateInit2_ := Z_MEM_ERROR;
     exit;
   end;
-  {$IFDEF DEBUG}
+  {$IFDEF ZLIB_DEBUG}
   Tracev('inflate: allocated');
   {$ENDIF}
   { reset state }
@@ -447,7 +447,7 @@ begin
           z.state^.sub.marker := 5;       { can't try inflateSync }
           continue;           { break C-switch }
         end;
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracev('inflate: zlib check ok');
         {$ENDIF}
         z.state^.mode := DONE; { falltrough }
@@ -512,7 +512,7 @@ begin
           z.state^.sub.marker := 5;       { can't try inflateSync }
           continue;      { break C-switch }
         end;
-        {$IFDEF DEBUG}
+        {$IFDEF ZLIB_DEBUG}
         Tracev('inflate: zlib header ok');
         {$ENDIF}
         if ((b and PRESET_DICT) = 0) then