Browse Source

* Cleanup demodir.

git-svn-id: trunk@7895 -
marco 18 years ago
parent
commit
6f30ee3775

+ 255 - 54
packages/base/paszlib/Makefile

@@ -231,7 +231,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=paszlib
-override PACKAGE_VERSION=2.0.0
+override PACKAGE_VERSION=2.2.0
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zip ziputils unzip
 endif
@@ -389,160 +389,160 @@ ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zip ziputils unzip
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_EXAMPLES+=demo
+override TARGET_EXAMPLEDIRS+=demo
 endif
 override INSTALL_FPCPACKAGE=y
 ifdef REQUIRE_UNITSDIR
@@ -2132,6 +2132,207 @@ endif
 fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifeq ($(FULL_TARGET),i386-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+TARGET_EXAMPLEDIRS_DEMO=1
+endif
+ifdef TARGET_EXAMPLEDIRS_DEMO
+demo_all:
+	$(MAKE) -C demo all
+demo_debug:
+	$(MAKE) -C demo debug
+demo_smart:
+	$(MAKE) -C demo smart
+demo_release:
+	$(MAKE) -C demo release
+demo_units:
+	$(MAKE) -C demo units
+demo_examples:
+	$(MAKE) -C demo examples
+demo_shared:
+	$(MAKE) -C demo shared
+demo_install:
+	$(MAKE) -C demo install
+demo_sourceinstall:
+	$(MAKE) -C demo sourceinstall
+demo_exampleinstall:
+	$(MAKE) -C demo exampleinstall
+demo_distinstall:
+	$(MAKE) -C demo distinstall
+demo_zipinstall:
+	$(MAKE) -C demo zipinstall
+demo_zipsourceinstall:
+	$(MAKE) -C demo zipsourceinstall
+demo_zipexampleinstall:
+	$(MAKE) -C demo zipexampleinstall
+demo_zipdistinstall:
+	$(MAKE) -C demo zipdistinstall
+demo_clean:
+	$(MAKE) -C demo clean
+demo_distclean:
+	$(MAKE) -C demo distclean
+demo_cleanall:
+	$(MAKE) -C demo cleanall
+demo_info:
+	$(MAKE) -C demo info
+demo_makefiles:
+	$(MAKE) -C demo makefiles
+demo:
+	$(MAKE) -C demo all
+.PHONY: demo_all demo_debug demo_smart demo_release demo_units demo_examples demo_shared demo_install demo_sourceinstall demo_exampleinstall demo_distinstall demo_zipinstall demo_zipsourceinstall demo_zipexampleinstall demo_zipdistinstall demo_clean demo_distclean demo_cleanall demo_info demo_makefiles demo
+endif
 all: fpc_all
 debug: fpc_debug
 smart: fpc_smart
@@ -2147,7 +2348,7 @@ zipinstall: fpc_zipinstall
 zipsourceinstall: fpc_zipsourceinstall
 zipexampleinstall: fpc_zipexampleinstall
 zipdistinstall: fpc_zipdistinstall
-clean: fpc_clean
+clean: fpc_clean $(addsuffix _clean,$(TARGET_EXAMPLEDIRS))
 distclean: fpc_distclean
 cleanall: fpc_cleanall
 info: fpc_info

+ 2 - 2
packages/base/paszlib/Makefile.fpc

@@ -4,14 +4,14 @@
 
 [package]
 name=paszlib
-version=2.0.0
+version=2.2.0
 
 [require]
 packages=hash
 
 [target]
 units=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zip ziputils unzip
-examples=demo
+exampledirs=demo
 
 [install]
 fpcpackage=y

+ 1 - 2
packages/base/paszlib/demo/example.pas

@@ -18,7 +18,6 @@ program example;
 
 uses
   strings,
-  zutil,
   zbase,
   gzio,
   zinflate,
@@ -390,7 +389,7 @@ begin
   err := deflate(c_stream, Z_FULL_FLUSH);
   CHECK_ERR(err, 'deflate');
 
-  Inc(pzByteArray(compr)^[3]); { force an error in first compressed block }
+  Inc(pchar(compr)[3]); { force an error in first compressed block }
   c_stream.avail_in := len - 3;
 
   err := deflate(c_stream, Z_FINISH);

+ 36 - 42
packages/base/paszlib/demo/miniunz.pas

@@ -19,13 +19,13 @@ program MiniUnz;
   {$endif}
 {$endif}
 
-uses {$ifdef Delphi}
-  SysUtils,
+uses
+  sysutils,
+  {$ifdef Delphi}
   Windows,
- {$else}
-   {$endif}
-  zutil,
-  //zlib,
+  {$else}
+   zlib,ctypes,
+  {$endif}
   ziputils,
   unzip;
 
@@ -55,7 +55,7 @@ const
   end;
 
 {$else}
-  {$ifdef FPC}
+{$if defined(FPC) and defined(win32)}
 var
   hFile : THandle;
   ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite : TFileTime;
@@ -69,14 +69,8 @@ begin
   CloseHandle(hFile);
 end;
   {$else} {  msdos }
-var
-  f: file;
 begin
-  Assign(f, filename);
-  Reset(f, 1); { open file for reading }
-   { (Otherwise, close will update time) }
-  SetFTime(f,dosDate);
-  Close(f);
+  FileSetDate(filename,dosdate);
 end;
   {$endif}
 {$endif}
@@ -99,7 +93,7 @@ end;
   var
     buffer: PChar;
     p:      PChar;
-    len:    int;
+    len:    cint;
   var
     hold:   char;
   begin
@@ -109,7 +103,7 @@ end;
     if (len <= 0) then
       exit;
 
-    buffer := PChar(zcalloc(nil, len + 1, 1));
+    buffer := PChar(allocmem( len + 1));
 
     strcopy(buffer, newdir);
 
@@ -119,7 +113,7 @@ end;
     if mymkdir(buffer) then
     begin
       if Assigned(buffer) then
-        zcfree(nil, buffer);
+        freemem( buffer);
       makedir := True;
       exit;
     end;
@@ -135,7 +129,7 @@ end;
       begin
         WriteLn('couldn''t create directory ', buffer);
         if Assigned(buffer) then
-          zcfree(nil, buffer);
+          freemem( buffer);
         exit;
       end;
       if (hold = #0) then
@@ -144,7 +138,7 @@ end;
       Inc(p);
     end;
     if Assigned(buffer) then
-      zcfree(nil, buffer);
+      freemem( buffer);
     makedir := True;
   end;
 
@@ -172,13 +166,13 @@ end;
     LeadingZero := s;
   end;
 
-  function HexToStr(w: long): string;
+  function HexToStr(w: clong): string;
   const
     ByteToChar: array[0..$F] of char = '0123456789ABCDEF';
   var
     s: string;
-    i: int;
-    x: long;
+    i: cint;
+    x: clong;
   begin
     s := '';
     x := w;
@@ -190,18 +184,18 @@ end;
     HexToStr := s;
   end;
 
-  function do_list(uf: unzFile): int;
+  function do_list(uf: unzFile): cint;
   var
     i:      longword;
     gi:     unz_global_info;
-    err:    int;
+    err:    cint;
   var
     filename_inzip: array[0..255] of char;
     file_info: unz_file_info;
     ratio:  longword;
     string_method: string[255];
   var
-    iLevel: uInt;
+    iLevel: cuInt;
   begin
     err := unzGetGlobalInfo(uf, gi);
     if (err <> UNZ_OK) then
@@ -225,7 +219,7 @@ end;
       else
       if (file_info.compression_method = Z_DEFLATED) then
       begin
-        iLevel := uInt((file_info.flag and $06) div 2);
+        iLevel := cuInt((file_info.flag and $06) div 2);
         case iLevel of
           0: string_method    := 'Defl:N';
           1: string_method    := 'Defl:X';
@@ -261,19 +255,19 @@ end;
   end;
 
 
-  function do_extract_currentfile(uf: unzFile; const popt_extract_without_path: int; var popt_overwrite: int): int;
+  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;
-    err:    int;
+    err:    cint;
     fout:   FILEptr;
     buf:    pointer;
-    size_buf: uInt;
+    size_buf: cuInt;
     file_info: unz_file_info;
   var
     write_filename: PChar;
-    skip:   int;
+    skip:   cint;
   var
     rep:    char;
     ftestexist: FILEptr;
@@ -295,7 +289,7 @@ end;
     end;
 
     size_buf := WRITEBUFFERSIZE;
-    buf      := zcalloc(nil, size_buf, 1);
+    buf      := allocmem(size_buf);
     if (buf = nil) then
     begin
       WriteLn('Error allocating memory');
@@ -415,16 +409,16 @@ end;
     end;
 
     if buf <> nil then
-      zcfree(nil, buf);
+      freemem( buf);
     do_extract_currentfile := err;
   end;
 
 
-  function do_extract(uf: unzFile; opt_extract_without_path: int; opt_overwrite: int): int;
+  function do_extract(uf: unzFile; opt_extract_without_path: cint; opt_overwrite: cint): cint;
   var
     i:   longword;
     gi:  unz_global_info;
-    err: int;
+    err: cint;
   begin
     err := unzGetGlobalInfo(uf, gi);
     if (err <> UNZ_OK) then
@@ -450,7 +444,7 @@ end;
     do_extract := 0;
   end;
 
-  function do_extract_onefile(uf: unzFile; const filename: PChar; opt_extract_without_path: int; opt_overwrite: int): int;
+  function do_extract_onefile(uf: unzFile; const filename: PChar; opt_extract_without_path: cint; opt_overwrite: cint): cint;
   begin
     if (unzLocateFile(uf, filename, CASESENSITIVITY) <> UNZ_OK) then
     begin
@@ -467,20 +461,20 @@ end;
   end;
 
   { -------------------------------------------------------------------- }
-  function main: int;
+  function main: cint;
   const
     zipfilename: PChar = nil;
     filename_to_extract: PChar = nil;
   var
-    i:    int;
-    opt_do_list: int;
-    opt_do_extract: int;
-    opt_do_extract_withoutpath: int;
-    opt_overwrite: int;
+    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;
     uf:   unzFile;
   var
-    p:    int;
+    p:    cint;
     pstr: string[255];
     c:    char;
   begin

+ 20 - 23
packages/base/paszlib/demo/minizip.pas

@@ -11,18 +11,22 @@ program MiniZip;
   Pascal tranlastion
   Copyright (C) 2000 by Jacques Nomssi Nzali
   For conditions of distribution and use, see copyright notice in readme.txt
-}{$ifdef WIN32}
+}
+
+{$ifdef WIN32}
   {$define Delphi}
   {$ifndef FPC}
     {$define Delphi32}
   {$endif}
 {$endif}
 
-uses {$ifdef Delphi}
-  SysUtils,
-//  Windows,
+uses
+ Sysutils,
+ {$ifdef Delphi}
+  Windows,
  {$else}
-   {$endif}
+   zlib,ctypes,
+ {$endif}
   //zutil,
   //zlib,
   ziputils,
@@ -56,7 +60,7 @@ const
   end;
 
 {$else}
-{$ifdef FPC}
+{$ifdef delphi)} // fpcwin32
 function filetime(f : PChar;               { name of file to get info on }
    var tmzip : tm_zip; { return value: access, modific. and creation times }
    var dt : uLong) : uLong;                { dostime }
@@ -81,29 +85,22 @@ end;
 {$else}
 function filetime(f : PChar;               { name of file to get info on }
    var tmzip : tm_zip; { return value: access, modific. and creation times }
-   var dt : uLong) : uLong;                { dostime }
+   var dt : cuLong) : cuLong;                { dostime }
 var
   fl : file;
   yy, mm, dd, dow : Word;
   h, m, s, hund : Word; { For GetTime}
   dtrec : TDateTime; { For Pack/UnpackTime}
+  stime:tsystemtime;
 begin
-  {$i-}
-  Assign(fl, f);
-  Reset(fl, 1);
-  if IOresult = 0 then
-  begin
-    GetFTime(fl,dt); { Get creation time }
-    UnpackTime(dt, dtrec);
-    Close(fl);
-    tmzip.tm_sec  := dtrec.sec;
-    tmzip.tm_min  := dtrec.min;
-    tmzip.tm_hour := dtrec.hour;
-    tmzip.tm_mday := dtrec.day;
-    tmzip.tm_mon  := dtrec.month;
-    tmzip.tm_year := dtrec.year;
-  end;
-
+  dtrec:=FileDateToDateTime(fileage(f));
+  datetimetosystemtime(dtrec,stime);
+  tmzip.tm_sec  := stime.second;
+  tmzip.tm_min  := stime.minute;
+  tmzip.tm_hour := stime.hour;
+  tmzip.tm_mday := stime.day;
+  tmzip.tm_mon  := stime.month;
+  tmzip.tm_year := stime.year;
   filetime := 0;
 end;
 {$endif}