Browse Source

* PChar -> PAnsiChar

Michaël Van Canneyt 2 years ago
parent
commit
9aab3305e5

+ 24 - 24
packages/paszlib/examples/example.pas

@@ -46,13 +46,13 @@ begin
 end;
 
 const
-  hello : PChar = 'hello, hello!';
+  hello : PAnsiChar = 'hello, hello!';
 { "hello world" would be more standard, but the repeated "hello"
   stresses the compression code better, sorry... }
 
 {$IFDEF TEST_DICT}
 const
-  dictionary : PChar = 'hello';
+  dictionary : PAnsiChar = 'hello';
 var
   dictId : cardinal; { Adler32 value of the dictionary }
 {$ENDIF}
@@ -71,18 +71,18 @@ begin
   err := compress(compr, comprLen, Pbyte(hello)^, len);
   CHECK_ERR(err, 'compress');
 
-  strcopy(PChar(uncompr), 'garbage');
+  strcopy(PAnsiChar(uncompr), 'garbage');
 
   err := uncompress(uncompr, uncomprLen, compr^, comprLen);
   CHECK_ERR(err, 'uncompress');
 
-  if (strcomp(PChar(uncompr), hello)) <> 0 then
+  if (strcomp(PAnsiChar(uncompr), hello)) <> 0 then
   begin
     WriteLn('bad uncompress');
     Stop;
   end
   else
-    WriteLn('uncompress(): ', StrPas(PChar(uncompr)));
+    WriteLn('uncompress(): ', StrPas(PAnsiChar(uncompr)));
 end;
 {$ENDIF}
 
@@ -135,7 +135,7 @@ begin
   if (zfile = NIL) then
     WriteLn('gzopen error');
 
-  strcopy(pchar(uncompr), 'garbage');
+  strcopy(PAnsiChar(uncompr), 'garbage');
 
   uncomprLen := gzread(zfile, uncompr, cardinal(uncomprLen));
   if (uncomprLen <> len) then
@@ -143,13 +143,13 @@ begin
     WriteLn('gzread err: ', gzerror(zfile, err));
     Stop;
   end;
-  if (strcomp(pchar(uncompr), hello)) <> 0 then
+  if (strcomp(PAnsiChar(uncompr), hello)) <> 0 then
   begin
-    WriteLn('bad gzread: ', pchar(uncompr));
+    WriteLn('bad gzread: ', PAnsiChar(uncompr));
     Stop;
   end
   else
-    WriteLn('gzread(): ', pchar(uncompr));
+    WriteLn('gzread(): ', PAnsiChar(uncompr));
 
   pos := gzseek(zfile, longint(-8), SEEK_CUR);
   if (pos <> 6) or (gztell(zfile) <> pos) then
@@ -158,26 +158,26 @@ begin
     Stop;
   end;
 
-  if (char(gzgetc(zfile)) <> ' ') then
+  if (AnsiChar(gzgetc(zfile)) <> ' ') then
   begin
     WriteLn('gzgetc error');
     Stop;
   end;
 
-  gzgets(zfile, pchar(uncompr), uncomprLen);
-  uncomprLen := strlen(pchar(uncompr));
+  gzgets(zfile, PAnsiChar(uncompr), uncomprLen);
+  uncomprLen := strlen(PAnsiChar(uncompr));
   if (uncomprLen <> 6) then
   begin { "hello!" }
     WriteLn('gzgets err after gzseek: ', gzerror(zfile, err));
     Stop;
   end;
-  if (strcomp(pchar(uncompr), hello+7)) <> 0 then
+  if (strcomp(PAnsiChar(uncompr), hello+7)) <> 0 then
   begin
     WriteLn('bad gzgets after gzseek');
     Stop;
   end
   else
-    WriteLn('gzgets() after gzseek: ', PChar(uncompr));
+    WriteLn('gzgets() after gzseek: ', PAnsiChar(uncompr));
 
   gzclose(zfile);
 end;
@@ -235,7 +235,7 @@ var
   err : integer;
   d_stream : z_stream; { decompression stream }
 begin
-  strcopy(PChar(uncompr), 'garbage');
+  strcopy(PAnsiChar(uncompr), 'garbage');
 
   d_stream.next_in  := compr;
   d_stream.avail_in := 0;
@@ -258,14 +258,14 @@ begin
   err := inflateEnd(d_stream);
   CHECK_ERR(err, 'inflateEnd');
 
-  if (strcomp(PChar(uncompr), hello) <> 0) then
+  if (strcomp(PAnsiChar(uncompr), hello) <> 0) then
   begin
     WriteLn('bad inflate');
     exit;
   end
   else
   begin
-    WriteLn('inflate(): ', StrPas(PChar(uncompr)));
+    WriteLn('inflate(): ', StrPas(PAnsiChar(uncompr)));
   end;
 end;
 {$ENDIF}
@@ -335,7 +335,7 @@ var
   err : integer;
   d_stream : z_stream; { decompression stream }
 begin
-  strcopy(PChar(uncompr), 'garbage');
+  strcopy(PAnsiChar(uncompr), 'garbage');
 
   d_stream.next_in  := compr;
   d_stream.avail_in := cardinal(comprLen);
@@ -389,7 +389,7 @@ begin
   err := deflate(c_stream, Z_FULL_FLUSH);
   CHECK_ERR(err, 'deflate');
 
-  Inc(pchar(compr)[3]); { force an error in first compressed block }
+  Inc(PAnsiChar(compr)[3]); { force an error in first compressed block }
   c_stream.avail_in := len - 3;
 
   err := deflate(c_stream, Z_FINISH);
@@ -413,7 +413,7 @@ var
   err : integer;
   d_stream : z_stream; { decompression stream }
 begin
-  strcopy(PChar(uncompr), 'garbage');
+  strcopy(PAnsiChar(uncompr), 'garbage');
 
   d_stream.next_in  := compr;
   d_stream.avail_in := 2; { just read the zlib header }
@@ -441,7 +441,7 @@ begin
   err := inflateEnd(d_stream);
   CHECK_ERR(err, 'inflateEnd');
 
-  WriteLn('after inflateSync(): hel', StrPas(PChar(uncompr)));
+  WriteLn('after inflateSync(): hel', StrPas(PAnsiChar(uncompr)));
 end;
 {$ENDIF}
 
@@ -487,7 +487,7 @@ var
   err : integer;
   d_stream : z_stream; { decompression stream }
 begin
-  strcopy(PChar(uncompr), 'garbage');
+  strcopy(PAnsiChar(uncompr), 'garbage');
 
   d_stream.next_in  := compr;
   d_stream.avail_in := cardinal(comprLen);
@@ -519,14 +519,14 @@ begin
   err := inflateEnd(d_stream);
   CHECK_ERR(err, 'inflateEnd');
 
-  if (strcomp(PChar(uncompr), hello)) <> 0 then
+  if (strcomp(PAnsiChar(uncompr), hello)) <> 0 then
   begin
     WriteLn('bad inflate with dict');
     Stop;
   end
   else
   begin
-    WriteLn('inflate with dictionary: ', StrPas(PChar(uncompr)));
+    WriteLn('inflate with dictionary: ', StrPas(PAnsiChar(uncompr)));
   end;
 end;
 {$ENDIF}

+ 23 - 23
packages/paszlib/examples/miniunz.pas

@@ -41,7 +41,7 @@ const
     dosdate : the new date at the MSDos format (4 bytes)
     tmu_date : the SAME new date at the tm_unz format }
 
-  procedure change_file_date(const filename: PChar; dosdate: longword; tmu_date: tm_unz);
+  procedure change_file_date(const filename: PAnsiChar; dosdate: longword; tmu_date: tm_unz);
 {$ifdef Delphi32}
   var
     hFile: THandle;
@@ -81,7 +81,7 @@ end;
 { mymkdir and change_file_date are not 100 % portable
   As I don't know well Unix, I wait feedback for the unix portion }
 
-  function mymkdir(dirname: PChar): boolean;
+  function mymkdir(dirname: PAnsiChar): boolean;
   var
     S: string;
   begin
@@ -91,13 +91,13 @@ end;
     mymkdir := IOresult = 0;
   end;
 
-  function makedir(newdir: PChar): boolean;
+  function makedir(newdir: PAnsiChar): boolean;
   var
-    buffer: PChar;
-    p:      PChar;
+    buffer: PAnsiChar;
+    p:      PAnsiChar;
     len:    cint;
   var
-    hold:   char;
+    hold:   AnsiChar;
   begin
     makedir := False;
     len     := strlen(newdir);
@@ -105,7 +105,7 @@ end;
     if (len <= 0) then
       exit;
 
-    buffer := PChar(allocmem( len + 1));
+    buffer := PAnsiChar(allocmem( len + 1));
 
     strcopy(buffer, newdir);
 
@@ -170,7 +170,7 @@ end;
 
   function HexToStr(w: clong): string;
   const
-    ByteToChar: array[0..$F] of char = '0123456789ABCDEF';
+    ByteToChar: array[0..$F] of AnsiChar = '0123456789ABCDEF';
   var
     s: string;
     i: cint;
@@ -192,7 +192,7 @@ end;
     gi:     unz_global_info;
     err:    cint;
   var
-    filename_inzip: array[0..255] of char;
+    filename_inzip: array[0..255] of AnsiChar;
     file_info: unz_file_info;
     ratio:  longword;
     string_method: string[255];
@@ -259,24 +259,24 @@ end;
 
   function do_extract_currentfile(uf: unzFile; const popt_extract_without_path: cint; var popt_overwrite: cint): cint;
   var
-    filename_inzip: packed array[0..255] of char;
-    filename_withoutpath: PChar;
-    p:      PChar;
+    filename_inzip: packed array[0..255] of AnsiChar;
+    filename_withoutpath: PAnsiChar;
+    p:      PAnsiChar;
     err:    cint;
     fout:   FILEptr;
     buf:    pointer;
     size_buf: cuInt;
     file_info: unz_file_info;
   var
-    write_filename: PChar;
+    write_filename: PAnsiChar;
     skip:   cint;
   var
-    rep:    char;
+    rep:    AnsiChar;
     ftestexist: FILEptr;
   var
     answer: string[127];
   var
-    c:      char;
+    c:      AnsiChar;
   begin
     fout := nil;
 
@@ -362,7 +362,7 @@ end;
 
         { some zipfile don't contain directory alone before file }
         if (fout = nil) and (popt_extract_without_path = 0) and
-          (filename_withoutpath <> PChar(@filename_inzip)) then
+          (filename_withoutpath <> PAnsiChar(@filename_inzip)) then
         begin
           c := (filename_withoutpath - 1)^;
           (filename_withoutpath -1)^ := #0;
@@ -446,7 +446,7 @@ end;
     do_extract := 0;
   end;
 
-  function do_extract_onefile(uf: unzFile; const filename: PChar; opt_extract_without_path: cint; opt_overwrite: cint): cint;
+  function do_extract_onefile(uf: unzFile; const filename: PAnsiChar; opt_extract_without_path: cint; opt_overwrite: cint): cint;
   begin
     if (unzLocateFile(uf, filename, CASESENSITIVITY) <> UNZ_OK) then
     begin
@@ -465,20 +465,20 @@ end;
   { -------------------------------------------------------------------- }
   function main: cint;
   const
-    zipfilename: PChar = nil;
-    filename_to_extract: PChar = nil;
+    zipfilename: PAnsiChar = nil;
+    filename_to_extract: PAnsiChar = nil;
   var
     i:    cint;
     opt_do_list: cint;
     opt_do_extract: cint;
     opt_do_extract_withoutpath: cint;
     opt_overwrite: cint;
-    filename_try: array[0..512 - 1] of char;
+    filename_try: array[0..512 - 1] of AnsiChar;
     uf:   unzFile;
   var
     p:    cint;
     pstr: string[255];
-    c:    char;
+    c:    AnsiChar;
   begin
     opt_do_list := 0;
     opt_do_extract := 1;
@@ -516,10 +516,10 @@ end;
         begin
           pstr := pstr + #0;
           if (zipfilename = nil) then
-            zipfilename := StrNew(PChar(@pstr[1]))
+            zipfilename := StrNew(PAnsiChar(@pstr[1]))
           else
           if (filename_to_extract = nil) then
-            filename_to_extract := StrNew(PChar(@pstr[1]));
+            filename_to_extract := StrNew(PAnsiChar(@pstr[1]));
         end;
       end{ for };
 

+ 9 - 9
packages/paszlib/examples/minizip.pas

@@ -20,7 +20,7 @@ const
   WRITEBUFFERSIZE = Z_BUFSIZE;
   MAXFILENAME     = Z_MAXFILENAMEINZIP;
 
-  function filetime(f: PChar;               { name of file to get info on }
+  function filetime(f: PAnsiChar;               { name of file to get info on }
     var tmzip: tm_zip): cuLong;             { return value: access, modific. and creation times }
   var
     dtrec: TDateTime;    { For Pack/UnpackTime}
@@ -58,19 +58,19 @@ const
     answer: string[128];
     argstr: string;
     buf:    pointer;
-    c:      char;
+    c:      AnsiChar;
     dot_found: longint;
     err:    longint;
     errclose: longint;
-    filenameinzip: PChar;
-    filename_try: array[0..MAXFILENAME - 1] of char;
+    filenameinzip: PAnsiChar;
+    filename_try: array[0..MAXFILENAME - 1] of AnsiChar;
     fin:    FILEptr;
     i:      longint;
     len:    longint;
     opt_compress_level: longint;
     opt_overwrite: longint;
-    p:      PChar;
-    rep:    char;
+    p:      PAnsiChar;
+    rep:    AnsiChar;
     size_buf: longint;
     size_read: longint;
     zf:     zipFile;
@@ -97,7 +97,7 @@ const
         argstr := ParamStr(i) + #0;
         if (argstr[1] = '-') then
         begin
-          p := @argstr[1 + 1];       {const char *p=argv[i]+1;}
+          p := @argstr[1 + 1];       {const AnsiChar *p=argv[i]+1;}
 
           while (p^ <> #0) do
           begin
@@ -131,7 +131,7 @@ const
 
       zipok  := 1;
       argstr := ParamStr(zipfilenamearg) + #0;
-      strcopy(filename_try, PChar(@argstr[1]));
+      strcopy(filename_try, PAnsiChar(@argstr[1]));
       len := strlen(filename_try);
       for i := 0 to len - 1 do
         if (filename_try[i] = '.') then
@@ -173,7 +173,7 @@ const
         argstr := ParamStr(i) + #0;
         if (argstr[1] <> '-') and (argstr[1] <> '/') then
         begin
-          filenameinzip := PChar(@argstr[1]);
+          filenameinzip := PAnsiChar(@argstr[1]);
 
           zi.tmz_date.tm_sec := 0;
           zi.tmz_date.tm_min := 0;

+ 11 - 11
packages/paszlib/src/gzio.pas

@@ -29,12 +29,12 @@ type z_off_t = int64;
 function gzopen  (path:string; mode:string) : gzFile;
 function gzread  (f:gzFile; buf:pointer; len:cardinal) : integer;
 function gzgetc  (f:gzfile) : integer;
-function gzgets  (f:gzfile; buf:Pchar; len:integer) : Pchar;
+function gzgets  (f:gzfile; buf:PAnsiChar; len:integer) : PAnsiChar;
 
 {$ifndef NO_DEFLATE}
 function gzwrite (f:gzFile; buf:pointer; len:cardinal) : integer;
-function gzputc  (f:gzfile; c:char) : integer;
-function gzputs  (f:gzfile; s:Pchar) : integer;
+function gzputc  (f:gzfile; c:AnsiChar) : integer;
+function gzputs  (f:gzfile; s:PAnsiChar) : integer;
 function gzflush (f:gzFile; flush:integer)           : integer;
   {$ifdef GZ_FORMAT_STRING}
   function gzprintf (zfile : gzFile;
@@ -86,7 +86,7 @@ type gz_stream = record
   msg,                    { error message - limit 79 chars }
   path        : string[79];   { path name for debugging only - limit 79 chars }
   transparent : boolean;  { true if input file is not a .gz file }
-  mode        : char;     { 'w' or 'r' }
+  mode        : AnsiChar;     { 'w' or 'r' }
   startpos    : longint;     { start of compressed data in file (header skipped) }
   total_out : cardinal;  { Total read, over blocks }
 end;
@@ -712,13 +712,13 @@ end;
 
 ============================================================================}
 
-function gzgets (f:gzfile; buf:Pchar; len:integer) : Pchar;
+function gzgets (f:gzfile; buf:PAnsiChar; len:integer) : PAnsiChar;
 
 var
 
-  b      : Pchar; { start of buffer }
+  b      : PAnsiChar; { start of buffer }
   bytes  : integer;   { number of bytes read by gzread }
-  gzchar : char;  { char read by gzread }
+  gzchar : AnsiChar;  { AnsiChar read by gzread }
 
 begin
 
@@ -804,7 +804,7 @@ function gzprintf (zfile : gzFile;
                    const format : string;
                    a : array of integer) : integer;
 var
-  buf : array[0..Z_PRINTF_BUFSIZE-1] of char;
+  buf : array[0..Z_PRINTF_BUFSIZE-1] of AnsiChar;
   len : integer;
 begin
 {$ifdef HAS_snprintf}
@@ -824,12 +824,12 @@ end;
 
 { GZPUTC ====================================================================
 
-  Writes c, converted to an unsigned char, into the compressed file.
+  Writes c, converted to an unsigned AnsiChar, into the compressed file.
   gzputc returns the value that was written, or -1 in case of error.
 
 ============================================================================}
 
-function gzputc (f:gzfile; c:char) : integer;
+function gzputc (f:gzfile; c:AnsiChar) : integer;
 begin
   if (gzwrite (f,@c,1) = 1) then
   {$IFDEF FPC}
@@ -850,7 +850,7 @@ end;
 
 ============================================================================}
 
-function gzputs (f:gzfile; s:Pchar) : integer;
+function gzputs (f:gzfile; s:PAnsiChar) : integer;
 begin
   gzputs := gzwrite (f, pointer(s), strlen(s));
 end;

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

@@ -183,7 +183,7 @@ begin
         c^.sub.lit := t^.base;
        {$IFDEF ZLIB_DEBUG}
         if (t^.base >= $20) and (t^.base < $7f) then
-          Tracevv('inflate:         literal '+char(t^.base))
+          Tracevv('inflate:         literal '+AnsiChar(t^.base))
         else
           Tracevv('inflate:         literal $'+IntToHex(t^.base, 2));
         {$ENDIF}          

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

@@ -96,7 +96,7 @@ begin
       dec(k, t^.bits);
      {$IFDEF ZLIB_DEBUG}
       if (t^.base >= $20) and (t^.base < $7f) then
-        Tracevv('inflate:         * literal '+char(t^.base))
+        Tracevv('inflate:         * literal '+AnsiChar(t^.base))
       else
         Tracevv('inflate:         * literal '+ IntToStr(t^.base));
       {$ENDIF}
@@ -238,7 +238,7 @@ begin
 
          {$IFDEF ZLIB_DEBUG}
           if (t^.base >= $20) and (t^.base < $7f) then
-            Tracevv('inflate:         * literal '+char(t^.base))
+            Tracevv('inflate:         * literal '+AnsiChar(t^.base))
           else
             Tracevv('inflate:         * literal '+IntToStr(t^.base));
           {$ENDIF}            

+ 32 - 32
packages/paszlib/src/paszlib.pas

@@ -64,24 +64,24 @@ function deflate(var strm:TZstream; flush:longint):longint;inline;
 function deflateEnd(var strm:TZstream):longint;inline;
 function inflate(var strm:TZstream; flush:longint):longint;inline;
 function inflateEnd(var strm:TZstream):longint;inline;
-function deflateSetDictionary(var strm:TZstream;dictionary : Pchar; dictLength:cardinal):longint;inline;
+function deflateSetDictionary(var strm:TZstream;dictionary : PAnsiChar; dictLength:cardinal):longint;inline;
 function deflateCopy(var dest,source:TZstream):longint;inline;
 function deflateReset(var strm:TZstream):longint;inline;
 function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;inline;
-function inflateSetDictionary(var strm:TZStream;dictionary : Pchar; dictLength:cardinal):longint;inline;
+function inflateSetDictionary(var strm:TZStream;dictionary : PAnsiChar; dictLength:cardinal):longint;inline;
 function inflateSync(var strm:TZStream):longint;inline;
 function inflateReset(var strm:TZStream):longint;inline;
-function compress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
-function compress2(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal; level:longint):longint;
-function uncompress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
-function gzopen(path:Pchar; mode:Pchar):gzFile;inline;
+function compress(dest:PAnsiChar;var destLen:cardinal; source : PAnsiChar; sourceLen:cardinal):longint;
+function compress2(dest:PAnsiChar;var destLen:cardinal; source : PAnsiChar; sourceLen:cardinal; level:longint):longint;
+function uncompress(dest:PAnsiChar;var destLen:cardinal; source : PAnsiChar; sourceLen:cardinal):longint;
+function gzopen(path:PAnsiChar; mode:PAnsiChar):gzFile;inline;
 function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;inline;
 function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;inline;
 function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;inline;
-function gzputs(thefile:gzFile; s:Pchar):longint;inline;
-function gzgets(thefile:gzFile; buf:Pchar; len:longint):Pchar;inline;
-function gzputc(thefile:gzFile; c:char):longint;inline;
-function gzgetc(thefile:gzFile):char;inline;
+function gzputs(thefile:gzFile; s:PAnsiChar):longint;inline;
+function gzgets(thefile:gzFile; buf:PAnsiChar; len:longint):PAnsiChar;inline;
+function gzputc(thefile:gzFile; c:AnsiChar):longint;inline;
+function gzgetc(thefile:gzFile):AnsiChar;inline;
 function gzflush(thefile:gzFile; flush:longint):longint;inline;
 function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;inline;
 function gzrewind(thefile:gzFile):longint;inline;
@@ -89,12 +89,12 @@ function gztell(thefile:gzFile):z_off_t;inline;
 function gzeof(thefile:gzFile):longbool;inline;
 function gzclose(thefile:gzFile):longint;inline;
 function gzerror(thefile:gzFile; var errnum:smallint):string;inline;
-function adler32(theadler:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
-function crc32(thecrc:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
-function deflateInit_(var strm:TZStream; level:longint; version:Pchar; stream_size:longint):longint;inline;
-function inflateInit_(var strm:TZStream; version:Pchar; stream_size:longint):longint;inline;
-function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:Pchar; stream_size:longint):longint;inline;
-function inflateInit2_(var strm:TZStream; windowBits:longint; version:Pchar; stream_size:longint):longint;inline;
+function adler32(theadler:cardinal;buf : PAnsiChar; len:cardinal):cardinal;inline;
+function crc32(thecrc:cardinal;buf : PAnsiChar; len:cardinal):cardinal;inline;
+function deflateInit_(var strm:TZStream; level:longint; version:PAnsiChar; stream_size:longint):longint;inline;
+function inflateInit_(var strm:TZStream; version:PAnsiChar; stream_size:longint):longint;inline;
+function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:PAnsiChar; stream_size:longint):longint;inline;
+function inflateInit2_(var strm:TZStream; windowBits:longint; version:PAnsiChar; stream_size:longint):longint;inline;
 function deflateInit(var strm:TZStream;level : longint) : longint;inline;
 function inflateInit(var strm:TZStream) : longint;inline;
 function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;inline;
@@ -133,7 +133,7 @@ begin
   inflateEnd:=zinflate.inflateEnd(strm);
 end;
 
-function deflateSetDictionary(var strm:TZstream;dictionary : Pchar; dictLength:cardinal):longint;inline;
+function deflateSetDictionary(var strm:TZstream;dictionary : PAnsiChar; dictLength:cardinal):longint;inline;
 begin
   deflateSetDictionary:=zdeflate.deflateSetDictionary(strm,Pbyte(dictionary),dictlength);
 end;
@@ -153,7 +153,7 @@ begin
   deflateParams:=zdeflate.deflateParams(strm,level,strategy);
 end;
 
-function inflateSetDictionary(var strm:TZStream;dictionary : Pchar; dictLength:cardinal):longint;inline;
+function inflateSetDictionary(var strm:TZStream;dictionary : PAnsiChar; dictLength:cardinal):longint;inline;
 begin
   inflateSetDictionary:=zinflate.inflateSetDictionary(strm,Pbyte(dictionary),dictlength);
 end;
@@ -168,7 +168,7 @@ begin
   inflateReset:=zinflate.inflateReset(strm);
 end;
 
-function compress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
+function compress(dest:PAnsiChar;var destLen:cardinal; source : PAnsiChar; sourceLen:cardinal):longint;
 
 type Pbytearray=^Tbytearray;
      Tbytearray=array[0..0] of byte;
@@ -177,7 +177,7 @@ begin
   compress:=zcompres.compress(Pbyte(dest),destlen,Pbytearray(source)^,sourcelen);
 end;
 
-function compress2(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal; level:longint):longint;
+function compress2(dest:PAnsiChar;var destLen:cardinal; source : PAnsiChar; sourceLen:cardinal; level:longint):longint;
 
 type Pbytearray=^Tbytearray;
      Tbytearray=array[0..0] of byte;
@@ -186,7 +186,7 @@ begin
   compress2:=zcompres.compress2(Pbyte(dest),destlen,Pbytearray(source)^,sourcelen,level);
 end;
 
-function uncompress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
+function uncompress(dest:PAnsiChar;var destLen:cardinal; source : PAnsiChar; sourceLen:cardinal):longint;
 
 type Pbytearray=^Tbytearray;
      Tbytearray=array[0..0] of byte;
@@ -195,7 +195,7 @@ begin
   uncompress:=zuncompr.uncompress(Pbyte(dest),destlen,Pbytearray(source)^,sourcelen);
 end;
 
-function gzopen(path:Pchar; mode:Pchar):gzFile;inline;
+function gzopen(path:PAnsiChar; mode:PAnsiChar):gzFile;inline;
 begin
   gzopen:=gzio.gzopen(path,mode);
 end;
@@ -215,22 +215,22 @@ begin
   gzwrite:=gzio.gzwrite(thefile,buf,len);
 end;
 
-function gzputs(thefile:gzFile; s:Pchar):longint;inline;
+function gzputs(thefile:gzFile; s:PAnsiChar):longint;inline;
 begin
   gzputs:=gzio.gzputs(thefile,s);
 end;
 
-function gzgets(thefile:gzFile; buf:Pchar; len:longint):Pchar;inline;
+function gzgets(thefile:gzFile; buf:PAnsiChar; len:longint):PAnsiChar;inline;
 begin
   gzgets:=gzio.gzgets(thefile,buf,len);
 end;
 
-function gzputc(thefile:gzFile; c:char):longint;inline;
+function gzputc(thefile:gzFile; c:AnsiChar):longint;inline;
 begin
   gzputc:=gzio.gzputc(thefile,c);
 end;
 
-function gzgetc(thefile:gzFile):char;inline;
+function gzgetc(thefile:gzFile):AnsiChar;inline;
 begin
   gzgetc:=chr(gzio.gzgetc(thefile));
 end;
@@ -270,32 +270,32 @@ begin
   gzerror:=gzio.gzerror(thefile,errnum);
 end;
 
-function adler32(theadler:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
+function adler32(theadler:cardinal;buf : PAnsiChar; len:cardinal):cardinal;inline;
 begin
   adler32:=adler.adler32(theadler,Pbyte(buf),len);
 end;
 
-function crc32(thecrc:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
+function crc32(thecrc:cardinal;buf : PAnsiChar; len:cardinal):cardinal;inline;
 begin
   crc32:=crc.crc32(thecrc,Pbyte(buf),len);
 end;
 
-function deflateInit_(var strm:TZStream; level:longint; version:Pchar; stream_size:longint):longint;inline;
+function deflateInit_(var strm:TZStream; level:longint; version:PAnsiChar; stream_size:longint):longint;inline;
 begin
   deflateInit_:=zdeflate.deflateInit_(@strm,level,version,stream_size);
 end;
 
-function inflateInit_(var strm:TZStream; version:Pchar; stream_size:longint):longint;inline;
+function inflateInit_(var strm:TZStream; version:PAnsiChar; stream_size:longint):longint;inline;
 begin
   inflateInit_:=zinflate.inflateInit_(@strm,version,stream_size);
 end;
 
-function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:Pchar; stream_size:longint):longint;inline;
+function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:PAnsiChar; stream_size:longint):longint;inline;
 begin
   deflateInit2_:=zdeflate.deflateInit2_(strm,level,method,windowBits,memlevel,strategy,version,stream_size);
 end;
 
-function inflateInit2_(var strm:TZStream; windowBits:longint; version:Pchar; stream_size:longint):longint;inline;
+function inflateInit2_(var strm:TZStream; windowBits:longint; version:PAnsiChar; stream_size:longint):longint;inline;
 begin
   inflateInit2_:=zinflate.inflateInit2_(strm,windowBits,version,stream_size);
 end;

+ 6 - 6
packages/paszlib/src/trees.pas

@@ -638,7 +638,7 @@ const
  }
 
 const
-  Buf_size = (8 * 2*sizeof(char));
+  Buf_size = (8 * 2*sizeof(AnsiChar));
 { Number of bits used within bi_buf. (bi_buf might be implemented on
   more than 16 bits on some systems.) }
 
@@ -877,7 +877,7 @@ begin
     {$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 '+
+       (^M'n #'+IntToStr(n)+' '+AnsiChar(n)+' l '+IntToStr(len)+' c '+
          IntToStr(tree[n].fc.Code)+' ('+IntToStr(next_code[len]-1)+')'))
     else
       Tracecv(tree <> tree_ptr(@static_ltree),
@@ -1903,7 +1903,7 @@ procedure compress_block(var s : deflate_state;
                          var dtree : array of ct_data);  { distance tree }
 var
   dist : cardinal;      { distance of matched string }
-  lc : integer;             { match length or unmatched char (if dist == 0) }
+  lc : integer;             { match length or unmatched AnsiChar (if dist == 0) }
   lx : cardinal;        { running index in l_buf }
   code : cardinal;      { the code to send }
   extra : integer;          { number of extra bits to send }
@@ -1919,7 +1919,7 @@ begin
       { send a literal byte }
       {$ifdef ZLIB_DEBUG}
       Tracevvv(#13'cd '+IntToStr(lc));
-      Tracecv((lc > 31) and (lc < 128), ' '+char(lc)+' ');
+      Tracecv((lc > 31) and (lc < 128), ' '+AnsiChar(lc)+' ');
       {$ENDIF}
       send_bits(s, ltree[lc].fc.Code, ltree[lc].dl.Len);
     end
@@ -2126,7 +2126,7 @@ end;
 
 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) }
+   lc : cardinal) : boolean; { match length-MIN_MATCH or unmatched AnsiChar (if dist=0) }
 var
   {$IFDEF ZLIB_DEBUG}
   MAX_DIST : word;
@@ -2144,7 +2144,7 @@ begin
   inc(s.last_lit);
   if (dist = 0) then
   begin
-    { lc is the unmatched char }
+    { lc is the unmatched AnsiChar }
     inc(s.dyn_ltree[lc].fc.Freq);
   end
   else

+ 17 - 17
packages/paszlib/src/unzip.pas

@@ -88,7 +88,7 @@ type
   unz_file_info_ptr = ^unz_file_info;
 
 
-function unzStringFileNameCompare(const fileName1: PChar; const fileName2: PChar; iCaseSensitivity: longint): longint;
+function unzStringFileNameCompare(const fileName1: PAnsiChar; const fileName2: PAnsiChar; iCaseSensitivity: longint): longint;
 { Compare two filename (fileName1,fileName2).
   If iCaseSenisivity = 1 (1=true),
     comparision is case sensitive (like strcmp)
@@ -99,7 +99,7 @@ function unzStringFileNameCompare(const fileName1: PChar; const fileName2: PChar
 }
 
 
-function unzOpen(const path: PChar): unzFile;
+function unzOpen(const path: PAnsiChar): unzFile;
 
 { Open a Zip file. path contain the full pathname (by example,
   on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
@@ -124,7 +124,7 @@ function unzGetGlobalInfo(afile: unzFile; var pglobal_info: unz_global_info): lo
   No preparation of the structure is needed
   return UNZ_OK if there is no problem. }
 
-function unzGetGlobalComment(afile: unzFile; szComment: PChar; uSizeBuf: longint): longint;
+function unzGetGlobalComment(afile: unzFile; szComment: PAnsiChar; uSizeBuf: longint): longint;
 
 { Get the global comment string of the ZipFile, in the szComment buffer.
   uSizeBuf is the size of the szComment buffer.
@@ -145,7 +145,7 @@ function unzGoToNextFile(afile: unzFile): longint;
   return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. }
 
 
-function unzLocateFile(afile: unzFile; const szFileName: PChar; iCaseSensitivity: longint): longint; { ZEXPORT }
+function unzLocateFile(afile: unzFile; const szFileName: PAnsiChar; iCaseSensitivity: longint): longint; { ZEXPORT }
 
 { Try locate the file szFileName in the zipfile.
   For the iCaseSensitivity signification, see unzStringFileNameCompare
@@ -155,7 +155,7 @@ function unzLocateFile(afile: unzFile; const szFileName: PChar; iCaseSensitivity
   UNZ_END_OF_LIST_OF_FILE if the file is not found }
 
 
-function unzGetCurrentFileInfo(afile: unzFile; pfile_info: unz_file_info_ptr; szFileName: PChar; fileNameBufferSize: longint; extraField: pointer; extraFieldBufferSize: longint; szComment: PChar; commentBufferSize: longint): longint; { ZEXPORT }
+function unzGetCurrentFileInfo(afile: unzFile; pfile_info: unz_file_info_ptr; szFileName: PAnsiChar; fileNameBufferSize: longint; extraField: pointer; extraFieldBufferSize: longint; szComment: PAnsiChar; commentBufferSize: longint): longint; { ZEXPORT }
 
 { Get Info about the current file
   if pfile_info<>NIL, the pfile_info^ structure will contain somes
@@ -242,7 +242,7 @@ const
   UNZ_MAXFILENAMEINZIP = Z_MAXFILENAMEINZIP;
 
 const
-  unz_copyright: PChar = ' unzip 0.15 Copyright 1998 Gilles Vollant ';
+  unz_copyright: PAnsiChar = ' unzip 0.15 Copyright 1998 Gilles Vollant ';
 
 { unz_file_info_internal contain internal info about a file in zipfile }
 type
@@ -256,7 +256,7 @@ type
   in zipfile, when reading and decompress it }
 type
   file_in_zip_read_info_s = record
-    read_buffer: PChar;       { internal buffer for compressed data }
+    read_buffer: PAnsiChar;       { internal buffer for compressed data }
     stream:      z_stream;    { zLib stream structure for inflate }
 
     pos_in_zipfile:     longint;       { position in byte on the zipfile, for fseek}
@@ -380,9 +380,9 @@ end;
 
 
 { My own strcmpi / strcasecmp }
-function strcmpcasenosensitive_internal(fileName1: PChar; fileName2: PChar): longint;
+function strcmpcasenosensitive_internal(fileName1: PAnsiChar; fileName2: PAnsiChar): longint;
 var
-  c1, c2: char;
+  c1, c2: AnsiChar;
 begin
   repeat
     c1 := fileName1^;
@@ -423,7 +423,7 @@ end;
 const
   CASESENSITIVITYDEFAULTVALUE = 2;
 
-function unzStringFileNameCompare(const fileName1: PChar; const fileName2: PChar; iCaseSensitivity: longint): longint; { ZEXPORT }
+function unzStringFileNameCompare(const fileName1: PAnsiChar; const fileName2: PAnsiChar; iCaseSensitivity: longint): longint; { ZEXPORT }
 { Compare two filename (fileName1,fileName2).
   If iCaseSenisivity = 1 (1=true),
     comparision is case sensitive (like strcmp)
@@ -533,7 +533,7 @@ end;
      of this unzip package.
 }
 
-function unzOpen(const path: PChar): unzFile; { ZEXPORT }
+function unzOpen(const path: PAnsiChar): unzFile; { ZEXPORT }
 var
   us:  unz_s;
   s:   unz_s_ptr;
@@ -693,7 +693,7 @@ begin
 end;
 
 { Get Info about the current file in the zipfile, with internal only info }
-function unzlocal_GetCurrentFileInfoInternal(afile: unzFile; pfile_info: unz_file_info_ptr; pfile_info_internal: unz_file_info_internal_ptr; szFileName: PChar; fileNameBufferSize: longint; extraField: pointer; extraFieldBufferSize: longint; szComment: PChar; commentBufferSize: longint): longint;
+function unzlocal_GetCurrentFileInfoInternal(afile: unzFile; pfile_info: unz_file_info_ptr; pfile_info_internal: unz_file_info_internal_ptr; szFileName: PAnsiChar; fileNameBufferSize: longint; extraField: pointer; extraFieldBufferSize: longint; szComment: PAnsiChar; commentBufferSize: longint): longint;
 var
   s:      unz_s_ptr;
   file_info: unz_file_info;
@@ -847,7 +847,7 @@ end;
   No preparation of the structure is needed
   return UNZ_OK if there is no problem. }
 
-function unzGetCurrentFileInfo(afile: unzFile; pfile_info: unz_file_info_ptr; szFileName: PChar; fileNameBufferSize: longint; extraField: pointer; extraFieldBufferSize: longint; szComment: PChar; commentBufferSize: longint): longint; { ZEXPORT }
+function unzGetCurrentFileInfo(afile: unzFile; pfile_info: unz_file_info_ptr; szFileName: PAnsiChar; fileNameBufferSize: longint; extraField: pointer; extraFieldBufferSize: longint; szComment: PAnsiChar; commentBufferSize: longint): longint; { ZEXPORT }
 
 { Get Info about the current file
   if pfile_info<>NIL, the pfile_info^ structure will contain somes
@@ -932,14 +932,14 @@ end;
   UNZ_OK if the file is found. It becomes the current file.
   UNZ_END_OF_LIST_OF_FILE if the file is not found }
 
-function unzLocateFile(afile: unzFile; const szFileName: PChar; iCaseSensitivity: longint): longint; { ZEXPORT }
+function unzLocateFile(afile: unzFile; const szFileName: PAnsiChar; iCaseSensitivity: longint): longint; { ZEXPORT }
 var
   s:   unz_s_ptr;
   err: longint;
   num_fileSaved: longint;
   pos_in_central_dirSaved: longint;
 var
-  szCurrentFileName: array[0..UNZ_MAXFILENAMEINZIP + 1 - 1] of char;
+  szCurrentFileName: array[0..UNZ_MAXFILENAMEINZIP + 1 - 1] of AnsiChar;
 begin
   if (afile = nil) then
   begin
@@ -1125,7 +1125,7 @@ begin
     exit;
   end;
 
-  pfile_in_zip_read_info^.read_buffer := PChar(AllocMem(UNZ_BUFSIZE));
+  pfile_in_zip_read_info^.read_buffer := PAnsiChar(AllocMem(UNZ_BUFSIZE));
   pfile_in_zip_read_info^.offset_local_extrafield := offset_local_extrafield;
   pfile_in_zip_read_info^.size_local_extrafield := size_local_extrafield;
   pfile_in_zip_read_info^.pos_local_extrafield := 0;
@@ -1519,7 +1519,7 @@ end;
   uSizeBuf is the size of the szComment buffer.
   return the number of byte copied or an error code <0 }
 
-function unzGetGlobalComment(afile: unzFile; szComment: PChar; uSizeBuf: longint): longint; { ZEXPORT }
+function unzGetGlobalComment(afile: unzFile; szComment: PAnsiChar; uSizeBuf: longint): longint; { ZEXPORT }
 
 var
   s: unz_s_ptr;

+ 5 - 5
packages/paszlib/src/zdeflate.pas

@@ -1580,7 +1580,7 @@ begin
   begin
     WriteLn(' start ',start,', match ',match ,' length ', length);
     repeat
-      Write(char(s.window^[match]), char(s.window^[start]));
+      Write(AnsiChar(s.window^[match]), AnsiChar(s.window^[start]));
       inc(match);
       inc(start);
       dec(length);
@@ -1591,7 +1591,7 @@ begin
   begin
     Write('\\[',start-match,',',length,']');
     repeat
-       Write(char(s.window^[start]));
+       Write(AnsiChar(s.window^[start]));
        inc(start);
        dec(length);
     Until (length = 0);
@@ -1959,7 +1959,7 @@ end;
     begin
       { No match, output a literal byte }
       {$IFDEF ZLIB_DEBUG}
-      Tracevv(char(s.window^[s.strstart]));
+      Tracevv(AnsiChar(s.window^[s.strstart]));
       {$ENDIF}
       {_tr_tally_lit (s, 0, s.window^[s.strstart], bflush);}
       bflush := _tr_tally (s, 0, s.window^[s.strstart]);
@@ -2116,7 +2116,7 @@ begin
             single literal. If there was a match but the current match
             is longer, truncate the previous match to a single literal. }
           {$IFDEF ZLIB_DEBUG}
-          Tracevv(char(s.window^[s.strstart-1]));
+          Tracevv(AnsiChar(s.window^[s.strstart-1]));
           {$ENDIF}
           bflush := _tr_tally (s, 0, s.window^[s.strstart-1]);
 
@@ -2155,7 +2155,7 @@ begin
   if (s.match_available) then
   begin
     {$IFDEF ZLIB_DEBUG}
-    Tracevv(char(s.window^[s.strstart-1]));
+    Tracevv(AnsiChar(s.window^[s.strstart-1]));
     bflush :=
     {$ENDIF}
       _tr_tally (s, 0, s.window^[s.strstart-1]);

+ 12 - 12
packages/paszlib/src/zip.pas

@@ -61,7 +61,7 @@ type
   end;
   zip_fileinfo_ptr = ^zip_fileinfo;
 
-function zipOpen(const pathname: PChar; append: longint): zipFile; {ZEXPORT}
+function zipOpen(const pathname: PAnsiChar; append: longint): zipFile; {ZEXPORT}
 { Create a zipfile.
   pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on
   an Unix computer "zlib/zlib111.zip".
@@ -72,7 +72,7 @@ function zipOpen(const pathname: PChar; append: longint): zipFile; {ZEXPORT}
   of this zip package. }
 
 function zipOpenNewFileInZip(afile: zipFile;
-  {const} filename: PChar; const zipfi: zip_fileinfo_ptr; const extrafield_local: pointer; size_extrafield_local: integer; const extrafield_global: pointer; size_extrafield_global: integer; const comment: PChar; method: longint; level: longint): longint; {ZEXPORT}
+  {const} filename: PAnsiChar; const zipfi: zip_fileinfo_ptr; const extrafield_local: pointer; size_extrafield_local: integer; const extrafield_global: pointer; size_extrafield_global: integer; const comment: PAnsiChar; method: longint; level: longint): longint; {ZEXPORT}
 { Open a file in the ZIP for writing.
   filename : the filename in zip (if NIL, '-' without quote will be used
   zipfi^ contain supplemental information
@@ -90,7 +90,7 @@ function zipWriteInFileInZip(afile: zipFile; const buf: pointer; len: cardinal):
 function zipCloseFileInZip(afile: zipFile): longint; {ZEXPORT}
  { Close the current file in the zipfile }
 
-function zipClose(afile: zipFile; const global_comment: PChar): longint; {ZEXPORT}
+function zipClose(afile: zipFile; const global_comment: PAnsiChar): longint; {ZEXPORT}
  { Close the zipfile }
 
 implementation
@@ -107,7 +107,7 @@ const
   VERSIONMADEBY = ($0); { platform depedent }
 
 const
-  zip_copyright: PChar = ' zip 0.15 Copyright 1998 Gilles Vollant ';
+  zip_copyright: PAnsiChar = ' zip 0.15 Copyright 1998 Gilles Vollant ';
 
 
 const
@@ -148,7 +148,7 @@ type
 
     pos_local_header: longint;     { offset of the local header of the file
                                     currenty writing }
-    central_header: PChar;       { central header data for the current file }
+    central_header: PAnsiChar;       { central header data for the current file }
     size_centralheader: longint;   { size of the central header for cur file }
     flag: longint;                 { flag of the file currently writing }
 
@@ -345,7 +345,7 @@ end;
 
 {**************************************************************************}
 
-function zipOpen(const pathname: PChar; append: longint): zipFile; {ZEXPORT}
+function zipOpen(const pathname: PAnsiChar; append: longint): zipFile; {ZEXPORT}
 var
   ziinit: zip_internal;
   zi:     zip_internal_ptr;
@@ -379,7 +379,7 @@ begin
 end;
 
 function zipOpenNewFileInZip(afile: zipFile;
-  {const} filename: PChar; const zipfi: zip_fileinfo_ptr; const extrafield_local: pointer; size_extrafield_local: integer; const extrafield_global: pointer; size_extrafield_global: integer; const comment: PChar; method: longint; level: longint): longint; {ZEXPORT}
+  {const} filename: PAnsiChar; const zipfi: zip_fileinfo_ptr; const extrafield_local: pointer; size_extrafield_local: integer; const extrafield_global: pointer; size_extrafield_global: integer; const comment: PAnsiChar; method: longint; level: longint): longint; {ZEXPORT}
 var
   zi:  zip_internal_ptr;
   size_filename: integer;
@@ -443,7 +443,7 @@ begin
   zi^.ci.pos_local_header := ftell(zi^.filezip);
   zi^.ci.size_centralheader := SIZECENTRALHEADER + size_filename +
     size_extrafield_global + size_comment;
-  zi^.ci.central_header := PChar(AllocMem(integer(zi^.ci.size_centralheader)));
+  zi^.ci.central_header := PAnsiChar(AllocMem(integer(zi^.ci.size_centralheader)));
 
   ziplocal_putValue_inmemory(zi^.ci.central_header, longint(CENTRALHEADERMAGIC), 4);
   { version info }
@@ -483,7 +483,7 @@ begin
   while (i < size_extrafield_global) do
   begin
     (zi^.ci.central_header +SIZECENTRALHEADER + size_filename + i)^ :=
-      ({const} PChar(extrafield_global) + i)^;
+      ({const} PAnsiChar(extrafield_global) + i)^;
     Inc(i);
   end;
 
@@ -607,8 +607,8 @@ begin
         copy_this := zi^.ci.stream.avail_out;
 
       for i := 0 to copy_this - 1 do
-        (PChar(zi^.ci.stream.next_out) +i)^ :=
-          ( {const} PChar(zi^.ci.stream.next_in) + i)^;
+        (PAnsiChar(zi^.ci.stream.next_out) +i)^ :=
+          ( {const} PAnsiChar(zi^.ci.stream.next_in) + i)^;
 
 
       Dec(zi^.ci.stream.avail_in, copy_this);
@@ -713,7 +713,7 @@ begin
   zipCloseFileInZip := err;
 end;
 
-function zipClose(afile: zipFile; const global_comment: PChar): longint; {ZEXPORT}
+function zipClose(afile: zipFile; const global_comment: PAnsiChar): longint; {ZEXPORT}
 var
   zi:  zip_internal_ptr;
   err: longint;

+ 35 - 35
packages/paszlib/src/zipper.pp

@@ -200,7 +200,7 @@ Type
   TProgressEvent = Procedure(Sender : TObject; Const Pct : Double) of object;
   TProgressEventEx = Procedure(Sender : TObject; Const ATotPos, ATotSize: Int64) of object;
   TOnEndOfFileEvent = Procedure(Sender : TObject; Const Ratio : Double) of object;
-  TOnStartFileEvent = Procedure(Sender : TObject; Const AFileName : String) of object;
+  TOnStartFileEvent = Procedure(Sender : TObject; Const AFileName : AnsiString) of object;
 
 Type
 
@@ -290,7 +290,7 @@ Type
                                             {    during adaptive resets        }
     CodeSize    :  Byte;     { Size of codes (in bits) currently being written }
     MaxCode     :  Word;   { Largest code that can be written in CodeSize bits }
-    InBufIdx,                     { Points to next char in buffer to be read   }
+    InBufIdx,                     { Points to next AnsiChar in buffer to be read   }
     OutBufIdx   :  LongWord;      { Points to next free space in output buffer }
     InBuf,                        { I/O buffers                                }
     OutBuf      :  BufPtr;
@@ -314,7 +314,7 @@ Type
                            TargetSuffix : Byte;
                            Out FoundAt  : Smallint) : Boolean;
     Procedure Shrink(Suffix : Smallint);
-    Procedure ProcessLine(Const Source : String);
+    Procedure ProcessLine(Const Source : AnsiString);
     Procedure DoOnProgress(Const Pct : Double); Virtual;
   Public
     Constructor Create(AInFile, AOutFile : TStream; ABufSize : LongWord); override;
@@ -352,12 +352,12 @@ Type
 
   TZipFileEntry = Class(TCollectionItem)
   private
-    FArchiveFileName: String; //Name of the file as it appears in the zip file list
+    FArchiveFileName: AnsiString; //Name of the file as it appears in the zip file list
     FUTF8FileName : UTF8String;
     FUTF8DiskFileName : UTF8String;
     FAttributes: LongWord;
     FDateTime: TDateTime;
-    FDiskFileName: String; {Name of the file on disk (i.e. uncompressed. Can be empty if based on a stream.);
+    FDiskFileName: AnsiString; {Name of the file on disk (i.e. uncompressed. Can be empty if based on a stream.);
     uses local OS/filesystem directory separators}
     FHeaderPos: int64;
     FNeedsZip64: Boolean; //flags whether filesize is big enough so we need a zip64 entry
@@ -365,11 +365,11 @@ Type
     FSize: Int64;
     FStream: TStream;
     FCompressionLevel: TCompressionlevel;
-    function GetArchiveFileName: String;
+    function GetArchiveFileName: AnsiString;
     function GetUTF8ArchiveFileName: UTF8String;
     function GetUTF8DiskFileName: UTF8String;
-    procedure SetArchiveFileName(Const AValue: String);
-    procedure SetDiskFileName(Const AValue: String);
+    procedure SetArchiveFileName(Const AValue: AnsiString);
+    procedure SetDiskFileName(Const AValue: AnsiString);
     procedure SetUTF8ArchiveFileName(AValue: UTF8String);
     procedure SetUTF8DiskFileName(AValue: UTF8String);
   Protected
@@ -383,9 +383,9 @@ Type
     Procedure Assign(Source : TPersistent); override;
     Property Stream : TStream Read FStream Write FStream;
   Published
-    Property ArchiveFileName : String Read GetArchiveFileName Write SetArchiveFileName;
+    Property ArchiveFileName : AnsiString Read GetArchiveFileName Write SetArchiveFileName;
     Property UTF8ArchiveFileName : UTF8String Read GetUTF8ArchiveFileName Write SetUTF8ArchiveFileName;
-    Property DiskFileName : String Read FDiskFileName Write SetDiskFileName;
+    Property DiskFileName : AnsiString Read FDiskFileName Write SetDiskFileName;
     Property UTF8DiskFileName : UTF8String Read GetUTF8DiskFileName Write SetUTF8DiskFileName;
     Property Size : Int64 Read FSize Write FSize;
     Property DateTime : TDateTime Read FDateTime Write FDateTime;
@@ -401,9 +401,9 @@ Type
     function GetZ(AIndex : Integer): TZipFileEntry;
     procedure SetZ(AIndex : Integer; const AValue: TZipFileEntry);
   Public
-    Function AddFileEntry(Const ADiskFileName : String): TZipFileEntry;
-    Function AddFileEntry(Const ADiskFileName, AArchiveFileName : String): TZipFileEntry;
-    Function AddFileEntry(Const AStream : TSTream; Const AArchiveFileName : String): TZipFileEntry;
+    Function AddFileEntry(Const ADiskFileName : AnsiString): TZipFileEntry;
+    Function AddFileEntry(Const ADiskFileName, AArchiveFileName : AnsiString): TZipFileEntry;
+    Function AddFileEntry(Const AStream : TSTream; Const AArchiveFileName : AnsiString): TZipFileEntry;
     Procedure AddFileEntries(Const List : TStrings);
     Property Entries[AIndex : Integer] : TZipFileEntry Read GetZ Write SetZ; default;
   end;
@@ -417,7 +417,7 @@ Type
     FZipping        : Boolean;
     FBufSize        : LongWord;
     FFileName       : RawByteString;         { Name of resulting Zip file                 }
-    FFileComment    : String;
+    FFileComment    : AnsiString;
     FFiles          : TStrings;
     FInMemSize      : Int64;
     FZipFileNeedsZip64 : Boolean; //flags whether at least one file is big enough to require a zip64 record
@@ -482,7 +482,7 @@ Type
     Property OnStartFile : TOnStartFileEvent Read FOnStartFile Write FOnStartFile;
     Property OnEndFile : TOnEndOfFileEvent Read FOnEndOfFile Write FOnEndOfFile;
     Property FileName : RawByteString Read FFileName Write SetFileName;
-    Property FileComment: String Read FFileComment Write FFileComment;
+    Property FileComment: AnsiString Read FFileComment Write FFileComment;
     // Deprecated. Use Entries.AddFileEntry(FileName) or Entries.AddFileEntries(List) instead.
     Property Files : TStrings Read FFiles; deprecated;
     Property InMemSize : Int64 Read FInMemSize Write FInMemSize;
@@ -532,7 +532,7 @@ Type
     FBufSize    : LongWord;
     FFileName   : RawByteString;         { Name of resulting Zip file                 }
     FOutputPath : RawByteString;
-    FFileComment: String;
+    FFileComment: AnsiString;
     FEntries    : TFullZipFileEntries;
     FFiles      : TStrings;
     FUseUTF8    : Boolean;
@@ -585,7 +585,7 @@ Type
     Class Procedure Unzip(const AZipFileName : RawByteString);
     // Unzip a single file.
     Class Procedure Unzip(const AZipFileName : RawByteString;aExtractFileName : RawByteString);
-    Class Procedure UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName : string);
+    Class Procedure UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName : AnsiString);
     // Unzip several files
     Class Procedure Unzip(const AZipFileName : RawByteString; aFileList : Array of RawByteString);
     Class Procedure Unzip(const AZipFileName : RawByteString; aFileList : TStrings);
@@ -607,7 +607,7 @@ Type
     Property OnEndFile : TOnEndOfFileEvent Read FOnEndOfFile Write FOnEndOfFile;
     Property FileName : RawByteString Read FFileName Write SetFileName;
     Property OutputPath : RawByteString Read FOutputPath Write SetOutputPath;
-    Property FileComment: String Read FFileComment;
+    Property FileComment: AnsiString Read FFileComment;
     Property Files : TStrings Read FFiles;
     Property Entries : TFullZipFileEntries Read FEntries;
     Property UseUTF8 : Boolean Read FUseUTF8 Write FUseUTF8;
@@ -868,7 +868,7 @@ end;
 
 
 
-function ZipUnixAttrsToFatAttrs(const Name: String; Attrs: Longint): Longint;
+function ZipUnixAttrsToFatAttrs(const Name: AnsiString; Attrs: Longint): Longint;
 begin
   Result := faArchive;
 
@@ -900,7 +900,7 @@ begin
       Result := Result or UNIX_FILE;
 end;
 
-function CRC32Str(const s:string):DWord;
+function CRC32Str(const s:AnsiString):DWord;
 var
   i:Integer;
 begin
@@ -1149,7 +1149,7 @@ end;
 Procedure TShrinker.Compress;
 
 Var
-   OneString : String;
+   OneString : AnsiString;
    Remaining : Word;
 
 begin
@@ -1467,7 +1467,7 @@ Begin
     end;
 end;
 
-Procedure TShrinker.ProcessLine(Const Source : String);
+Procedure TShrinker.ProcessLine(Const Source : AnsiString);
 
 Var
   I : Word;
@@ -1698,7 +1698,7 @@ Var
   HdrPos    : Int64; //offset from disk where file begins to local header
   CenDirPos : Int64;
   ACount    : QWord; //entry counter
-  ZFileName : string; //archive filename
+  ZFileName : AnsiString; //archive filename
   IsZip64   : boolean; //local header=zip64 format?
   MinReqdVersion: word; //minimum needed to extract
   ExtInfoHeader : Extensible_Data_Field_Header_Type;
@@ -1918,7 +1918,7 @@ Var
   ZVersionReqd : Word;
   ZBitFlag : Word;
   ZipStream : TStream;
-  TmpFileName, Start : String;
+  TmpFileName, Start : AnsiString;
   I : Integer;
 
 Begin
@@ -2224,7 +2224,7 @@ function TUnZipper.OpenOutput(OutFileName: RawByteString;
   out OutStream: TStream; Item: TFullZipFileEntry): Boolean;
 Var
   Path: RawByteString;
-  OldDirectorySeparators: set of char;
+  OldDirectorySeparators: set of AnsiChar;
 
 Begin
   { the default RTL behavior is broken on Unix platforms
@@ -2823,7 +2823,7 @@ Begin
         LinkTargetStream := TStringStream.Create('');
         try
           DoUnzip(LinkTargetStream);
-          fpSymlink(PChar(LinkTargetStream.DataString), PChar(OutputFileName));
+          fpSymlink(PAnsiChar(LinkTargetStream.DataString), PAnsiChar(OutputFileName));
         finally
           LinkTargetStream.Free;
         end;
@@ -3035,7 +3035,7 @@ Type
   Public
     Constructor Create(aUnZipper : TUnzipper);
     Destructor Destroy; override;
-    Procedure UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName: string);
+    Procedure UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName: AnsiString);
   end;
 
 { TCustomExtractor }
@@ -3059,14 +3059,14 @@ begin
   Inherited;
 end;
 
-procedure TCustomExtractor.UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName: string);
+procedure TCustomExtractor.UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName: AnsiString);
 begin
   FStream:=TFileStream.Create(aOutputFileName,fmCreate);
   FUnZipper.OnCreateStream:=@DoCreateStream;
   FUnzipper.UnzipFile(aZipFileName,aExtractFileName);
 end;
 
-class procedure TUnZipper.UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName: string);
+class procedure TUnZipper.UnZip(const AZipFileName, aExtractFileName: RawByteString; aOutputFileName: AnsiString);
 
 
 
@@ -3201,7 +3201,7 @@ end;
 
 { TZipFileEntry }
 
-function TZipFileEntry.GetArchiveFileName: String;
+function TZipFileEntry.GetArchiveFileName: AnsiString;
 begin
   Result:=FArchiveFileName;
   If (Result='') then
@@ -3262,7 +3262,7 @@ begin
   end;
 end;
 
-procedure TZipFileEntry.SetArchiveFileName(const AValue: String);
+procedure TZipFileEntry.SetArchiveFileName(const AValue: AnsiString);
 
 begin
   if FArchiveFileName=AValue then Exit;
@@ -3273,7 +3273,7 @@ begin
     FArchiveFileName:=StringReplace(AValue, DirectorySeparator, '/', [rfReplaceAll]);
 end;
 
-procedure TZipFileEntry.SetDiskFileName(const AValue: String);
+procedure TZipFileEntry.SetDiskFileName(const AValue: AnsiString);
 begin
   if FDiskFileName=AValue then Exit;
   // Zip file uses / as directory separator on all platforms
@@ -3338,21 +3338,21 @@ begin
   Items[AIndex]:=AValue;
 end;
 
-function TZipFileEntries.AddFileEntry(const ADiskFileName: String): TZipFileEntry;
+function TZipFileEntries.AddFileEntry(const ADiskFileName: AnsiString): TZipFileEntry;
 begin
   Result:=Add as TZipFileEntry;
   Result.DiskFileName:=ADiskFileName;
 end;
 
 function TZipFileEntries.AddFileEntry(const ADiskFileName,
-  AArchiveFileName: String): TZipFileEntry;
+  AArchiveFileName: AnsiString): TZipFileEntry;
 begin
   Result:=AddFileEntry(ADiskFileName);
   Result.ArchiveFileName:=AArchiveFileName;
 end;
 
 function TZipFileEntries.AddFileEntry(const AStream: TSTream;
-  const AArchiveFileName: String): TZipFileEntry;
+  const AArchiveFileName: AnsiString): TZipFileEntry;
 begin
   Result:=Add as TZipFileEntry;
   Result.Stream:=AStream;

+ 4 - 4
packages/paszlib/src/ziputils.pas

@@ -36,7 +36,7 @@ type
   seek_mode = (SEEK_SET, SEEK_CUR, SEEK_END);
   open_mode = (fopenread, fopenwrite, fappendwrite);
 
-function fopen(filename: PChar; mode: open_mode): FILEptr;
+function fopen(filename: PAnsiChar; mode: open_mode): FILEptr;
 
 procedure fclose(fp: FILEptr);
 
@@ -84,14 +84,14 @@ const
   SIZEZIPLOCALHEADER = $1e;
 
 const
-  Paszip_copyright: PChar = ' Paszip Copyright 2000 Jacques Nomssi Nzali ';
+  Paszip_copyright: PAnsiChar = ' Paszip Copyright 2000 Jacques Nomssi Nzali ';
 
 implementation
 
 {$ifdef Streams}
 { ---------------------------------------------------------------- }
 
-function fopen(filename: PChar; mode: open_mode): FILEptr;
+function fopen(filename: PAnsiChar; mode: open_mode): FILEptr;
 var
   fp: FILEptr;
 begin
@@ -178,7 +178,7 @@ end;
 {$else}
 { ---------------------------------------------------------------- }
 
-function fopen(filename : PChar; mode : open_mode) : FILEptr;
+function fopen(filename : PAnsiChar; mode : open_mode) : FILEptr;
 var
   fp : FILEptr;
   OldFileMode : byte;

+ 27 - 27
packages/paszlib/tests/tczipper.pp

@@ -28,16 +28,16 @@ type
   TCallBackHandler = class(TObject) //Callbacks used in zip/unzip processing
   private
     FPerformChecks: boolean;
-    FOriginalContent: string;
+    FOriginalContent: ansistring;
     FShowContent: boolean;
     FStreamResult: boolean;
   public
     property PerformChecks: boolean read FPerformChecks write FPerformChecks; //If false, do not perform any consistency checks
-    property OriginalContent: string read FOriginalContent write FOriginalContent; //Zip entry uncompressed content used in TestZipEntries
+    property OriginalContent: ansistring read FOriginalContent write FOriginalContent; //Zip entry uncompressed content used in TestZipEntries
     property ShowContent: boolean read FShowContent write FShowContent; //Show contents of zip when extracting?
     property StreamResult: boolean read FStreamResult; //For handler to report success/failure
     procedure EndOfFile(Sender:TObject; const Ratio:double);
-    procedure StartOfFile(Sender:TObject; const AFileName:string);
+    procedure StartOfFile(Sender:TObject; const AFileName:ansistring);
     procedure DoCreateZipOutputStream(Sender: TObject; var AStream: TStream;
       AItem: TFullZipFileEntry);
     procedure DoDoneOutZipStream(Sender: TObject; var AStream: TStream;
@@ -55,7 +55,7 @@ begin
   end;
 end;
 
-procedure TCallBackHandler.StartOfFile(Sender: TObject; const AFileName: string);
+procedure TCallBackHandler.StartOfFile(Sender: TObject; const AFileName: ansistring);
 begin
   writeln('Start of file handler hit; filename: '+AFileName);
   if (FPerformChecks) and (AFileName='') then
@@ -74,7 +74,7 @@ end;
 procedure TCallBackHandler.DoDoneOutZipStream(Sender: TObject; var AStream: TStream;
   AItem: TFullZipFileEntry);
 var
-  DecompressedContent: string;
+  DecompressedContent: ansistring;
 begin
   //writeln('At end of '+AItem.ArchiveFileName);
   AStream.Position:=0;
@@ -112,12 +112,12 @@ end;
 function CompareCompressDecompress: boolean;
 var
   CallBackHandler: TCallBackHandler;
-  CompressedFile: string;
+  CompressedFile: ansistring;
   FileContents: TStringList;
-  UncompressedFile1: string;
-  UncompressedFile1Hash: string;
-  UncompressedFile2: string;
-  UncompressedFile2Hash: string;
+  UncompressedFile1: ansistring;
+  UncompressedFile1Hash: ansistring;
+  UncompressedFile2: ansistring;
+  UncompressedFile2Hash: ansistring;
   OurZipper: TZipper;
   UnZipper: TUnZipper;
 begin
@@ -218,10 +218,10 @@ function CompressSmallStreams: boolean;
 // Test verifies that the entries in the zip are not bigger than
 // the originals.
 var
-  DestFile: string;
+  DestFile: ansistring;
   z: TZipper;
   zfe: TZipFileEntry;
-  s: string = 'abcd';
+  s: ansistring = 'abcd';
   DefaultStream, StoreStream: TStringStream;
 begin
   result:=true;
@@ -295,7 +295,7 @@ begin
   //The column Size Shows that compressed files are bigger than source files
 end;
 
-function ShowZipFile(ZipFile: string): boolean;
+function ShowZipFile(ZipFile: ansistring): boolean;
 // Reads zip file and lists entries
 var
   CallBackHandler: TCallBackHandler;
@@ -343,9 +343,9 @@ function TestZipEntries(Entries: qword): boolean;
 // Starting from 65535 entries, the zip needs to be in zip64 format
 var
   CallBackHandler: TCallBackHandler;
-  DestFile: string;
+  DestFile: ansistring;
   i: qword;
-  OriginalContent: string = 'A'; //Uncompressed content for zip file entry
+  OriginalContent: ansistring = 'A'; //Uncompressed content for zip file entry
   ContentStreams: TFPList;
   ContentStream: TStringStream;
   UnZipper: TUnZipper;
@@ -432,7 +432,7 @@ function TestEmptyZipEntries(Entries: qword): boolean;
 // useful for testing large number of files
 var
   CallBackHandler: TCallBackHandler;
-  DestFile: string;
+  DestFile: ansistring;
   i: qword;
   ContentStreams: TFPList;
   ContentStream: TNullStream;
@@ -517,11 +517,11 @@ end;
 
 function SaveToFileTest: boolean;
 var
-  NewFileName: string;
-  OldFileName: string;
+  NewFileName: ansistring;
+  OldFileName: ansistring;
   z: TZipper;
   zfe: TZipFileEntry;
-  s: string = 'abcd';
+  s: ansistring = 'abcd';
   DefaultStream: TStringStream;
 begin
   result:=true;
@@ -563,9 +563,9 @@ end;
 function TestLargeFileName: boolean;
 // Zips/unzips 259-character filename
 var
-  ArchiveFile: string;
-  DestFile: string;
-  s: string = 'a';
+  ArchiveFile: ansistring;
+  DestFile: ansistring;
+  s: ansistring = 'a';
   DefaultStream: TStringStream;
   UnZipper: TUnZipper;
   Zipper: TZipper;
@@ -616,9 +616,9 @@ function TestWindowsPath: boolean;
 // Zip standard requires using /
 // On Linux, \ should be seen as a regular part of the filename
 var
-  FileWithBackslash: string;
-  DestFile: string;
-  s: string = 'a';
+  FileWithBackslash: ansistring;
+  DestFile: ansistring;
+  s: ansistring = 'a';
   DefaultStream: TStringStream;
   UnZipper: TUnZipper;
   Zipper: TZipper;
@@ -677,8 +677,8 @@ function TestLargeZip64: boolean;
 // Tests single zip file with large uncompressed content
 // which forces it to zip64 format
 var
-  ArchiveFile: string;
-  DestFile: string;
+  ArchiveFile: ansistring;
+  DestFile: ansistring;
   ContentStream: TNullStream; //empty contents
   UnZipper: TUnZipper;
   Zipper: TZipper;