Browse Source

* Kill zmemcpy and zmemzero

git-svn-id: trunk@1844 -
daniel 19 years ago
parent
commit
17dd59fdcb

+ 4 - 11
packages/base/paszlib/gzio.pas

@@ -21,13 +21,6 @@ uses
   {$else}
   dos,
   {$endif}
-(*
-  {$ifdef MSDOS}
-  dos, strings,
-  {$else}
-  sysutils,
-  {$endif}
-*)
   zutil, zbase, crc, zdeflate, zinflate;
 
 type gzFile = pointer;
@@ -573,7 +566,7 @@ begin
       n := s^.stream.avail_in;
       if (n > s^.stream.avail_out) then n := s^.stream.avail_out;
       if (n > 0) then begin
-        zmemcpy(s^.stream.next_out, s^.stream.next_in, n);
+        move(s^.stream.next_in^,s^.stream.next_out^,n);
         inc (s^.stream.next_out, n);
         inc (s^.stream.next_in, n);
         dec (s^.stream.avail_out, n);
@@ -994,9 +987,9 @@ begin
     end;
 
     { At this point, offset is the number of zero bytes to write. }
-    if (s^.inbuf = nil) then begin
-      GetMem (s^.inbuf, Z_BUFSIZE);
-      zmemzero(s^.inbuf, Z_BUFSIZE);
+    if s^.inbuf=nil then begin
+      getmem(s^.inbuf,Z_BUFSIZE);
+      fillchar(s^.inbuf^,Z_BUFSIZE,0);
     end;
 
     while (offset > 0) do begin

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

@@ -445,9 +445,9 @@ begin
           t := n;
         if (t > m) then
           t := m;
-        zmemcpy(q, p, t);
-        Inc(p, t);  dec(n, t);
-        Inc(q, t);  dec(m, t);
+        move(p^,q^,t);
+        inc(p, t);  dec(n, t);
+        inc(q, t);  dec(m, t);
         dec(s.sub.left, t);
         if (s.sub.left = 0) then
         begin
@@ -929,9 +929,9 @@ procedure inflate_set_dictionary(var s : inflate_blocks_state;
                                  const d : array of byte; { dictionary }
                                  n : cardinal);         { dictionary length }
 begin
-  zmemcpy(s.window, Pbyte(@d), n);
+  move(d,s.window^,n);
   s.write := s.window;
-  Inc(s.write, n);
+  inc(s.write, n);
   s.read := s.write;
 end;
 

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

@@ -174,7 +174,7 @@ begin
   end;
 
   { copy as far as end of window }
-  zmemcpy(p, q, n);
+  move(q^,p^,n);
   inc(p, n);
   inc(q, n);
 
@@ -205,7 +205,7 @@ begin
     end;
 
     { copy }
-    zmemcpy(p, q, n);
+    move(q^,p^,n);
     inc(p, n);
     inc(q, n);
   end;

+ 12 - 13
packages/base/paszlib/zdeflate.pas

@@ -685,7 +685,7 @@ begin
 {$endif}
   end;
 
-  zmemcpy( Pbyte(s^.window), dictionary, length);
+  move(dictionary^,Pbyte(s^.window)^,length);
   s^.strstart := length;
   s^.block_start := longint(length);
 
@@ -828,7 +828,7 @@ begin
   if (len = 0) then
     exit;
 
-  zmemcpy(strm.next_out, s^.pending_out, len);
+  move(s^.pending_out^,strm.next_out^,len);
   inc(strm.next_out, len);
   inc(s^.pending_out, len);
   inc(strm.total_out, len);
@@ -984,7 +984,7 @@ begin
         begin
           {macro CLEAR_HASH(s);}             { forget history }
           s^.head^[s^.hash_size-1] := ZNIL;
-          zmemzero(Pbyte(s^.head), cardinal(s^.hash_size-1)*sizeof(s^.head^[0]));
+          fillchar(Pbyte(s^.head)^,cardinal(s^.hash_size-1)*sizeof(s^.head^[0]),0);
         end;
       end;
 
@@ -1114,11 +1114,11 @@ begin
     deflateCopy := Z_MEM_ERROR;
     exit;
   end;
-  { following zmemcpy do not work for 16-bit MSDOS }
-  zmemcpy(Pbyte(ds^.window), Pbyte(ss^.window), ds^.w_size * 2 * sizeof(Byte));
-  zmemcpy(Pbyte(ds^.prev), Pbyte(ss^.prev), ds^.w_size * sizeof(Pos));
-  zmemcpy(Pbyte(ds^.head), Pbyte(ss^.head), ds^.hash_size * sizeof(Pos));
-  zmemcpy(Pbyte(ds^.pending_buf), Pbyte(ss^.pending_buf), cardinal(ds^.pending_buf_size));
+
+  move(Pbyte(ss^.window)^,Pbyte(ds^.window)^,ds^.w_size * 2 * sizeof(byte));
+  move(Pbyte(ss^.prev)^,Pbyte(ds^.prev)^,ds^.w_size * sizeof(pos));
+  move(Pbyte(ss^.head)^,Pbyte(ds^.head)^,ds^.hash_size * sizeof(pos));
+  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)] );
@@ -1161,11 +1161,11 @@ begin
   begin
     strm^.adler := adler32(strm^.adler, strm^.next_in, len);
   end;
-  zmemcpy(buf, strm^.next_in, len);
+  move(strm^.next_in^,buf^,len);
   inc(strm^.next_in, len);
   inc(strm^.total_in, len);
 
-  read_buf := integer(len);
+  read_buf := len;
 end;
 
 { ===========================================================================
@@ -1178,7 +1178,7 @@ begin
 
   {macro CLEAR_HASH(s);}
   s.head^[s.hash_size-1] := ZNIL;
-  zmemzero(Pbyte(s.head), cardinal(s.hash_size-1)*sizeof(s.head^[0]));
+  fillchar(Pbyte(s.head)^, cardinal(s.hash_size-1)*sizeof(s.head^[0]),0);
 
   { Set the default configuration parameters: }
 
@@ -1587,8 +1587,7 @@ begin
      else
        if (s.strstart >= wsize+ {MAX_DIST}(wsize-MIN_LOOKAHEAD)) then
        begin
-         zmemcpy( Pbyte(s.window), Pbyte(@(s.window^[wsize])),
-                 cardinal(wsize));
+         move(s.window^[wsize],Pbyte(s.window)^,wsize);
          dec(s.match_start, wsize);
          dec(s.strstart, wsize); { we now have strstart >= MAX_DIST }
          dec(s.block_start, longint(wsize));

+ 1 - 13
packages/base/paszlib/zutil.pas

@@ -1,4 +1,4 @@
-Unit ZUtil;
+unit zutil;
 
 {
   Copyright (C) 1998 by Jacques Nomssi Nzali
@@ -34,9 +34,7 @@ type
   zushfArray = array[0..(MaxMemBlock div SizeOf(word))-1] of word;
   pushfArray = ^zushfArray;
 
-procedure zmemcpy(destp : Pbyte; sourcep : Pbyte; len : cardinal);
 function zmemcmp(s1p, s2p : Pbyte; len : cardinal) : integer;
-procedure zmemzero(destp : Pbyte; len : cardinal);
 procedure zcfree(opaque : pointer; ptr : pointer);
 function zcalloc (opaque : pointer; items : cardinal; size : cardinal) : pointer;
 
@@ -320,11 +318,6 @@ end;
 
 {$ENDIF}
 
-procedure zmemcpy(destp : Pbyte; sourcep : Pbyte; len : cardinal);
-begin
-  Move(sourcep^, destp^, len);
-end;
-
 function zmemcmp(s1p, s2p : Pbyte; len : cardinal) : integer;
 var
   j : cardinal;
@@ -346,11 +339,6 @@ begin
   zmemcmp := 0;
 end;
 
-procedure zmemzero(destp : Pbyte; len : cardinal);
-begin
-  FillChar(destp^, len, 0);
-end;
-
 procedure zcfree(opaque : pointer; ptr : pointer);
 {$ifdef Delphi16}
 var