summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog32
-rw-r--r--INDEX3
-rw-r--r--Makefile2
-rw-r--r--Makefile.in2
-rw-r--r--README6
-rw-r--r--as400/zlib.inc6
-rwxr-xr-xconfigure6
-rw-r--r--contrib/README.contrib2
-rw-r--r--contrib/ada/buffer_demo.adb106
-rw-r--r--contrib/ada/mtest.adb11
-rw-r--r--contrib/ada/read.adb9
-rw-r--r--contrib/ada/readme.txt27
-rw-r--r--contrib/ada/zlib-streams.adb14
-rw-r--r--contrib/ada/zlib-streams.ads6
-rw-r--r--contrib/ada/zlib-thin.adb70
-rw-r--r--contrib/ada/zlib-thin.ads57
-rw-r--r--contrib/ada/zlib.adb143
-rw-r--r--contrib/ada/zlib.ads105
-rw-r--r--contrib/ada/zlib.gpr42
-rw-r--r--contrib/delphi/ZLib.pas4
-rw-r--r--contrib/infback9/infback9.c3
-rw-r--r--contrib/infback9/inftree9.c4
-rwxr-xr-xcontrib/masmx86/mkasm.bat2
-rw-r--r--contrib/minizip/ChangeLogUnzip8
-rw-r--r--contrib/minizip/crypt.h4
-rw-r--r--contrib/minizip/ioapi.c4
-rw-r--r--contrib/minizip/ioapi.h4
-rw-r--r--contrib/minizip/iowin32.c4
-rw-r--r--contrib/minizip/iowin32.h4
-rw-r--r--contrib/minizip/miniunz.c41
-rw-r--r--contrib/minizip/minizip.c37
-rw-r--r--contrib/minizip/mztools.c281
-rw-r--r--contrib/minizip/mztools.h31
-rw-r--r--contrib/minizip/unzip.c61
-rw-r--r--contrib/minizip/unzip.h14
-rw-r--r--contrib/minizip/zip.c26
-rw-r--r--contrib/minizip/zip.h5
-rw-r--r--contrib/pascal/zlibpas.pas2
-rw-r--r--contrib/untgz/untgz.c135
-rw-r--r--contrib/vstudio/vc7/zlib.rc6
-rw-r--r--crc32.c78
-rw-r--r--deflate.c2
-rw-r--r--deflate.h1
-rw-r--r--gzio.c4
-rw-r--r--infback.c3
-rw-r--r--inffast.c4
-rw-r--r--inflate.c3
-rw-r--r--inftrees.c5
-rw-r--r--projects/README.projects38
-rw-r--r--projects/visualc6/README.txt38
-rw-r--r--projects/visualc6/example.dsp278
-rw-r--r--projects/visualc6/minigzip.dsp278
-rw-r--r--projects/visualc6/zlib.dsp539
-rw-r--r--projects/visualc6/zlib.dsw59
-rw-r--r--qnx/package.qpg10
-rw-r--r--trees.c4
-rw-r--r--win32/DLL_FAQ.txt99
-rw-r--r--win32/zlib1.rc10
-rw-r--r--zconf.h83
-rw-r--r--zconf.in.h83
-rw-r--r--zlib.34
-rw-r--r--zlib.h10
-rw-r--r--zutil.h7
63 files changed, 2463 insertions, 506 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b69391..26e551e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,37 @@
1 1
2 ChangeLog file for zlib 2 ChangeLog file for zlib
3 3
4Changes in 1.2.1.2 (9 September 2004)
5- Update INDEX file
6- Fix trees.c to update strm->data_type (no one ever noticed!)
7- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
8- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
9- Add limited multitasking protection to DYNAMIC_CRC_TABLE
10- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
11- Don't declare strerror() under VMS [Mozilla]
12- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
13- Update contrib/ada [Anisimkov]
14- Update contrib/minizip [Vollant]
15- Fix configure to not hardcode directories for Darwin [Peterson]
16- Fix gzio.c to not return error on empty files [Brown]
17- Fix indentation; update version in contrib/delphi/ZLib.pas and
18 contrib/pascal/zlibpas.pas [Truta]
19- Update mkasm.bat in contrib/masmx86 [Truta]
20- Update contrib/untgz [Truta]
21- Add projects/README.projects [Truta]
22- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
23- Update win32/DLL_FAQ.txt [Truta]
24- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
25- Remove an unnecessary assignment to curr in inftrees.c [Truta]
26- Add OS/2 to exe builds in configure [Poltorak]
27- Remove err dummy parameter in zlib.h [Kientzle]
28
4Changes in 1.2.1.1 (9 January 2004) 29Changes in 1.2.1.1 (9 January 2004)
5- Updated email address in README 30- Update email address in README
6- Several FAQ updates 31- Several FAQ updates
7- Fixed a big fat bug in inftrees.c that prevented decoding valid 32- Fix a big fat bug in inftrees.c that prevented decoding valid
8 dynamic blocks with only literals and no distance codes. 33 dynamic blocks with only literals and no distance codes --
34 Thanks to "Hot Emu" for the bug report and sample file
9- Add a note to puff.c on no distance codes case. 35- Add a note to puff.c on no distance codes case.
10 36
11Changes in 1.2.1 (17 November 2003) 37Changes in 1.2.1 (17 November 2003)
diff --git a/INDEX b/INDEX
index a9de784..331b56b 100644
--- a/INDEX
+++ b/INDEX
@@ -8,9 +8,12 @@ algorithm.txt description of the (de)compression algorithm
8configure configure script for Unix 8configure configure script for Unix
9zconf.in.h template for zconf.h (used by configure) 9zconf.in.h template for zconf.h (used by configure)
10 10
11amiga/ makefiles for Amiga SAS C
12as400/ makefiles for IBM AS/400
11msdos/ makefiles for MSDOS 13msdos/ makefiles for MSDOS
12old/ makefiles for various architectures and zlib documentation 14old/ makefiles for various architectures and zlib documentation
13 files that have not yet been updated for zlib 1.2.x 15 files that have not yet been updated for zlib 1.2.x
16projects/ projects for various Integrated Development Environments
14qnx/ makefiles for QNX 17qnx/ makefiles for QNX
15win32/ makefiles for Windows 18win32/ makefiles for Windows
16 19
diff --git a/Makefile b/Makefile
index 33420fd..9f04797 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ CPP=$(CC) -E
30 30
31LIBS=libz.a 31LIBS=libz.a
32SHAREDLIB=libz.so 32SHAREDLIB=libz.so
33SHAREDLIBV=libz.so.1.2.1.1 33SHAREDLIBV=libz.so.1.2.1.2
34SHAREDLIBM=libz.so.1 34SHAREDLIBM=libz.so.1
35 35
36AR=ar rc 36AR=ar rc
diff --git a/Makefile.in b/Makefile.in
index 33420fd..9f04797 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -30,7 +30,7 @@ CPP=$(CC) -E
30 30
31LIBS=libz.a 31LIBS=libz.a
32SHAREDLIB=libz.so 32SHAREDLIB=libz.so
33SHAREDLIBV=libz.so.1.2.1.1 33SHAREDLIBV=libz.so.1.2.1.2
34SHAREDLIBM=libz.so.1 34SHAREDLIBM=libz.so.1
35 35
36AR=ar rc 36AR=ar rc
diff --git a/README b/README
index ffcf1c4..48f44e2 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
1ZLIB DATA COMPRESSION LIBRARY 1ZLIB DATA COMPRESSION LIBRARY
2 2
3zlib 1.2.1.1 is a general purpose data compression library. All the code is 3zlib 1.2.1.2 is a general purpose data compression library. All the code is
4thread safe. The data format used by the zlib library is described by RFCs 4thread safe. The data format used by the zlib library is described by RFCs
5(Request for Comments) 1950 to 1952 in the files 5(Request for Comments) 1950 to 1952 in the files
6http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) 6http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -34,7 +34,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
34issue of Dr. Dobb's Journal; a copy of the article is available in 34issue of Dr. Dobb's Journal; a copy of the article is available in
35http://dogma.net/markn/articles/zlibtool/zlibtool.htm 35http://dogma.net/markn/articles/zlibtool/zlibtool.htm
36 36
37The changes made in version 1.2.1.1 are documented in the file ChangeLog. 37The changes made in version 1.2.1.2 are documented in the file ChangeLog.
38 38
39Unsupported third party contributions are provided in directory "contrib". 39Unsupported third party contributions are provided in directory "contrib".
40 40
@@ -93,7 +93,7 @@ Acknowledgments:
93 93
94Copyright notice: 94Copyright notice:
95 95
96 (C) 1995-2003 Jean-loup Gailly and Mark Adler 96 (C) 1995-2004 Jean-loup Gailly and Mark Adler
97 97
98 This software is provided 'as-is', without any express or implied 98 This software is provided 'as-is', without any express or implied
99 warranty. In no event will the authors be held liable for any damages 99 warranty. In no event will the authors be held liable for any damages
diff --git a/as400/zlib.inc b/as400/zlib.inc
index de07084..bb24691 100644
--- a/as400/zlib.inc
+++ b/as400/zlib.inc
@@ -1,7 +1,7 @@
1 * ZLIB.INC - Interface to the general purpose compression library 1 * ZLIB.INC - Interface to the general purpose compression library
2 * 2 *
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE. 3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
4 * Version 1.2.1.1 4 * Version 1.2.1.2
5 * 5 *
6 * 6 *
7 * WARNING: 7 * WARNING:
@@ -20,8 +20,8 @@
20 * Constants 20 * Constants
21 ************************************************************************** 21 **************************************************************************
22 * 22 *
23 D ZLIB_VERSION C '1.2.1.1' Header's version 23 D ZLIB_VERSION C '1.2.1.2' Header's version
24 D ZLIB_VERNUM C X'1211' 24 D ZLIB_VERNUM C X'1212'
25 * 25 *
26 D Z_NO_FLUSH C 0 26 D Z_NO_FLUSH C 0
27 D Z_SYNC_FLUSH C 2 27 D Z_SYNC_FLUSH C 2
diff --git a/configure b/configure
index d698479..6e13859 100755
--- a/configure
+++ b/configure
@@ -77,7 +77,7 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
77 CFLAGS="$cflags" 77 CFLAGS="$cflags"
78 case `(uname -s || echo unknown) 2>/dev/null` in 78 case `(uname -s || echo unknown) 2>/dev/null` in
79 Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; 79 Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
80 CYGWIN* | Cygwin* | cygwin* ) 80 CYGWIN* | Cygwin* | cygwin* | OS/2* )
81 EXE='.exe';; 81 EXE='.exe';;
82 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 82 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
83 # (alain.bonnefoy@icbt.com) 83 # (alain.bonnefoy@icbt.com)
@@ -89,9 +89,7 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
89 SHAREDLIB=libz$shared_ext 89 SHAREDLIB=libz$shared_ext
90 SHAREDLIBV=libz.$VER$shared_ext 90 SHAREDLIBV=libz.$VER$shared_ext
91 SHAREDLIBM=libz.$VER1$shared_ext 91 SHAREDLIBM=libz.$VER1$shared_ext
92 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name /usr/lib/$SHAREDLIBV -compatibility_version $VER2 -current_version $VER"} 92 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBV -compatibility_version $VER2 -current_version $VER"};;
93 libdir='/usr/lib'
94 includedir='/usr/include';;
95 *) LDSHARED=${LDSHARED-"$cc -shared"};; 93 *) LDSHARED=${LDSHARED-"$cc -shared"};;
96 esac 94 esac
97else 95else
diff --git a/contrib/README.contrib b/contrib/README.contrib
index 8860f31..eae15aa 100644
--- a/contrib/README.contrib
+++ b/contrib/README.contrib
@@ -67,4 +67,4 @@ visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
67 How to use compress(), uncompress() and the gz* functions from VB 67 How to use compress(), uncompress() and the gz* functions from VB
68 68
69vstudio/ by Gilles Vollant <info@winimage.com> 69vstudio/ by Gilles Vollant <info@winimage.com>
70 Building zlib with Visual Studio .NET 70 Building a minizip-enhanced zlib with Visual Studio .NET
diff --git a/contrib/ada/buffer_demo.adb b/contrib/ada/buffer_demo.adb
new file mode 100644
index 0000000..46b8638
--- /dev/null
+++ b/contrib/ada/buffer_demo.adb
@@ -0,0 +1,106 @@
1----------------------------------------------------------------
2-- ZLib for Ada thick binding. --
3-- --
4-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
5-- --
6-- Open source license information is in the zlib.ads file. --
7----------------------------------------------------------------
8--
9-- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
10
11-- This demo program provided by Dr Steve Sangwine <sjs@essex.ac.uk>
12--
13-- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
14-- of exactly the correct size is used for decompressed data, and the last
15-- few bytes passed in to Zlib are checksum bytes.
16
17-- This program compresses a string of text, and then decompresses the
18-- compressed text into a buffer of the same size as the original text.
19
20with Ada.Streams; use Ada.Streams;
21with Ada.Text_IO;
22
23with ZLib; use ZLib;
24
25procedure Buffer_Demo is
26 EOL : Character renames ASCII.LF;
27 Text : constant String
28 := "Four score and seven years ago our fathers brought forth," & EOL &
29 "upon this continent, a new nation, conceived in liberty," & EOL &
30 "and dedicated to the proposition that `all men are created equal'.";
31
32 Source : Stream_Element_Array (1 .. Text'Length);
33 for Source'Address use Text'Address;
34
35begin
36 Ada.Text_IO.Put (Text);
37 Ada.Text_IO.New_Line;
38 Ada.Text_IO.Put_Line
39 ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
40
41 declare
42 Compressed_Data : Stream_Element_Array (1 .. Text'Length);
43 L : Stream_Element_Offset;
44 begin
45 Compress : declare
46 Compressor : Filter_Type;
47 I : Stream_Element_Offset;
48 begin
49 Deflate_Init (Compressor);
50
51 -- Compress the whole of T at once.
52
53 Translate (Compressor, Source, I, Compressed_Data, L, Finish);
54 pragma Assert (I = Source'Last);
55
56 Close (Compressor);
57
58 Ada.Text_IO.Put_Line
59 ("Compressed size : "
60 & Stream_Element_Offset'Image (L) & " bytes");
61 end Compress;
62
63 -- Now we decompress the data, passing short blocks of data to Zlib
64 -- (because this demonstrates the problem - the last block passed will
65 -- contain checksum information and there will be no output, only a
66 -- check inside Zlib that the checksum is correct).
67
68 Decompress : declare
69 Decompressor : Filter_Type;
70
71 Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
72
73 Block_Size : constant := 4;
74 -- This makes sure that the last block contains
75 -- only Adler checksum data.
76
77 P : Stream_Element_Offset := Compressed_Data'First - 1;
78 O : Stream_Element_Offset;
79 begin
80 Inflate_Init (Decompressor);
81
82 loop
83 Translate
84 (Decompressor,
85 Compressed_Data
86 (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
87 P,
88 Uncompressed_Data
89 (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
90 O,
91 No_Flush);
92
93 Ada.Text_IO.Put_Line
94 ("Total in : " & Count'Image (Total_In (Decompressor)) &
95 ", out : " & Count'Image (Total_Out (Decompressor)));
96
97 exit when P = L;
98 end loop;
99
100 Ada.Text_IO.New_Line;
101 Ada.Text_IO.Put_Line
102 ("Decompressed text matches original text : "
103 & Boolean'Image (Uncompressed_Data = Source));
104 end Decompress;
105 end;
106end Buffer_Demo;
diff --git a/contrib/ada/mtest.adb b/contrib/ada/mtest.adb
index 91a96cd..c4dfd08 100644
--- a/contrib/ada/mtest.adb
+++ b/contrib/ada/mtest.adb
@@ -5,10 +5,10 @@
5-- -- 5-- --
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8-- Continuous test for ZLib multithreading. If the test is fail 8-- Continuous test for ZLib multithreading. If the test would fail
9-- Wou should provide thread safe allocation routines for the Z_Stream. 9-- we should provide thread safe allocation routines for the Z_Stream.
10-- 10--
11-- $Id: mtest.adb,v 1.2 2003/08/12 12:11:05 vagul Exp $ 11-- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
12 12
13with ZLib; 13with ZLib;
14with Ada.Streams; 14with Ada.Streams;
@@ -148,6 +148,9 @@ procedure MTest is
148 148
149 pragma Unreferenced (Test); 149 pragma Unreferenced (Test);
150 150
151 Dummy : Character;
152
151begin 153begin
152 null; 154 Ada.Text_IO.Get_Immediate (Dummy);
155 Stop := True;
153end MTest; 156end MTest;
diff --git a/contrib/ada/read.adb b/contrib/ada/read.adb
index 184ea00..1f2efbf 100644
--- a/contrib/ada/read.adb
+++ b/contrib/ada/read.adb
@@ -6,7 +6,7 @@
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: read.adb,v 1.7 2003/08/12 12:12:35 vagul Exp $ 9-- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
10 10
11-- Test/demo program for the generic read interface. 11-- Test/demo program for the generic read interface.
12 12
@@ -68,7 +68,11 @@ procedure Read is
68 -- ZLib.Read 68 -- ZLib.Read
69 -- reading data from the File_In. 69 -- reading data from the File_In.
70 70
71 procedure Read is new ZLib.Read (Read, Read_Buffer, Read_First, Read_Last); 71 procedure Read is new ZLib.Read
72 (Read,
73 Read_Buffer,
74 Rest_First => Read_First,
75 Rest_Last => Read_Last);
72 76
73 ---------- 77 ----------
74 -- Read -- 78 -- Read --
@@ -103,6 +107,7 @@ procedure Read is
103 Pack_Size := 0; 107 Pack_Size := 0;
104 Offset := 1; 108 Offset := 1;
105 Read_First := Read_Buffer'Last + 1; 109 Read_First := Read_Buffer'Last + 1;
110 Read_Last := Read_Buffer'Last;
106 end Reset; 111 end Reset;
107 112
108begin 113begin
diff --git a/contrib/ada/readme.txt b/contrib/ada/readme.txt
index ad02c22..dec7ef3 100644
--- a/contrib/ada/readme.txt
+++ b/contrib/ada/readme.txt
@@ -1,20 +1,31 @@
1
2 ZLib for Ada thick binding (ZLib.Ada) 1 ZLib for Ada thick binding (ZLib.Ada)
3 Release 1.2 2 Release 1.3
4 3
5ZLib.Ada is a thick binding interface to the popular ZLib data 4ZLib.Ada is a thick binding interface to the popular ZLib data
6compression library, available at http://www.gzip.org/zlib/. 5compression library, available at http://www.gzip.org/zlib/.
7It provides Ada-style access to the ZLib C library. 6It provides Ada-style access to the ZLib C library.
8 7
9 8
10 Here are the main changes since ZLib.Ada 1.1: 9 Here are the main changes since ZLib.Ada 1.2:
10
11- Attension: ZLib.Read generic routine have a initialization requirement
12 for Read_Last parameter now. It is a bit incompartible with previous version,
13 but extends functionality, we could use new parameters Allow_Read_Some and
14 Flush now.
15
16- Added Is_Open routines to ZLib and ZLib.Streams packages.
11 17
12- The default header type has a name "Default" now. Auto is used only for 18- Add pragma Assert to check Stream_Element is 8 bit.
13 automatic GZip/ZLib header detection.
14 19
15- Added test for multitasking mtest.adb. 20- Fix extraction to buffer with exact known decompressed size. Error reported by
21 Steve Sangwine.
16 22
17- Added GNAT project file zlib.gpr. 23- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits
24 computers. Patch provided by Pascal Obry.
25
26- Add Status_Error exception definition.
27
28- Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit.
18 29
19 30
20 How to build ZLib.Ada under GNAT 31 How to build ZLib.Ada under GNAT
@@ -50,3 +61,5 @@ The routines from the package specifications are commented.
50 61
51Homepage: http://zlib-ada.sourceforge.net/ 62Homepage: http://zlib-ada.sourceforge.net/
52Author: Dmitriy Anisimkov <anisimkov@yahoo.com> 63Author: Dmitriy Anisimkov <anisimkov@yahoo.com>
64
65Contributors: Pascal Obry <pascal@obry.org>, Steve Sangwine <sjs@essex.ac.uk>
diff --git a/contrib/ada/zlib-streams.adb b/contrib/ada/zlib-streams.adb
index d213b5c..398664a 100644
--- a/contrib/ada/zlib-streams.adb
+++ b/contrib/ada/zlib-streams.adb
@@ -6,7 +6,7 @@
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: zlib-streams.adb,v 1.9 2003/08/12 13:15:31 vagul Exp $ 9-- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
10 10
11with Ada.Unchecked_Deallocation; 11with Ada.Unchecked_Deallocation;
12 12
@@ -90,6 +90,7 @@ package body ZLib.Streams is
90 90
91 Stream.Buffer := new Buffer_Subtype; 91 Stream.Buffer := new Buffer_Subtype;
92 Stream.Rest_First := Stream.Buffer'Last + 1; 92 Stream.Rest_First := Stream.Buffer'Last + 1;
93 Stream.Rest_Last := Stream.Buffer'Last;
93 end if; 94 end if;
94 end Create; 95 end Create;
95 96
@@ -113,6 +114,15 @@ package body ZLib.Streams is
113 end loop; 114 end loop;
114 end Flush; 115 end Flush;
115 116
117 -------------
118 -- Is_Open --
119 -------------
120
121 function Is_Open (Stream : Stream_Type) return Boolean is
122 begin
123 return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
124 end Is_Open;
125
116 ---------- 126 ----------
117 -- Read -- 127 -- Read --
118 ---------- 128 ----------
@@ -212,4 +222,4 @@ package body ZLib.Streams is
212 return Total_Out (Stream.Writer); 222 return Total_Out (Stream.Writer);
213 end Write_Total_Out; 223 end Write_Total_Out;
214 224
215end ZLib.Streams; 225end ZLib.Streams; \ No newline at end of file
diff --git a/contrib/ada/zlib-streams.ads b/contrib/ada/zlib-streams.ads
index 1d5e904..5c68667 100644
--- a/contrib/ada/zlib-streams.ads
+++ b/contrib/ada/zlib-streams.ads
@@ -6,7 +6,7 @@
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: zlib-streams.ads,v 1.11 2003/08/12 13:15:31 vagul Exp $ 9-- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
10 10
11package ZLib.Streams is 11package ZLib.Streams is
12 12
@@ -77,6 +77,8 @@ package ZLib.Streams is
77 -- !!! When the Need_Header is False ZLib-Ada is using undocumented 77 -- !!! When the Need_Header is False ZLib-Ada is using undocumented
78 -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers. 78 -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
79 79
80 function Is_Open (Stream : Stream_Type) return Boolean;
81
80 procedure Close (Stream : in out Stream_Type); 82 procedure Close (Stream : in out Stream_Type);
81 83
82private 84private
@@ -109,4 +111,4 @@ private
109 Writer : Filter_Type; 111 Writer : Filter_Type;
110 end record; 112 end record;
111 113
112end ZLib.Streams; 114end ZLib.Streams; \ No newline at end of file
diff --git a/contrib/ada/zlib-thin.adb b/contrib/ada/zlib-thin.adb
index 163bd5b..0ca4a71 100644
--- a/contrib/ada/zlib-thin.adb
+++ b/contrib/ada/zlib-thin.adb
@@ -6,12 +6,11 @@
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: zlib-thin.adb,v 1.6 2003/01/21 15:26:37 vagul Exp $ 9-- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
10 10
11package body ZLib.Thin is 11package body ZLib.Thin is
12 12
13 ZLIB_VERSION : constant Chars_Ptr := 13 ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
14 Interfaces.C.Strings.New_String ("1.1.4");
15 14
16 Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit; 15 Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
17 16
@@ -38,14 +37,6 @@ package body ZLib.Thin is
38 ------------------ 37 ------------------
39 38
40 function Deflate_Init 39 function Deflate_Init
41 (strm : in Z_Streamp;
42 level : in Int := Z_DEFAULT_COMPRESSION)
43 return Int is
44 begin
45 return deflateInit (strm, level, ZLIB_VERSION, Z_Stream_Size);
46 end Deflate_Init;
47
48 function Deflate_Init
49 (strm : Z_Streamp; 40 (strm : Z_Streamp;
50 level : Int; 41 level : Int;
51 method : Int; 42 method : Int;
@@ -69,16 +60,15 @@ package body ZLib.Thin is
69 -- Inflate_Init -- 60 -- Inflate_Init --
70 ------------------ 61 ------------------
71 62
72 function Inflate_Init (strm : Z_Streamp) return Int is
73 begin
74 return inflateInit (strm, ZLIB_VERSION, Z_Stream_Size);
75 end Inflate_Init;
76
77 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is 63 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
78 begin 64 begin
79 return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size); 65 return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
80 end Inflate_Init; 66 end Inflate_Init;
81 67
68 ------------------------
69 -- Last_Error_Message --
70 ------------------------
71
82 function Last_Error_Message (Strm : in Z_Stream) return String is 72 function Last_Error_Message (Strm : in Z_Stream) return String is
83 use Interfaces.C.Strings; 73 use Interfaces.C.Strings;
84 begin 74 begin
@@ -89,54 +79,28 @@ package body ZLib.Thin is
89 end if; 79 end if;
90 end Last_Error_Message; 80 end Last_Error_Message;
91 81
92 -------------
93 -- Need_In --
94 -------------
95
96 function Need_In (strm : Z_Stream) return Boolean is
97 begin
98 return strm.Avail_In = 0;
99 end Need_In;
100
101 --------------
102 -- Need_Out --
103 --------------
104
105 function Need_Out (strm : Z_Stream) return Boolean is
106 begin
107 return strm.Avail_Out = 0;
108 end Need_Out;
109
110 ------------ 82 ------------
111 -- Set_In -- 83 -- Set_In --
112 ------------ 84 ------------
113 85
114 procedure Set_In 86 procedure Set_In
115 (Strm : in out Z_Stream; 87 (Strm : in out Z_Stream;
116 Buffer : in Byte_Access; 88 Buffer : in Voidp;
117 Size : in UInt) is 89 Size : in UInt) is
118 begin 90 begin
119 Strm.Next_In := Buffer; 91 Strm.Next_In := Buffer;
120 Strm.Avail_In := Size; 92 Strm.Avail_In := Size;
121 end Set_In; 93 end Set_In;
122 94
123 procedure Set_In
124 (Strm : in out Z_Stream;
125 Buffer : in Voidp;
126 Size : in UInt) is
127 begin
128 Set_In (Strm, Bytes.To_Pointer (Buffer), Size);
129 end Set_In;
130
131 ------------------ 95 ------------------
132 -- Set_Mem_Func -- 96 -- Set_Mem_Func --
133 ------------------ 97 ------------------
134 98
135 procedure Set_Mem_Func 99 procedure Set_Mem_Func
136 (Strm : in out Z_Stream; 100 (Strm : in out Z_Stream;
137 Opaque : in Voidp; 101 Opaque : in Voidp;
138 Alloc : in alloc_func; 102 Alloc : in alloc_func;
139 Free : in free_func) is 103 Free : in free_func) is
140 begin 104 begin
141 Strm.opaque := Opaque; 105 Strm.opaque := Opaque;
142 Strm.zalloc := Alloc; 106 Strm.zalloc := Alloc;
@@ -149,21 +113,13 @@ package body ZLib.Thin is
149 113
150 procedure Set_Out 114 procedure Set_Out
151 (Strm : in out Z_Stream; 115 (Strm : in out Z_Stream;
152 Buffer : in Byte_Access; 116 Buffer : in Voidp;
153 Size : in UInt) is 117 Size : in UInt) is
154 begin 118 begin
155 Strm.Next_Out := Buffer; 119 Strm.Next_Out := Buffer;
156 Strm.Avail_Out := Size; 120 Strm.Avail_Out := Size;
157 end Set_Out; 121 end Set_Out;
158 122
159 procedure Set_Out
160 (Strm : in out Z_Stream;
161 Buffer : in Voidp;
162 Size : in UInt) is
163 begin
164 Set_Out (Strm, Bytes.To_Pointer (Buffer), Size);
165 end Set_Out;
166
167 -------------- 123 --------------
168 -- Total_In -- 124 -- Total_In --
169 -------------- 125 --------------
diff --git a/contrib/ada/zlib-thin.ads b/contrib/ada/zlib-thin.ads
index c227374..d4407eb 100644
--- a/contrib/ada/zlib-thin.ads
+++ b/contrib/ada/zlib-thin.ads
@@ -6,10 +6,11 @@
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: zlib-thin.ads,v 1.8 2003/08/12 13:16:51 vagul Exp $ 9-- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
10 10
11with Interfaces.C.Strings; 11with Interfaces.C.Strings;
12with System.Address_To_Access_Conversions; 12
13with System;
13 14
14private package ZLib.Thin is 15private package ZLib.Thin is
15 16
@@ -36,18 +37,18 @@ private package ZLib.Thin is
36 -- zconf.h:216 37 -- zconf.h:216
37 type Int is new Interfaces.C.int; 38 type Int is new Interfaces.C.int;
38 39
39 type ULong is new Interfaces.C.unsigned; -- 32 bits or more 40 type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
40 -- zconf.h:217 41 -- zconf.h:217
41 subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr; 42 subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
42 43
43 type ULong_Access is access ULong; 44 type ULong_Access is access ULong;
44 type Int_Access is access Int; 45 type Int_Access is access Int;
45 subtype Voidp is System.Address; -- zconf.h:232
46 46
47 package Bytes is new System.Address_To_Access_Conversions (Byte); 47 subtype Voidp is System.Address; -- zconf.h:232
48 48
49 subtype Byte_Access is Bytes.Object_Pointer; 49 subtype Byte_Access is Voidp;
50 50
51 Nul : constant Voidp := System.Null_Address;
51 -- end from zconf 52 -- end from zconf
52 53
53 Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125 54 Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
@@ -251,12 +252,6 @@ private package ZLib.Thin is
251 stream_size : Int) 252 stream_size : Int)
252 return Int; 253 return Int;
253 254
254 function Deflate_Init
255 (strm : in Z_Streamp;
256 level : in Int := Z_DEFAULT_COMPRESSION)
257 return Int;
258 pragma Inline (Deflate_Init);
259
260 function deflateInit2 255 function deflateInit2
261 (strm : Z_Streamp; 256 (strm : Z_Streamp;
262 level : Int; 257 level : Int;
@@ -284,9 +279,6 @@ private package ZLib.Thin is
284 stream_size : Int) 279 stream_size : Int)
285 return Int; 280 return Int;
286 281
287 function Inflate_Init (strm : Z_Streamp) return Int;
288 pragma Inline (Inflate_Init);
289
290 function inflateInit2 282 function inflateInit2
291 (strm : in Z_Streamp; 283 (strm : in Z_Streamp;
292 windowBits : in Int; 284 windowBits : in Int;
@@ -318,20 +310,6 @@ private package ZLib.Thin is
318 -- has dropped to zero. The application must initialize zalloc, zfree and 310 -- has dropped to zero. The application must initialize zalloc, zfree and
319 -- opaque before calling the init function. 311 -- opaque before calling the init function.
320 312
321 function Need_In (strm : in Z_Stream) return Boolean;
322 -- return true when we do not need to setup Next_In and Avail_In fields.
323 pragma Inline (Need_In);
324
325 function Need_Out (strm : in Z_Stream) return Boolean;
326 -- return true when we do not need to setup Next_Out and Avail_Out field.
327 pragma Inline (Need_Out);
328
329 procedure Set_In
330 (Strm : in out Z_Stream;
331 Buffer : in Byte_Access;
332 Size : in UInt);
333 pragma Inline (Set_In);
334
335 procedure Set_In 313 procedure Set_In
336 (Strm : in out Z_Stream; 314 (Strm : in out Z_Stream;
337 Buffer : in Voidp; 315 Buffer : in Voidp;
@@ -340,12 +318,6 @@ private package ZLib.Thin is
340 318
341 procedure Set_Out 319 procedure Set_Out
342 (Strm : in out Z_Stream; 320 (Strm : in out Z_Stream;
343 Buffer : in Byte_Access;
344 Size : in UInt);
345 pragma Inline (Set_Out);
346
347 procedure Set_Out
348 (Strm : in out Z_Stream;
349 Buffer : in Voidp; 321 Buffer : in Voidp;
350 Size : in UInt); 322 Size : in UInt);
351 pragma Inline (Set_Out); 323 pragma Inline (Set_Out);
@@ -388,19 +360,13 @@ private package ZLib.Thin is
388 360
389 function zlibCompileFlags return ULong; 361 function zlibCompileFlags return ULong;
390 362
391 function deflatePrime
392 (strm : Z_Streamp;
393 bits : Int;
394 value : Int)
395 return Int;
396
397private 363private
398 364
399 type Z_Stream is record -- zlib.h:68 365 type Z_Stream is record -- zlib.h:68
400 Next_In : Byte_Access; -- next input byte 366 Next_In : Voidp := Nul; -- next input byte
401 Avail_In : UInt := 0; -- number of bytes available at next_in 367 Avail_In : UInt := 0; -- number of bytes available at next_in
402 Total_In : ULong := 0; -- total nb of input bytes read so far 368 Total_In : ULong := 0; -- total nb of input bytes read so far
403 Next_Out : Byte_Access; -- next output byte should be put there 369 Next_Out : Voidp := Nul; -- next output byte should be put there
404 Avail_Out : UInt := 0; -- remaining free space at next_out 370 Avail_Out : UInt := 0; -- remaining free space at next_out
405 Total_Out : ULong := 0; -- total nb of bytes output so far 371 Total_Out : ULong := 0; -- total nb of bytes output so far
406 msg : Chars_Ptr; -- last error message, NULL if no error 372 msg : Chars_Ptr; -- last error message, NULL if no error
@@ -460,14 +426,13 @@ private
460 pragma Import (C, inflateSyncPoint, "inflateSyncPoint"); 426 pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
461 pragma Import (C, get_crc_table, "get_crc_table"); 427 pragma Import (C, get_crc_table, "get_crc_table");
462 428
463 -- added in zlib 1.2.1: 429 -- since zlib 1.2.0:
464 430
465 pragma Import (C, inflateCopy, "inflateCopy"); 431 pragma Import (C, inflateCopy, "inflateCopy");
466 pragma Import (C, compressBound, "compressBound"); 432 pragma Import (C, compressBound, "compressBound");
467 pragma Import (C, deflateBound, "deflateBound"); 433 pragma Import (C, deflateBound, "deflateBound");
468 pragma Import (C, gzungetc, "gzungetc"); 434 pragma Import (C, gzungetc, "gzungetc");
469 pragma Import (C, zlibCompileFlags, "zlibCompileFlags"); 435 pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
470 pragma Import (C, deflatePrime, "deflatePrime");
471 436
472 pragma Import (C, inflateBackInit, "inflateBackInit_"); 437 pragma Import (C, inflateBackInit, "inflateBackInit_");
473 438
diff --git a/contrib/ada/zlib.adb b/contrib/ada/zlib.adb
index 93bf885..8b6fd68 100644
--- a/contrib/ada/zlib.adb
+++ b/contrib/ada/zlib.adb
@@ -1,12 +1,12 @@
1---------------------------------------------------------------- 1----------------------------------------------------------------
2-- ZLib for Ada thick binding. -- 2-- ZLib for Ada thick binding. --
3-- -- 3-- --
4-- Copyright (C) 2002-2003 Dmitriy Anisimkov -- 4-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
5-- -- 5-- --
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: zlib.adb,v 1.19 2003/07/13 16:02:19 vagul Exp $ 9-- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
10 10
11with Ada.Exceptions; 11with Ada.Exceptions;
12with Ada.Unchecked_Conversion; 12with Ada.Unchecked_Conversion;
@@ -34,7 +34,7 @@ package body ZLib is
34 VERSION_ERROR); 34 VERSION_ERROR);
35 35
36 type Flate_Step_Function is access 36 type Flate_Step_Function is access
37 function (Strm : Thin.Z_Streamp; flush : Thin.Int) return Thin.Int; 37 function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
38 pragma Convention (C, Flate_Step_Function); 38 pragma Convention (C, Flate_Step_Function);
39 39
40 type Flate_End_Function is access 40 type Flate_End_Function is access
@@ -82,13 +82,13 @@ package body ZLib is
82 Flush_Finish : constant array (Boolean) of Flush_Mode 82 Flush_Finish : constant array (Boolean) of Flush_Mode
83 := (True => Finish, False => No_Flush); 83 := (True => Finish, False => No_Flush);
84 84
85 procedure Raise_Error (Stream : Z_Stream); 85 procedure Raise_Error (Stream : in Z_Stream);
86 pragma Inline (Raise_Error); 86 pragma Inline (Raise_Error);
87 87
88 procedure Raise_Error (Message : String); 88 procedure Raise_Error (Message : in String);
89 pragma Inline (Raise_Error); 89 pragma Inline (Raise_Error);
90 90
91 procedure Check_Error (Stream : Z_Stream; Code : Thin.Int); 91 procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
92 92
93 procedure Free is new Ada.Unchecked_Deallocation 93 procedure Free is new Ada.Unchecked_Deallocation
94 (Z_Stream, Z_Stream_Access); 94 (Z_Stream, Z_Stream_Access);
@@ -118,7 +118,7 @@ package body ZLib is
118 -- Check_Error -- 118 -- Check_Error --
119 ----------------- 119 -----------------
120 120
121 procedure Check_Error (Stream : Z_Stream; Code : Thin.Int) is 121 procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
122 use type Thin.Int; 122 use type Thin.Int;
123 begin 123 begin
124 if Code /= Thin.Z_OK then 124 if Code /= Thin.Z_OK then
@@ -138,10 +138,11 @@ package body ZLib is
138 is 138 is
139 Code : Thin.Int; 139 Code : Thin.Int;
140 begin 140 begin
141 Code := Flate (Filter.Compression).Done 141 if not Ignore_Error and then not Is_Open (Filter) then
142 (To_Thin_Access (Filter.Strm)); 142 raise Status_Error;
143 end if;
143 144
144 Filter.Opened := False; 145 Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
145 146
146 if Ignore_Error or else Code = Thin.Z_OK then 147 if Ignore_Error or else Code = Thin.Z_OK then
147 Free (Filter.Strm); 148 Free (Filter.Strm);
@@ -154,7 +155,7 @@ package body ZLib is
154 Ada.Exceptions.Raise_Exception 155 Ada.Exceptions.Raise_Exception
155 (ZLib_Error'Identity, 156 (ZLib_Error'Identity,
156 Return_Code_Enum'Image (Return_Code (Code)) 157 Return_Code_Enum'Image (Return_Code (Code))
157 & ": " & Error_Message); 158 & ": " & Error_Message);
158 end; 159 end;
159 end if; 160 end if;
160 end Close; 161 end Close;
@@ -170,10 +171,9 @@ package body ZLib is
170 is 171 is
171 use Thin; 172 use Thin;
172 begin 173 begin
173 return Unsigned_32 (crc32 174 return Unsigned_32 (crc32 (ULong (CRC),
174 (ULong (CRC), 175 Data'Address,
175 Bytes.To_Pointer (Data'Address), 176 Data'Length));
176 Data'Length));
177 end CRC32; 177 end CRC32;
178 178
179 procedure CRC32 179 procedure CRC32
@@ -192,13 +192,17 @@ package body ZLib is
192 Level : in Compression_Level := Default_Compression; 192 Level : in Compression_Level := Default_Compression;
193 Strategy : in Strategy_Type := Default_Strategy; 193 Strategy : in Strategy_Type := Default_Strategy;
194 Method : in Compression_Method := Deflated; 194 Method : in Compression_Method := Deflated;
195 Window_Bits : in Window_Bits_Type := 15; 195 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
196 Memory_Level : in Memory_Level_Type := 8; 196 Memory_Level : in Memory_Level_Type := Default_Memory_Level;
197 Header : in Header_Type := Default) 197 Header : in Header_Type := Default)
198 is 198 is
199 use type Thin.Int; 199 use type Thin.Int;
200 Win_Bits : Thin.Int := Thin.Int (Window_Bits); 200 Win_Bits : Thin.Int := Thin.Int (Window_Bits);
201 begin 201 begin
202 if Is_Open (Filter) then
203 raise Status_Error;
204 end if;
205
202 -- We allow ZLib to make header only in case of default header type. 206 -- We allow ZLib to make header only in case of default header type.
203 -- Otherwise we would either do header by ourselfs, or do not do 207 -- Otherwise we would either do header by ourselfs, or do not do
204 -- header at all. 208 -- header at all.
@@ -216,10 +220,9 @@ package body ZLib is
216 Filter.Offset := Simple_GZip_Header'Last + 1; 220 Filter.Offset := Simple_GZip_Header'Last + 1;
217 end if; 221 end if;
218 222
219 Filter.Strm := new Z_Stream; 223 Filter.Strm := new Z_Stream;
220 Filter.Compression := True; 224 Filter.Compression := True;
221 Filter.Stream_End := False; 225 Filter.Stream_End := False;
222 Filter.Opened := True;
223 Filter.Header := Header; 226 Filter.Header := Header;
224 227
225 if Thin.Deflate_Init 228 if Thin.Deflate_Init
@@ -255,18 +258,18 @@ package body ZLib is
255 ----------------------- 258 -----------------------
256 259
257 procedure Generic_Translate 260 procedure Generic_Translate
258 (Filter : in out ZLib.Filter_Type; 261 (Filter : in out ZLib.Filter_Type;
259 In_Buffer_Size : Integer := Default_Buffer_Size; 262 In_Buffer_Size : in Integer := Default_Buffer_Size;
260 Out_Buffer_Size : Integer := Default_Buffer_Size) 263 Out_Buffer_Size : in Integer := Default_Buffer_Size)
261 is 264 is
262 In_Buffer : Stream_Element_Array 265 In_Buffer : Stream_Element_Array
263 (1 .. Stream_Element_Offset (In_Buffer_Size)); 266 (1 .. Stream_Element_Offset (In_Buffer_Size));
264 Out_Buffer : Stream_Element_Array 267 Out_Buffer : Stream_Element_Array
265 (1 .. Stream_Element_Offset (Out_Buffer_Size)); 268 (1 .. Stream_Element_Offset (Out_Buffer_Size));
266 Last : Stream_Element_Offset; 269 Last : Stream_Element_Offset;
267 In_Last : Stream_Element_Offset; 270 In_Last : Stream_Element_Offset;
268 In_First : Stream_Element_Offset; 271 In_First : Stream_Element_Offset;
269 Out_Last : Stream_Element_Offset; 272 Out_Last : Stream_Element_Offset;
270 begin 273 begin
271 Main : loop 274 Main : loop
272 Data_In (In_Buffer, Last); 275 Data_In (In_Buffer, Last);
@@ -275,18 +278,21 @@ package body ZLib is
275 278
276 loop 279 loop
277 Translate 280 Translate
278 (Filter, 281 (Filter => Filter,
279 In_Buffer (In_First .. Last), 282 In_Data => In_Buffer (In_First .. Last),
280 In_Last, 283 In_Last => In_Last,
281 Out_Buffer, 284 Out_Data => Out_Buffer,
282 Out_Last, 285 Out_Last => Out_Last,
283 Flush_Finish (Last < In_Buffer'First)); 286 Flush => Flush_Finish (Last < In_Buffer'First));
284 287
285 Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last)); 288 if Out_Buffer'First <= Out_Last then
289 Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
290 end if;
286 291
287 exit Main when Stream_End (Filter); 292 exit Main when Stream_End (Filter);
288 293
289 -- The end of in buffer. 294 -- The end of in buffer.
295
290 exit when In_Last = Last; 296 exit when In_Last = Last;
291 297
292 In_First := In_Last + 1; 298 In_First := In_Last + 1;
@@ -301,7 +307,7 @@ package body ZLib is
301 307
302 procedure Inflate_Init 308 procedure Inflate_Init
303 (Filter : in out Filter_Type; 309 (Filter : in out Filter_Type;
304 Window_Bits : in Window_Bits_Type := 15; 310 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
305 Header : in Header_Type := Default) 311 Header : in Header_Type := Default)
306 is 312 is
307 use type Thin.Int; 313 use type Thin.Int;
@@ -320,6 +326,10 @@ package body ZLib is
320 end Check_Version; 326 end Check_Version;
321 327
322 begin 328 begin
329 if Is_Open (Filter) then
330 raise Status_Error;
331 end if;
332
323 case Header is 333 case Header is
324 when None => 334 when None =>
325 Check_Version; 335 Check_Version;
@@ -344,10 +354,9 @@ package body ZLib is
344 when Default => null; 354 when Default => null;
345 end case; 355 end case;
346 356
347 Filter.Strm := new Z_Stream; 357 Filter.Strm := new Z_Stream;
348 Filter.Compression := False; 358 Filter.Compression := False;
349 Filter.Stream_End := False; 359 Filter.Stream_End := False;
350 Filter.Opened := True;
351 Filter.Header := Header; 360 Filter.Header := Header;
352 361
353 if Thin.Inflate_Init 362 if Thin.Inflate_Init
@@ -357,16 +366,25 @@ package body ZLib is
357 end if; 366 end if;
358 end Inflate_Init; 367 end Inflate_Init;
359 368
369 -------------
370 -- Is_Open --
371 -------------
372
373 function Is_Open (Filter : in Filter_Type) return Boolean is
374 begin
375 return Filter.Strm /= null;
376 end Is_Open;
377
360 ----------------- 378 -----------------
361 -- Raise_Error -- 379 -- Raise_Error --
362 ----------------- 380 -----------------
363 381
364 procedure Raise_Error (Message : String) is 382 procedure Raise_Error (Message : in String) is
365 begin 383 begin
366 Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message); 384 Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
367 end Raise_Error; 385 end Raise_Error;
368 386
369 procedure Raise_Error (Stream : Z_Stream) is 387 procedure Raise_Error (Stream : in Z_Stream) is
370 begin 388 begin
371 Raise_Error (Last_Error_Message (Stream)); 389 Raise_Error (Last_Error_Message (Stream));
372 end Raise_Error; 390 end Raise_Error;
@@ -378,21 +396,29 @@ package body ZLib is
378 procedure Read 396 procedure Read
379 (Filter : in out Filter_Type; 397 (Filter : in out Filter_Type;
380 Item : out Ada.Streams.Stream_Element_Array; 398 Item : out Ada.Streams.Stream_Element_Array;
381 Last : out Ada.Streams.Stream_Element_Offset) 399 Last : out Ada.Streams.Stream_Element_Offset;
400 Flush : in Flush_Mode := No_Flush)
382 is 401 is
383 In_Last : Stream_Element_Offset; 402 In_Last : Stream_Element_Offset;
384 Item_First : Ada.Streams.Stream_Element_Offset := Item'First; 403 Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
404 V_Flush : Flush_Mode := Flush;
385 405
386 begin 406 begin
387 pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1); 407 pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
408 pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
388 409
389 loop 410 loop
390 if Rest_First > Buffer'Last then 411 if Rest_Last = Buffer'First - 1 then
412 V_Flush := Finish;
413
414 elsif Rest_First > Rest_Last then
391 Read (Buffer, Rest_Last); 415 Read (Buffer, Rest_Last);
392 Rest_First := Buffer'First; 416 Rest_First := Buffer'First;
393 end if;
394 417
395 pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last); 418 if Rest_Last < Buffer'First then
419 V_Flush := Finish;
420 end if;
421 end if;
396 422
397 Translate 423 Translate
398 (Filter => Filter, 424 (Filter => Filter,
@@ -400,11 +426,13 @@ package body ZLib is
400 In_Last => In_Last, 426 In_Last => In_Last,
401 Out_Data => Item (Item_First .. Item'Last), 427 Out_Data => Item (Item_First .. Item'Last),
402 Out_Last => Last, 428 Out_Last => Last,
403 Flush => Flush_Finish (Rest_Last < Rest_First)); 429 Flush => V_Flush);
404 430
405 Rest_First := In_Last + 1; 431 Rest_First := In_Last + 1;
406 432
407 exit when Last = Item'Last or else Stream_End (Filter); 433 exit when Stream_End (Filter)
434 or else Last = Item'Last
435 or else (Last >= Item'First and then Allow_Read_Some);
408 436
409 Item_First := Last + 1; 437 Item_First := Last + 1;
410 end loop; 438 end loop;
@@ -489,11 +517,11 @@ package body ZLib is
489 Code : Thin.Int; 517 Code : Thin.Int;
490 518
491 begin 519 begin
492 if Filter.Opened = False then 520 if not Is_Open (Filter) then
493 raise ZLib_Error; 521 raise Status_Error;
494 end if; 522 end if;
495 523
496 if Out_Data'Length = 0 then 524 if Out_Data'Length = 0 and then In_Data'Length = 0 then
497 raise Constraint_Error; 525 raise Constraint_Error;
498 end if; 526 end if;
499 527
@@ -514,7 +542,6 @@ package body ZLib is
514 - Stream_Element_Offset (Avail_In (Filter.Strm.all)); 542 - Stream_Element_Offset (Avail_In (Filter.Strm.all));
515 Out_Last := Out_Data'Last 543 Out_Last := Out_Data'Last
516 - Stream_Element_Offset (Avail_Out (Filter.Strm.all)); 544 - Stream_Element_Offset (Avail_Out (Filter.Strm.all));
517
518 end Translate_Auto; 545 end Translate_Auto;
519 546
520 -------------------- 547 --------------------
@@ -529,7 +556,7 @@ package body ZLib is
529 Out_Last : out Ada.Streams.Stream_Element_Offset; 556 Out_Last : out Ada.Streams.Stream_Element_Offset;
530 Flush : in Flush_Mode) 557 Flush : in Flush_Mode)
531 is 558 is
532 Out_First : Stream_Element_Offset; 559 Out_First : Stream_Element_Offset;
533 560
534 procedure Add_Data (Data : in Stream_Element_Array); 561 procedure Add_Data (Data : in Stream_Element_Array);
535 -- Add data to stream from the Filter.Offset till necessary, 562 -- Add data to stream from the Filter.Offset till necessary,
@@ -596,7 +623,7 @@ package body ZLib is
596 Add_Data (Simple_GZip_Header); 623 Add_Data (Simple_GZip_Header);
597 624
598 Translate_Auto 625 Translate_Auto
599 (Filter => Filter, 626 (Filter => Filter,
600 In_Data => In_Data, 627 In_Data => In_Data,
601 In_Last => In_Last, 628 In_Last => In_Last,
602 Out_Data => Out_Data (Out_First .. Out_Data'Last), 629 Out_Data => Out_Data (Out_First .. Out_Data'Last),
@@ -604,7 +631,6 @@ package body ZLib is
604 Flush => Flush); 631 Flush => Flush);
605 632
606 CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last)); 633 CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
607
608 end if; 634 end if;
609 635
610 if Filter.Stream_End and then Out_Last <= Out_Data'Last then 636 if Filter.Stream_End and then Out_Last <= Out_Data'Last then
@@ -642,10 +668,11 @@ package body ZLib is
642 procedure Write 668 procedure Write
643 (Filter : in out Filter_Type; 669 (Filter : in out Filter_Type;
644 Item : in Ada.Streams.Stream_Element_Array; 670 Item : in Ada.Streams.Stream_Element_Array;
645 Flush : in Flush_Mode) 671 Flush : in Flush_Mode := No_Flush)
646 is 672 is
647 Buffer : Stream_Element_Array (1 .. Buffer_Size); 673 Buffer : Stream_Element_Array (1 .. Buffer_Size);
648 In_Last, Out_Last : Stream_Element_Offset; 674 In_Last : Stream_Element_Offset;
675 Out_Last : Stream_Element_Offset;
649 In_First : Stream_Element_Offset := Item'First; 676 In_First : Stream_Element_Offset := Item'First;
650 begin 677 begin
651 if Item'Length = 0 and Flush = No_Flush then 678 if Item'Length = 0 and Flush = No_Flush then
@@ -654,7 +681,7 @@ package body ZLib is
654 681
655 loop 682 loop
656 Translate 683 Translate
657 (Filter => Filter, 684 (Filter => Filter,
658 In_Data => Item (In_First .. Item'Last), 685 In_Data => Item (In_First .. Item'Last),
659 In_Last => In_Last, 686 In_Last => In_Last,
660 Out_Data => Buffer, 687 Out_Data => Buffer,
diff --git a/contrib/ada/zlib.ads b/contrib/ada/zlib.ads
index b72e4d2..79ffc40 100644
--- a/contrib/ada/zlib.ads
+++ b/contrib/ada/zlib.ads
@@ -1,7 +1,7 @@
1------------------------------------------------------------------------------ 1------------------------------------------------------------------------------
2-- ZLib for Ada thick binding. -- 2-- ZLib for Ada thick binding. --
3-- -- 3-- --
4-- Copyright (C) 2002-2003 Dmitriy Anisimkov -- 4-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
5-- -- 5-- --
6-- This library is free software; you can redistribute it and/or modify -- 6-- This library is free software; you can redistribute it and/or modify --
7-- it under the terms of the GNU General Public License as published by -- 7-- it under the terms of the GNU General Public License as published by --
@@ -25,7 +25,7 @@
25-- covered by the GNU Public License. -- 25-- covered by the GNU Public License. --
26------------------------------------------------------------------------------ 26------------------------------------------------------------------------------
27 27
28-- $Id: zlib.ads,v 1.17 2003/08/12 13:19:07 vagul Exp $ 28-- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $
29 29
30with Ada.Streams; 30with Ada.Streams;
31 31
@@ -33,7 +33,8 @@ with Interfaces;
33 33
34package ZLib is 34package ZLib is
35 35
36 ZLib_Error : exception; 36 ZLib_Error : exception;
37 Status_Error : exception;
37 38
38 type Compression_Level is new Integer range -1 .. 9; 39 type Compression_Level is new Integer range -1 .. 9;
39 40
@@ -55,12 +56,15 @@ package ZLib is
55 56
56 subtype Count is Ada.Streams.Stream_Element_Count; 57 subtype Count is Ada.Streams.Stream_Element_Count;
57 58
59 Default_Memory_Level : constant Memory_Level_Type := 8;
60 Default_Window_Bits : constant Window_Bits_Type := 15;
61
58 ---------------------------------- 62 ----------------------------------
59 -- Compression method constants -- 63 -- Compression method constants --
60 ---------------------------------- 64 ----------------------------------
61 65
62 Deflated : constant Compression_Method; 66 Deflated : constant Compression_Method;
63 -- Only one method allowed in this ZLib version. 67 -- Only one method allowed in this ZLib version
64 68
65 --------------------------------- 69 ---------------------------------
66 -- Compression level constants -- 70 -- Compression level constants --
@@ -79,21 +83,29 @@ package ZLib is
79 -- Regular way for compression, no flush 83 -- Regular way for compression, no flush
80 84
81 Partial_Flush : constant Flush_Mode; 85 Partial_Flush : constant Flush_Mode;
82 -- will be removed, use Z_SYNC_FLUSH instead 86 -- Will be removed, use Z_SYNC_FLUSH instead
83 87
84 Sync_Flush : constant Flush_Mode; 88 Sync_Flush : constant Flush_Mode;
85 -- all pending output is flushed to the output buffer and the output 89 -- All pending output is flushed to the output buffer and the output
86 -- is aligned on a byte boundary, so that the decompressor can get all 90 -- is aligned on a byte boundary, so that the decompressor can get all
87 -- input data available so far. (In particular avail_in is zero after the 91 -- input data available so far. (In particular avail_in is zero after the
88 -- call if enough output space has been provided before the call.) 92 -- call if enough output space has been provided before the call.)
89 -- Flushing may degrade compression for some compression algorithms and so 93 -- Flushing may degrade compression for some compression algorithms and so
90 -- it should be used only when necessary. 94 -- it should be used only when necessary.
91 95
96 Block_Flush : constant Flush_Mode;
97 -- Z_BLOCK requests that inflate() stop
98 -- if and when it get to the next deflate block boundary. When decoding the
99 -- zlib or gzip format, this will cause inflate() to return immediately
100 -- after the header and before the first block. When doing a raw inflate,
101 -- inflate() will go ahead and process the first block, and will return
102 -- when it gets to the end of that block, or when it runs out of data.
103
92 Full_Flush : constant Flush_Mode; 104 Full_Flush : constant Flush_Mode;
93 -- all output is flushed as with SYNC_FLUSH, and the compression state 105 -- All output is flushed as with SYNC_FLUSH, and the compression state
94 -- is reset so that decompression can restart from this point if previous 106 -- is reset so that decompression can restart from this point if previous
95 -- compressed data has been damaged or if random access is desired. Using 107 -- compressed data has been damaged or if random access is desired. Using
96 -- FULL_FLUSH too often can seriously degrade the compression. 108 -- Full_Flush too often can seriously degrade the compression.
97 109
98 Finish : constant Flush_Mode; 110 Finish : constant Flush_Mode;
99 -- Just for tell the compressor that input data is complete. 111 -- Just for tell the compressor that input data is complete.
@@ -111,7 +123,7 @@ package ZLib is
111 123
112 Default_Buffer_Size : constant := 4096; 124 Default_Buffer_Size : constant := 4096;
113 125
114 type Filter_Type is limited private; 126 type Filter_Type is tagged limited private;
115 -- The filter is for compression and for decompression. 127 -- The filter is for compression and for decompression.
116 -- The usage of the type is depend of its initialization. 128 -- The usage of the type is depend of its initialization.
117 129
@@ -124,8 +136,8 @@ package ZLib is
124 Level : in Compression_Level := Default_Compression; 136 Level : in Compression_Level := Default_Compression;
125 Strategy : in Strategy_Type := Default_Strategy; 137 Strategy : in Strategy_Type := Default_Strategy;
126 Method : in Compression_Method := Deflated; 138 Method : in Compression_Method := Deflated;
127 Window_Bits : in Window_Bits_Type := 15; 139 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
128 Memory_Level : in Memory_Level_Type := 8; 140 Memory_Level : in Memory_Level_Type := Default_Memory_Level;
129 Header : in Header_Type := Default); 141 Header : in Header_Type := Default);
130 -- Compressor initialization. 142 -- Compressor initialization.
131 -- When Header parameter is Auto or Default, then default zlib header 143 -- When Header parameter is Auto or Default, then default zlib header
@@ -136,7 +148,7 @@ package ZLib is
136 148
137 procedure Inflate_Init 149 procedure Inflate_Init
138 (Filter : in out Filter_Type; 150 (Filter : in out Filter_Type;
139 Window_Bits : in Window_Bits_Type := 15; 151 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
140 Header : in Header_Type := Default); 152 Header : in Header_Type := Default);
141 -- Decompressor initialization. 153 -- Decompressor initialization.
142 -- Default header type mean that ZLib default header is expecting in the 154 -- Default header type mean that ZLib default header is expecting in the
@@ -146,10 +158,14 @@ package ZLib is
146 -- input compressed stream. 158 -- input compressed stream.
147 -- Auto header type mean that header type (GZip or Native) would be 159 -- Auto header type mean that header type (GZip or Native) would be
148 -- detected automatically in the input stream. 160 -- detected automatically in the input stream.
149 -- Note that header types parameter values None, GZip and Auto is 161 -- Note that header types parameter values None, GZip and Auto are
150 -- supporting for inflate routine only in ZLib versions 1.2.0.2 and later. 162 -- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
151 -- Deflate_Init is supporting all header types. 163 -- Deflate_Init is supporting all header types.
152 164
165 function Is_Open (Filter : in Filter_Type) return Boolean;
166 pragma Inline (Is_Open);
167 -- Is the filter opened for compression or decompression.
168
153 procedure Close 169 procedure Close
154 (Filter : in out Filter_Type; 170 (Filter : in out Filter_Type;
155 Ignore_Error : in Boolean := False); 171 Ignore_Error : in Boolean := False);
@@ -167,31 +183,31 @@ package ZLib is
167 (Filter : in out Filter_Type; 183 (Filter : in out Filter_Type;
168 In_Buffer_Size : in Integer := Default_Buffer_Size; 184 In_Buffer_Size : in Integer := Default_Buffer_Size;
169 Out_Buffer_Size : in Integer := Default_Buffer_Size); 185 Out_Buffer_Size : in Integer := Default_Buffer_Size);
170 -- Compressing/decompressing data arrived from Data_In routine 186 -- Compress/decompress data fetch from Data_In routine and pass the result
171 -- to the Data_Out routine. User should provide Data_In and Data_Out 187 -- to the Data_Out routine. User should provide Data_In and Data_Out
172 -- for compression/decompression data flow. 188 -- for compression/decompression data flow.
173 -- Compression or decompression depend on initialization of Filter. 189 -- Compression or decompression depend on Filter initialization.
174 190
175 function Total_In (Filter : in Filter_Type) return Count; 191 function Total_In (Filter : in Filter_Type) return Count;
176 pragma Inline (Total_In); 192 pragma Inline (Total_In);
177 -- Return total number of input bytes read so far. 193 -- Returns total number of input bytes read so far
178 194
179 function Total_Out (Filter : in Filter_Type) return Count; 195 function Total_Out (Filter : in Filter_Type) return Count;
180 pragma Inline (Total_Out); 196 pragma Inline (Total_Out);
181 -- Return total number of bytes output so far. 197 -- Returns total number of bytes output so far
182 198
183 function CRC32 199 function CRC32
184 (CRC : in Unsigned_32; 200 (CRC : in Unsigned_32;
185 Data : in Ada.Streams.Stream_Element_Array) 201 Data : in Ada.Streams.Stream_Element_Array)
186 return Unsigned_32; 202 return Unsigned_32;
187 pragma Inline (CRC32); 203 pragma Inline (CRC32);
188 -- Calculate CRC32, it could be necessary for make gzip format. 204 -- Compute CRC32, it could be necessary for make gzip format
189 205
190 procedure CRC32 206 procedure CRC32
191 (CRC : in out Unsigned_32; 207 (CRC : in out Unsigned_32;
192 Data : in Ada.Streams.Stream_Element_Array); 208 Data : in Ada.Streams.Stream_Element_Array);
193 pragma Inline (CRC32); 209 pragma Inline (CRC32);
194 -- Calculate CRC32, it could be necessary for make gzip format. 210 -- Compute CRC32, it could be necessary for make gzip format
195 211
196 ------------------------------------------------- 212 -------------------------------------------------
197 -- Below is more complex low level routines. -- 213 -- Below is more complex low level routines. --
@@ -204,15 +220,11 @@ package ZLib is
204 Out_Data : out Ada.Streams.Stream_Element_Array; 220 Out_Data : out Ada.Streams.Stream_Element_Array;
205 Out_Last : out Ada.Streams.Stream_Element_Offset; 221 Out_Last : out Ada.Streams.Stream_Element_Offset;
206 Flush : in Flush_Mode); 222 Flush : in Flush_Mode);
207 -- Compressing/decompressing the datas from In_Data buffer to the 223 -- Compress/decompress the In_Data buffer and place the result into
208 -- Out_Data buffer. 224 -- Out_Data. In_Last is the index of last element from In_Data accepted by
209 -- In_Data is incoming data portion, 225 -- the Filter. Out_Last is the last element of the received data from
210 -- In_Last is the index of last element from In_Data accepted by the 226 -- Filter. To tell the filter that incoming data are complete put the
211 -- Filter. 227 -- Flush parameter to Finish.
212 -- Out_Data is the buffer for output data from the filter.
213 -- Out_Last is the last element of the received data from Filter.
214 -- To tell the filter that incoming data is complete put the
215 -- Flush parameter to FINISH.
216 228
217 function Stream_End (Filter : in Filter_Type) return Boolean; 229 function Stream_End (Filter : in Filter_Type) return Boolean;
218 pragma Inline (Stream_End); 230 pragma Inline (Stream_End);
@@ -239,10 +251,9 @@ package ZLib is
239 procedure Write 251 procedure Write
240 (Filter : in out Filter_Type; 252 (Filter : in out Filter_Type;
241 Item : in Ada.Streams.Stream_Element_Array; 253 Item : in Ada.Streams.Stream_Element_Array;
242 Flush : in Flush_Mode); 254 Flush : in Flush_Mode := No_Flush);
243 -- Compressing/Decompressing data from Item to the 255 -- Compress/Decompress data from Item to the generic parameter procedure
244 -- generic parameter procedure Write. 256 -- Write. Output buffer size could be set in Buffer_Size generic parameter.
245 -- Output buffer size could be set in Buffer_Size generic parameter.
246 257
247 generic 258 generic
248 with procedure Read 259 with procedure Read
@@ -257,33 +268,41 @@ package ZLib is
257 268
258 Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset; 269 Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
259 -- Rest_First have to be initialized to Buffer'Last + 1 270 -- Rest_First have to be initialized to Buffer'Last + 1
271 -- Rest_Last have to be initialized to Buffer'Last
260 -- before usage. 272 -- before usage.
261 273
274 Allow_Read_Some : in Boolean := False;
275 -- Is it allowed to return Last < Item'Last before end of data.
276
262 procedure Read 277 procedure Read
263 (Filter : in out Filter_Type; 278 (Filter : in out Filter_Type;
264 Item : out Ada.Streams.Stream_Element_Array; 279 Item : out Ada.Streams.Stream_Element_Array;
265 Last : out Ada.Streams.Stream_Element_Offset); 280 Last : out Ada.Streams.Stream_Element_Offset;
266 -- Compressing/Decompressing data from generic parameter 281 Flush : in Flush_Mode := No_Flush);
267 -- procedure Read to the Item. 282 -- Compress/Decompress data from generic parameter procedure Read to the
268 -- User should provide Buffer for the operation 283 -- Item. User should provide Buffer and initialized Rest_First, Rest_Last
269 -- and Rest_First variable first time initialized to the Buffer'Last + 1. 284 -- indicators. If Allow_Read_Some is True, Read routines could return
285 -- Last < Item'Last only at end of stream.
270 286
271private 287private
272 288
273 use Ada.Streams; 289 use Ada.Streams;
274 290
275 type Flush_Mode is new Integer range 0 .. 4; 291 pragma Assert (Ada.Streams.Stream_Element'Size = 8);
292 pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
293
294 type Flush_Mode is new Integer range 0 .. 5;
276 295
277 type Compression_Method is new Integer range 8 .. 8; 296 type Compression_Method is new Integer range 8 .. 8;
278 297
279 type Strategy_Type is new Integer range 0 .. 3; 298 type Strategy_Type is new Integer range 0 .. 3;
280 299
281 No_Flush : constant Flush_Mode := 0; 300 No_Flush : constant Flush_Mode := 0;
301 Partial_Flush : constant Flush_Mode := 1;
282 Sync_Flush : constant Flush_Mode := 2; 302 Sync_Flush : constant Flush_Mode := 2;
283 Full_Flush : constant Flush_Mode := 3; 303 Full_Flush : constant Flush_Mode := 3;
284 Finish : constant Flush_Mode := 4; 304 Finish : constant Flush_Mode := 4;
285 Partial_Flush : constant Flush_Mode := 1; 305 Block_Flush : constant Flush_Mode := 5;
286 -- will be removed, use Z_SYNC_FLUSH instead
287 306
288 Filtered : constant Strategy_Type := 1; 307 Filtered : constant Strategy_Type := 1;
289 Huffman_Only : constant Strategy_Type := 2; 308 Huffman_Only : constant Strategy_Type := 2;
@@ -296,7 +315,7 @@ private
296 315
297 type Z_Stream_Access is access all Z_Stream; 316 type Z_Stream_Access is access all Z_Stream;
298 317
299 type Filter_Type is record 318 type Filter_Type is tagged limited record
300 Strm : Z_Stream_Access; 319 Strm : Z_Stream_Access;
301 Compression : Boolean; 320 Compression : Boolean;
302 Stream_End : Boolean; 321 Stream_End : Boolean;
@@ -304,8 +323,6 @@ private
304 CRC : Unsigned_32; 323 CRC : Unsigned_32;
305 Offset : Stream_Element_Offset; 324 Offset : Stream_Element_Offset;
306 -- Offset for gzip header/footer output. 325 -- Offset for gzip header/footer output.
307
308 Opened : Boolean := False;
309 end record; 326 end record;
310 327
311end ZLib; 328end ZLib;
diff --git a/contrib/ada/zlib.gpr b/contrib/ada/zlib.gpr
index 0f58985..88f51cc 100644
--- a/contrib/ada/zlib.gpr
+++ b/contrib/ada/zlib.gpr
@@ -1,21 +1,21 @@
1project Zlib is 1project Zlib is
2 2
3 for Languages use ("Ada"); 3 for Languages use ("Ada");
4 for Source_Dirs use ("."); 4 for Source_Dirs use (".");
5 for Object_Dir use "."; 5 for Object_Dir use ".";
6 for Main use ("test.adb", "mtest.adb", "read.adb"); 6 for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo");
7 7
8 package Compiler is 8 package Compiler is
9 for Default_Switches ("ada") use ("-gnatwbcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst"); 9 for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");
10 end Compiler; 10 end Compiler;
11 11
12 package Linker is 12 package Linker is
13 for Default_Switches ("ada") use ("-lz"); 13 for Default_Switches ("ada") use ("-lz");
14 end Linker; 14 end Linker;
15 15
16 package Builder is 16 package Builder is
17 for Default_Switches ("ada") use ("-s", "-gnatQ"); 17 for Default_Switches ("ada") use ("-s", "-gnatQ");
18 end Builder; 18 end Builder;
19 19
20end Zlib; 20end Zlib;
21 21
diff --git a/contrib/delphi/ZLib.pas b/contrib/delphi/ZLib.pas
index 61ffd08..8853866 100644
--- a/contrib/delphi/ZLib.pas
+++ b/contrib/delphi/ZLib.pas
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer); 152 const OutBuf: Pointer; BufSize: Integer);
153 153
154const 154const
155 zlib_version = '1.2.1'; 155 zlib_version = '1.2.2';
156 156
157type 157type
158 EZlibError = class(Exception); 158 EZlibError = class(Exception);
@@ -510,7 +510,7 @@ begin
510 Result := Count - FZRec.avail_out; 510 Result := Count - FZRec.avail_out;
511 Exit; 511 Exit;
512 end; 512 end;
513 FZRec.next_in := FBuffer; 513 FZRec.next_in := FBuffer;
514 FStrmPos := FStrm.Position; 514 FStrmPos := FStrm.Position;
515 Progress(Self); 515 Progress(Self);
516 end; 516 end;
diff --git a/contrib/infback9/infback9.c b/contrib/infback9/infback9.c
index 34a95fc..103d901 100644
--- a/contrib/infback9/infback9.c
+++ b/contrib/infback9/infback9.c
@@ -430,6 +430,9 @@ void FAR *out_desc;
430 } 430 }
431 } 431 }
432 432
433 /* handle error breaks in while */
434 if (mode == BAD) break;
435
433 /* build code tables */ 436 /* build code tables */
434 state->next = state->codes; 437 state->next = state->codes;
435 lencode = (code const FAR *)(state->next); 438 lencode = (code const FAR *)(state->next);
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c
index 337a277..5fd5b4a 100644
--- a/contrib/infback9/inftree9.c
+++ b/contrib/infback9/inftree9.c
@@ -9,7 +9,7 @@
9#define MAXBITS 15 9#define MAXBITS 15
10 10
11const char inflate9_copyright[] = 11const char inflate9_copyright[] =
12 " inflate9 1.2.1.1 Copyright 1995-2003 Mark Adler "; 12 " inflate9 1.2.1.2 Copyright 1995-2004 Mark Adler ";
13/* 13/*
14 If you use the zlib library in a product, an acknowledgment is welcome 14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot 15 in the documentation of your product. If for some reason you cannot
@@ -64,7 +64,7 @@ unsigned short FAR *work;
64 static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 64 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
65 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 65 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, 66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
67 133, 133, 133, 133, 144, 202, 196}; 67 133, 133, 133, 133, 144, 77, 194};
68 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 68 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
69 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 69 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
diff --git a/contrib/masmx86/mkasm.bat b/contrib/masmx86/mkasm.bat
index f3fa0a0..70a51f8 100755
--- a/contrib/masmx86/mkasm.bat
+++ b/contrib/masmx86/mkasm.bat
@@ -1,3 +1,3 @@
1cl /I..\.. /O2 /c gvmat32c.c 1cl /DASMV /I..\.. /O2 /c gvmat32c.c
2ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm 2ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm
3ml /coff /Zi /c /Flinffas32.lst inffas32.asm 3ml /coff /Zi /c /Flinffas32.lst inffas32.asm
diff --git a/contrib/minizip/ChangeLogUnzip b/contrib/minizip/ChangeLogUnzip
index d7d4b6b..4be4d16 100644
--- a/contrib/minizip/ChangeLogUnzip
+++ b/contrib/minizip/ChangeLogUnzip
@@ -1,3 +1,11 @@
1Change in 1.01b (20 may 04)
2- Integrate patch from Debian package (submited by Mark Brown)
3- Add tools mztools from Xavier Roche
4
5Change in 1.01 (8 may 04)
6- fix buffer overrun risk in unzip.c (Xavier Roche)
7- fix a minor buffer insecurity in minizip.c (Mike Whittaker)
8
1Change in 1.00: (10 sept 03) 9Change in 1.00: (10 sept 03)
2- rename to 1.00 10- rename to 1.00
3- cosmetic code change 11- cosmetic code change
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h
index 9c7a89c..7f8a634 100644
--- a/contrib/minizip/crypt.h
+++ b/contrib/minizip/crypt.h
@@ -1,9 +1,9 @@
1/* crypt.h -- base code for crypt/uncrypt ZIPfile 1/* crypt.h -- base code for crypt/uncrypt ZIPfile
2 2
3 3
4 Version 1.00, September 10th, 2003 4 Version 1.01, May 8th, 2004
5 5
6 Copyright (C) 1998-2003 Gilles Vollant 6 Copyright (C) 1998-2004 Gilles Vollant
7 7
8 This code is a modified version of crypting code in Infozip distribution 8 This code is a modified version of crypting code in Infozip distribution
9 9
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c
index 80443b7..6ddfd36 100644
--- a/contrib/minizip/ioapi.c
+++ b/contrib/minizip/ioapi.c
@@ -1,9 +1,9 @@
1/* ioapi.c -- IO base function header for compress/uncompress .zip 1/* ioapi.c -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 3
4 Version 1.00, September 10th, 2003 4 Version 1.01, May 8th, 2004
5 5
6 Copyright (C) 1998-2003 Gilles Vollant 6 Copyright (C) 1998-2004 Gilles Vollant
7*/ 7*/
8 8
9#include <stdio.h> 9#include <stdio.h>
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h
index 6bc2a2c..b761161 100644
--- a/contrib/minizip/ioapi.h
+++ b/contrib/minizip/ioapi.h
@@ -1,9 +1,9 @@
1/* ioapi.h -- IO base function header for compress/uncompress .zip 1/* ioapi.h -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 3
4 Version 1.00, September 10th, 2003 4 Version 1.01, May 8th, 2004
5 5
6 Copyright (C) 1998-2003 Gilles Vollant 6 Copyright (C) 1998-2004 Gilles Vollant
7*/ 7*/
8 8
9#ifndef _ZLIBIOAPI_H 9#ifndef _ZLIBIOAPI_H
diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c
index 02b27cb..940dc0b 100644
--- a/contrib/minizip/iowin32.c
+++ b/contrib/minizip/iowin32.c
@@ -2,9 +2,9 @@
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 This IO API version uses the Win32 API (for Microsoft Windows) 3 This IO API version uses the Win32 API (for Microsoft Windows)
4 4
5 Version 1.00, September 10th, 2003 5 Version 1.01, May 8th, 2004
6 6
7 Copyright (C) 1998-2003 Gilles Vollant 7 Copyright (C) 1998-2004 Gilles Vollant
8*/ 8*/
9 9
10#include <stdlib.h> 10#include <stdlib.h>
diff --git a/contrib/minizip/iowin32.h b/contrib/minizip/iowin32.h
index c0ebd50..8774fe7 100644
--- a/contrib/minizip/iowin32.h
+++ b/contrib/minizip/iowin32.h
@@ -2,9 +2,9 @@
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 This IO API version uses the Win32 API (for Microsoft Windows) 3 This IO API version uses the Win32 API (for Microsoft Windows)
4 4
5 Version 1.00, September 10th, 2003 5 Version 1.01, May 8th, 2004
6 6
7 Copyright (C) 1998-2003 Gilles Vollant 7 Copyright (C) 1998-2004 Gilles Vollant
8*/ 8*/
9 9
10#include <windows.h> 10#include <windows.h>
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index c8cf81e..11b7260 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -1,3 +1,11 @@
1/*
2 miniunz.c
3 Version 1.01b, May 30th, 2004
4
5 Copyright (C) 1998-2004 Gilles Vollant
6*/
7
8
1#include <stdio.h> 9#include <stdio.h>
2#include <stdlib.h> 10#include <stdlib.h>
3#include <string.h> 11#include <string.h>
@@ -27,7 +35,7 @@
27 mini unzip, demo of unzip package 35 mini unzip, demo of unzip package
28 36
29 usage : 37 usage :
30 Usage : miniunz [-exvlo] file.zip [file_to_extract] 38 Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir]
31 39
32 list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT 40 list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
33 if it exists 41 if it exists
@@ -140,17 +148,18 @@ int makedir (newdir)
140 148
141void do_banner() 149void do_banner()
142{ 150{
143 printf("MiniUnz 1.00, demo of zLib + Unz package written by Gilles Vollant\n"); 151 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
144 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 152 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
145} 153}
146 154
147void do_help() 155void do_help()
148{ 156{
149 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.]\n\n" \ 157 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
150 " -e Extract without pathname (junk paths)\n" \ 158 " -e Extract without pathname (junk paths)\n" \
151 " -x Extract with pathname\n" \ 159 " -x Extract with pathname\n" \
152 " -v list files\n" \ 160 " -v list files\n" \
153 " -l list files\n" \ 161 " -l list files\n" \
162 " -d directory to extract into\n" \
154 " -o overwrite files without prompting\n" \ 163 " -o overwrite files without prompting\n" \
155 " -p extract crypted file using password\n\n"); 164 " -p extract crypted file using password\n\n");
156} 165}
@@ -304,8 +313,14 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
304 do 313 do
305 { 314 {
306 char answer[128]; 315 char answer[128];
307 printf("The file %s exist. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); 316 int ret;
308 scanf("%1s",answer); 317
318 printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
319 ret = scanf("%1s",answer);
320 if (ret != 1)
321 {
322 exit(EXIT_FAILURE);
323 }
309 rep = answer[0] ; 324 rep = answer[0] ;
310 if ((rep>='a') && (rep<='z')) 325 if ((rep>='a') && (rep<='z'))
311 rep -= 0x20; 326 rep -= 0x20;
@@ -459,6 +474,8 @@ int main(argc,argv)
459 int opt_do_extract=1; 474 int opt_do_extract=1;
460 int opt_do_extract_withoutpath=0; 475 int opt_do_extract_withoutpath=0;
461 int opt_overwrite=0; 476 int opt_overwrite=0;
477 int opt_extractdir=0;
478 const char *dirname=NULL;
462 unzFile uf=NULL; 479 unzFile uf=NULL;
463 480
464 do_banner(); 481 do_banner();
@@ -488,6 +505,12 @@ int main(argc,argv)
488 opt_do_extract = opt_do_extract_withoutpath = 1; 505 opt_do_extract = opt_do_extract_withoutpath = 1;
489 if ((c=='o') || (c=='O')) 506 if ((c=='o') || (c=='O'))
490 opt_overwrite=1; 507 opt_overwrite=1;
508 if ((c=='d') || (c=='D'))
509 {
510 opt_extractdir=1;
511 dirname=argv[i+1];
512 }
513
491 if (((c=='p') || (c=='P')) && (i+1<argc)) 514 if (((c=='p') || (c=='P')) && (i+1<argc))
492 { 515 {
493 password=argv[i+1]; 516 password=argv[i+1];
@@ -499,7 +522,7 @@ int main(argc,argv)
499 { 522 {
500 if (zipfilename == NULL) 523 if (zipfilename == NULL)
501 zipfilename = argv[i]; 524 zipfilename = argv[i];
502 else if (filename_to_extract==NULL) 525 else if ((filename_to_extract==NULL) && (!opt_extractdir))
503 filename_to_extract = argv[i] ; 526 filename_to_extract = argv[i] ;
504 } 527 }
505 } 528 }
@@ -544,6 +567,12 @@ int main(argc,argv)
544 return do_list(uf); 567 return do_list(uf);
545 else if (opt_do_extract==1) 568 else if (opt_do_extract==1)
546 { 569 {
570 if (opt_extractdir && chdir(dirname))
571 {
572 printf("Error changing into %s, aborting\n", dirname);
573 exit(-1);
574 }
575
547 if (filename_to_extract == NULL) 576 if (filename_to_extract == NULL)
548 return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password); 577 return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
549 else 578 else
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 5746f5c..918c322 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -1,3 +1,10 @@
1/*
2 minizip.c
3 Version 1.01b, May 30th, 2004
4
5 Copyright (C) 1998-2004 Gilles Vollant
6*/
7
1#include <stdio.h> 8#include <stdio.h>
2#include <stdlib.h> 9#include <stdlib.h>
3#include <string.h> 10#include <string.h>
@@ -53,8 +60,8 @@ uLong filetime(f, tmzip, dt)
53#else 60#else
54#ifdef unix 61#ifdef unix
55uLong filetime(f, tmzip, dt) 62uLong filetime(f, tmzip, dt)
56 char *f; /* name of file to get info on */ 63 char *f; /* name of file to get info on */
57 tm_zip *tmzip; /* return value: access, modific. and creation times */ 64 tm_zip *tmzip; /* return value: access, modific. and creation times */
58 uLong *dt; /* dostime */ 65 uLong *dt; /* dostime */
59{ 66{
60 int ret=0; 67 int ret=0;
@@ -66,6 +73,8 @@ uLong filetime(f, tmzip, dt)
66 { 73 {
67 char name[MAXFILENAME+1]; 74 char name[MAXFILENAME+1];
68 int len = strlen(f); 75 int len = strlen(f);
76 if (len > MAXFILENAME)
77 len = MAXFILENAME;
69 78
70 strncpy(name, f,MAXFILENAME-1); 79 strncpy(name, f,MAXFILENAME-1);
71 /* strncpy doesnt append the trailing NULL, of the string is too long. */ 80 /* strncpy doesnt append the trailing NULL, of the string is too long. */
@@ -120,7 +129,7 @@ int check_exist_file(filename)
120 129
121void do_banner() 130void do_banner()
122{ 131{
123 printf("MiniZip 1.00, demo of zLib + Zip package written by Gilles Vollant\n"); 132 printf("MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant\n");
124 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 133 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
125} 134}
126 135
@@ -269,8 +278,13 @@ int main(argc,argv)
269 do 278 do
270 { 279 {
271 char answer[128]; 280 char answer[128];
272 printf("The file %s exist. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try); 281 int ret;
273 scanf("%1s",answer); 282 printf("The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
283 ret = scanf("%1s",answer);
284 if (ret != 1)
285 {
286 exit(EXIT_FAILURE);
287 }
274 rep = answer[0] ; 288 rep = answer[0] ;
275 if ((rep>='a') && (rep<='z')) 289 if ((rep>='a') && (rep<='z'))
276 rep -= 0x20; 290 rep -= 0x20;
@@ -305,7 +319,12 @@ int main(argc,argv)
305 319
306 for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++) 320 for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
307 { 321 {
308 if (((*(argv[i]))!='-') && ((*(argv[i]))!='/')) 322 if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
323 ((argv[i][1]=='o') || (argv[i][1]=='O') ||
324 (argv[i][1]=='a') || (argv[i][1]=='A') ||
325 (argv[i][1]=='p') || (argv[i][1]=='P') ||
326 ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
327 (strlen(argv[i]) == 2)))
309 { 328 {
310 FILE * fin; 329 FILE * fin;
311 int size_read; 330 int size_read;
@@ -390,7 +409,11 @@ int main(argc,argv)
390 errclose = zipClose(zf,NULL); 409 errclose = zipClose(zf,NULL);
391 if (errclose != ZIP_OK) 410 if (errclose != ZIP_OK)
392 printf("error in closing %s\n",filename_try); 411 printf("error in closing %s\n",filename_try);
393 } 412 }
413 else
414 {
415 do_help();
416 }
394 417
395 free(buf); 418 free(buf);
396 return 0; 419 return 0;
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c
new file mode 100644
index 0000000..363ee13
--- /dev/null
+++ b/contrib/minizip/mztools.c
@@ -0,0 +1,281 @@
1/*
2 Additional tools for Minizip
3 Code: Xavier Roche '2004
4 License: Same as ZLIB (www.gzip.org)
5*/
6
7/* Code */
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include "zlib.h"
12#include "unzip.h"
13
14#define READ_8(adr) ((unsigned char)*(adr))
15#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
16#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
17
18#define WRITE_8(buff, n) do { \
19 *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
20} while(0)
21#define WRITE_16(buff, n) do { \
22 WRITE_8((unsigned char*)(buff), n); \
23 WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
24} while(0)
25#define WRITE_32(buff, n) do { \
26 WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
27 WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
28} while(0)
29
30extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
31const char* file;
32const char* fileOut;
33const char* fileOutTmp;
34uLong* nRecovered;
35uLong* bytesRecovered;
36{
37 int err = Z_OK;
38 FILE* fpZip = fopen(file, "rb");
39 FILE* fpOut = fopen(fileOut, "wb");
40 FILE* fpOutCD = fopen(fileOutTmp, "wb");
41 if (fpZip != NULL && fpOut != NULL) {
42 int entries = 0;
43 uLong totalBytes = 0;
44 char header[30];
45 char filename[256];
46 char extra[1024];
47 int offset = 0;
48 int offsetCD = 0;
49 while ( fread(header, 1, 30, fpZip) == 30 ) {
50 int currentOffset = offset;
51
52 /* File entry */
53 if (READ_32(header) == 0x04034b50) {
54 unsigned int version = READ_16(header + 4);
55 unsigned int gpflag = READ_16(header + 6);
56 unsigned int method = READ_16(header + 8);
57 unsigned int filetime = READ_16(header + 10);
58 unsigned int filedate = READ_16(header + 12);
59 unsigned int crc = READ_32(header + 14); /* crc */
60 unsigned int cpsize = READ_32(header + 18); /* compressed size */
61 unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
62 unsigned int fnsize = READ_16(header + 26); /* file name length */
63 unsigned int extsize = READ_16(header + 28); /* extra field length */
64 filename[0] = extra[0] = '\0';
65
66 /* Header */
67 if (fwrite(header, 1, 30, fpOut) == 30) {
68 offset += 30;
69 } else {
70 err = Z_ERRNO;
71 break;
72 }
73
74 /* Filename */
75 if (fnsize > 0) {
76 if (fread(filename, 1, fnsize, fpZip) == fnsize) {
77 if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
78 offset += fnsize;
79 } else {
80 err = Z_ERRNO;
81 break;
82 }
83 } else {
84 err = Z_ERRNO;
85 break;
86 }
87 } else {
88 err = Z_STREAM_ERROR;
89 break;
90 }
91
92 /* Extra field */
93 if (extsize > 0) {
94 if (fread(extra, 1, extsize, fpZip) == extsize) {
95 if (fwrite(extra, 1, extsize, fpOut) == extsize) {
96 offset += extsize;
97 } else {
98 err = Z_ERRNO;
99 break;
100 }
101 } else {
102 err = Z_ERRNO;
103 break;
104 }
105 }
106
107 /* Data */
108 {
109 int dataSize = cpsize;
110 if (dataSize == 0) {
111 dataSize = uncpsize;
112 }
113 if (dataSize > 0) {
114 char* data = malloc(dataSize);
115 if (data != NULL) {
116 if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
117 if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
118 offset += dataSize;
119 totalBytes += dataSize;
120 } else {
121 err = Z_ERRNO;
122 }
123 } else {
124 err = Z_ERRNO;
125 }
126 free(data);
127 if (err != Z_OK) {
128 break;
129 }
130 } else {
131 err = Z_MEM_ERROR;
132 break;
133 }
134 }
135 }
136
137 /* Central directory entry */
138 {
139 char header[46];
140 char* comment = "";
141 int comsize = (int) strlen(comment);
142 WRITE_32(header, 0x02014b50);
143 WRITE_16(header + 4, version);
144 WRITE_16(header + 6, version);
145 WRITE_16(header + 8, gpflag);
146 WRITE_16(header + 10, method);
147 WRITE_16(header + 12, filetime);
148 WRITE_16(header + 14, filedate);
149 WRITE_32(header + 16, crc);
150 WRITE_32(header + 20, cpsize);
151 WRITE_32(header + 24, uncpsize);
152 WRITE_16(header + 28, fnsize);
153 WRITE_16(header + 30, extsize);
154 WRITE_16(header + 32, comsize);
155 WRITE_16(header + 34, 0); /* disk # */
156 WRITE_16(header + 36, 0); /* int attrb */
157 WRITE_32(header + 38, 0); /* ext attrb */
158 WRITE_32(header + 42, currentOffset);
159 /* Header */
160 if (fwrite(header, 1, 46, fpOutCD) == 46) {
161 offsetCD += 46;
162
163 /* Filename */
164 if (fnsize > 0) {
165 if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
166 offsetCD += fnsize;
167 } else {
168 err = Z_ERRNO;
169 break;
170 }
171 } else {
172 err = Z_STREAM_ERROR;
173 break;
174 }
175
176 /* Extra field */
177 if (extsize > 0) {
178 if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
179 offsetCD += extsize;
180 } else {
181 err = Z_ERRNO;
182 break;
183 }
184 }
185
186 /* Comment field */
187 if (comsize > 0) {
188 if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
189 offsetCD += comsize;
190 } else {
191 err = Z_ERRNO;
192 break;
193 }
194 }
195
196
197 } else {
198 err = Z_ERRNO;
199 break;
200 }
201 }
202
203 /* Success */
204 entries++;
205
206 } else {
207 break;
208 }
209 }
210
211 /* Final central directory */
212 {
213 int entriesZip = entries;
214 char header[22];
215 char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
216 int comsize = (int) strlen(comment);
217 if (entriesZip > 0xffff) {
218 entriesZip = 0xffff;
219 }
220 WRITE_32(header, 0x06054b50);
221 WRITE_16(header + 4, 0); /* disk # */
222 WRITE_16(header + 6, 0); /* disk # */
223 WRITE_16(header + 8, entriesZip); /* hack */
224 WRITE_16(header + 10, entriesZip); /* hack */
225 WRITE_32(header + 12, offsetCD); /* size of CD */
226 WRITE_32(header + 16, offset); /* offset to CD */
227 WRITE_16(header + 20, comsize); /* comment */
228
229 /* Header */
230 if (fwrite(header, 1, 22, fpOutCD) == 22) {
231
232 /* Comment field */
233 if (comsize > 0) {
234 if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
235 err = Z_ERRNO;
236 }
237 }
238
239 } else {
240 err = Z_ERRNO;
241 }
242 }
243
244 /* Final merge (file + central directory) */
245 fclose(fpOutCD);
246 if (err == Z_OK) {
247 fpOutCD = fopen(fileOutTmp, "rb");
248 if (fpOutCD != NULL) {
249 int nRead;
250 char buffer[8192];
251 while ( (nRead = fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
252 if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
253 err = Z_ERRNO;
254 break;
255 }
256 }
257 fclose(fpOutCD);
258 }
259 }
260
261 /* Close */
262 fclose(fpZip);
263 fclose(fpOut);
264
265 /* Wipe temporary file */
266 (void)remove(fileOutTmp);
267
268 /* Number of recovered entries */
269 if (err == Z_OK) {
270 if (nRecovered != NULL) {
271 *nRecovered = entries;
272 }
273 if (bytesRecovered != NULL) {
274 *bytesRecovered = totalBytes;
275 }
276 }
277 } else {
278 err = Z_STREAM_ERROR;
279 }
280 return err;
281}
diff --git a/contrib/minizip/mztools.h b/contrib/minizip/mztools.h
new file mode 100644
index 0000000..eee78dc
--- /dev/null
+++ b/contrib/minizip/mztools.h
@@ -0,0 +1,31 @@
1/*
2 Additional tools for Minizip
3 Code: Xavier Roche '2004
4 License: Same as ZLIB (www.gzip.org)
5*/
6
7#ifndef _zip_tools_H
8#define _zip_tools_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#ifndef _ZLIB_H
15#include "zlib.h"
16#endif
17
18#include "unzip.h"
19
20/* Repair a ZIP file (missing central directory)
21 file: file to recover
22 fileOut: output file after recovery
23 fileOutTmp: temporary file name used for recovery
24*/
25extern int ZEXPORT unzRepair(const char* file,
26 const char* fileOut,
27 const char* fileOutTmp,
28 uLong* nRecovered,
29 uLong* bytesRecovered);
30
31#endif
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
index f08f624..e804a2a 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -1,7 +1,7 @@
1/* unzip.c -- IO for uncompress .zip files using zlib 1/* unzip.c -- IO for uncompress .zip files using zlib
2 Version 1.00, September 10th, 2003 2 Version 1.01c, August 23th, 2004
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2004 Gilles Vollant
5 5
6 Read unzip.h for more info 6 Read unzip.h for more info
7*/ 7*/
@@ -88,7 +88,7 @@ woven in by Terry Thorsen 1/2003.
88 88
89 89
90const char unz_copyright[] = 90const char unz_copyright[] =
91 " unzip 1.00 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll"; 91 " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
92 92
93/* unz_file_info_interntal contain internal info about a file in zipfile*/ 93/* unz_file_info_interntal contain internal info about a file in zipfile*/
94typedef struct unz_file_info_internal_s 94typedef struct unz_file_info_internal_s
@@ -798,7 +798,8 @@ extern int ZEXPORT unzGoToNextFile (file)
798 s=(unz_s*)file; 798 s=(unz_s*)file;
799 if (!s->current_file_ok) 799 if (!s->current_file_ok)
800 return UNZ_END_OF_LIST_OF_FILE; 800 return UNZ_END_OF_LIST_OF_FILE;
801 if (s->num_file+1==s->gi.number_entry) 801 if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
802 if (s->num_file+1==s->gi.number_entry)
802 return UNZ_END_OF_LIST_OF_FILE; 803 return UNZ_END_OF_LIST_OF_FILE;
803 804
804 s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + 805 s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
@@ -1244,9 +1245,15 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
1244 1245
1245 pfile_in_zip_read_info->stream.avail_out = (uInt)len; 1246 pfile_in_zip_read_info->stream.avail_out = (uInt)len;
1246 1247
1247 if (len>pfile_in_zip_read_info->rest_read_uncompressed) 1248 if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
1249 (!(pfile_in_zip_read_info->raw)))
1248 pfile_in_zip_read_info->stream.avail_out = 1250 pfile_in_zip_read_info->stream.avail_out =
1249 (uInt)pfile_in_zip_read_info->rest_read_uncompressed; 1251 (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
1252
1253 if ((len>pfile_in_zip_read_info->rest_read_compressed) &&
1254 (pfile_in_zip_read_info->raw))
1255 pfile_in_zip_read_info->stream.avail_out =
1256 (uInt)pfile_in_zip_read_info->rest_read_compressed;
1250 1257
1251 while (pfile_in_zip_read_info->stream.avail_out>0) 1258 while (pfile_in_zip_read_info->stream.avail_out>0)
1252 { 1259 {
@@ -1339,6 +1346,9 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
1339 */ 1346 */
1340 err=inflate(&pfile_in_zip_read_info->stream,flush); 1347 err=inflate(&pfile_in_zip_read_info->stream,flush);
1341 1348
1349 if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
1350 err = Z_DATA_ERROR;
1351
1342 uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; 1352 uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
1343 uOutThis = uTotalOutAfter-uTotalOutBefore; 1353 uOutThis = uTotalOutAfter-uTotalOutBefore;
1344 1354
@@ -1461,7 +1471,7 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
1461 1471
1462 if (ZREAD(pfile_in_zip_read_info->z_filefunc, 1472 if (ZREAD(pfile_in_zip_read_info->z_filefunc,
1463 pfile_in_zip_read_info->filestream, 1473 pfile_in_zip_read_info->filestream,
1464 buf,size_to_read)!=size_to_read) 1474 buf,read_now)!=read_now)
1465 return UNZ_ERRNO; 1475 return UNZ_ERRNO;
1466 1476
1467 return (int)read_now; 1477 return (int)read_now;
@@ -1544,3 +1554,40 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
1544 *(szComment+s->gi.size_comment)='\0'; 1554 *(szComment+s->gi.size_comment)='\0';
1545 return (int)uReadThis; 1555 return (int)uReadThis;
1546} 1556}
1557
1558/* Additions by RX '2004 */
1559extern uLong ZEXPORT unzGetOffset (file)
1560 unzFile file;
1561{
1562 unz_s* s;
1563
1564 if (file==NULL)
1565 return UNZ_PARAMERROR;
1566 s=(unz_s*)file;
1567 if (!s->current_file_ok)
1568 return 0;
1569 if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
1570 if (s->num_file==s->gi.number_entry)
1571 return 0;
1572 return s->pos_in_central_dir;
1573}
1574
1575extern int ZEXPORT unzSetOffset (file, pos)
1576 unzFile file;
1577 uLong pos;
1578{
1579 unz_s* s;
1580 int err;
1581
1582 if (file==NULL)
1583 return UNZ_PARAMERROR;
1584 s=(unz_s*)file;
1585
1586 s->pos_in_central_dir = pos;
1587 s->num_file = s->gi.number_entry; /* hack */
1588 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1589 &s->cur_file_info_internal,
1590 NULL,0,NULL,0,NULL,0);
1591 s->current_file_ok = (err == UNZ_OK);
1592 return err;
1593}
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h
index 4e50979..0c7c6f1 100644
--- a/contrib/minizip/unzip.h
+++ b/contrib/minizip/unzip.h
@@ -1,7 +1,7 @@
1/* unzip.h -- IO for uncompress .zip files using zlib 1/* unzip.h -- IO for uncompress .zip files using zlib
2 Version 1.00, September 10th, 2003 2 Version 1.01, May 8th, 2004
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2004 Gilles Vollant
5 5
6 This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g 6 This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
7 WinZip, InfoZip tools and compatible. 7 WinZip, InfoZip tools and compatible.
@@ -335,6 +335,16 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
335 the error code 335 the error code
336*/ 336*/
337 337
338/***************************************************************************/
339
340/* Get the current file offset */
341extern uLong ZEXPORT unzGetOffset (unzFile file);
342
343/* Set the current file offset */
344extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
345
346
347
338#ifdef __cplusplus 348#ifdef __cplusplus
339} 349}
340#endif 350#endif
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index 1a713e5..ce1444c 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -1,7 +1,7 @@
1/* zip.c -- IO on .zip files using zlib 1/* zip.c -- IO on .zip files using zlib
2 Version 1.00, September 10th, 2003 2 Version 1.01, May 8th, 2004
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2004 Gilles Vollant
5 5
6 Read zip.h for more info 6 Read zip.h for more info
7*/ 7*/
@@ -77,7 +77,7 @@
77#endif 77#endif
78#endif 78#endif
79const char zip_copyright[] = 79const char zip_copyright[] =
80 " zip 1.00 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll"; 80 " zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
81 81
82 82
83#define SIZEDATA_INDATABLOCK (4096-(4*4)) 83#define SIZEDATA_INDATABLOCK (4096-(4*4))
@@ -265,10 +265,19 @@ local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
265{ 265{
266 unsigned char buf[4]; 266 unsigned char buf[4];
267 int n; 267 int n;
268 for (n = 0; n < nbByte; n++) { 268 for (n = 0; n < nbByte; n++)
269 {
269 buf[n] = (unsigned char)(x & 0xff); 270 buf[n] = (unsigned char)(x & 0xff);
270 x >>= 8; 271 x >>= 8;
271 } 272 }
273 if (x != 0)
274 { /* data overflow - hack for ZIP64 (X Roche) */
275 for (n = 0; n < nbByte; n++)
276 {
277 buf[n] = 0xff;
278 }
279 }
280
272 if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) 281 if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
273 return ZIP_ERRNO; 282 return ZIP_ERRNO;
274 else 283 else
@@ -287,7 +296,16 @@ local void ziplocal_putValue_inmemory (dest, x, nbByte)
287 buf[n] = (unsigned char)(x & 0xff); 296 buf[n] = (unsigned char)(x & 0xff);
288 x >>= 8; 297 x >>= 8;
289 } 298 }
299
300 if (x != 0)
301 { /* data overflow - hack for ZIP64 */
302 for (n = 0; n < nbByte; n++)
303 {
304 buf[n] = 0xff;
305 }
306 }
290} 307}
308
291/****************************************************************************/ 309/****************************************************************************/
292 310
293 311
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h
index c37ea21..d5112c4 100644
--- a/contrib/minizip/zip.h
+++ b/contrib/minizip/zip.h
@@ -1,7 +1,7 @@
1/* zip.h -- IO for compress .zip files using zlib 1/* zip.h -- IO for compress .zip files using zlib
2 Version 1.00, September 10th, 2003 2 Version 1.01, May 8th, 2004
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2004 Gilles Vollant
5 5
6 This unzip package allow creates .ZIP file, compatible with PKZip 2.04g 6 This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
7 WinZip, InfoZip tools and compatible. 7 WinZip, InfoZip tools and compatible.
@@ -212,7 +212,6 @@ extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
212 Close the current file in the zipfile 212 Close the current file in the zipfile
213*/ 213*/
214 214
215
216extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 215extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
217 uLong uncompressed_size, 216 uLong uncompressed_size,
218 uLong crc32)); 217 uLong crc32));
diff --git a/contrib/pascal/zlibpas.pas b/contrib/pascal/zlibpas.pas
index 6d5ebe0..94103d2 100644
--- a/contrib/pascal/zlibpas.pas
+++ b/contrib/pascal/zlibpas.pas
@@ -10,7 +10,7 @@ unit zlibpas;
10interface 10interface
11 11
12const 12const
13 ZLIB_VERSION = '1.2.1'; 13 ZLIB_VERSION = '1.2.2';
14 14
15type 15type
16 alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; 16 alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
diff --git a/contrib/untgz/untgz.c b/contrib/untgz/untgz.c
index d748b69..3a30768 100644
--- a/contrib/untgz/untgz.c
+++ b/contrib/untgz/untgz.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * untgz.c -- Display contents and extract files from a gzip'd TAR file 2 * untgz.c -- Display contents and extract files from a gzip'd TAR file
3 * 3 *
4 * written by "Pedro A. Aranda Guti\irrez" <paag@tid.es> 4 * written by Pedro A. Aranda Gutierrez <paag@tid.es>
5 * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org> 5 * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
6 * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro> 6 * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
7 */ 7 */
@@ -15,10 +15,10 @@
15#include "zlib.h" 15#include "zlib.h"
16 16
17#ifdef unix 17#ifdef unix
18# include <unistd.h> 18# include <unistd.h>
19#else 19#else
20# include <direct.h> 20# include <direct.h>
21# include <io.h> 21# include <io.h>
22#endif 22#endif
23 23
24#ifdef WIN32 24#ifdef WIN32
@@ -28,8 +28,9 @@
28# endif 28# endif
29# define mkdir(dirname,mode) _mkdir(dirname) 29# define mkdir(dirname,mode) _mkdir(dirname)
30# ifdef _MSC_VER 30# ifdef _MSC_VER
31# define strdup(str) _strdup(str)
32# define access(path,mode) _access(path,mode) 31# define access(path,mode) _access(path,mode)
32# define chmod(path,mode) _chmod(path,mode)
33# define strdup(str) _strdup(str)
33# endif 34# endif
34#else 35#else
35# include <utime.h> 36# include <utime.h>
@@ -48,7 +49,21 @@
48#define FIFOTYPE '6' /* FIFO special */ 49#define FIFOTYPE '6' /* FIFO special */
49#define CONTTYPE '7' /* reserved */ 50#define CONTTYPE '7' /* reserved */
50 51
51#define BLOCKSIZE 512 52/* GNU tar extensions */
53
54#define GNUTYPE_DUMPDIR 'D' /* file names from dumped directory */
55#define GNUTYPE_LONGLINK 'K' /* long link name */
56#define GNUTYPE_LONGNAME 'L' /* long file name */
57#define GNUTYPE_MULTIVOL 'M' /* continuation of file from another volume */
58#define GNUTYPE_NAMES 'N' /* file name that does not fit into main hdr */
59#define GNUTYPE_SPARSE 'S' /* sparse file */
60#define GNUTYPE_VOLHDR 'V' /* tape/volume header */
61
62
63/* tar header */
64
65#define BLOCKSIZE 512
66#define SHORTNAMESIZE 100
52 67
53struct tar_header 68struct tar_header
54{ /* byte offset */ 69{ /* byte offset */
@@ -71,11 +86,20 @@ struct tar_header
71 /* 500 */ 86 /* 500 */
72}; 87};
73 88
74union tar_buffer { 89union tar_buffer
90{
75 char buffer[BLOCKSIZE]; 91 char buffer[BLOCKSIZE];
76 struct tar_header header; 92 struct tar_header header;
77}; 93};
78 94
95struct attr_item
96{
97 struct attr_item *next;
98 char *fname;
99 int mode;
100 time_t time;
101};
102
79enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID }; 103enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID };
80 104
81char *TGZfname OF((const char *)); 105char *TGZfname OF((const char *));
@@ -84,6 +108,9 @@ void TGZnotfound OF((const char *));
84int getoct OF((char *, int)); 108int getoct OF((char *, int));
85char *strtime OF((time_t *)); 109char *strtime OF((time_t *));
86int setfiletime OF((char *, time_t)); 110int setfiletime OF((char *, time_t));
111void push_attr OF((struct attr_item **, char *, int, time_t));
112void restore_attr OF((struct attr_item **));
113
87int ExprMatch OF((char *, char *)); 114int ExprMatch OF((char *, char *));
88 115
89int makedir OF((char *)); 116int makedir OF((char *));
@@ -221,7 +248,42 @@ int setfiletime (char *fname,time_t ftime)
221} 248}
222 249
223 250
224/* regular expression matching */ 251/* push file attributes */
252
253void push_attr(struct attr_item **list,char *fname,int mode,time_t time)
254{
255 struct attr_item *item;
256
257 item = (struct attr_item *)malloc(sizeof(struct attr_item));
258 if (item == NULL)
259 error("Out of memory");
260 item->fname = strdup(fname);
261 item->mode = mode;
262 item->time = time;
263 item->next = *list;
264 *list = item;
265}
266
267
268/* restore file attributes */
269
270void restore_attr(struct attr_item **list)
271{
272 struct attr_item *item, *prev;
273
274 for (item = *list; item != NULL; )
275 {
276 setfiletime(item->fname,item->time);
277 chmod(item->fname,item->mode);
278 prev = item;
279 item = item->next;
280 free(prev);
281 }
282 *list = NULL;
283}
284
285
286/* match regular expression */
225 287
226#define ISSPECIAL(c) (((c) == '*') || ((c) == '/')) 288#define ISSPECIAL(c) (((c) == '*') || ((c) == '/'))
227 289
@@ -332,6 +394,7 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
332 char fname[BLOCKSIZE]; 394 char fname[BLOCKSIZE];
333 int tarmode; 395 int tarmode;
334 time_t tartime; 396 time_t tartime;
397 struct attr_item *attributes = NULL;
335 398
336 if (action == TGZ_LIST) 399 if (action == TGZ_LIST)
337 printf(" date time size file\n" 400 printf(" date time size file\n"
@@ -354,14 +417,15 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
354 /* 417 /*
355 * If we have to get a tar header 418 * If we have to get a tar header
356 */ 419 */
357 if (getheader == 1) 420 if (getheader >= 1)
358 { 421 {
359 /* 422 /*
360 * if we met the end of the tar 423 * if we met the end of the tar
361 * or the end-of-tar block, 424 * or the end-of-tar block,
362 * we are done 425 * we are done
363 */ 426 */
364 if ((len == 0) || (buffer.header.name[0] == 0)) break; 427 if (len == 0 || buffer.header.name[0] == 0)
428 break;
365 429
366 tarmode = getoct(buffer.header.mode,8); 430 tarmode = getoct(buffer.header.mode,8);
367 tartime = (time_t)getoct(buffer.header.mtime,12); 431 tartime = (time_t)getoct(buffer.header.mtime,12);
@@ -371,8 +435,25 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
371 action = TGZ_INVALID; 435 action = TGZ_INVALID;
372 } 436 }
373 437
374 strcpy(fname,buffer.header.name); 438 if (getheader == 1)
439 {
440 strncpy(fname,buffer.header.name,SHORTNAMESIZE);
441 if (fname[SHORTNAMESIZE-1] != 0)
442 fname[SHORTNAMESIZE] = 0;
443 }
444 else
445 {
446 /*
447 * The file name is longer than SHORTNAMESIZE
448 */
449 if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0)
450 error("bad long name");
451 getheader = 1;
452 }
375 453
454 /*
455 * Act according to the type flag
456 */
376 switch (buffer.header.typeflag) 457 switch (buffer.header.typeflag)
377 { 458 {
378 case DIRTYPE: 459 case DIRTYPE:
@@ -381,7 +462,7 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
381 if (action == TGZ_EXTRACT) 462 if (action == TGZ_EXTRACT)
382 { 463 {
383 makedir(fname); 464 makedir(fname);
384 setfiletime(fname,tartime); 465 push_attr(&attributes,fname,tarmode,tartime);
385 } 466 }
386 break; 467 break;
387 case REGTYPE: 468 case REGTYPE:
@@ -419,6 +500,24 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
419 } 500 }
420 getheader = 0; 501 getheader = 0;
421 break; 502 break;
503 case GNUTYPE_LONGLINK:
504 case GNUTYPE_LONGNAME:
505 remaining = getoct(buffer.header.size,12);
506 if (remaining < 0 || remaining >= BLOCKSIZE)
507 {
508 action = TGZ_INVALID;
509 break;
510 }
511 len = gzread(in, fname, BLOCKSIZE);
512 if (len < 0)
513 error(gzerror(in, &err));
514 if (fname[BLOCKSIZE-1] != 0 || (int)strlen(fname) > remaining)
515 {
516 action = TGZ_INVALID;
517 break;
518 }
519 getheader = 2;
520 break;
422 default: 521 default:
423 if (action == TGZ_LIST) 522 if (action == TGZ_LIST)
424 printf(" %s <---> %s\n",strtime(&tartime),fname); 523 printf(" %s <---> %s\n",strtime(&tartime),fname);
@@ -433,7 +532,8 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
433 { 532 {
434 if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes) 533 if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes)
435 { 534 {
436 fprintf(stderr,"%s: Error writing %s -- skipping\n",prog,fname); 535 fprintf(stderr,
536 "%s: Error writing %s -- skipping\n",prog,fname);
437 fclose(outfile); 537 fclose(outfile);
438 outfile = NULL; 538 outfile = NULL;
439 remove(fname); 539 remove(fname);
@@ -450,7 +550,7 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
450 fclose(outfile); 550 fclose(outfile);
451 outfile = NULL; 551 outfile = NULL;
452 if (action != TGZ_INVALID) 552 if (action != TGZ_INVALID)
453 setfiletime(fname,tartime); 553 push_attr(&attributes,fname,tarmode,tartime);
454 } 554 }
455 } 555 }
456 556
@@ -464,6 +564,11 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
464 } 564 }
465 } 565 }
466 566
567 /*
568 * Restore file modes and time stamps
569 */
570 restore_attr(&attributes);
571
467 if (gzclose(in) != Z_OK) 572 if (gzclose(in) != Z_OK)
468 error("failed gzclose"); 573 error("failed gzclose");
469 574
@@ -475,7 +580,7 @@ int tar (gzFile in,int action,int arg,int argc,char **argv)
475 580
476void help(int exitval) 581void help(int exitval)
477{ 582{
478 printf("untgz version 0.2\n" 583 printf("untgz version 0.2.1\n"
479 " using zlib version %s\n\n", 584 " using zlib version %s\n\n",
480 zlibVersion()); 585 zlibVersion());
481 printf("Usage: untgz file.tgz extract all files\n" 586 printf("Usage: untgz file.tgz extract all files\n"
diff --git a/contrib/vstudio/vc7/zlib.rc b/contrib/vstudio/vc7/zlib.rc
index 6c51679..2eb7c6b 100644
--- a/contrib/vstudio/vc7/zlib.rc
+++ b/contrib/vstudio/vc7/zlib.rc
@@ -2,8 +2,8 @@
2 2
3#define IDR_VERSION1 1 3#define IDR_VERSION1 1
4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 FILEVERSION 1,2,1,0 5 FILEVERSION 1,2,1,2
6 PRODUCTVERSION 1,2,1,0 6 PRODUCTVERSION 1,2,1,2
7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 FILEFLAGS 0 8 FILEFLAGS 0
9 FILEOS VOS_DOS_WINDOWS32 9 FILEOS VOS_DOS_WINDOWS32
@@ -17,7 +17,7 @@ BEGIN
17 17
18 BEGIN 18 BEGIN
19 VALUE "FileDescription", "zlib data compression library\0" 19 VALUE "FileDescription", "zlib data compression library\0"
20 VALUE "FileVersion", "1.2.1.0\0" 20 VALUE "FileVersion", "1.2.1.2\0"
21 VALUE "InternalName", "zlib\0" 21 VALUE "InternalName", "zlib\0"
22 VALUE "OriginalFilename", "zlib.dll\0" 22 VALUE "OriginalFilename", "zlib.dll\0"
23 VALUE "ProductName", "ZLib.DLL\0" 23 VALUE "ProductName", "ZLib.DLL\0"
diff --git a/crc32.c b/crc32.c
index 689b288..0e04880 100644
--- a/crc32.c
+++ b/crc32.c
@@ -11,6 +11,14 @@
11 11
12/* @(#) $Id$ */ 12/* @(#) $Id$ */
13 13
14/*
15 Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection
16 on the static variables used to control the first-use generation of the crc
17 tables. Therefore if you #define DYNAMIC_CRC_TABLE, you should first call
18 get_crc_table() to initialize the tables before allowing more than on thread
19 to use crc32().
20 */
21
14#ifdef MAKECRCH 22#ifdef MAKECRCH
15# include <stdio.h> 23# include <stdio.h>
16# ifndef DYNAMIC_CRC_TABLE 24# ifndef DYNAMIC_CRC_TABLE
@@ -58,7 +66,7 @@
58 66
59#ifdef DYNAMIC_CRC_TABLE 67#ifdef DYNAMIC_CRC_TABLE
60 68
61local int crc_table_empty = 1; 69local volatile int crc_table_empty = 1;
62local unsigned long FAR crc_table[TBLS][256]; 70local unsigned long FAR crc_table[TBLS][256];
63local void make_crc_table OF((void)); 71local void make_crc_table OF((void));
64#ifdef MAKECRCH 72#ifdef MAKECRCH
@@ -95,38 +103,51 @@ local void make_crc_table()
95{ 103{
96 unsigned long c; 104 unsigned long c;
97 int n, k; 105 int n, k;
98 unsigned long poly; /* polynomial exclusive-or pattern */ 106 unsigned long poly; /* polynomial exclusive-or pattern */
99 /* terms of polynomial defining this crc (except x^32): */ 107 /* terms of polynomial defining this crc (except x^32): */
108 static volatile int first = 1; /* flag to limit concurrent making */
100 static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; 109 static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
101 110
102 /* make exclusive-or pattern from polynomial (0xedb88320UL) */ 111 /* See if another task is already doing this (not thread-safe, but better
103 poly = 0UL; 112 than nothing -- significantly reduces duration of vulnerability in
104 for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) 113 case the advice about DYNAMIC_CRC_TABLE is ignored) */
105 poly |= 1UL << (31 - p[n]); 114 if (first) {
106 115 first = 0;
107 /* generate a crc for every 8-bit value */ 116
108 for (n = 0; n < 256; n++) { 117 /* make exclusive-or pattern from polynomial (0xedb88320UL) */
109 c = (unsigned long)n; 118 poly = 0UL;
110 for (k = 0; k < 8; k++) 119 for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
111 c = c & 1 ? poly ^ (c >> 1) : c >> 1; 120 poly |= 1UL << (31 - p[n]);
112 crc_table[0][n] = c; 121
113 } 122 /* generate a crc for every 8-bit value */
123 for (n = 0; n < 256; n++) {
124 c = (unsigned long)n;
125 for (k = 0; k < 8; k++)
126 c = c & 1 ? poly ^ (c >> 1) : c >> 1;
127 crc_table[0][n] = c;
128 }
114 129
115#ifdef BYFOUR 130#ifdef BYFOUR
116 /* generate crc for each value followed by one, two, and three zeros, and 131 /* generate crc for each value followed by one, two, and three zeros, and
117 then the byte reversal of those as well as the first table */ 132 then the byte reversal of those as well as the first table */
118 for (n = 0; n < 256; n++) { 133 for (n = 0; n < 256; n++) {
119 c = crc_table[0][n]; 134 c = crc_table[0][n];
120 crc_table[4][n] = REV(c); 135 crc_table[4][n] = REV(c);
121 for (k = 1; k < 4; k++) { 136 for (k = 1; k < 4; k++) {
122 c = crc_table[0][c & 0xff] ^ (c >> 8); 137 c = crc_table[0][c & 0xff] ^ (c >> 8);
123 crc_table[k][n] = c; 138 crc_table[k][n] = c;
124 crc_table[k + 4][n] = REV(c); 139 crc_table[k + 4][n] = REV(c);
125 } 140 }
126 } 141 }
127#endif /* BYFOUR */ 142#endif /* BYFOUR */
128 143
129 crc_table_empty = 0; 144 crc_table_empty = 0;
145 }
146 else { /* not first */
147 /* wait for the other guy to finish (not exactly efficient, but rare) */
148 while (crc_table_empty)
149 ;
150 }
130 151
131#ifdef MAKECRCH 152#ifdef MAKECRCH
132 /* write out CRC tables to crc32.h */ 153 /* write out CRC tables to crc32.h */
@@ -180,9 +201,10 @@ local void write_table(out, table)
180const unsigned long FAR * ZEXPORT get_crc_table() 201const unsigned long FAR * ZEXPORT get_crc_table()
181{ 202{
182#ifdef DYNAMIC_CRC_TABLE 203#ifdef DYNAMIC_CRC_TABLE
183 if (crc_table_empty) make_crc_table(); 204 if (crc_table_empty)
205 make_crc_table();
184#endif /* DYNAMIC_CRC_TABLE */ 206#endif /* DYNAMIC_CRC_TABLE */
185 return (const unsigned long FAR *)crc_table; 207 return (const unsigned long FAR *)crc_table;
186} 208}
187 209
188/* ========================================================================= */ 210/* ========================================================================= */
diff --git a/deflate.c b/deflate.c
index ada7cfd..b402fe5 100644
--- a/deflate.c
+++ b/deflate.c
@@ -52,7 +52,7 @@
52#include "deflate.h" 52#include "deflate.h"
53 53
54const char deflate_copyright[] = 54const char deflate_copyright[] =
55 " deflate 1.2.1.1 Copyright 1995-2003 Jean-loup Gailly "; 55 " deflate 1.2.1.2 Copyright 1995-2004 Jean-loup Gailly ";
56/* 56/*
57 If you use the zlib library in a product, an acknowledgment is welcome 57 If you use the zlib library in a product, an acknowledgment is welcome
58 in the documentation of your product. If for some reason you cannot 58 in the documentation of your product. If for some reason you cannot
diff --git a/deflate.h b/deflate.h
index e31f66b..410681d 100644
--- a/deflate.h
+++ b/deflate.h
@@ -95,7 +95,6 @@ typedef struct internal_state {
95 Bytef *pending_out; /* next pending byte to output to the stream */ 95 Bytef *pending_out; /* next pending byte to output to the stream */
96 int pending; /* nb of bytes in the pending buffer */ 96 int pending; /* nb of bytes in the pending buffer */
97 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ 97 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
98 Byte data_type; /* UNKNOWN, BINARY or ASCII */
99 Byte method; /* STORED (for zip only) or DEFLATED */ 98 Byte method; /* STORED (for zip only) or DEFLATED */
100 int last_flush; /* value of flush param for previous deflate call */ 99 int last_flush; /* value of flush param for previous deflate call */
101 100
diff --git a/gzio.c b/gzio.c
index 4afd102..0ceafff 100644
--- a/gzio.c
+++ b/gzio.c
@@ -455,6 +455,10 @@ int ZEXPORT gzread (file, buf, len)
455 s->z_err = Z_ERRNO; 455 s->z_err = Z_ERRNO;
456 break; 456 break;
457 } 457 }
458 if (feof(s->file)) { /* avoid error for empty file */
459 s->z_err = Z_STREAM_END;
460 break;
461 }
458 } 462 }
459 s->stream.next_in = s->inbuf; 463 s->stream.next_in = s->inbuf;
460 } 464 }
diff --git a/infback.c b/infback.c
index 110b03b..477b6ea 100644
--- a/infback.c
+++ b/infback.c
@@ -434,6 +434,9 @@ void FAR *out_desc;
434 } 434 }
435 } 435 }
436 436
437 /* handle error breaks in while */
438 if (state->mode == BAD) break;
439
437 /* build code tables */ 440 /* build code tables */
438 state->next = state->codes; 441 state->next = state->codes;
439 state->lencode = (code const FAR *)(state->next); 442 state->lencode = (code const FAR *)(state->next);
diff --git a/inffast.c b/inffast.c
index c716440..8c02a17 100644
--- a/inffast.c
+++ b/inffast.c
@@ -1,5 +1,5 @@
1/* inffast.c -- fast decoding 1/* inffast.c -- fast decoding
2 * Copyright (C) 1995-2003 Mark Adler 2 * Copyright (C) 1995-2004 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
@@ -19,7 +19,7 @@
19 - none 19 - none
20 No measurable difference: 20 No measurable difference:
21 - Pentium III (Anderson) 21 - Pentium III (Anderson)
22 - 68060 (Nikl) 22 - M68060 (Nikl)
23 */ 23 */
24#ifdef POSTINC 24#ifdef POSTINC
25# define OFF 0 25# define OFF 0
diff --git a/inflate.c b/inflate.c
index a53b5c7..06ca1de 100644
--- a/inflate.c
+++ b/inflate.c
@@ -861,6 +861,9 @@ int flush;
861 } 861 }
862 } 862 }
863 863
864 /* handle error breaks in while */
865 if (state->mode == BAD) break;
866
864 /* build code tables */ 867 /* build code tables */
865 state->next = state->codes; 868 state->next = state->codes;
866 state->lencode = (code const FAR *)(state->next); 869 state->lencode = (code const FAR *)(state->next);
diff --git a/inftrees.c b/inftrees.c
index 767ae1f..0ced3ae 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -9,7 +9,7 @@
9#define MAXBITS 15 9#define MAXBITS 15
10 10
11const char inflate_copyright[] = 11const char inflate_copyright[] =
12 " inflate 1.2.1.1 Copyright 1995-2004 Mark Adler "; 12 " inflate 1.2.1.2 Copyright 1995-2004 Mark Adler ";
13/* 13/*
14 If you use the zlib library in a product, an acknowledgment is welcome 14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot 15 in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; 62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 202, 196}; 65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 194};
66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -303,7 +303,6 @@ unsigned short FAR *work;
303 drop = 0; 303 drop = 0;
304 len = root; 304 len = root;
305 next = *table; 305 next = *table;
306 curr = root;
307 this.bits = (unsigned char)len; 306 this.bits = (unsigned char)len;
308 } 307 }
309 308
diff --git a/projects/README.projects b/projects/README.projects
new file mode 100644
index 0000000..f32de76
--- /dev/null
+++ b/projects/README.projects
@@ -0,0 +1,38 @@
1This directory contains project files for building zlib under various
2Integrated Development Environments (IDE).
3
4If you wish to submit a new project to this directory, you should comply
5to the following requirements. Otherwise (e.g. if you wish to integrate
6a custom piece of code that changes the zlib interface or its behavior),
7please consider submitting the project to the contrib directory.
8
9
10Requirements
11============
12
13- The project must build zlib using exclusively the source files from
14 the official zlib distribution.
15
16- If there are "official" makefiles in the zlib distribution, the builds
17 given by the makefiles must be compatible with the builds given by the
18 project. These builds are called "official" builds.
19
20- It is possible to add non-official pieces of code to the project,
21 if the resulting build remains compatible with an official build.
22 For example, it is possible to add an "ASM build" target besides
23 the regular target, by including ASM source files from the contrib
24 directory.
25
26- If there are significant differences between the project files created
27 by different versions of an IDE (e.g. Visual C++ 6.0 vs. 7.0), the name
28 of the project directory should contain the version number of the IDE
29 for which the project is intended (e.g. "visualc6" for Visual C++ 6.0,
30 or "visualc7" for Visual C++ 7.0 and 7.1).
31
32
33Current projects
34================
35
36visualc6/ by Simon-Pierre Cadieux <methodex@methodex.ca>
37 and Cosmin Truta <cosmint@cs.ubbcluj.ro>
38 Project for Microsoft Visual C++ 6.0
diff --git a/projects/visualc6/README.txt b/projects/visualc6/README.txt
new file mode 100644
index 0000000..71d6105
--- /dev/null
+++ b/projects/visualc6/README.txt
@@ -0,0 +1,38 @@
1Microsoft Developer Studio Project Files, Format Version 6.00 for zlib.
2
3Copyright (C) 2000-2004 Simon-Pierre Cadieux.
4Copyright (C) 2004 Cosmin Truta.
5For conditions of distribution and use, see copyright notice in zlib.h.
6
7
8To use:
9
101) On the main menu, select "File | Open Workspace".
11 Open "zlib.dsw".
12
132) Select "Build | Set Active Configuration".
14 Choose the configuration you wish to build.
15
163) Select "Build | Clean".
17
184) Select "Build | Build ... (F7)". Ignore warning messages about
19 not being able to find certain include files (e.g. alloc.h).
20
215) If you built one of the sample programs (example or minigzip),
22 select "Build | Execute ... (Ctrl+F5)".
23
24
25This project builds the zlib binaries as follows:
26
27* Win32_DLL_Release\zlib1.dll DLL build
28* Win32_DLL_Debug\zlib1d.dll DLL build (debug version)
29* Win32_DLL_ASM_Release\zlib1.dll DLL build using ASM code
30* Win32_DLL_ASM_Debug\zlib1d.dll DLL build using ASM code (debug version)
31* Win32_LIB_Release\zlib.lib static build
32* Win32_LIB_Debug\zlibd.lib static build (debug version)
33* Win32_LIB_ASM_Release\zlib.lib static build using ASM code
34* Win32_LIB_ASM_Debug\zlibd.lib static build using ASM code (debug version)
35
36
37For more information regarding the DLL builds, please see the DLL FAQ
38in ..\..\win32\DLL_FAQ.txt.
diff --git a/projects/visualc6/example.dsp b/projects/visualc6/example.dsp
new file mode 100644
index 0000000..308a82c
--- /dev/null
+++ b/projects/visualc6/example.dsp
@@ -0,0 +1,278 @@
1# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4>
2# Microsoft Developer Studio Generated Build File, Format Version 6.00
3# ** DO NOT EDIT **
4
5# TARGTYPE "Win32 (x86) Console Application" 0x0103
6
7CFG=example - Win32 LIB Debug
8!MESSAGE This is not a valid makefile. To build this project using NMAKE,
9!MESSAGE use the Export Makefile command and run
10!MESSAGE
11!MESSAGE NMAKE /f "example.mak".
12!MESSAGE
13!MESSAGE You can specify a configuration when running NMAKE
14!MESSAGE by defining the macro CFG on the command line. For example:
15!MESSAGE
16!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 LIB Debug"
17!MESSAGE
18!MESSAGE Possible choices for configuration are:
19!MESSAGE
20!MESSAGE "example - Win32 DLL Release" (based on "Win32 (x86) Console Application")
21!MESSAGE "example - Win32 DLL Debug" (based on "Win32 (x86) Console Application")
22!MESSAGE "example - Win32 DLL ASM Release" (based on "Win32 (x86) Console Application")
23!MESSAGE "example - Win32 DLL ASM Debug" (based on "Win32 (x86) Console Application")
24!MESSAGE "example - Win32 LIB Release" (based on "Win32 (x86) Console Application")
25!MESSAGE "example - Win32 LIB Debug" (based on "Win32 (x86) Console Application")
26!MESSAGE "example - Win32 LIB ASM Release" (based on "Win32 (x86) Console Application")
27!MESSAGE "example - Win32 LIB ASM Debug" (based on "Win32 (x86) Console Application")
28!MESSAGE
29
30# Begin Project
31# PROP AllowPerConfigDependencies 0
32# PROP Scc_ProjName ""
33# PROP Scc_LocalPath ""
34CPP=cl.exe
35RSC=rc.exe
36
37!IF "$(CFG)" == "example - Win32 DLL Release"
38
39# PROP BASE Use_MFC 0
40# PROP BASE Use_Debug_Libraries 0
41# PROP BASE Output_Dir "example___Win32_DLL_Release"
42# PROP BASE Intermediate_Dir "example___Win32_DLL_Release"
43# PROP BASE Target_Dir ""
44# PROP Use_MFC 0
45# PROP Use_Debug_Libraries 0
46# PROP Output_Dir "Win32_DLL_Release"
47# PROP Intermediate_Dir "Win32_DLL_Release"
48# PROP Ignore_Export_Lib 0
49# PROP Target_Dir ""
50# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
51# SUBTRACT BASE CPP /YX
52# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
53# SUBTRACT CPP /YX
54# ADD BASE RSC /l 0x409 /d "NDEBUG"
55# ADD RSC /l 0x409 /d "NDEBUG"
56BSC32=bscmake.exe
57# ADD BASE BSC32 /nologo
58# ADD BSC32 /nologo
59LINK32=link.exe
60# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
61# ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_Release"
62
63!ELSEIF "$(CFG)" == "example - Win32 DLL Debug"
64
65# PROP BASE Use_MFC 0
66# PROP BASE Use_Debug_Libraries 1
67# PROP BASE Output_Dir "example___Win32_DLL_Debug"
68# PROP BASE Intermediate_Dir "example___Win32_DLL_Debug"
69# PROP BASE Target_Dir ""
70# PROP Use_MFC 0
71# PROP Use_Debug_Libraries 1
72# PROP Output_Dir "Win32_DLL_Debug"
73# PROP Intermediate_Dir "Win32_DLL_Debug"
74# PROP Ignore_Export_Lib 0
75# PROP Target_Dir ""
76# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
77# SUBTRACT BASE CPP /YX
78# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
79# SUBTRACT CPP /YX
80# ADD BASE RSC /l 0x409 /d "_DEBUG"
81# ADD RSC /l 0x409 /d "_DEBUG"
82BSC32=bscmake.exe
83# ADD BASE BSC32 /nologo
84# ADD BSC32 /nologo
85LINK32=link.exe
86# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
87# ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_Debug"
88
89!ELSEIF "$(CFG)" == "example - Win32 DLL ASM Release"
90
91# PROP BASE Use_MFC 0
92# PROP BASE Use_Debug_Libraries 0
93# PROP BASE Output_Dir "example___Win32_DLL_ASM_Release"
94# PROP BASE Intermediate_Dir "example___Win32_DLL_ASM_Release"
95# PROP BASE Target_Dir ""
96# PROP Use_MFC 0
97# PROP Use_Debug_Libraries 0
98# PROP Output_Dir "Win32_DLL_ASM_Release"
99# PROP Intermediate_Dir "Win32_DLL_ASM_Release"
100# PROP Ignore_Export_Lib 0
101# PROP Target_Dir ""
102# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
103# SUBTRACT BASE CPP /YX
104# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
105# SUBTRACT CPP /YX
106# ADD BASE RSC /l 0x409 /d "NDEBUG"
107# ADD RSC /l 0x409 /d "NDEBUG"
108BSC32=bscmake.exe
109# ADD BASE BSC32 /nologo
110# ADD BSC32 /nologo
111LINK32=link.exe
112# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
113# ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_ASM_Release"
114
115!ELSEIF "$(CFG)" == "example - Win32 DLL ASM Debug"
116
117# PROP BASE Use_MFC 0
118# PROP BASE Use_Debug_Libraries 1
119# PROP BASE Output_Dir "example___Win32_DLL_ASM_Debug"
120# PROP BASE Intermediate_Dir "example___Win32_DLL_ASM_Debug"
121# PROP BASE Target_Dir ""
122# PROP Use_MFC 0
123# PROP Use_Debug_Libraries 1
124# PROP Output_Dir "Win32_DLL_ASM_Debug"
125# PROP Intermediate_Dir "Win32_DLL_ASM_Debug"
126# PROP Ignore_Export_Lib 0
127# PROP Target_Dir ""
128# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
129# SUBTRACT BASE CPP /YX
130# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
131# SUBTRACT CPP /YX
132# ADD BASE RSC /l 0x409 /d "_DEBUG"
133# ADD RSC /l 0x409 /d "_DEBUG"
134BSC32=bscmake.exe
135# ADD BASE BSC32 /nologo
136# ADD BSC32 /nologo
137LINK32=link.exe
138# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
139# ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_ASM_Debug"
140
141!ELSEIF "$(CFG)" == "example - Win32 LIB Release"
142
143# PROP BASE Use_MFC 0
144# PROP BASE Use_Debug_Libraries 0
145# PROP BASE Output_Dir "example___Win32_LIB_Release"
146# PROP BASE Intermediate_Dir "example___Win32_LIB_Release"
147# PROP BASE Target_Dir ""
148# PROP Use_MFC 0
149# PROP Use_Debug_Libraries 0
150# PROP Output_Dir "Win32_LIB_Release"
151# PROP Intermediate_Dir "Win32_LIB_Release"
152# PROP Ignore_Export_Lib 0
153# PROP Target_Dir ""
154# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
155# SUBTRACT BASE CPP /YX
156# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
157# SUBTRACT CPP /YX
158# ADD BASE RSC /l 0x409 /d "NDEBUG"
159# ADD RSC /l 0x409 /d "NDEBUG"
160BSC32=bscmake.exe
161# ADD BASE BSC32 /nologo
162# ADD BSC32 /nologo
163LINK32=link.exe
164# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
165# ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_Release"
166
167!ELSEIF "$(CFG)" == "example - Win32 LIB Debug"
168
169# PROP BASE Use_MFC 0
170# PROP BASE Use_Debug_Libraries 1
171# PROP BASE Output_Dir "example___Win32_LIB_Debug"
172# PROP BASE Intermediate_Dir "example___Win32_LIB_Debug"
173# PROP BASE Target_Dir ""
174# PROP Use_MFC 0
175# PROP Use_Debug_Libraries 1
176# PROP Output_Dir "Win32_LIB_Debug"
177# PROP Intermediate_Dir "Win32_LIB_Debug"
178# PROP Ignore_Export_Lib 0
179# PROP Target_Dir ""
180# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
181# SUBTRACT BASE CPP /YX
182# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
183# SUBTRACT CPP /YX
184# ADD BASE RSC /l 0x409 /d "_DEBUG"
185# ADD RSC /l 0x409 /d "_DEBUG"
186BSC32=bscmake.exe
187# ADD BASE BSC32 /nologo
188# ADD BSC32 /nologo
189LINK32=link.exe
190# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
191# ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_Debug"
192
193!ELSEIF "$(CFG)" == "example - Win32 LIB ASM Release"
194
195# PROP BASE Use_MFC 0
196# PROP BASE Use_Debug_Libraries 0
197# PROP BASE Output_Dir "example___Win32_LIB_ASM_Release"
198# PROP BASE Intermediate_Dir "example___Win32_LIB_ASM_Release"
199# PROP BASE Target_Dir ""
200# PROP Use_MFC 0
201# PROP Use_Debug_Libraries 0
202# PROP Output_Dir "Win32_LIB_ASM_Release"
203# PROP Intermediate_Dir "Win32_LIB_ASM_Release"
204# PROP Ignore_Export_Lib 0
205# PROP Target_Dir ""
206# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
207# SUBTRACT BASE CPP /YX
208# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
209# SUBTRACT CPP /YX
210# ADD BASE RSC /l 0x409 /d "NDEBUG"
211# ADD RSC /l 0x409 /d "NDEBUG"
212BSC32=bscmake.exe
213# ADD BASE BSC32 /nologo
214# ADD BSC32 /nologo
215LINK32=link.exe
216# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
217# ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_ASM_Release"
218
219!ELSEIF "$(CFG)" == "example - Win32 LIB ASM Debug"
220
221# PROP BASE Use_MFC 0
222# PROP BASE Use_Debug_Libraries 1
223# PROP BASE Output_Dir "example___Win32_LIB_ASM_Debug"
224# PROP BASE Intermediate_Dir "example___Win32_LIB_ASM_Debug"
225# PROP BASE Target_Dir ""
226# PROP Use_MFC 0
227# PROP Use_Debug_Libraries 1
228# PROP Output_Dir "Win32_LIB_ASM_Debug"
229# PROP Intermediate_Dir "Win32_LIB_ASM_Debug"
230# PROP Ignore_Export_Lib 0
231# PROP Target_Dir ""
232# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
233# SUBTRACT BASE CPP /YX
234# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
235# SUBTRACT CPP /YX
236# ADD BASE RSC /l 0x409 /d "_DEBUG"
237# ADD RSC /l 0x409 /d "_DEBUG"
238BSC32=bscmake.exe
239# ADD BASE BSC32 /nologo
240# ADD BSC32 /nologo
241LINK32=link.exe
242# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
243# ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_ASM_Debug"
244
245!ENDIF
246
247# Begin Target
248
249# Name "example - Win32 DLL Release"
250# Name "example - Win32 DLL Debug"
251# Name "example - Win32 DLL ASM Release"
252# Name "example - Win32 DLL ASM Debug"
253# Name "example - Win32 LIB Release"
254# Name "example - Win32 LIB Debug"
255# Name "example - Win32 LIB ASM Release"
256# Name "example - Win32 LIB ASM Debug"
257# Begin Group "Source Files"
258
259# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
260# Begin Source File
261
262SOURCE=..\..\example.c
263# End Source File
264# End Group
265# Begin Group "Header Files"
266
267# PROP Default_Filter "h;hpp;hxx;hm;inl"
268# Begin Source File
269
270SOURCE=..\..\zconf.h
271# End Source File
272# Begin Source File
273
274SOURCE=..\..\zlib.h
275# End Source File
276# End Group
277# End Target
278# End Project
diff --git a/projects/visualc6/minigzip.dsp b/projects/visualc6/minigzip.dsp
new file mode 100644
index 0000000..91d981d
--- /dev/null
+++ b/projects/visualc6/minigzip.dsp
@@ -0,0 +1,278 @@
1# Microsoft Developer Studio Project File - Name="minigzip" - Package Owner=<4>
2# Microsoft Developer Studio Generated Build File, Format Version 6.00
3# ** DO NOT EDIT **
4
5# TARGTYPE "Win32 (x86) Console Application" 0x0103
6
7CFG=minigzip - Win32 LIB Debug
8!MESSAGE This is not a valid makefile. To build this project using NMAKE,
9!MESSAGE use the Export Makefile command and run
10!MESSAGE
11!MESSAGE NMAKE /f "minigzip.mak".
12!MESSAGE
13!MESSAGE You can specify a configuration when running NMAKE
14!MESSAGE by defining the macro CFG on the command line. For example:
15!MESSAGE
16!MESSAGE NMAKE /f "minigzip.mak" CFG="minigzip - Win32 LIB Debug"
17!MESSAGE
18!MESSAGE Possible choices for configuration are:
19!MESSAGE
20!MESSAGE "minigzip - Win32 DLL Release" (based on "Win32 (x86) Console Application")
21!MESSAGE "minigzip - Win32 DLL Debug" (based on "Win32 (x86) Console Application")
22!MESSAGE "minigzip - Win32 DLL ASM Release" (based on "Win32 (x86) Console Application")
23!MESSAGE "minigzip - Win32 DLL ASM Debug" (based on "Win32 (x86) Console Application")
24!MESSAGE "minigzip - Win32 LIB Release" (based on "Win32 (x86) Console Application")
25!MESSAGE "minigzip - Win32 LIB Debug" (based on "Win32 (x86) Console Application")
26!MESSAGE "minigzip - Win32 LIB ASM Release" (based on "Win32 (x86) Console Application")
27!MESSAGE "minigzip - Win32 LIB ASM Debug" (based on "Win32 (x86) Console Application")
28!MESSAGE
29
30# Begin Project
31# PROP AllowPerConfigDependencies 0
32# PROP Scc_ProjName ""
33# PROP Scc_LocalPath ""
34CPP=cl.exe
35RSC=rc.exe
36
37!IF "$(CFG)" == "minigzip - Win32 DLL Release"
38
39# PROP BASE Use_MFC 0
40# PROP BASE Use_Debug_Libraries 0
41# PROP BASE Output_Dir "minigzip___Win32_DLL_Release"
42# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_Release"
43# PROP BASE Target_Dir ""
44# PROP Use_MFC 0
45# PROP Use_Debug_Libraries 0
46# PROP Output_Dir "Win32_DLL_Release"
47# PROP Intermediate_Dir "Win32_DLL_Release"
48# PROP Ignore_Export_Lib 0
49# PROP Target_Dir ""
50# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
51# SUBTRACT BASE CPP /YX
52# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
53# SUBTRACT CPP /YX
54# ADD BASE RSC /l 0x409 /d "NDEBUG"
55# ADD RSC /l 0x409 /d "NDEBUG"
56BSC32=bscmake.exe
57# ADD BASE BSC32 /nologo
58# ADD BSC32 /nologo
59LINK32=link.exe
60# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
61# ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_Release"
62
63!ELSEIF "$(CFG)" == "minigzip - Win32 DLL Debug"
64
65# PROP BASE Use_MFC 0
66# PROP BASE Use_Debug_Libraries 1
67# PROP BASE Output_Dir "minigzip___Win32_DLL_Debug"
68# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_Debug"
69# PROP BASE Target_Dir ""
70# PROP Use_MFC 0
71# PROP Use_Debug_Libraries 1
72# PROP Output_Dir "Win32_DLL_Debug"
73# PROP Intermediate_Dir "Win32_DLL_Debug"
74# PROP Ignore_Export_Lib 0
75# PROP Target_Dir ""
76# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
77# SUBTRACT BASE CPP /YX
78# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
79# SUBTRACT CPP /YX
80# ADD BASE RSC /l 0x409 /d "_DEBUG"
81# ADD RSC /l 0x409 /d "_DEBUG"
82BSC32=bscmake.exe
83# ADD BASE BSC32 /nologo
84# ADD BSC32 /nologo
85LINK32=link.exe
86# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
87# ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_Debug"
88
89!ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Release"
90
91# PROP BASE Use_MFC 0
92# PROP BASE Use_Debug_Libraries 0
93# PROP BASE Output_Dir "minigzip___Win32_DLL_ASM_Release"
94# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_ASM_Release"
95# PROP BASE Target_Dir ""
96# PROP Use_MFC 0
97# PROP Use_Debug_Libraries 0
98# PROP Output_Dir "Win32_DLL_ASM_Release"
99# PROP Intermediate_Dir "Win32_DLL_ASM_Release"
100# PROP Ignore_Export_Lib 0
101# PROP Target_Dir ""
102# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
103# SUBTRACT BASE CPP /YX
104# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
105# SUBTRACT CPP /YX
106# ADD BASE RSC /l 0x409 /d "NDEBUG"
107# ADD RSC /l 0x409 /d "NDEBUG"
108BSC32=bscmake.exe
109# ADD BASE BSC32 /nologo
110# ADD BSC32 /nologo
111LINK32=link.exe
112# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
113# ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_ASM_Release"
114
115!ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Debug"
116
117# PROP BASE Use_MFC 0
118# PROP BASE Use_Debug_Libraries 1
119# PROP BASE Output_Dir "minigzip___Win32_DLL_ASM_Debug"
120# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_ASM_Debug"
121# PROP BASE Target_Dir ""
122# PROP Use_MFC 0
123# PROP Use_Debug_Libraries 1
124# PROP Output_Dir "Win32_DLL_ASM_Debug"
125# PROP Intermediate_Dir "Win32_DLL_ASM_Debug"
126# PROP Ignore_Export_Lib 0
127# PROP Target_Dir ""
128# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
129# SUBTRACT BASE CPP /YX
130# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
131# SUBTRACT CPP /YX
132# ADD BASE RSC /l 0x409 /d "_DEBUG"
133# ADD RSC /l 0x409 /d "_DEBUG"
134BSC32=bscmake.exe
135# ADD BASE BSC32 /nologo
136# ADD BSC32 /nologo
137LINK32=link.exe
138# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
139# ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_ASM_Debug"
140
141!ELSEIF "$(CFG)" == "minigzip - Win32 LIB Release"
142
143# PROP BASE Use_MFC 0
144# PROP BASE Use_Debug_Libraries 0
145# PROP BASE Output_Dir "minigzip___Win32_LIB_Release"
146# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_Release"
147# PROP BASE Target_Dir ""
148# PROP Use_MFC 0
149# PROP Use_Debug_Libraries 0
150# PROP Output_Dir "Win32_LIB_Release"
151# PROP Intermediate_Dir "Win32_LIB_Release"
152# PROP Ignore_Export_Lib 0
153# PROP Target_Dir ""
154# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
155# SUBTRACT BASE CPP /YX
156# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
157# SUBTRACT CPP /YX
158# ADD BASE RSC /l 0x409 /d "NDEBUG"
159# ADD RSC /l 0x409 /d "NDEBUG"
160BSC32=bscmake.exe
161# ADD BASE BSC32 /nologo
162# ADD BSC32 /nologo
163LINK32=link.exe
164# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
165# ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_Release"
166
167!ELSEIF "$(CFG)" == "minigzip - Win32 LIB Debug"
168
169# PROP BASE Use_MFC 0
170# PROP BASE Use_Debug_Libraries 1
171# PROP BASE Output_Dir "minigzip___Win32_LIB_Debug"
172# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_Debug"
173# PROP BASE Target_Dir ""
174# PROP Use_MFC 0
175# PROP Use_Debug_Libraries 1
176# PROP Output_Dir "Win32_LIB_Debug"
177# PROP Intermediate_Dir "Win32_LIB_Debug"
178# PROP Ignore_Export_Lib 0
179# PROP Target_Dir ""
180# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
181# SUBTRACT BASE CPP /YX
182# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
183# SUBTRACT CPP /YX
184# ADD BASE RSC /l 0x409 /d "_DEBUG"
185# ADD RSC /l 0x409 /d "_DEBUG"
186BSC32=bscmake.exe
187# ADD BASE BSC32 /nologo
188# ADD BSC32 /nologo
189LINK32=link.exe
190# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
191# ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_Debug"
192
193!ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Release"
194
195# PROP BASE Use_MFC 0
196# PROP BASE Use_Debug_Libraries 0
197# PROP BASE Output_Dir "minigzip___Win32_LIB_ASM_Release"
198# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_ASM_Release"
199# PROP BASE Target_Dir ""
200# PROP Use_MFC 0
201# PROP Use_Debug_Libraries 0
202# PROP Output_Dir "Win32_LIB_ASM_Release"
203# PROP Intermediate_Dir "Win32_LIB_ASM_Release"
204# PROP Ignore_Export_Lib 0
205# PROP Target_Dir ""
206# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
207# SUBTRACT BASE CPP /YX
208# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
209# SUBTRACT CPP /YX
210# ADD BASE RSC /l 0x409 /d "NDEBUG"
211# ADD RSC /l 0x409 /d "NDEBUG"
212BSC32=bscmake.exe
213# ADD BASE BSC32 /nologo
214# ADD BSC32 /nologo
215LINK32=link.exe
216# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
217# ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_ASM_Release"
218
219!ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Debug"
220
221# PROP BASE Use_MFC 0
222# PROP BASE Use_Debug_Libraries 1
223# PROP BASE Output_Dir "minigzip___Win32_LIB_ASM_Debug"
224# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_ASM_Debug"
225# PROP BASE Target_Dir ""
226# PROP Use_MFC 0
227# PROP Use_Debug_Libraries 1
228# PROP Output_Dir "Win32_LIB_ASM_Debug"
229# PROP Intermediate_Dir "Win32_LIB_ASM_Debug"
230# PROP Ignore_Export_Lib 0
231# PROP Target_Dir ""
232# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
233# SUBTRACT BASE CPP /YX
234# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
235# SUBTRACT CPP /YX
236# ADD BASE RSC /l 0x409 /d "_DEBUG"
237# ADD RSC /l 0x409 /d "_DEBUG"
238BSC32=bscmake.exe
239# ADD BASE BSC32 /nologo
240# ADD BSC32 /nologo
241LINK32=link.exe
242# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
243# ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_ASM_Debug"
244
245!ENDIF
246
247# Begin Target
248
249# Name "minigzip - Win32 DLL Release"
250# Name "minigzip - Win32 DLL Debug"
251# Name "minigzip - Win32 DLL ASM Release"
252# Name "minigzip - Win32 DLL ASM Debug"
253# Name "minigzip - Win32 LIB Release"
254# Name "minigzip - Win32 LIB Debug"
255# Name "minigzip - Win32 LIB ASM Release"
256# Name "minigzip - Win32 LIB ASM Debug"
257# Begin Group "Source Files"
258
259# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
260# Begin Source File
261
262SOURCE=..\..\minigzip.c
263# End Source File
264# End Group
265# Begin Group "Header Files"
266
267# PROP Default_Filter "h;hpp;hxx;hm;inl"
268# Begin Source File
269
270SOURCE=..\..\zconf.h
271# End Source File
272# Begin Source File
273
274SOURCE=..\..\zlib.h
275# End Source File
276# End Group
277# End Target
278# End Project
diff --git a/projects/visualc6/zlib.dsp b/projects/visualc6/zlib.dsp
new file mode 100644
index 0000000..a1a401a
--- /dev/null
+++ b/projects/visualc6/zlib.dsp
@@ -0,0 +1,539 @@
1# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4>
2# Microsoft Developer Studio Generated Build File, Format Version 6.00
3# ** DO NOT EDIT **
4
5# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6# TARGTYPE "Win32 (x86) Static Library" 0x0104
7
8CFG=zlib - Win32 LIB Debug
9!MESSAGE This is not a valid makefile. To build this project using NMAKE,
10!MESSAGE use the Export Makefile command and run
11!MESSAGE
12!MESSAGE NMAKE /f "zlib.mak".
13!MESSAGE
14!MESSAGE You can specify a configuration when running NMAKE
15!MESSAGE by defining the macro CFG on the command line. For example:
16!MESSAGE
17!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 LIB Debug"
18!MESSAGE
19!MESSAGE Possible choices for configuration are:
20!MESSAGE
21!MESSAGE "zlib - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library")
22!MESSAGE "zlib - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
23!MESSAGE "zlib - Win32 DLL ASM Release" (based on "Win32 (x86) Dynamic-Link Library")
24!MESSAGE "zlib - Win32 DLL ASM Debug" (based on "Win32 (x86) Dynamic-Link Library")
25!MESSAGE "zlib - Win32 LIB Release" (based on "Win32 (x86) Static Library")
26!MESSAGE "zlib - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
27!MESSAGE "zlib - Win32 LIB ASM Release" (based on "Win32 (x86) Static Library")
28!MESSAGE "zlib - Win32 LIB ASM Debug" (based on "Win32 (x86) Static Library")
29!MESSAGE
30
31# Begin Project
32# PROP AllowPerConfigDependencies 0
33# PROP Scc_ProjName ""
34# PROP Scc_LocalPath ""
35
36!IF "$(CFG)" == "zlib - Win32 DLL Release"
37
38# PROP BASE Use_MFC 0
39# PROP BASE Use_Debug_Libraries 0
40# PROP BASE Output_Dir "zlib___Win32_DLL_Release"
41# PROP BASE Intermediate_Dir "zlib___Win32_DLL_Release"
42# PROP BASE Target_Dir ""
43# PROP Use_MFC 0
44# PROP Use_Debug_Libraries 0
45# PROP Output_Dir "Win32_DLL_Release"
46# PROP Intermediate_Dir "Win32_DLL_Release"
47# PROP Ignore_Export_Lib 0
48# PROP Target_Dir ""
49CPP=cl.exe
50# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
51# SUBTRACT BASE CPP /YX /Yc /Yu
52# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
53# SUBTRACT CPP /YX /Yc /Yu
54MTL=midl.exe
55# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
56# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
57RSC=rc.exe
58# ADD BASE RSC /l 0x409 /d "NDEBUG"
59# ADD RSC /l 0x409 /d "NDEBUG"
60BSC32=bscmake.exe
61# ADD BASE BSC32 /nologo
62# ADD BSC32 /nologo
63LINK32=link.exe
64# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
65# ADD LINK32 /nologo /dll /machine:I386 /out:"Win32_DLL_Release\zlib1.dll"
66
67!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
68
69# PROP BASE Use_MFC 0
70# PROP BASE Use_Debug_Libraries 1
71# PROP BASE Output_Dir "zlib___Win32_DLL_Debug"
72# PROP BASE Intermediate_Dir "zlib___Win32_DLL_Debug"
73# PROP BASE Target_Dir ""
74# PROP Use_MFC 0
75# PROP Use_Debug_Libraries 1
76# PROP Output_Dir "Win32_DLL_Debug"
77# PROP Intermediate_Dir "Win32_DLL_Debug"
78# PROP Ignore_Export_Lib 0
79# PROP Target_Dir ""
80CPP=cl.exe
81# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
82# SUBTRACT BASE CPP /YX /Yc /Yu
83# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
84# SUBTRACT CPP /YX /Yc /Yu
85MTL=midl.exe
86# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
87# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
88RSC=rc.exe
89# ADD BASE RSC /l 0x409 /d "_DEBUG"
90# ADD RSC /l 0x409 /d "_DEBUG"
91BSC32=bscmake.exe
92# ADD BASE BSC32 /nologo
93# ADD BSC32 /nologo
94LINK32=link.exe
95# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
96# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\zlib1d.dll" /pdbtype:sept
97
98!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
99
100# PROP BASE Use_MFC 0
101# PROP BASE Use_Debug_Libraries 0
102# PROP BASE Output_Dir "zlib___Win32_DLL_ASM_Release"
103# PROP BASE Intermediate_Dir "zlib___Win32_DLL_ASM_Release"
104# PROP BASE Target_Dir ""
105# PROP Use_MFC 0
106# PROP Use_Debug_Libraries 0
107# PROP Output_Dir "Win32_DLL_ASM_Release"
108# PROP Intermediate_Dir "Win32_DLL_ASM_Release"
109# PROP Ignore_Export_Lib 0
110# PROP Target_Dir ""
111CPP=cl.exe
112# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
113# SUBTRACT BASE CPP /YX /Yc /Yu
114# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "ASMV" /D "ASMINF" /FD /c
115# SUBTRACT CPP /YX /Yc /Yu
116MTL=midl.exe
117# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
118# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
119RSC=rc.exe
120# ADD BASE RSC /l 0x409 /d "NDEBUG"
121# ADD RSC /l 0x409 /d "NDEBUG"
122BSC32=bscmake.exe
123# ADD BASE BSC32 /nologo
124# ADD BSC32 /nologo
125LINK32=link.exe
126# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
127# ADD LINK32 /nologo /dll /machine:I386 /out:"Win32_DLL_ASM_Release\zlib1.dll"
128
129!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
130
131# PROP BASE Use_MFC 0
132# PROP BASE Use_Debug_Libraries 1
133# PROP BASE Output_Dir "zlib___Win32_DLL_ASM_Debug"
134# PROP BASE Intermediate_Dir "zlib___Win32_DLL_ASM_Debug"
135# PROP BASE Target_Dir ""
136# PROP Use_MFC 0
137# PROP Use_Debug_Libraries 1
138# PROP Output_Dir "Win32_DLL_ASM_Debug"
139# PROP Intermediate_Dir "Win32_DLL_ASM_Debug"
140# PROP Ignore_Export_Lib 0
141# PROP Target_Dir ""
142CPP=cl.exe
143# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
144# SUBTRACT BASE CPP /YX /Yc /Yu
145# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "ASMV" /D "ASMINF" /FD /GZ /c
146# SUBTRACT CPP /YX /Yc /Yu
147MTL=midl.exe
148# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
149# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
150RSC=rc.exe
151# ADD BASE RSC /l 0x409 /d "_DEBUG"
152# ADD RSC /l 0x409 /d "_DEBUG"
153BSC32=bscmake.exe
154# ADD BASE BSC32 /nologo
155# ADD BSC32 /nologo
156LINK32=link.exe
157# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
158# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Win32_DLL_ASM_Debug\zlib1d.dll" /pdbtype:sept
159
160!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
161
162# PROP BASE Use_MFC 0
163# PROP BASE Use_Debug_Libraries 0
164# PROP BASE Output_Dir "zlib___Win32_LIB_Release"
165# PROP BASE Intermediate_Dir "zlib___Win32_LIB_Release"
166# PROP BASE Target_Dir ""
167# PROP Use_MFC 0
168# PROP Use_Debug_Libraries 0
169# PROP Output_Dir "Win32_LIB_Release"
170# PROP Intermediate_Dir "Win32_LIB_Release"
171# PROP Target_Dir ""
172CPP=cl.exe
173# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
174# SUBTRACT BASE CPP /YX /Yc /Yu
175# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
176# SUBTRACT CPP /YX /Yc /Yu
177RSC=rc.exe
178# ADD BASE RSC /l 0x409 /d "NDEBUG"
179# ADD RSC /l 0x409 /d "NDEBUG"
180BSC32=bscmake.exe
181# ADD BASE BSC32 /nologo
182# ADD BSC32 /nologo
183LIB32=link.exe -lib
184# ADD BASE LIB32 /nologo
185# ADD LIB32 /nologo
186
187!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
188
189# PROP BASE Use_MFC 0
190# PROP BASE Use_Debug_Libraries 1
191# PROP BASE Output_Dir "zlib___Win32_LIB_Debug"
192# PROP BASE Intermediate_Dir "zlib___Win32_LIB_Debug"
193# PROP BASE Target_Dir ""
194# PROP Use_MFC 0
195# PROP Use_Debug_Libraries 1
196# PROP Output_Dir "Win32_LIB_Debug"
197# PROP Intermediate_Dir "Win32_LIB_Debug"
198# PROP Target_Dir ""
199CPP=cl.exe
200# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
201# SUBTRACT BASE CPP /YX /Yc /Yu
202# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
203# SUBTRACT CPP /YX /Yc /Yu
204RSC=rc.exe
205# ADD BASE RSC /l 0x409 /d "_DEBUG"
206# ADD RSC /l 0x409 /d "_DEBUG"
207BSC32=bscmake.exe
208# ADD BASE BSC32 /nologo
209# ADD BSC32 /nologo
210LIB32=link.exe -lib
211# ADD BASE LIB32 /nologo
212# ADD LIB32 /nologo /out:"Win32_LIB_Debug\zlibd.lib"
213
214!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
215
216# PROP BASE Use_MFC 0
217# PROP BASE Use_Debug_Libraries 0
218# PROP BASE Output_Dir "zlib___Win32_LIB_ASM_Release"
219# PROP BASE Intermediate_Dir "zlib___Win32_LIB_ASM_Release"
220# PROP BASE Target_Dir ""
221# PROP Use_MFC 0
222# PROP Use_Debug_Libraries 0
223# PROP Output_Dir "Win32_LIB_ASM_Release"
224# PROP Intermediate_Dir "Win32_LIB_ASM_Release"
225# PROP Target_Dir ""
226CPP=cl.exe
227# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
228# SUBTRACT BASE CPP /YX /Yc /Yu
229# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "ASMV" /D "ASMINF" /FD /c
230# SUBTRACT CPP /YX /Yc /Yu
231RSC=rc.exe
232# ADD BASE RSC /l 0x409 /d "NDEBUG"
233# ADD RSC /l 0x409 /d "NDEBUG"
234BSC32=bscmake.exe
235# ADD BASE BSC32 /nologo
236# ADD BSC32 /nologo
237LIB32=link.exe -lib
238# ADD BASE LIB32 /nologo
239# ADD LIB32 /nologo
240
241!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
242
243# PROP BASE Use_MFC 0
244# PROP BASE Use_Debug_Libraries 1
245# PROP BASE Output_Dir "zlib___Win32_LIB_ASM_Debug"
246# PROP BASE Intermediate_Dir "zlib___Win32_LIB_ASM_Debug"
247# PROP BASE Target_Dir ""
248# PROP Use_MFC 0
249# PROP Use_Debug_Libraries 1
250# PROP Output_Dir "Win32_LIB_ASM_Debug"
251# PROP Intermediate_Dir "Win32_LIB_ASM_Debug"
252# PROP Target_Dir ""
253CPP=cl.exe
254# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
255# SUBTRACT BASE CPP /YX /Yc /Yu
256# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "ASMV" /D "ASMINF" /FD /GZ /c
257# SUBTRACT CPP /YX /Yc /Yu
258RSC=rc.exe
259# ADD BASE RSC /l 0x409 /d "_DEBUG"
260# ADD RSC /l 0x409 /d "_DEBUG"
261BSC32=bscmake.exe
262# ADD BASE BSC32 /nologo
263# ADD BSC32 /nologo
264LIB32=link.exe -lib
265# ADD BASE LIB32 /nologo
266# ADD LIB32 /nologo /out:"Win32_LIB_ASM_Debug\zlibd.lib"
267
268!ENDIF
269
270# Begin Target
271
272# Name "zlib - Win32 DLL Release"
273# Name "zlib - Win32 DLL Debug"
274# Name "zlib - Win32 DLL ASM Release"
275# Name "zlib - Win32 DLL ASM Debug"
276# Name "zlib - Win32 LIB Release"
277# Name "zlib - Win32 LIB Debug"
278# Name "zlib - Win32 LIB ASM Release"
279# Name "zlib - Win32 LIB ASM Debug"
280# Begin Group "Source Files"
281
282# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
283# Begin Source File
284
285SOURCE=..\..\adler32.c
286# End Source File
287# Begin Source File
288
289SOURCE=..\..\compress.c
290# End Source File
291# Begin Source File
292
293SOURCE=..\..\crc32.c
294# End Source File
295# Begin Source File
296
297SOURCE=..\..\deflate.c
298# End Source File
299# Begin Source File
300
301SOURCE=..\..\gzio.c
302# End Source File
303# Begin Source File
304
305SOURCE=..\..\infback.c
306# End Source File
307# Begin Source File
308
309SOURCE=..\..\inffast.c
310# End Source File
311# Begin Source File
312
313SOURCE=..\..\inflate.c
314# End Source File
315# Begin Source File
316
317SOURCE=..\..\inftrees.c
318# End Source File
319# Begin Source File
320
321SOURCE=..\..\trees.c
322# End Source File
323# Begin Source File
324
325SOURCE=..\..\uncompr.c
326# End Source File
327# Begin Source File
328
329SOURCE=..\..\win32\zlib.def
330
331!IF "$(CFG)" == "zlib - Win32 DLL Release"
332
333!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
334
335!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
336
337!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
338
339!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
340
341# PROP Exclude_From_Build 1
342
343!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
344
345# PROP Exclude_From_Build 1
346
347!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
348
349# PROP Exclude_From_Build 1
350
351!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
352
353# PROP Exclude_From_Build 1
354
355!ENDIF
356
357# End Source File
358# Begin Source File
359
360SOURCE=..\..\zutil.c
361# End Source File
362# End Group
363# Begin Group "Header Files"
364
365# PROP Default_Filter "h;hpp;hxx;hm;inl"
366# Begin Source File
367
368SOURCE=..\..\crc32.h
369# End Source File
370# Begin Source File
371
372SOURCE=..\..\deflate.h
373# End Source File
374# Begin Source File
375
376SOURCE=..\..\inffast.h
377# End Source File
378# Begin Source File
379
380SOURCE=..\..\inffixed.h
381# End Source File
382# Begin Source File
383
384SOURCE=..\..\inflate.h
385# End Source File
386# Begin Source File
387
388SOURCE=..\..\inftrees.h
389# End Source File
390# Begin Source File
391
392SOURCE=..\..\trees.h
393# End Source File
394# Begin Source File
395
396SOURCE=..\..\zconf.h
397# End Source File
398# Begin Source File
399
400SOURCE=..\..\zlib.h
401# End Source File
402# Begin Source File
403
404SOURCE=..\..\zutil.h
405# End Source File
406# End Group
407# Begin Group "Resource Files"
408
409# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
410# Begin Source File
411
412SOURCE=..\..\win32\zlib1.rc
413# End Source File
414# End Group
415# Begin Group "Assembler Files (Unsupported)"
416
417# PROP Default_Filter "asm;obj;c;cpp;cxx;h;hpp;hxx"
418# Begin Source File
419
420SOURCE=..\..\contrib\masmx86\gvmat32.asm
421# PROP Exclude_From_Build 1
422# End Source File
423# Begin Source File
424
425SOURCE=..\..\contrib\masmx86\gvmat32c.c
426
427!IF "$(CFG)" == "zlib - Win32 DLL Release"
428
429# PROP Exclude_From_Build 1
430# ADD CPP /I "..\.."
431
432!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
433
434# PROP Exclude_From_Build 1
435# ADD CPP /I "..\.."
436
437!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
438
439# ADD CPP /I "..\.."
440
441!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
442
443# ADD CPP /I "..\.."
444
445!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
446
447# PROP Exclude_From_Build 1
448# ADD CPP /I "..\.."
449
450!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
451
452# PROP Exclude_From_Build 1
453# ADD CPP /I "..\.."
454
455!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
456
457# ADD CPP /I "..\.."
458
459!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
460
461# ADD CPP /I "..\.."
462
463!ENDIF
464
465# End Source File
466# Begin Source File
467
468SOURCE=..\..\contrib\masmx86\inffas32.asm
469# PROP Exclude_From_Build 1
470# End Source File
471# Begin Source File
472
473SOURCE=..\..\contrib\masmx86\gvmat32.obj
474
475!IF "$(CFG)" == "zlib - Win32 DLL Release"
476
477# PROP Exclude_From_Build 1
478
479!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
480
481# PROP Exclude_From_Build 1
482
483!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
484
485!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
486
487!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
488
489# PROP Exclude_From_Build 1
490
491!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
492
493# PROP Exclude_From_Build 1
494
495!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
496
497!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
498
499!ENDIF
500
501# End Source File
502# Begin Source File
503
504SOURCE=..\..\contrib\masmx86\inffas32.obj
505
506!IF "$(CFG)" == "zlib - Win32 DLL Release"
507
508# PROP Exclude_From_Build 1
509
510!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
511
512# PROP Exclude_From_Build 1
513
514!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
515
516!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
517
518!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
519
520# PROP Exclude_From_Build 1
521
522!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
523
524# PROP Exclude_From_Build 1
525
526!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
527
528!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
529
530!ENDIF
531
532# End Source File
533# End Group
534# Begin Source File
535
536SOURCE=.\README.txt
537# End Source File
538# End Target
539# End Project
diff --git a/projects/visualc6/zlib.dsw b/projects/visualc6/zlib.dsw
new file mode 100644
index 0000000..3a771fc
--- /dev/null
+++ b/projects/visualc6/zlib.dsw
@@ -0,0 +1,59 @@
1Microsoft Developer Studio Workspace File, Format Version 6.00
2# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3
4###############################################################################
5
6Project: "example"=.\example.dsp - Package Owner=<4>
7
8Package=<5>
9{{{
10}}}
11
12Package=<4>
13{{{
14 Begin Project Dependency
15 Project_Dep_Name zlib
16 End Project Dependency
17}}}
18
19###############################################################################
20
21Project: "minigzip"=.\minigzip.dsp - Package Owner=<4>
22
23Package=<5>
24{{{
25}}}
26
27Package=<4>
28{{{
29 Begin Project Dependency
30 Project_Dep_Name zlib
31 End Project Dependency
32}}}
33
34###############################################################################
35
36Project: "zlib"=.\zlib.dsp - Package Owner=<4>
37
38Package=<5>
39{{{
40}}}
41
42Package=<4>
43{{{
44}}}
45
46###############################################################################
47
48Global:
49
50Package=<5>
51{{{
52}}}
53
54Package=<3>
55{{{
56}}}
57
58###############################################################################
59
diff --git a/qnx/package.qpg b/qnx/package.qpg
index 71f4462..9986c6d 100644
--- a/qnx/package.qpg
+++ b/qnx/package.qpg
@@ -25,10 +25,10 @@
25 <QPG:Files> 25 <QPG:Files>
26 <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> 26 <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
27 <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/> 27 <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
28 <QPG:Add file="../libz.so.1.2.1.1" install="/opt/lib/" user="root:bin" permission="644"/> 28 <QPG:Add file="../libz.so.1.2.1.2" install="/opt/lib/" user="root:bin" permission="644"/>
29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.1.1"/> 29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.1.2"/>
30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.1.1"/> 30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.1.2"/>
31 <QPG:Add file="../libz.so.1.2.1.1" install="/opt/lib/" component="slib"/> 31 <QPG:Add file="../libz.so.1.2.1.2" install="/opt/lib/" component="slib"/>
32 </QPG:Files> 32 </QPG:Files>
33 33
34 <QPG:PackageFilter> 34 <QPG:PackageFilter>
@@ -63,7 +63,7 @@
63 </QPM:ProductDescription> 63 </QPM:ProductDescription>
64 64
65 <QPM:ReleaseDescription> 65 <QPM:ReleaseDescription>
66 <QPM:ReleaseVersion>1.2.1.1</QPM:ReleaseVersion> 66 <QPM:ReleaseVersion>1.2.1.2</QPM:ReleaseVersion>
67 <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> 67 <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
68 <QPM:ReleaseStability>Stable</QPM:ReleaseStability> 68 <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
69 <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> 69 <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
diff --git a/trees.c b/trees.c
index bb09554..52c820f 100644
--- a/trees.c
+++ b/trees.c
@@ -931,7 +931,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
931 if (s->level > 0) { 931 if (s->level > 0) {
932 932
933 /* Check if the file is ascii or binary */ 933 /* Check if the file is ascii or binary */
934 if (s->data_type == Z_UNKNOWN) set_data_type(s); 934 if (s->strm->data_type == Z_UNKNOWN) set_data_type(s);
935 935
936 /* Construct the literal and distance trees */ 936 /* Construct the literal and distance trees */
937 build_tree(s, (tree_desc *)(&(s->l_desc))); 937 build_tree(s, (tree_desc *)(&(s->l_desc)));
@@ -1131,7 +1131,7 @@ local void set_data_type(s)
1131 while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; 1131 while (n < 7) bin_freq += s->dyn_ltree[n++].Freq;
1132 while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; 1132 while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
1133 while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; 1133 while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
1134 s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII); 1134 s->strm->data_type = bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII;
1135} 1135}
1136 1136
1137/* =========================================================================== 1137/* ===========================================================================
diff --git a/win32/DLL_FAQ.txt b/win32/DLL_FAQ.txt
index 80b6b42..a3ed5dd 100644
--- a/win32/DLL_FAQ.txt
+++ b/win32/DLL_FAQ.txt
@@ -12,7 +12,7 @@ in the zlib distribution, or at the following location:
12 1. What is ZLIB1.DLL, and how can I get it? 12 1. What is ZLIB1.DLL, and how can I get it?
13 13
14 - ZLIB1.DLL is the official build of zlib as a DLL. 14 - ZLIB1.DLL is the official build of zlib as a DLL.
15 (Please remark the symbol '1' in the name.) 15 (Please remark the character '1' in the name.)
16 16
17 Pointers to a precompiled ZLIB1.DLL can be found in the zlib 17 Pointers to a precompiled ZLIB1.DLL can be found in the zlib
18 web site at: 18 web site at:
@@ -37,20 +37,19 @@ in the zlib distribution, or at the following location:
37 and build settings. If you do build the DLL yourself, please 37 and build settings. If you do build the DLL yourself, please
38 make sure that it complies with all the above requirements, 38 make sure that it complies with all the above requirements,
39 and it runs with the precompiled test programs, bundled with 39 and it runs with the precompiled test programs, bundled with
40 the original ZLIB1.DLL distribution and available at the zlib 40 the original ZLIB1.DLL distribution.
41 web site.
42 41
43 If, for any reason, you need to build an incompatible DLL, 42 If, for any reason, you need to build an incompatible DLL,
44 please use a different name. 43 please use a different file name.
45 44
46 45
47 2. Why did you change the name of the DLL to ZLIB1.DLL? 46 2. Why did you change the name of the DLL to ZLIB1.DLL?
48 What happened to the old ZLIB.DLL? 47 What happened to the old ZLIB.DLL?
49 48
50 - The old ZLIB.DLL, built from zlib-1.1.x and earlier, required 49 - The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required
51 compilation settings that were incompatible to those used by a 50 compilation settings that were incompatible to those used by
52 static build. The DLL settings were supposed to be enabled by 51 a static build. The DLL settings were supposed to be enabled
53 defining the macro ZLIB_DLL, before including "zlib.h". 52 by defining the macro ZLIB_DLL, before including "zlib.h".
54 Incorrect handling of this macro was silently accepted at 53 Incorrect handling of this macro was silently accepted at
55 build time, resulting in two major problems: 54 build time, resulting in two major problems:
56 55
@@ -65,8 +64,8 @@ in the zlib distribution, or at the following location:
65 functions. Failure to do so resulted in creating binaries 64 functions. Failure to do so resulted in creating binaries
66 that were unable to run with the official ZLIB.DLL build. 65 that were unable to run with the official ZLIB.DLL build.
67 66
68 The only possible solution that we could foresee was to make a 67 The only possible solution that we could foresee was to make
69 binary-incompatible change in the DLL interfacing, in order to 68 a binary-incompatible change in the DLL interface, in order to
70 remove the dependency on the ZLIB_DLL macro, and to release 69 remove the dependency on the ZLIB_DLL macro, and to release
71 the new DLL under a different name. 70 the new DLL under a different name.
72 71
@@ -85,17 +84,13 @@ in the zlib distribution, or at the following location:
85 84
86 - In principle, you can do it by assigning calling convention 85 - In principle, you can do it by assigning calling convention
87 keywords to the macros ZEXPORT and ZEXPORTVA. In practice, 86 keywords to the macros ZEXPORT and ZEXPORTVA. In practice,
88 it depends on what you mean by "an old ZLIB.DLL", because 87 it depends on what you mean by "an old ZLIB.DLL", because the
89 the old DLL exists in several mutually-incompatible versions. 88 old DLL exists in several mutually-incompatible versions.
90 89 You have to find out first what kind of calling convention is
91 If you have a compiled application that works with a certain 90 being used in your particular ZLIB.DLL build, and to use the
92 ZLIB.DLL without any known security issues, there is hardly 91 same one in the new build. If you don't know what this is all
93 a need to rebuild the DLL from new sources only to link it to 92 about, you might be better off if you would just leave the old
94 the old app binary. But if you really want to do it, you have 93 DLL intact.
95 to find out first what kind of calling convention uses your
96 particular ZLIB.DLL build, and to use the same one in the new
97 build. If you don't know what this is all about, you might be
98 better off if you would just forget it.
99 94
100 95
101 4. Can I compile my application using the new zlib interface, and 96 4. Can I compile my application using the new zlib interface, and
@@ -170,19 +165,19 @@ in the zlib distribution, or at the following location:
170 the K&R-style function prototypes, where the argument types 165 the K&R-style function prototypes, where the argument types
171 are not specified; but that is another story for another day. 166 are not specified; but that is another story for another day.
172 167
173 The fact that remains is that CDECL is the default convention. 168 The remaining fact is that CDECL is the default convention.
174 Even if an explicit convention (such as STDCALL or FASTCALL) 169 Even if an explicit convention is hard-coded into the function
175 is hard-coded into the function prototypes inside C headers, 170 prototypes inside C headers, problems may appear. The
176 problems may appear. One problem, for example, deals with the 171 necessity to expose the convention in users' callbacks is one
177 necessity to expose the convention in users' callbacks. 172 of these problems.
178 173
179 The calling convention issues are also important when using 174 The calling convention issues are also important when using
180 zlib in other programming languages. Some of them, like Ada 175 zlib in other programming languages. Some of them, like Ada
181 (GNAT) and Fortran (GNU G77), have C bindings implemented 176 (GNAT) and Fortran (GNU G77), have C bindings implemented
182 initially on Unix, and relying on the C calling convention. 177 initially on Unix, and relying on the C calling convention.
183 On the other hand, the pre- .NET versions of Microsoft Visual 178 On the other hand, the pre- .NET versions of Microsoft Visual
184 Basic require STDCALL, while Borland Delphi prefers (although 179 Basic require STDCALL, while Borland Delphi prefers, although
185 it does not require) FASTCALL. 180 it does not require, FASTCALL.
186 181
187 In fairness to all possible uses of zlib outside the C 182 In fairness to all possible uses of zlib outside the C
188 programming language, we choose the default "C" convention. 183 programming language, we choose the default "C" convention.
@@ -208,7 +203,16 @@ in the zlib distribution, or at the following location:
208 zlib distribution. 203 zlib distribution.
209 204
210 205
211 8. If my application uses ZLIB1.DLL, should I link it to 206 8. I need a DLL for my Microsoft .NET project. What can I do?
207
208 - We did not implement a COM wrapper around zlib, so you will
209 have to develop it yourself, or to get it from somewhere else.
210
211 If you would be so generous as to contribute such a wrapper,
212 we would like to include it in a future zlib version.
213
214
215 9. If my application uses ZLIB1.DLL, should I link it to
212 MSVCRT.DLL? Why? 216 MSVCRT.DLL? Why?
213 217
214 - It is not required, but it is recommended to link your 218 - It is not required, but it is recommended to link your
@@ -223,7 +227,7 @@ in the zlib distribution, or at the following location:
223 depend on it should also be linked to MSVCRT.DLL. 227 depend on it should also be linked to MSVCRT.DLL.
224 228
225 229
226 9. Why are you saying that ZLIB1.DLL and my application must be 23010. Why are you saying that ZLIB1.DLL and my application must be
227 linked to the same C run-time (CRT) library? I linked my 231 linked to the same C run-time (CRT) library? I linked my
228 application and my DLLs to different C libraries (e.g. my 232 application and my DLLs to different C libraries (e.g. my
229 application to a static library, and my DLLs to MSVCRT.DLL), 233 application to a static library, and my DLLs to MSVCRT.DLL),
@@ -255,11 +259,11 @@ in the zlib distribution, or at the following location:
255 and DLLs are avoiding the corruption of each of the CRTs' 259 and DLLs are avoiding the corruption of each of the CRTs'
256 internal states, maybe by careful design, or maybe by fortune. 260 internal states, maybe by careful design, or maybe by fortune.
257 261
258 Also note that linking ZLIB1.DLL to non-Microsoft CRTs (such 262 Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such
259 as those provided by Borland) raises similar problems. 263 as those provided by Borland, raises similar problems.
260 264
261 265
26210. Why are you linking ZLIB1.DLL to MSVCRT.DLL? 26611. Why are you linking ZLIB1.DLL to MSVCRT.DLL?
263 267
264 - MSVCRT.DLL exists on every Windows 95 with a new service pack 268 - MSVCRT.DLL exists on every Windows 95 with a new service pack
265 installed, or with Microsoft Internet Explorer 4 or later, and 269 installed, or with Microsoft Internet Explorer 4 or later, and
@@ -269,12 +273,11 @@ in the zlib distribution, or at the following location:
269 software provider for free. 273 software provider for free.
270 274
271 The fact that MSVCRT.DLL does not exist on a virgin Windows 95 275 The fact that MSVCRT.DLL does not exist on a virgin Windows 95
272 is not so problematic. The number of Windows 95 installations 276 is not so problematic. Windows 95 is scarcely found nowadays,
273 is rapidly decreasing, Microsoft stopped supporting it a long 277 Microsoft ended its support a long time ago, and many recent
274 time ago, and many recent applications from various vendors, 278 applications from various vendors, including Microsoft, do not
275 including Microsoft, do not even run on it. Furthermore, no 279 even run on it. Furthermore, no serious user should run
276 serious user should run Windows 95 without a proper update 280 Windows 95 without a proper update installed.
277 installed.
278 281
279 There is also the fact that the mainstream C compilers for 282 There is also the fact that the mainstream C compilers for
280 Windows are Microsoft Visual C++ 6.0, and gcc/MinGW. Both 283 Windows are Microsoft Visual C++ 6.0, and gcc/MinGW. Both
@@ -283,7 +286,7 @@ in the zlib distribution, or at the following location:
283 select by users. 286 select by users.
284 287
285 288
28611. Why are you not linking ZLIB1.DLL to 28912. Why are you not linking ZLIB1.DLL to
287 <<my favorite C run-time library>> ? 290 <<my favorite C run-time library>> ?
288 291
289 - We considered and abandoned the following alternatives: 292 - We considered and abandoned the following alternatives:
@@ -314,7 +317,7 @@ in the zlib distribution, or at the following location:
314 Windows NT systems. 317 Windows NT systems.
315 318
316 319
31712. I need to link my own DLL build to a CRT different than 32013. I need to link my own DLL build to a CRT different than
318 MSVCRT.DLL. What can I do? 321 MSVCRT.DLL. What can I do?
319 322
320 - Feel free to rebuild the DLL from the zlib sources, and link 323 - Feel free to rebuild the DLL from the zlib sources, and link
@@ -330,7 +333,7 @@ in the zlib distribution, or at the following location:
330 CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. 333 CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL.
331 334
332 335
33313. May I include additional pieces of code that I find useful, 33614. May I include additional pieces of code that I find useful,
334 link them in ZLIB1.DLL, and export them? 337 link them in ZLIB1.DLL, and export them?
335 338
336 - No. A legitimate build of ZLIB1.DLL must not include code 339 - No. A legitimate build of ZLIB1.DLL must not include code
@@ -338,14 +341,12 @@ in the zlib distribution, or at the following location:
338 But you can make your own private DLL build, under a different 341 But you can make your own private DLL build, under a different
339 file name, as suggested in the previous answer. 342 file name, as suggested in the previous answer.
340 343
341 For example, in Borland Delphi and C++ Builder, zlib is a part 344 For example, zlib is a part of the VCL library, distributed
342 of the standard VCL library. If an application links to VCL 345 with Borland Delphi and C++ Builder. The DLL build of VCL
343 dynamically, the name of the distributable binary (VCLxx.DLL) 346 is a redistributable file, named VCLxx.DLL.
344 does not posess any danger of clashing with a legitimate but
345 incompatible ZLIB1.DLL.
346 347
347 348
34814. May I remove some functionality out of ZLIB1.DLL, by enabling 34915. May I remove some functionality out of ZLIB1.DLL, by enabling
349 macros like NO_GZCOMPRESS or NO_GZIP at compile time? 350 macros like NO_GZCOMPRESS or NO_GZIP at compile time?
350 351
351 - No. A legitimate build of ZLIB1.DLL must provide the complete 352 - No. A legitimate build of ZLIB1.DLL must provide the complete
@@ -354,7 +355,7 @@ in the zlib distribution, or at the following location:
354 different file name, as suggested in the previous answer. 355 different file name, as suggested in the previous answer.
355 356
356 357
35715. I made my own ZLIB1.DLL build. Can I test it for compliance? 35816. I made my own ZLIB1.DLL build. Can I test it for compliance?
358 359
359 - We prefer that you download the official DLL from the zlib 360 - We prefer that you download the official DLL from the zlib
360 web site. If you need something peculiar from this DLL, you 361 web site. If you need something peculiar from this DLL, you
diff --git a/win32/zlib1.rc b/win32/zlib1.rc
index 19fdc99..130493a 100644
--- a/win32/zlib1.rc
+++ b/win32/zlib1.rc
@@ -5,8 +5,8 @@ VS_VERSION_INFO VERSIONINFO
5#else 5#else
6VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 6VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
7#endif 7#endif
8 FILEVERSION 1,2,1,1 8 FILEVERSION 1,2,1,2
9 PRODUCTVERSION 1,2,1,1 9 PRODUCTVERSION 1,2,1,2
10 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 10 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
11#ifdef _DEBUG 11#ifdef _DEBUG
12 FILEFLAGS 1 12 FILEFLAGS 1
@@ -23,12 +23,12 @@ BEGIN
23 //language ID = U.S. English, char set = Windows, Multilingual 23 //language ID = U.S. English, char set = Windows, Multilingual
24 BEGIN 24 BEGIN
25 VALUE "FileDescription", "zlib data compression library\0" 25 VALUE "FileDescription", "zlib data compression library\0"
26 VALUE "FileVersion", "1.2.1.1\0" 26 VALUE "FileVersion", "1.2.1.2\0"
27 VALUE "InternalName", "zlib1.dll\0" 27 VALUE "InternalName", "zlib1.dll\0"
28 VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" 28 VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0"
29 VALUE "OriginalFilename", "zlib1.dll\0" 29 VALUE "OriginalFilename", "zlib1.dll\0"
30 VALUE "ProductName", "zlib\0" 30 VALUE "ProductName", "zlib\0"
31 VALUE "ProductVersion", "1.2.1.1\0" 31 VALUE "ProductVersion", "1.2.1.2\0"
32 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 32 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
33 END 33 END
34 END 34 END
diff --git a/zconf.h b/zconf.h
index 3cea897..3c21403 100644
--- a/zconf.h
+++ b/zconf.h
@@ -1,5 +1,5 @@
1/* zconf.h -- configuration of the zlib compression library 1/* zconf.h -- configuration of the zlib compression library
2 * Copyright (C) 1995-2003 Jean-loup Gailly. 2 * Copyright (C) 1995-2004 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
@@ -13,43 +13,46 @@
13 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 13 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
14 */ 14 */
15#ifdef Z_PREFIX 15#ifdef Z_PREFIX
16# define deflateInit_ z_deflateInit_ 16# define deflateInit_ z_deflateInit_
17# define deflate z_deflate 17# define deflate z_deflate
18# define deflateEnd z_deflateEnd 18# define deflateEnd z_deflateEnd
19# define inflateInit_ z_inflateInit_ 19# define inflateInit_ z_inflateInit_
20# define inflate z_inflate 20# define inflate z_inflate
21# define inflateEnd z_inflateEnd 21# define inflateEnd z_inflateEnd
22# define deflateInit2_ z_deflateInit2_ 22# define deflateInit2_ z_deflateInit2_
23# define deflateSetDictionary z_deflateSetDictionary 23# define deflateSetDictionary z_deflateSetDictionary
24# define deflateCopy z_deflateCopy 24# define deflateCopy z_deflateCopy
25# define deflateReset z_deflateReset 25# define deflateReset z_deflateReset
26# define deflatePrime z_deflatePrime 26# define deflateParams z_deflateParams
27# define deflateParams z_deflateParams 27# define deflateBound z_deflateBound
28# define deflateBound z_deflateBound 28# define deflatePrime z_deflatePrime
29# define inflateInit2_ z_inflateInit2_ 29# define inflateInit2_ z_inflateInit2_
30# define inflateSetDictionary z_inflateSetDictionary 30# define inflateSetDictionary z_inflateSetDictionary
31# define inflateSync z_inflateSync 31# define inflateSync z_inflateSync
32# define inflateSyncPoint z_inflateSyncPoint 32# define inflateSyncPoint z_inflateSyncPoint
33# define inflateCopy z_inflateCopy 33# define inflateCopy z_inflateCopy
34# define inflateReset z_inflateReset 34# define inflateReset z_inflateReset
35# define compress z_compress 35# define inflateBack z_inflateBack
36# define compress2 z_compress2 36# define inflateBackEnd z_inflateBackEnd
37# define compressBound z_compressBound 37# define compress z_compress
38# define uncompress z_uncompress 38# define compress2 z_compress2
39# define adler32 z_adler32 39# define compressBound z_compressBound
40# define crc32 z_crc32 40# define uncompress z_uncompress
41# define get_crc_table z_get_crc_table 41# define adler32 z_adler32
42# define crc32 z_crc32
43# define get_crc_table z_get_crc_table
44# define zError z_zError
42 45
43# define Byte z_Byte 46# define Byte z_Byte
44# define uInt z_uInt 47# define uInt z_uInt
45# define uLong z_uLong 48# define uLong z_uLong
46# define Bytef z_Bytef 49# define Bytef z_Bytef
47# define charf z_charf 50# define charf z_charf
48# define intf z_intf 51# define intf z_intf
49# define uIntf z_uIntf 52# define uIntf z_uIntf
50# define uLongf z_uLongf 53# define uLongf z_uLongf
51# define voidpf z_voidpf 54# define voidpf z_voidpf
52# define voidp z_voidp 55# define voidp z_voidp
53#endif 56#endif
54 57
55#if defined(__MSDOS__) && !defined(MSDOS) 58#if defined(__MSDOS__) && !defined(MSDOS)
@@ -281,7 +284,7 @@ typedef uLong FAR uLongf;
281# ifdef VMS 284# ifdef VMS
282# include <unixio.h> /* for off_t */ 285# include <unixio.h> /* for off_t */
283# endif 286# endif
284# define z_off_t off_t 287# define z_off_t off_t
285#endif 288#endif
286#ifndef SEEK_SET 289#ifndef SEEK_SET
287# define SEEK_SET 0 /* Seek from beginning of file. */ 290# define SEEK_SET 0 /* Seek from beginning of file. */
@@ -289,11 +292,11 @@ typedef uLong FAR uLongf;
289# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 292# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
290#endif 293#endif
291#ifndef z_off_t 294#ifndef z_off_t
292# define z_off_t long 295# define z_off_t long
293#endif 296#endif
294 297
295#if defined(__OS400__) 298#if defined(__OS400__)
296#define NO_vsnprintf 299# define NO_vsnprintf
297#endif 300#endif
298 301
299#if defined(__MVS__) 302#if defined(__MVS__)
diff --git a/zconf.in.h b/zconf.in.h
index 3cea897..3c21403 100644
--- a/zconf.in.h
+++ b/zconf.in.h
@@ -1,5 +1,5 @@
1/* zconf.h -- configuration of the zlib compression library 1/* zconf.h -- configuration of the zlib compression library
2 * Copyright (C) 1995-2003 Jean-loup Gailly. 2 * Copyright (C) 1995-2004 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
@@ -13,43 +13,46 @@
13 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 13 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
14 */ 14 */
15#ifdef Z_PREFIX 15#ifdef Z_PREFIX
16# define deflateInit_ z_deflateInit_ 16# define deflateInit_ z_deflateInit_
17# define deflate z_deflate 17# define deflate z_deflate
18# define deflateEnd z_deflateEnd 18# define deflateEnd z_deflateEnd
19# define inflateInit_ z_inflateInit_ 19# define inflateInit_ z_inflateInit_
20# define inflate z_inflate 20# define inflate z_inflate
21# define inflateEnd z_inflateEnd 21# define inflateEnd z_inflateEnd
22# define deflateInit2_ z_deflateInit2_ 22# define deflateInit2_ z_deflateInit2_
23# define deflateSetDictionary z_deflateSetDictionary 23# define deflateSetDictionary z_deflateSetDictionary
24# define deflateCopy z_deflateCopy 24# define deflateCopy z_deflateCopy
25# define deflateReset z_deflateReset 25# define deflateReset z_deflateReset
26# define deflatePrime z_deflatePrime 26# define deflateParams z_deflateParams
27# define deflateParams z_deflateParams 27# define deflateBound z_deflateBound
28# define deflateBound z_deflateBound 28# define deflatePrime z_deflatePrime
29# define inflateInit2_ z_inflateInit2_ 29# define inflateInit2_ z_inflateInit2_
30# define inflateSetDictionary z_inflateSetDictionary 30# define inflateSetDictionary z_inflateSetDictionary
31# define inflateSync z_inflateSync 31# define inflateSync z_inflateSync
32# define inflateSyncPoint z_inflateSyncPoint 32# define inflateSyncPoint z_inflateSyncPoint
33# define inflateCopy z_inflateCopy 33# define inflateCopy z_inflateCopy
34# define inflateReset z_inflateReset 34# define inflateReset z_inflateReset
35# define compress z_compress 35# define inflateBack z_inflateBack
36# define compress2 z_compress2 36# define inflateBackEnd z_inflateBackEnd
37# define compressBound z_compressBound 37# define compress z_compress
38# define uncompress z_uncompress 38# define compress2 z_compress2
39# define adler32 z_adler32 39# define compressBound z_compressBound
40# define crc32 z_crc32 40# define uncompress z_uncompress
41# define get_crc_table z_get_crc_table 41# define adler32 z_adler32
42# define crc32 z_crc32
43# define get_crc_table z_get_crc_table
44# define zError z_zError
42 45
43# define Byte z_Byte 46# define Byte z_Byte
44# define uInt z_uInt 47# define uInt z_uInt
45# define uLong z_uLong 48# define uLong z_uLong
46# define Bytef z_Bytef 49# define Bytef z_Bytef
47# define charf z_charf 50# define charf z_charf
48# define intf z_intf 51# define intf z_intf
49# define uIntf z_uIntf 52# define uIntf z_uIntf
50# define uLongf z_uLongf 53# define uLongf z_uLongf
51# define voidpf z_voidpf 54# define voidpf z_voidpf
52# define voidp z_voidp 55# define voidp z_voidp
53#endif 56#endif
54 57
55#if defined(__MSDOS__) && !defined(MSDOS) 58#if defined(__MSDOS__) && !defined(MSDOS)
@@ -281,7 +284,7 @@ typedef uLong FAR uLongf;
281# ifdef VMS 284# ifdef VMS
282# include <unixio.h> /* for off_t */ 285# include <unixio.h> /* for off_t */
283# endif 286# endif
284# define z_off_t off_t 287# define z_off_t off_t
285#endif 288#endif
286#ifndef SEEK_SET 289#ifndef SEEK_SET
287# define SEEK_SET 0 /* Seek from beginning of file. */ 290# define SEEK_SET 0 /* Seek from beginning of file. */
@@ -289,11 +292,11 @@ typedef uLong FAR uLongf;
289# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 292# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
290#endif 293#endif
291#ifndef z_off_t 294#ifndef z_off_t
292# define z_off_t long 295# define z_off_t long
293#endif 296#endif
294 297
295#if defined(__OS400__) 298#if defined(__OS400__)
296#define NO_vsnprintf 299# define NO_vsnprintf
297#endif 300#endif
298 301
299#if defined(__MVS__) 302#if defined(__MVS__)
diff --git a/zlib.3 b/zlib.3
index a9754f9..54655cd 100644
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
1.TH ZLIB 3 "9 January 2004" 1.TH ZLIB 3 "9 September 2004"
2.SH NAME 2.SH NAME
3zlib \- compression/decompression library 3zlib \- compression/decompression library
4.SH SYNOPSIS 4.SH SYNOPSIS
@@ -133,7 +133,7 @@ before asking for help.
133Send questions and/or comments to zlib@gzip.org, 133Send questions and/or comments to zlib@gzip.org,
134or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). 134or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
135.SH AUTHORS 135.SH AUTHORS
136Version 1.2.1.1 136Version 1.2.1.2
137Copyright (C) 1995-2004 Jean-loup Gailly (jloup@gzip.org) 137Copyright (C) 1995-2004 Jean-loup Gailly (jloup@gzip.org)
138and Mark Adler (madler@alumni.caltech.edu). 138and Mark Adler (madler@alumni.caltech.edu).
139.LP 139.LP
diff --git a/zlib.h b/zlib.h
index c97f682..0c94166 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.2.1.1, January 9th, 2004 2 version 1.2.1.2, September 9th, 2004
3 3
4 Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
5 5
@@ -37,8 +37,8 @@
37extern "C" { 37extern "C" {
38#endif 38#endif
39 39
40#define ZLIB_VERSION "1.2.1.1" 40#define ZLIB_VERSION "1.2.1.2"
41#define ZLIB_VERNUM 0x1211 41#define ZLIB_VERNUM 0x1212
42 42
43/* 43/*
44 The 'zlib' compression library provides in-memory compression and 44 The 'zlib' compression library provides in-memory compression and
@@ -401,7 +401,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
401 because Z_BLOCK is used. 401 because Z_BLOCK is used.
402 402
403 If a preset dictionary is needed after this call (see inflateSetDictionary 403 If a preset dictionary is needed after this call (see inflateSetDictionary
404 below), inflate sets strm-adler to the adler32 checksum of the dictionary 404 below), inflate sets strm->adler to the adler32 checksum of the dictionary
405 chosen by the compressor and returns Z_NEED_DICT; otherwise it sets 405 chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
406 strm->adler to the adler32 checksum of all output produced so far (that is, 406 strm->adler to the adler32 checksum of all output produced so far (that is,
407 total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described 407 total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
@@ -1189,7 +1189,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
1189 struct internal_state {int dummy;}; /* hack for buggy compilers */ 1189 struct internal_state {int dummy;}; /* hack for buggy compilers */
1190#endif 1190#endif
1191 1191
1192ZEXTERN const char * ZEXPORT zError OF((int err)); 1192ZEXTERN const char * ZEXPORT zError OF((int));
1193ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); 1193ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
1194ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); 1194ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
1195 1195
diff --git a/zutil.h b/zutil.h
index 87b70ac..7b42edc 100644
--- a/zutil.h
+++ b/zutil.h
@@ -189,9 +189,14 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
189# define NO_vsnprintf 189# define NO_vsnprintf
190# endif 190# endif
191#endif 191#endif
192#ifdef VMS
193# define NO_vsnprintf
194#endif
192 195
193#ifdef HAVE_STRERROR 196#ifdef HAVE_STRERROR
194 extern char *strerror OF((int)); 197# ifndef VMS
198 extern char *strerror OF((int));
199# endif
195# define zstrerror(errnum) strerror(errnum) 200# define zstrerror(errnum) strerror(errnum)
196#else 201#else
197# define zstrerror(errnum) "" 202# define zstrerror(errnum) ""