Browse Source

* commit second patch (from Hendi) from mantis #38930, make debug define compiling again

git-svn-id: trunk@49492 -
marco 4 years ago
parent
commit
6d287a8db8

+ 1 - 1
packages/paszlib/src/infblock.pas

@@ -45,7 +45,7 @@ function inflate_blocks_sync_point(var s : inflate_blocks_state) : integer;
 implementation
 implementation
 
 
 uses
 uses
-  infcodes, inftrees, infutil;
+  infcodes, inftrees, infutil{$IFDEF ZLIB_DEBUG}, SysUtils{$ENDIF};
 
 
 { Tables for deflate from PKZIP's appnote.txt. }
 { Tables for deflate from PKZIP's appnote.txt. }
 Const
 Const

+ 2 - 2
packages/paszlib/src/infcodes.pas

@@ -31,7 +31,7 @@ procedure inflate_codes_free(var c : pInflate_codes_state;
 implementation
 implementation
 
 
 uses
 uses
-  infutil, inffast;
+  infutil, inffast{$IFDEF ZLIB_DEBUG}, SysUtils{$ENDIF};
 
 
 
 
 function inflate_codes_new (bl : cardinal;
 function inflate_codes_new (bl : cardinal;
@@ -185,7 +185,7 @@ begin
         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
-          Tracevv('inflate:         literal '+IntToStr(t^.base));
+          Tracevv('inflate:         literal $'+IntToHex(t^.base, 2));
         {$ENDIF}          
         {$ENDIF}          
         c^.mode := LIT;
         c^.mode := LIT;
         continue;  { break switch statement }
         continue;  { break switch statement }

+ 1 - 1
packages/paszlib/src/inffast.pas

@@ -29,7 +29,7 @@ function inflate_fast( bl : cardinal;
 implementation
 implementation
 
 
 uses
 uses
-  infutil;
+  infutil{$IFDEF ZLIB_DEBUG}, SysUtils{$ENDIF};
 
 
 
 
 { Called with number of bytes left to write in window at least 258
 { Called with number of bytes left to write in window at least 258

+ 0 - 10
packages/paszlib/src/zbase.pas

@@ -380,10 +380,6 @@ const
   PRESET_DICT = $20; { preset dictionary flag in zlib header }
   PRESET_DICT = $20; { preset dictionary flag in zlib header }
 
 
 
 
-  {$IFDEF ZLIB_DEBUG}
-  procedure Assert(cond : boolean; msg : string);
-  {$ENDIF}
-
   procedure Trace(x : string);
   procedure Trace(x : string);
   procedure Tracev(x : string);
   procedure Tracev(x : string);
   procedure Tracevv(x : string);
   procedure Tracevv(x : string);
@@ -461,12 +457,6 @@ begin
   Halt(1);
   Halt(1);
 end;
 end;
 
 
-procedure Assert(cond : boolean; msg : string);
-begin
-  if not cond then
-    z_error(msg);
-end;
-
 procedure Trace(x : string);
 procedure Trace(x : string);
 begin
 begin
   WriteLn(x);
   WriteLn(x);

+ 6 - 0
packages/paszlib/src/zconf.inc

@@ -36,3 +36,9 @@
  {$UNDEF MAXSEG_64K}
  {$UNDEF MAXSEG_64K}
  {$UNDEF Delphi32}
  {$UNDEF Delphi32}
 {$ENDIF}
 {$ENDIF}
+
+{- $DEFINE ZLIB_DEBUG}
+
+{$IFDEF ZLIB_DEBUG}
+  {$ASSERTIONS ON}
+{$ENDIF}

+ 21 - 0
packages/paszlib/src/zdeflate.pas

@@ -1502,6 +1502,27 @@ end;
 {$endif} { FASTEST }
 {$endif} { FASTEST }
 
 
 {$ifdef ZLIB_DEBUG}
 {$ifdef ZLIB_DEBUG}
+function zmemcmp(s1p, s2p : PByte; len : Cardinal) : Integer;
+var
+  j : Cardinal;
+  source,
+  dest : PByte;
+begin
+  source := s1p;
+  dest := s2p;
+  for j := 0 to pred(len) do
+  begin
+    if (source^ <> dest^) then
+    begin
+      zmemcmp := 2*Ord(source^ > dest^)-1;
+      exit;
+    end;
+    Inc(source);
+    Inc(dest);
+  end;
+  zmemcmp := 0;
+end;
+
 { ===========================================================================
 { ===========================================================================
   Check that the match at match_start is indeed a match. }
   Check that the match at match_start is indeed a match. }