Browse Source

* allow to compile with DEBUG defined, replaced by STRUTILS_DEBUG

pierre 24 years ago
parent
commit
696c2af620
3 changed files with 31 additions and 31 deletions
  1. 15 15
      packages/paszlib/infblock.pas
  2. 9 9
      packages/paszlib/infcodes.pas
  3. 7 7
      packages/paszlib/inffast.pas

+ 15 - 15
packages/paszlib/infblock.pas

@@ -17,7 +17,7 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$IFDEF DEBUG}
+  {$IFDEF STRUTILS_DEBUG}
   strutils,
   strutils,
   {$ENDIF}
   {$ENDIF}
   zutil, zbase;
   zutil, zbase;
@@ -122,7 +122,7 @@ begin
     s.check := s.checkfn(uLong(0), pBytef(NIL), 0);
     s.check := s.checkfn(uLong(0), pBytef(NIL), 0);
     z.adler := s.check;
     z.adler := s.check;
   end;
   end;
-  {$IFDEF DEBUG}
+  {$IFDEF STRUTILS_DEBUG}
   Tracev('inflate:   blocks reset');
   Tracev('inflate:   blocks reset');
   {$ENDIF}
   {$ENDIF}
 end;
 end;
@@ -162,7 +162,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 STRUTILS_DEBUG}
   Tracev('inflate:   blocks allocated');
   Tracev('inflate:   blocks allocated');
   {$ENDIF}
   {$ENDIF}
   inflate_blocks_reset(s^, z, Z_NULL);
   inflate_blocks_reset(s^, z, Z_NULL);
@@ -244,7 +244,7 @@ begin
         case (t shr 1) of
         case (t shr 1) of
           0:                         { stored }
           0:                         { stored }
             begin
             begin
-              {$IFDEF DEBUG}
+              {$IFDEF STRUTILS_DEBUG}
               if s.last then
               if s.last then
                 Tracev('inflate:     stored block (last)')
                 Tracev('inflate:     stored block (last)')
               else
               else
@@ -264,7 +264,7 @@ begin
           1:                         { fixed }
           1:                         { fixed }
             begin
             begin
               begin
               begin
-                {$IFDEF DEBUG}
+                {$IFDEF STRUTILS_DEBUG}
                 if s.last then
                 if s.last then
                   Tracev('inflate:     fixed codes blocks (last)')
                   Tracev('inflate:     fixed codes blocks (last)')
                 else
                 else
@@ -294,7 +294,7 @@ begin
             end;
             end;
           2:                         { dynamic }
           2:                         { dynamic }
             begin
             begin
-              {$IFDEF DEBUG}
+              {$IFDEF STRUTILS_DEBUG}
               if s.last then
               if s.last then
                 Tracev('inflate:     dynamic codes block (last)')
                 Tracev('inflate:     dynamic codes block (last)')
               else
               else
@@ -371,7 +371,7 @@ begin
         s.sub.left := uInt(b) and $ffff;
         s.sub.left := uInt(b) and $ffff;
         k := 0;
         k := 0;
         b := 0;                      { dump bits }
         b := 0;                      { dump bits }
-        {$IFDEF DEBUG}
+        {$IFDEF STRUTILS_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
@@ -457,7 +457,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 STRUTILS_DEBUG}
           if (ptr2int(q) >= ptr2int(s.read)) then
           if (ptr2int(q) >= ptr2int(s.read)) then
             Tracev('inflate:       stored end '+
             Tracev('inflate:       stored end '+
                 IntToStr(z.total_out + ptr2int(q) - ptr2int(s.read)) + ' total out')
                 IntToStr(z.total_out + ptr2int(q) - ptr2int(s.read)) + ' total out')
@@ -537,7 +537,7 @@ begin
         Dec(k, 14);
         Dec(k, 14);
 
 
         s.sub.trees.index := 0;
         s.sub.trees.index := 0;
-        {$IFDEF DEBUG}
+        {$IFDEF STRUTILS_DEBUG}
         Tracev('inflate:       table sizes ok');
         Tracev('inflate:       table sizes ok');
         {$ENDIF}
         {$ENDIF}
         s.mode := BTREE;
         s.mode := BTREE;
@@ -605,7 +605,7 @@ begin
           exit;
           exit;
         end;
         end;
         s.sub.trees.index := 0;
         s.sub.trees.index := 0;
-        {$IFDEF DEBUG}
+        {$IFDEF STRUTILS_DEBUG}
         Tracev('inflate:       bits tree ok');
         Tracev('inflate:       bits tree ok');
         {$ENDIF}
         {$ENDIF}
         s.mode := DTREE;
         s.mode := DTREE;
@@ -760,7 +760,7 @@ begin
             inflate_blocks := inflate_flush(s,z,r);
             inflate_blocks := inflate_flush(s,z,r);
             exit;
             exit;
           end;
           end;
-          {$IFDEF DEBUG}
+          {$IFDEF STRUTILS_DEBUG}
           Tracev('inflate:       trees ok');
           Tracev('inflate:       trees ok');
           {$ENDIF}
           {$ENDIF}
           { c renamed to cs }
           { c renamed to cs }
@@ -813,7 +813,7 @@ begin
           m := uInt(ptr2int(s.read)-ptr2int(q)-1)
           m := uInt(ptr2int(s.read)-ptr2int(q)-1)
         else
         else
           m := uInt(ptr2int(s.zend)-ptr2int(q));
           m := uInt(ptr2int(s.zend)-ptr2int(q));
-        {$IFDEF DEBUG}
+        {$IFDEF STRUTILS_DEBUG}
         if (ptr2int(q) >= ptr2int(s.read)) then
         if (ptr2int(q) >= ptr2int(s.read)) then
           Tracev('inflate:       codes end '+
           Tracev('inflate:       codes end '+
               IntToStr(z.total_out + ptr2int(q) - ptr2int(s.read)) + ' total out')
               IntToStr(z.total_out + ptr2int(q) - ptr2int(s.read)) + ' total out')
@@ -830,7 +830,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 STRUTILS_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);
@@ -924,7 +924,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 STRUTILS_DEBUG}
   Trace('inflate:   blocks freed');
   Trace('inflate:   blocks freed');
   {$ENDIF}
   {$ENDIF}
   inflate_blocks_free := Z_OK;
   inflate_blocks_free := Z_OK;
@@ -951,4 +951,4 @@ begin
   inflate_blocks_sync_point := int(s.mode = LENS);
   inflate_blocks_sync_point := int(s.mode = LENS);
 end;
 end;
 
 
-end.
+end.

+ 9 - 9
packages/paszlib/infcodes.pas

@@ -13,7 +13,7 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$IFDEF DEBUG}
+  {$IFDEF STRUTILS_DEBUG}
   strutils,
   strutils,
   {$ENDIF}
   {$ENDIF}
   zutil, zbase;
   zutil, zbase;
@@ -53,7 +53,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 STRUTILS_DEBUG}
     Tracev('inflate:       codes new');
     Tracev('inflate:       codes new');
     {$ENDIF}
     {$ENDIF}
   end;
   end;
@@ -170,7 +170,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 STRUTILS_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
@@ -194,7 +194,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 STRUTILS_DEBUG}
         Tracevv('inflate:         end of block');
         Tracevv('inflate:         end of block');
         {$ENDIF}
         {$ENDIF}
         c^.mode := WASH;
         c^.mode := WASH;
@@ -246,7 +246,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 STRUTILS_DEBUG}
       Tracevv('inflate:         length '+IntToStr(c^.len));
       Tracevv('inflate:         length '+IntToStr(c^.len));
       {$ENDIF}
       {$ENDIF}
       c^.mode := DIST;
       c^.mode := DIST;
@@ -340,7 +340,7 @@ begin
       {DUMPBITS(j);}
       {DUMPBITS(j);}
       b := b shr j;
       b := b shr j;
       Dec(k, j);
       Dec(k, j);
-      {$IFDEF DEBUG}
+      {$IFDEF STRUTILS_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;
@@ -486,7 +486,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 STRUTILS_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);
@@ -568,9 +568,9 @@ 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 STRUTILS_DEBUG}
   Tracev('inflate:       codes free');
   Tracev('inflate:       codes free');
   {$ENDIF}
   {$ENDIF}
 end;
 end;
 
 
-end.
+end.

+ 7 - 7
packages/paszlib/inffast.pas

@@ -16,7 +16,7 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$ifdef DEBUG}
+  {$ifdef STRUTILS_DEBUG}
   strutils,
   strutils,
   {$ENDIF}
   {$ENDIF}
   zutil, zbase;
   zutil, zbase;
@@ -97,7 +97,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 STRUTILS_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
@@ -121,7 +121,7 @@ begin
         {DUMPBITS(e);}
         {DUMPBITS(e);}
         b := b shr e;
         b := b shr e;
         Dec(k, e);
         Dec(k, e);
-        {$IFDEF DEBUG}
+        {$IFDEF STRUTILS_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 }
@@ -159,7 +159,7 @@ begin
             b := b shr e;
             b := b shr e;
             Dec(k, e);
             Dec(k, e);
 
 
-            {$IFDEF DEBUG}
+            {$IFDEF STRUTILS_DEBUG}
             Tracevv('inflate:         * distance '+IntToStr(d));
             Tracevv('inflate:         * distance '+IntToStr(d));
             {$ENDIF}
             {$ENDIF}
             { do the copy }
             { do the copy }
@@ -239,7 +239,7 @@ begin
           b := b shr t^.bits;
           b := b shr t^.bits;
           Dec(k, t^.bits);
           Dec(k, t^.bits);
 
 
-         {$IFDEF DEBUG}
+         {$IFDEF STRUTILS_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
@@ -254,7 +254,7 @@ begin
       else
       else
         if (e and 32 <> 0) then
         if (e and 32 <> 0) then
         begin
         begin
-          {$IFDEF DEBUG}
+          {$IFDEF STRUTILS_DEBUG}
           Tracevv('inflate:         * end of block');
           Tracevv('inflate:         * end of block');
           {$ENDIF}
           {$ENDIF}
           {UNGRAB}
           {UNGRAB}
@@ -315,4 +315,4 @@ begin
   inflate_fast := Z_OK;
   inflate_fast := Z_OK;
 end;
 end;
 
 
-end.
+end.