Browse Source

* Remove now obsolete unit zutil

git-svn-id: trunk@1862 -
daniel 19 years ago
parent
commit
9f85c92ef1

+ 0 - 1
.gitattributes

@@ -1699,7 +1699,6 @@ packages/base/paszlib/zconf.inc svneol=native#text/plain
 packages/base/paszlib/zdeflate.pas svneol=native#text/plain
 packages/base/paszlib/zinflate.pas svneol=native#text/plain
 packages/base/paszlib/zuncompr.pas svneol=native#text/plain
-packages/base/paszlib/zutil.pas svneol=native#text/plain
 packages/base/postgres/Makefile svneol=native#text/plain
 packages/base/postgres/Makefile.fpc svneol=native#text/plain
 packages/base/postgres/README -text

+ 0 - 3
packages/base/paszlib/adler.pas

@@ -13,9 +13,6 @@ interface
 
 {$I zconf.inc}
 
-uses
-  zutil;
-
 function adler32(adler : cardinal; buf : Pbyte; len : cardinal) : cardinal;
 
 {    Update a running Adler-32 checksum with the bytes buf[0..len-1] and

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

@@ -21,7 +21,7 @@ uses
   {$else}
   dos,
   {$endif}
-  zutil, zbase, crc, zdeflate, zinflate;
+  zbase, crc, zdeflate, zinflate;
 
 type gzFile = pointer;
 type z_off_t = longint;

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

@@ -16,7 +16,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+  zbase;
 
 function inflate_blocks_new(var z : z_stream;
                             c : check_func;  { check function }
@@ -514,7 +514,7 @@ begin
         end;
   {$endif}
         t := 258 + (t and $1f) + ((t shr 5) and $1f);
-        s.sub.trees.blens := puIntArray( ZALLOC(z, t, sizeof(cardinal)) );
+        s.sub.trees.blens := Pcardinalarray( ZALLOC(z, t, sizeof(cardinal)) );
         if (s.sub.trees.blens = nil) then
         begin
           r := Z_MEM_ERROR;

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

@@ -13,7 +13,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+  zbase;
 
 function inflate_codes_new (bl : cardinal;
                             bd : cardinal;

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

@@ -16,7 +16,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+  zbase;
 
 function inflate_fast( bl : cardinal;
                        bd : cardinal;

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

@@ -18,7 +18,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+  zbase;
 
 
 { Maximum size of dynamic tree.  The maximum found in a long but non-
@@ -447,10 +447,10 @@ function inflate_trees_bits(
 var
   r : integer;
   hn : cardinal;          { hufts used in space }
-  v : PuIntArray;     { work area for huft_build }
+  v : Pcardinalarray;     { work area for huft_build }
 begin
   hn := 0;
-  v := PuIntArray( ZALLOC(z, 19, sizeof(cardinal)) );
+  v := Pcardinalarray( ZALLOC(z, 19, sizeof(cardinal)) );
   if (v = nil) then
   begin
     inflate_trees_bits := Z_MEM_ERROR;
@@ -487,11 +487,11 @@ var z : z_stream                  { for messages }
 var
   r : integer;
   hn : cardinal;          { hufts used in space }
-  v : PuIntArray;     { work area for huft_build }
+  v : Pcardinalarray;     { work area for huft_build }
 begin
   hn := 0;
   { allocate work area }
-  v := PuIntArray( ZALLOC(z, 288, sizeof(cardinal)) );
+  v := Pcardinalarray( ZALLOC(z, 288, sizeof(cardinal)) );
   if (v = nil) then
   begin
     inflate_trees_dynamic := Z_MEM_ERROR;
@@ -517,7 +517,7 @@ begin
   end;
 
   { build distance tree }
-  r := huft_build(puIntArray(@c[nl])^, nd, 0,
+  r := huft_build(Pcardinalarray(@c[nl])^, nd, 0,
                   cpdist, cpdext, @td, bd, hp, hn, v^);
   if (r <> Z_OK) or ((bd = 0) and (nl > 257)) then
   begin
@@ -719,8 +719,8 @@ type
   fixed_table = array[0..288-1] of cardinal;
 var
   k : integer;                   { temporary variable }
-  c : pFixed_table;          { length list for huft_build }
-  v : PuIntArray;            { work area for huft_build }
+  c : pFixed_table;              { length list for huft_build }
+  v : Pcardinalarray;            { work area for huft_build }
 var
   f : cardinal;                  { number of hufts used in fixed_mem }
 begin
@@ -736,7 +736,7 @@ begin
       inflate_trees_fixed := Z_MEM_ERROR;
       exit;
     end;
-    v := PuIntArray( ZALLOC(z, 288, sizeof(cardinal)) );
+    v := Pcardinalarray( ZALLOC(z, 288, sizeof(cardinal)) );
     if (v = nil) then
     begin
       ZFREE(z, c);

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

@@ -17,7 +17,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+  zbase;
 
 { copy as much as possible from the sliding window to the output area }
 function inflate_flush(var s : inflate_blocks_state;

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

@@ -18,7 +18,7 @@ program minigzip;
 }
 
 uses
-  gzio, zutil;
+  gzio;
 
 const
   BUFLEN       = 16384 ;

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

@@ -1,4 +1,4 @@
-Unit trees;
+unit trees;
 
 {$T-}
 {$define ORG_DEBUG}
@@ -42,7 +42,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+  zbase;
 
 { ===========================================================================
   Internal compression state. }
@@ -102,7 +102,7 @@ type
   dtree_type = array[0..2*D_CODES+1-1] of ct_data;  { distance tree }
   htree_type = array[0..2*BL_CODES+1-1] of ct_data;  { Huffman tree for bit lengths }
   { generic tree type }
-  tree_type = array[0..(MaxMemBlock div SizeOf(ct_data))-1] of ct_data;
+  tree_type = array[0..(maxint div SizeOf(ct_data))-1] of ct_data;
 
   tree_ptr = ^tree_type;
   ltree_ptr = ^ltree_type;
@@ -115,7 +115,7 @@ type
   static_tree_desc =
          record
     {const} static_tree : tree_ptr;     { static tree or NIL }
-    {const} extra_bits : pzIntfArray;   { extra bits for each code or NIL }
+    {const} extra_bits : Pintegerarray;   { extra bits for each code or NIL }
             extra_base : integer;           { base index for extra_bits }
             elems : integer;                { max number of elements in the tree }
             max_length : integer;           { max bit length for the codes }
@@ -135,7 +135,7 @@ type
 
   pPosf = ^Posf;
 
-  zPosfArray = array[0..(MaxMemBlock div SizeOf(Posf))-1] of Posf;
+  zPosfArray = array[0..(maxint div SizeOf(Posf))-1] of Posf;
   pzPosfArray = ^zPosfArray;
 
 { A Pos is an index in the character window. We use short instead of integer to
@@ -146,7 +146,7 @@ type
   deflate_state = record
     strm : z_streamp;          { pointer back to this zlib stream }
     status : integer;              { as the name implies }
-    pending_buf : pzByteArray; { output still pending }
+    pending_buf : Pbytearray; { output still pending }
     pending_buf_size : longint;    { size of pending_buf }
     pending_out : Pbyte;      { next pending byte to output to the stream }
     pending : integer;             { nb of bytes in the pending buffer }
@@ -161,7 +161,7 @@ type
     w_bits : cardinal;             { log2(w_size)  (8..16) }
     w_mask : cardinal;             { w_size - 1 }
 
-    window : pzByteArray;
+    window : Pbytearray;
     { Sliding window. Input bytes are read into the second half of the window,
       and move to the first half later to keep a dictionary of at least wSize
       bytes. With this organization, matches are limited to a distance of
@@ -248,7 +248,7 @@ type
     { Depth of each subtree used as tie breaker for trees of equal frequency }
 
 
-    l_buf : puchfArray;       { buffer for literals or lengths }
+    l_buf : Pbytearray;       { buffer for literals or lengths }
 
     lit_bufsize : cardinal;
     { Size of match buffer for literals/lengths.  There are 4 reasons for
@@ -272,7 +272,7 @@ type
 
     last_lit : cardinal;      { running index in l_buf }
 
-    d_buf : pushfArray;
+    d_buf : Pwordarray;
     { Buffer for distances. To simplify the code, d_buf and l_buf have
       the same number of elements. To use different lengths, an extra flag
       array would be necessary. }
@@ -1245,7 +1245,7 @@ var
   tree : tree_ptr;
   max_code : integer;
   stree : tree_ptr; {const}
-  extra : pzIntfArray; {const}
+  extra : Pintegerarray; {const}
   base : integer;
   max_length : integer;
   h : integer;              { heap index }

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

@@ -100,6 +100,17 @@ const
 const
   DEF_WBITS = MAX_WBITS;
 
+
+type  Pbytearray=^Tbytearray;
+      Pwordarray=^Twordarray;
+      Pcardinalarray=^Tcardinalarray;
+
+      Tbytearray = array [0..maxint div sizeof(byte)-1] of byte;
+      Twordarray = array [0..maxint div sizeof(word)-1] of word;
+      Tintegerarray = array [0..maxint div sizeof(integer)-1] of integer;
+      Tcardinalarray = array [0..maxint div sizeof(cardinal)-1] of cardinal;
+
+
 { The memory requirements for deflate are (in bytes):
             1 shl (windowBits+2)   +  1 shl (memLevel+9)
  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
@@ -128,7 +139,7 @@ type
   End;
 
 type
-  huft_field = Array[0..(MaxMemBlock div SizeOf(inflate_huft))-1] of inflate_huft;
+  huft_field = Array[0..(maxint div SizeOf(inflate_huft))-1] of inflate_huft;
   huft_ptr = ^huft_field;
 type
   ppInflate_huft = ^pInflate_huft;
@@ -208,7 +219,7 @@ type
     1:(trees : record             { if DTREE, decoding info for trees }
         table : cardinal;               { table lengths (14 bits) }
         index : cardinal;               { index into blens (or border) }
-        blens : PuIntArray;         { bit lengths of codes }
+        blens : Pcardinalarray;         { bit lengths of codes }
         bb : cardinal;                  { bit length tree depth }
         tb : pInflate_huft;         { bit length decoding tree }
       end);

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

@@ -13,7 +13,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase, zdeflate;
+  zbase, zdeflate;
 
                         { utility functions }
 

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

@@ -60,7 +60,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase;
+ zbase;
 
 
 function deflateInit_(strm : z_streamp;
@@ -509,7 +509,7 @@ var
   s : deflate_state_ptr;
   noheader : integer;
 
-  overlay : pushfArray;
+  overlay : Pwordarray;
   { We overlay pending_buf and d_buf+l_buf. This works since the average
     output size for (length,distance) codes is <= 24 bits. }
 begin
@@ -568,14 +568,14 @@ begin
   s^.hash_mask := s^.hash_size - 1;
   s^.hash_shift :=  ((s^.hash_bits+MIN_MATCH-1) div MIN_MATCH);
 
-  s^.window := pzByteArray (ZALLOC(strm, s^.w_size, 2*sizeof(Byte)));
+  s^.window := Pbytearray (ZALLOC(strm, s^.w_size, 2*sizeof(Byte)));
   s^.prev   := pzPosfArray (ZALLOC(strm, s^.w_size, sizeof(Pos)));
   s^.head   := pzPosfArray (ZALLOC(strm, s^.hash_size, sizeof(Pos)));
 
   s^.lit_bufsize := 1 shl (memLevel + 6); { 16K elements by default }
 
-  overlay := pushfArray (ZALLOC(strm, s^.lit_bufsize, sizeof(word)+2));
-  s^.pending_buf := pzByteArray (overlay);
+  overlay := Pwordarray (ZALLOC(strm, s^.lit_bufsize, sizeof(word)+2));
+  s^.pending_buf := Pbytearray(overlay);
   s^.pending_buf_size := longint(s^.lit_bufsize) * (sizeof(word)+longint(2));
 
   if (s^.window = Z_NULL) or (s^.prev = Z_NULL) or (s^.head = Z_NULL)
@@ -587,8 +587,8 @@ begin
     deflateInit2_ := Z_MEM_ERROR;
     exit;
   end;
-  s^.d_buf := pushfArray( @overlay^[s^.lit_bufsize div sizeof(word)] );
-  s^.l_buf := puchfArray( @s^.pending_buf^[(1+sizeof(word))*s^.lit_bufsize] );
+  s^.d_buf := Pwordarray( @overlay^[s^.lit_bufsize div sizeof(word)] );
+  s^.l_buf := Pbytearray( @s^.pending_buf^[(1+sizeof(word))*s^.lit_bufsize] );
 
   s^.level := level;
   s^.strategy := strategy;
@@ -1065,7 +1065,7 @@ function deflateCopy (dest, source : z_streamp) : integer;
 var
   ds : deflate_state_ptr;
   ss : deflate_state_ptr;
-  overlay : pushfArray;
+  overlay : Pwordarray;
 {$endif}
 begin
 {$ifdef MAXSEG_64K}
@@ -1091,11 +1091,11 @@ begin
   ds^ := ss^;
   ds^.strm := dest;
 
-  ds^.window := pzByteArray ( ZALLOC(dest^, ds^.w_size, 2*sizeof(Byte)) );
+  ds^.window := Pbytearray ( ZALLOC(dest^, ds^.w_size, 2*sizeof(Byte)) );
   ds^.prev   := pzPosfArray ( ZALLOC(dest^, ds^.w_size, sizeof(Pos)) );
   ds^.head   := pzPosfArray ( ZALLOC(dest^, ds^.hash_size, sizeof(Pos)) );
-  overlay := pushfArray ( ZALLOC(dest^, ds^.lit_bufsize, sizeof(word)+2) );
-  ds^.pending_buf := pzByteArray ( overlay );
+  overlay := Pwordarray ( ZALLOC(dest^, ds^.lit_bufsize, sizeof(word)+2) );
+  ds^.pending_buf := Pbytearray ( overlay );
 
   if (ds^.window = Z_NULL) or (ds^.prev = Z_NULL) or (ds^.head = Z_NULL)
      or (ds^.pending_buf = Z_NULL) then
@@ -1111,8 +1111,8 @@ begin
   move(Pbyte(ss^.pending_buf)^,Pbyte(ds^.pending_buf)^,cardinal(ds^.pending_buf_size));
 
   ds^.pending_out := @ds^.pending_buf^[ptrint(ss^.pending_out) - ptrint(ss^.pending_buf)];
-  ds^.d_buf := pushfArray (@overlay^[ds^.lit_bufsize div sizeof(word)] );
-  ds^.l_buf := puchfArray (@ds^.pending_buf^[(1+sizeof(word))*ds^.lit_bufsize]);
+  ds^.d_buf := Pwordarray(@overlay^[ds^.lit_bufsize div sizeof(word)] );
+  ds^.l_buf := Pbytearray(@ds^.pending_buf^[(1+sizeof(word))*ds^.lit_bufsize]);
 
   ds^.l_desc.dyn_tree := tree_ptr(@ds^.dyn_ltree);
   ds^.d_desc.dyn_tree := tree_ptr(@ds^.dyn_dtree);
@@ -1260,13 +1260,13 @@ distances are limited to MAX_DIST instead of WSIZE. }
 
   strend := Pbyte(@(s.window^[s.strstart + MAX_MATCH - 1]));
   scan_start := pushf(scan)^;
-  scan_end   := pushfArray(scan)^[best_len-1];   { fix }
+  scan_end   := Pwordarray(scan)^[best_len-1];   { fix }
 {$else}
   strend := Pbyte(@(s.window^[s.strstart + MAX_MATCH]));
   {$IFOPT R+} {$R-} {$DEFINE NoRangeCheck} {$ENDIF}
-  scan_end1  := pzByteArray(scan)^[best_len-1];
+  scan_end1  := Pbytearray(scan)^[best_len-1];
   {$IFDEF NoRangeCheck} {$R+} {$UNDEF NoRangeCheck} {$ENDIF}
-  scan_end   := pzByteArray(scan)^[best_len];
+  scan_end   := Pbytearray(scan)^[best_len];
 {$endif}
 
     { The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
@@ -1353,13 +1353,13 @@ distances are limited to MAX_DIST instead of WSIZE. }
 {$else} { UNALIGNED_OK }
 
   {$IFOPT R+} {$R-} {$DEFINE NoRangeCheck} {$ENDIF}
-        if (pzByteArray(match)^[best_len]   <> scan_end) or
-           (pzByteArray(match)^[best_len-1] <> scan_end1) or
+        if (Pbytearray(match)^[best_len]   <> scan_end) or
+           (Pbytearray(match)^[best_len-1] <> scan_end1) or
            (match^ <> scan^) then
           goto nextstep; {continue;}
   {$IFDEF NoRangeCheck} {$R+} {$UNDEF NoRangeCheck} {$ENDIF}
         inc(match);
-        if (match^ <> pzByteArray(scan)^[1]) then
+        if (match^ <> Pbytearray(scan)^[1]) then
           goto nextstep; {continue;}
 
         { The check at best_len-1 can be removed because it will be made
@@ -1407,10 +1407,10 @@ distances are limited to MAX_DIST instead of WSIZE. }
               break;
   {$IFOPT R+} {$R-} {$DEFINE NoRangeCheck} {$ENDIF}
 {$ifdef UNALIGNED_OK}
-            scan_end   := pzByteArray(scan)^[best_len-1];
+            scan_end   := Pbytearray(scan)^[best_len-1];
 {$else}
-            scan_end1  := pzByteArray(scan)^[best_len-1];
-            scan_end   := pzByteArray(scan)^[best_len];
+            scan_end1  := Pbytearray(scan)^[best_len-1];
+            scan_end   := Pbytearray(scan)^[best_len];
 {$endif}
   {$IFDEF NoRangeCheck} {$R+} {$UNDEF NoRangeCheck} {$ENDIF}
         end;

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

@@ -13,7 +13,7 @@ interface
 {$I zconf.inc}
 
 uses
-  zutil, zbase, infblock, infutil;
+  zbase, infblock, infutil;
 
 function inflateInit(var z : z_stream) : integer;
 

+ 0 - 64
packages/base/paszlib/zutil.pas

@@ -1,64 +0,0 @@
-unit zutil;
-
-{
-  Copyright (C) 1998 by Jacques Nomssi Nzali
-  For conditions of distribution and use, see copyright notice in readme.txt
-}
-
-interface
-
-{$I zconf.inc}
-
-
-const
-  {$IFDEF MAXSEG_64K}
-  MaxMemBlock = $FFFF;
-  {$ELSE}
-  MaxMemBlock = MaxInt;
-  {$ENDIF}
-
-type
-  zByteArray = array[0..(MaxMemBlock div SizeOf(byte))-1] of byte;
-  pzByteArray = ^zByteArray;
-type
-  zIntfArray = array[0..(MaxMemBlock div SizeOf(byte))-1] of integer;
-  pzIntfArray = ^zIntfArray;
-type
-  zuIntArray = array[0..(MaxMemBlock div SizeOf(cardinal))-1] of cardinal;
-  PuIntArray = ^zuIntArray;
-
-type
-  zuchfArray = zByteArray;
-  puchfArray = ^zuchfArray;
-type
-  zushfArray = array[0..(MaxMemBlock div SizeOf(word))-1] of word;
-  pushfArray = ^zushfArray;
-
-procedure zcfree(opaque : pointer; ptr : pointer);
-function zcalloc (opaque : pointer; items : cardinal; size : cardinal) : pointer;
-
-implementation
-
-type
-  LH = record
-    L, H : word;
-  end;
-
-
-procedure zcfree(opaque : pointer; ptr : pointer);
-
-begin
-  FreeMem(ptr);
-end;
-
-function zcalloc (opaque : pointer; items : cardinal; size : cardinal) : pointer;
-var
-  p : pointer;
-  memsize : cardinal;
-begin
-  memsize := items * size;
-  getmem(p, memsize);
-  zcalloc := p;
-end;
-
-end.