]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
zlib 1.2.2 v1.2.2
authorMark Adler <madler@alumni.caltech.edu>
Sat, 10 Sep 2011 06:24:02 +0000 (23:24 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sat, 10 Sep 2011 06:24:02 +0000 (23:24 -0700)
55 files changed:
ChangeLog
FAQ
INDEX
Makefile
Makefile.in
README
as400/compile.clp
as400/readme.txt
as400/zlib.inc
contrib/README.contrib
contrib/ada/readme.txt
contrib/ada/zlib-streams.adb
contrib/ada/zlib-streams.ads
contrib/ada/zlib.gpr
contrib/dotzlib/DotZLib.build [new file with mode: 0644]
contrib/dotzlib/DotZLib.chm [new file with mode: 0644]
contrib/dotzlib/DotZLib.sln [new file with mode: 0644]
contrib/dotzlib/DotZLib/AssemblyInfo.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/ChecksumImpl.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/CircularBuffer.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/CodecBase.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/Deflater.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/DotZLib.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/DotZLib.csproj [new file with mode: 0644]
contrib/dotzlib/DotZLib/GZipStream.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/Inflater.cs [new file with mode: 0644]
contrib/dotzlib/DotZLib/UnitTests.cs [new file with mode: 0644]
contrib/dotzlib/LICENSE_1_0.txt [new file with mode: 0644]
contrib/dotzlib/readme.txt [new file with mode: 0644]
contrib/gzappend/gzappend.c
contrib/infback9/infback9.c
contrib/infback9/inftree9.c
contrib/minizip/ioapi.c
contrib/minizip/miniunz.c
contrib/minizip/mztools.c
contrib/minizip/mztools.h
contrib/minizip/unzip.c
contrib/minizip/zip.c
contrib/untgz/untgz.c
contrib/vstudio/vc7/zlib.rc
crc32.c
deflate.c
gzio.c
infback.c
inflate.c
inftrees.c
old/README
old/visual-basic.txt [moved from contrib/visual-basic.txt with 100% similarity]
projects/visualc6/zlib.dsp
qnx/package.qpg
win32/DLL_FAQ.txt
win32/VisualC.txt [new file with mode: 0644]
win32/zlib1.rc
zlib.3
zlib.h

index 26e551e5f1d3abb88a409291cd5a2111510bb0ad..d60b6d377a9d86f3b9dbc51a58519cc0e0c5aadc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 
                 ChangeLog file for zlib
 
+Changes in 1.2.2 (3 October 2004)
+- Update zlib.h comments on gzip in-memory processing
+- Set adler to 1 in inflateReset() to support Java test suite [Walles]
+- Add contrib/dotzlib [Ravn]
+- Update win32/DLL_FAQ.txt [Truta]
+- Update contrib/minizip [Vollant]
+- Move contrib/visual-basic.txt to old/ [Truta]
+- Fix assembler builds in projects/visualc6/ [Truta]
+
 Changes in 1.2.1.2 (9 September 2004)
 - Update INDEX file
 - Fix trees.c to update strm->data_type (no one ever noticed!)
diff --git a/FAQ b/FAQ
index 578dbc22b37bf300dfd6786112a6646af15e1b46..4f61f1094e6b9130e6e2d5cd53b4bb286316444c 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -117,7 +117,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
     After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
     generates an error such as:
 
-        ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: 
+        ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
         symbol __register_frame_info: referenced symbol not found
 
     The symbol __register_frame_info is not part of zlib, it is generated by
diff --git a/INDEX b/INDEX
index 331b56b228e31bb1a6bfe69429b0f0c7bb718b2e..0587e5902bd155878ce6a11adbedd5c34630d7a3 100644 (file)
--- a/INDEX
+++ b/INDEX
@@ -8,7 +8,7 @@ algorithm.txt   description of the (de)compression algorithm
 configure       configure script for Unix
 zconf.in.h      template for zconf.h (used by configure)
 
-amiga/         makefiles for Amiga SAS C
+amiga/          makefiles for Amiga SAS C
 as400/          makefiles for IBM AS/400
 msdos/          makefiles for MSDOS
 old/            makefiles for various architectures and zlib documentation
index 9f04797847c2684deaddf2b44daf02cf7d008409..a29e9bc6ab4e3fd87bde4883bb6e3860bb4facd1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ CPP=$(CC) -E
 
 LIBS=libz.a
 SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.1.2
+SHAREDLIBV=libz.so.1.2.2
 SHAREDLIBM=libz.so.1
 
 AR=ar rc
index 9f04797847c2684deaddf2b44daf02cf7d008409..a29e9bc6ab4e3fd87bde4883bb6e3860bb4facd1 100644 (file)
@@ -30,7 +30,7 @@ CPP=$(CC) -E
 
 LIBS=libz.a
 SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.1.2
+SHAREDLIBV=libz.so.1.2.2
 SHAREDLIBM=libz.so.1
 
 AR=ar rc
diff --git a/README b/README
index 48f44e2b88775b72018cf35daba0484bba5afbb4..df95ae13f54e03ce4e7fa365e35db9ba281aa9a1 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ZLIB DATA COMPRESSION LIBRARY
 
-zlib 1.2.1.2 is a general purpose data compression library.  All the code is
+zlib 1.2.2 is a general purpose data compression library.  All the code is
 thread safe.  The data format used by the zlib library is described by RFCs
 (Request for Comments) 1950 to 1952 in the files
 http://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
 issue of  Dr. Dobb's Journal; a copy of the article is available in
 http://dogma.net/markn/articles/zlibtool/zlibtool.htm
 
-The changes made in version 1.2.1.2 are documented in the file ChangeLog.
+The changes made in version 1.2.2 are documented in the file ChangeLog.
 
 Unsupported third party contributions are provided in directory "contrib".
 
index dcd24215d62fe0282c26f8281ed0214d0754f2dc..3c47bb4b2238e931393f265751662b264a71835b 100644 (file)
                                  &MODLIB/INFTREES    &MODLIB/TREES       +
                                  &MODLIB/UNCOMPR     &MODLIB/ZUTIL)      +
                           SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
-                          TEXT('ZLIB 1.2.1') TGTRLS(V4R4M0)
+                          TEXT('ZLIB 1.2.2') TGTRLS(V4R4M0)
 
              ENDPGM
index eef7cb2ec63d79de893a5eb2b0ac07224013b5ec..27ca6763bf56c620033f5dbc8c211d7eaa5a3f01 100644 (file)
@@ -1,4 +1,4 @@
-        ZLIB version 1.2.1 for AS400 installation instructions
+        ZLIB version 1.2.2 for AS400 installation instructions
 
 I) From an AS400 *SAVF file:
 
index bb24691287663b354ff1869cf73035862e20f0f3..e31e1a72b006e158f5ffbaf22b6f0d2e446fb0a3 100644 (file)
@@ -1,7 +1,7 @@
       *  ZLIB.INC - Interface to the general purpose compression library
       *
       *  ILE RPG400 version by Patrick Monnerat, DATASPHERE.
-      *  Version 1.2.1.2
+      *  Version 1.2.2
       *
       *
       *  WARNING:
@@ -20,8 +20,8 @@
       *                               Constants
       **************************************************************************
       *
-     D ZLIB_VERSION    C                   '1.2.1.2'                            Header's version
-     D ZLIB_VERNUM     C                   X'1212'
+     D ZLIB_VERSION    C                   '1.2.2'                            Header's version
+     D ZLIB_VERNUM     C                   X'1220'
       *
      D Z_NO_FLUSH      C                   0
      D Z_SYNC_FLUSH    C                   2
index eae15aa023912db1d99dc347128b440ee674b56d..777898077befe2bbb4f813a1c976c7aa8e2939fb 100644 (file)
@@ -19,6 +19,9 @@ blast/      by Mark Adler <madler@alumni.caltech.edu>
 delphi/     by Cosmin Truta <cosmint@cs.ubbcluj.ro>
         Support for Delphi and C++ Builder
 
+dotzlib/    by Henrik Ravn <henrik@ravn.com>
+        Support for Microsoft .Net and Visual C++ .Net
+
 gzappend/   by Mark Adler <madler@alumni.caltech.edu>
         append to a gzip file -- illustrates the use of Z_BLOCK
 
@@ -60,11 +63,8 @@ puff/       by Mark Adler <madler@alumni.caltech.edu>
 testzlib/   by Gilles Vollant <info@winimage.com>
         Example of the use of zlib
 
-untgz/      by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+untgz/      by Pedro A. Aranda Gutierrez <paag@tid.es>
         A very simple tar.gz file extractor using zlib
 
-visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
-        How to use compress(), uncompress() and the gz* functions from VB
-
 vstudio/    by Gilles Vollant <info@winimage.com>
-        Building a minizip-enhanced zlib with Visual Studio .NET
+        Building a minizip-enhanced zlib with Microsoft Visual Studio
index dec7ef3d45f681763839dbacac59057c11744423..ce4d2cadf0d928f44dcf2bc2193c18941b214ddf 100644 (file)
@@ -1,12 +1,12 @@
-                       ZLib for Ada thick binding (ZLib.Ada)
-                       Release 1.3
+                        ZLib for Ada thick binding (ZLib.Ada)
+                        Release 1.3
 
 ZLib.Ada is a thick binding interface to the popular ZLib data
 compression library, available at http://www.gzip.org/zlib/.
 It provides Ada-style access to the ZLib C library.
 
 
-       Here are the main changes since ZLib.Ada 1.2:
+        Here are the main changes since ZLib.Ada 1.2:
 
 - Attension: ZLib.Read generic routine have a initialization requirement
   for Read_Last parameter now. It is a bit incompartible with previous version,
@@ -28,7 +28,7 @@ It provides Ada-style access to the ZLib C library.
 - Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit.
 
 
-       How to build ZLib.Ada under GNAT
+        How to build ZLib.Ada under GNAT
 
 You should have the ZLib library already build on your computer, before
 building ZLib.Ada. Make the directory of ZLib.Ada sources current and
@@ -41,7 +41,7 @@ Or use the GNAT project file build for GNAT 3.15 or later:
   gnatmake -Pzlib.gpr -L<directory where libz.a is>
 
 
-       How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2
+        How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2
 
 1. Make a project with all *.ads and *.adb files from the distribution.
 2. Build the libz.a library from the ZLib C sources.
@@ -51,7 +51,7 @@ Or use the GNAT project file build for GNAT 3.15 or later:
 6. Build the executable using test.adb as a main procedure.
 
 
-       How to use ZLib.Ada
+        How to use ZLib.Ada
 
 The source files test.adb and read.adb are small demo programs that show
 the main functionality of ZLib.Ada.
index 398664a65dbc580082ecdc137f87bcdeef62e794..b6497bae286e507898046fc580f4551edcad774a 100644 (file)
@@ -222,4 +222,4 @@ package body ZLib.Streams is
       return Total_Out (Stream.Writer);
    end Write_Total_Out;
 
-end ZLib.Streams;
\ No newline at end of file
+end ZLib.Streams;
index 5c68667fa9e28bcb623747462e935898683e5f44..f0193c6baeea5e0ca4c6f70129642149403c606a 100644 (file)
@@ -111,4 +111,4 @@ private
       Writer     : Filter_Type;
    end record;
 
-end ZLib.Streams;
\ No newline at end of file
+end ZLib.Streams;
index 88f51ccf8a6b1cd56deae83b39965a3745beda8e..296b22aa966706adb8780e12089d7a9072997a78 100644 (file)
@@ -1,21 +1,20 @@
-project Zlib is\r
-\r
-   for Languages use ("Ada");\r
-   for Source_Dirs use (".");\r
-   for Object_Dir use ".";\r
-   for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo");\r
-\r
-   package Compiler is\r
-      for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");\r
-   end Compiler;\r
-\r
-   package Linker is\r
-      for Default_Switches ("ada") use ("-lz");\r
-   end Linker;\r
-\r
-   package Builder is\r
-      for Default_Switches ("ada") use ("-s", "-gnatQ");\r
-   end Builder;\r
-\r
-end Zlib;\r
-\r
+project Zlib is
+
+   for Languages use ("Ada");
+   for Source_Dirs use (".");
+   for Object_Dir use ".";
+   for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo");
+
+   package Compiler is
+      for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");
+   end Compiler;
+
+   package Linker is
+      for Default_Switches ("ada") use ("-lz");
+   end Linker;
+
+   package Builder is
+      for Default_Switches ("ada") use ("-s", "-gnatQ");
+   end Builder;
+
+end Zlib;
diff --git a/contrib/dotzlib/DotZLib.build b/contrib/dotzlib/DotZLib.build
new file mode 100644 (file)
index 0000000..ed19cc9
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8" ?>\r
+<project name="DotZLib" default="build" basedir="./DotZLib">\r
+       <description>A .Net wrapper library around ZLib1.dll</description>\r
+\r
+       <property name="nunit.location" value="c:/program files/NUnit V2.1/bin" />\r
+       <property name="build.root" value="bin" />\r
+       \r
+       <property name="debug" value="true" />\r
+       <property name="nunit" value="true" />\r
+\r
+       <property name="build.folder" value="${build.root}/debug/" if="${debug}" />\r
+       <property name="build.folder" value="${build.root}/release/" unless="${debug}" />\r
+\r
+       <target name="clean" description="Remove all generated files">\r
+               <delete dir="${build.root}" failonerror="false" />\r
+       </target>\r
+\r
+       <target name="build" description="compiles the source code">\r
+               \r
+               <mkdir dir="${build.folder}" />\r
+               <csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}">\r
+                       <references basedir="${nunit.location}">\r
+                               <includes if="${nunit}" name="nunit.framework.dll" />\r
+                       </references>\r
+                       <sources>\r
+                               <includes name="*.cs" />\r
+                               <excludes name="UnitTests.cs" unless="${nunit}" />\r
+                       </sources>\r
+                       <arg value="/d:nunit" if="${nunit}" />\r
+               </csc>\r
+       </target>\r
+\r
+</project>
\ No newline at end of file
diff --git a/contrib/dotzlib/DotZLib.chm b/contrib/dotzlib/DotZLib.chm
new file mode 100644 (file)
index 0000000..0bc7df7
Binary files /dev/null and b/contrib/dotzlib/DotZLib.chm differ
diff --git a/contrib/dotzlib/DotZLib.sln b/contrib/dotzlib/DotZLib.sln
new file mode 100644 (file)
index 0000000..ac45ca0
--- /dev/null
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+       EndProjectSection\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfiguration) = preSolution\r
+               Debug = Debug\r
+               Release = Release\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfiguration) = postSolution\r
+               {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET\r
+               {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET\r
+               {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET\r
+               {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityGlobals) = postSolution\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityAddIns) = postSolution\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/contrib/dotzlib/DotZLib/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..6fc0fdc
--- /dev/null
@@ -0,0 +1,58 @@
+using System.Reflection;\r
+using System.Runtime.CompilerServices;\r
+\r
+//\r
+// General Information about an assembly is controlled through the following \r
+// set of attributes. Change these attribute values to modify the information\r
+// associated with an assembly.\r
+//\r
+[assembly: AssemblyTitle("DotZLib")]\r
+[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")]\r
+[assembly: AssemblyConfiguration("")]\r
+[assembly: AssemblyCompany("Henrik Ravn")]\r
+[assembly: AssemblyProduct("")]\r
+[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]\r
+[assembly: AssemblyTrademark("")]\r
+[assembly: AssemblyCulture("")]                \r
+\r
+//\r
+// Version information for an assembly consists of the following four values:\r
+//\r
+//      Major Version\r
+//      Minor Version \r
+//      Build Number\r
+//      Revision\r
+//\r
+// You can specify all the values or you can default the Revision and Build Numbers \r
+// by using the '*' as shown below:\r
+\r
+[assembly: AssemblyVersion("1.0.*")]\r
+\r
+//\r
+// In order to sign your assembly you must specify a key to use. Refer to the \r
+// Microsoft .NET Framework documentation for more information on assembly signing.\r
+//\r
+// Use the attributes below to control which key is used for signing. \r
+//\r
+// Notes: \r
+//   (*) If no key is specified, the assembly is not signed.\r
+//   (*) KeyName refers to a key that has been installed in the Crypto Service\r
+//       Provider (CSP) on your machine. KeyFile refers to a file which contains\r
+//       a key.\r
+//   (*) If the KeyFile and the KeyName values are both specified, the \r
+//       following processing occurs:\r
+//       (1) If the KeyName can be found in the CSP, that key is used.\r
+//       (2) If the KeyName does not exist and the KeyFile does exist, the key \r
+//           in the KeyFile is installed into the CSP and used.\r
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.\r
+//       When specifying the KeyFile, the location of the KeyFile should be\r
+//       relative to the project output directory which is\r
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is\r
+//       located in the project directory, you would specify the AssemblyKeyFile \r
+//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]\r
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework\r
+//       documentation for more information on this.\r
+//\r
+[assembly: AssemblyDelaySign(false)]\r
+[assembly: AssemblyKeyFile("")]\r
+[assembly: AssemblyKeyName("")]\r
diff --git a/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/contrib/dotzlib/DotZLib/ChecksumImpl.cs
new file mode 100644 (file)
index 0000000..dfe7e90
--- /dev/null
@@ -0,0 +1,202 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using System.Text;\r
+\r
+\r
+namespace DotZLib\r
+{\r
+    #region ChecksumGeneratorBase\r
+    /// <summary>\r
+    /// Implements the common functionality needed for all <see cref="ChecksumGenerator"/>s\r
+    /// </summary>\r
+    /// <example></example>\r
+    public abstract class ChecksumGeneratorBase : ChecksumGenerator\r
+    {\r
+        /// <summary>\r
+        /// The value of the current checksum\r
+        /// </summary>\r
+        protected uint _current;\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the checksum generator base - the current checksum is \r
+        /// set to zero\r
+        /// </summary>\r
+        public ChecksumGeneratorBase()\r
+        {\r
+            _current = 0;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the checksum generator basewith a specified value\r
+        /// </summary>\r
+        /// <param name="initialValue">The value to set the current checksum to</param>\r
+        public ChecksumGeneratorBase(uint initialValue)\r
+        {\r
+            _current = initialValue;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Resets the current checksum to zero\r
+        /// </summary>\r
+        public void Reset() { _current = 0; }\r
+\r
+        /// <summary>\r
+        /// Gets the current checksum value\r
+        /// </summary>\r
+        public uint Value { get { return _current; } }\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with part of an array of bytes\r
+        /// </summary>\r
+        /// <param name="data">The data to update the checksum with</param>\r
+        /// <param name="offset">Where in <c>data</c> to start updating</param>\r
+        /// <param name="count">The number of bytes from <c>data</c> to use</param>\r
+        /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>\r
+        /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>\r
+        /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>\r
+        /// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one. \r
+        /// This is therefore the only method a derived class has to implement</remarks>\r
+        public abstract void Update(byte[] data, int offset, int count);\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with an array of bytes.\r
+        /// </summary>\r
+        /// <param name="data">The data to update the checksum with</param>\r
+        public void Update(byte[] data)\r
+        {\r
+            Update(data, 0, data.Length);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with the data from a string\r
+        /// </summary>\r
+        /// <param name="data">The string to update the checksum with</param>\r
+        /// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>\r
+        public void Update(string data)\r
+        {\r
+                       Update(Encoding.UTF8.GetBytes(data));\r
+        }\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with the data from a string, using a specific encoding\r
+        /// </summary>\r
+        /// <param name="data">The string to update the checksum with</param>\r
+        /// <param name="encoding">The encoding to use</param>\r
+        public void Update(string data, Encoding encoding)\r
+        {\r
+            Update(encoding.GetBytes(data));\r
+        }\r
+\r
+    }\r
+    #endregion\r
+\r
+    #region CRC32\r
+    /// <summary>\r
+    /// Implements a CRC32 checksum generator\r
+    /// </summary>\r
+    public sealed class CRC32Checksum : ChecksumGeneratorBase    \r
+    {\r
+        #region DLL imports\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern uint crc32(uint crc, int data, uint length);\r
+\r
+        #endregion\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the CRC32 checksum generator\r
+        /// </summary>\r
+        public CRC32Checksum() : base() {}\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the CRC32 checksum generator with a specified value\r
+        /// </summary>\r
+        /// <param name="initialValue">The value to set the current checksum to</param>\r
+        public CRC32Checksum(uint initialValue) : base(initialValue) {}\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with part of an array of bytes\r
+        /// </summary>\r
+        /// <param name="data">The data to update the checksum with</param>\r
+        /// <param name="offset">Where in <c>data</c> to start updating</param>\r
+        /// <param name="count">The number of bytes from <c>data</c> to use</param>\r
+        /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>\r
+        /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>\r
+        /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>\r
+        public override void Update(byte[] data, int offset, int count)\r
+        {\r
+            if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();\r
+            if ((offset+count) > data.Length) throw new ArgumentException();\r
+            GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);\r
+            try\r
+            {\r
+                _current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);\r
+            }\r
+            finally\r
+            {\r
+                hData.Free();\r
+            }\r
+        }\r
+\r
+    }\r
+    #endregion\r
+\r
+    #region Adler\r
+    /// <summary>\r
+    /// Implements a checksum generator that computes the Adler checksum on data\r
+    /// </summary>\r
+    public sealed class AdlerChecksum : ChecksumGeneratorBase    \r
+    {\r
+        #region DLL imports\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern uint adler32(uint adler, int data, uint length);\r
+\r
+        #endregion\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the Adler checksum generator\r
+        /// </summary>\r
+        public AdlerChecksum() : base() {}\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the Adler checksum generator with a specified value\r
+        /// </summary>\r
+        /// <param name="initialValue">The value to set the current checksum to</param>\r
+        public AdlerChecksum(uint initialValue) : base(initialValue) {}\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with part of an array of bytes\r
+        /// </summary>\r
+        /// <param name="data">The data to update the checksum with</param>\r
+        /// <param name="offset">Where in <c>data</c> to start updating</param>\r
+        /// <param name="count">The number of bytes from <c>data</c> to use</param>\r
+        /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>\r
+        /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>\r
+        /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>\r
+        public override void Update(byte[] data, int offset, int count)\r
+        {\r
+            if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();\r
+            if ((offset+count) > data.Length) throw new ArgumentException();\r
+            GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);\r
+            try\r
+            {\r
+                _current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);\r
+            }\r
+            finally\r
+            {\r
+                hData.Free();\r
+            }\r
+        }\r
+\r
+    }\r
+    #endregion\r
+\r
+}
\ No newline at end of file
diff --git a/contrib/dotzlib/DotZLib/CircularBuffer.cs b/contrib/dotzlib/DotZLib/CircularBuffer.cs
new file mode 100644 (file)
index 0000000..16997e9
--- /dev/null
@@ -0,0 +1,83 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.Diagnostics;\r
+\r
+namespace DotZLib\r
+{\r
+\r
+       /// <summary>\r
+       /// This class implements a circular buffer\r
+       /// </summary>\r
+       internal class CircularBuffer\r
+       {\r
+        #region Private data\r
+        private int _capacity;\r
+        private int _head;\r
+        private int _tail;\r
+        private int _size;\r
+        private byte[] _buffer;\r
+        #endregion\r
+\r
+        public CircularBuffer(int capacity)\r
+        {    \r
+            Debug.Assert( capacity > 0 );\r
+            _buffer = new byte[capacity];\r
+            _capacity = capacity;\r
+            _head = 0;\r
+            _tail = 0;\r
+            _size = 0;\r
+        }\r
+\r
+        public int Size { get { return _size; } }\r
+\r
+        public int Put(byte[] source, int offset, int count)\r
+        {\r
+            Debug.Assert( count > 0 );\r
+            int trueCount = Math.Min(count, _capacity - Size);\r
+            for (int i = 0; i < trueCount; ++i)\r
+                _buffer[(_tail+i) % _capacity] = source[offset+i];\r
+            _tail += trueCount;\r
+            _tail %= _capacity;\r
+            _size += trueCount;\r
+            return trueCount;\r
+        }\r
+\r
+        public bool Put(byte b)\r
+        {\r
+            if (Size == _capacity) // no room\r
+                return false;\r
+            _buffer[_tail++] = b;\r
+            _tail %= _capacity;\r
+            ++_size;\r
+            return true;\r
+        }\r
+\r
+        public int Get(byte[] destination, int offset, int count)\r
+        {\r
+            int trueCount = Math.Min(count,Size);\r
+            for (int i = 0; i < trueCount; ++i)\r
+                destination[offset + i] = _buffer[(_head+i) % _capacity];\r
+            _head += trueCount;\r
+            _head %= _capacity;\r
+            _size -= trueCount;\r
+            return trueCount;\r
+        }\r
+\r
+        public int Get()\r
+        {\r
+            if (Size == 0)\r
+                return -1;\r
+\r
+            int result = (int)_buffer[_head++ % _capacity];\r
+            --_size;\r
+            return result;\r
+        }\r
+\r
+    }\r
+}\r
diff --git a/contrib/dotzlib/DotZLib/CodecBase.cs b/contrib/dotzlib/DotZLib/CodecBase.cs
new file mode 100644 (file)
index 0000000..954db7d
--- /dev/null
@@ -0,0 +1,198 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace DotZLib\r
+{\r
+       /// <summary>\r
+       /// Implements the common functionality needed for all <see cref="Codec"/>s\r
+       /// </summary>\r
+       public abstract class CodecBase : Codec, IDisposable\r
+       {\r
+\r
+        #region Data members\r
+\r
+        /// <summary>\r
+        /// Instance of the internal zlib buffer structure that is \r
+        /// passed to all functions in the zlib dll\r
+        /// </summary>\r
+        internal ZStream _ztream = new ZStream();\r
+\r
+        /// <summary>\r
+        /// True if the object instance has been disposed, false otherwise\r
+        /// </summary>\r
+        protected bool _isDisposed = false;\r
+\r
+        /// <summary>\r
+        /// The size of the internal buffers\r
+        /// </summary>\r
+        protected const int kBufferSize = 16384;\r
+\r
+        private byte[] _outBuffer = new byte[kBufferSize];\r
+        private byte[] _inBuffer = new byte[kBufferSize];\r
+\r
+        private GCHandle _hInput;\r
+        private GCHandle _hOutput;\r
+\r
+        private uint _checksum = 0;\r
+\r
+        #endregion\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <c>CodeBase</c> class. \r
+        /// </summary>\r
+               public CodecBase()\r
+               {\r
+            try\r
+            {\r
+                _hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned);\r
+                _hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned);\r
+            }\r
+            catch (Exception)\r
+            {\r
+                CleanUp(false);\r
+                throw;\r
+            }\r
+        }\r
+\r
+\r
+        #region Codec Members\r
+\r
+        /// <summary>\r
+        /// Occurs when more processed data are available.\r
+        /// </summary>\r
+        public event DataAvailableHandler DataAvailable;\r
+\r
+        /// <summary>\r
+        /// Fires the <see cref="DataAvailable"/> event\r
+        /// </summary>\r
+        protected void OnDataAvailable()\r
+        {\r
+            if (_ztream.total_out > 0)\r
+            {\r
+                if (DataAvailable != null)\r
+                    DataAvailable( _outBuffer, 0, (int)_ztream.total_out); \r
+                resetOutput();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Adds more data to the codec to be processed.\r
+        /// </summary>\r
+        /// <param name="data">Byte array containing the data to be added to the codec</param>\r
+        /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>\r
+        public void Add(byte[] data)\r
+        {\r
+            Add(data,0,data.Length);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Adds more data to the codec to be processed.\r
+        /// </summary>\r
+        /// <param name="data">Byte array containing the data to be added to the codec</param>\r
+        /// <param name="offset">The index of the first byte to add from <c>data</c></param>\r
+        /// <param name="count">The number of bytes to add</param>\r
+        /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>\r
+        /// <remarks>This must be implemented by a derived class</remarks>\r
+        public abstract void Add(byte[] data, int offset, int count);\r
+\r
+        /// <summary>\r
+        /// Finishes up any pending data that needs to be processed and handled.\r
+        /// </summary>\r
+        /// <remarks>This must be implemented by a derived class</remarks>\r
+        public abstract void Finish();\r
+\r
+        /// <summary>\r
+        /// Gets the checksum of the data that has been added so far\r
+        /// </summary>\r
+        public uint Checksum { get { return _checksum; } }\r
+\r
+        #endregion\r
+\r
+        #region Destructor & IDisposable stuff\r
+\r
+        /// <summary>\r
+        /// Destroys this instance\r
+        /// </summary>\r
+        ~CodecBase()\r
+        {\r
+            CleanUp(false);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Releases any unmanaged resources and calls the <see cref="CleanUp()"/> method of the derived class\r
+        /// </summary>\r
+        public void Dispose()\r
+        {\r
+            CleanUp(true);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Performs any codec specific cleanup\r
+        /// </summary>\r
+        /// <remarks>This must be implemented by a derived class</remarks>\r
+        protected abstract void CleanUp();\r
+\r
+        // performs the release of the handles and calls the dereived CleanUp()\r
+        private void CleanUp(bool isDisposing)\r
+        {\r
+            if (!_isDisposed)\r
+            {\r
+                CleanUp();\r
+                if (_hInput.IsAllocated)\r
+                    _hInput.Free();\r
+                if (_hOutput.IsAllocated)\r
+                    _hOutput.Free();\r
+\r
+                _isDisposed = true;\r
+            }\r
+        }\r
+\r
+\r
+        #endregion\r
+\r
+        #region Helper methods\r
+\r
+        /// <summary>\r
+        /// Copies a number of bytes to the internal codec buffer - ready for proccesing\r
+        /// </summary>\r
+        /// <param name="data">The byte array that contains the data to copy</param>\r
+        /// <param name="startIndex">The index of the first byte to copy</param>\r
+        /// <param name="count">The number of bytes to copy from <c>data</c></param>\r
+        protected void copyInput(byte[] data, int startIndex, int count)\r
+        {\r
+            Array.Copy(data, startIndex, _inBuffer,0, count);\r
+            _ztream.next_in = _hInput.AddrOfPinnedObject();\r
+            _ztream.total_in = 0;\r
+            _ztream.avail_in = (uint)count;\r
+\r
+        }\r
+\r
+        /// <summary>\r
+        /// Resets the internal output buffers to a known state - ready for processing\r
+        /// </summary>\r
+        protected void resetOutput()\r
+        {\r
+            _ztream.total_out = 0;\r
+            _ztream.avail_out = kBufferSize;\r
+            _ztream.next_out = _hOutput.AddrOfPinnedObject();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Updates the running checksum property\r
+        /// </summary>\r
+        /// <param name="newSum">The new checksum value</param>\r
+        protected void setChecksum(uint newSum)\r
+        {\r
+            _checksum = newSum;\r
+        }\r
+        #endregion\r
+\r
+    }\r
+}\r
diff --git a/contrib/dotzlib/DotZLib/Deflater.cs b/contrib/dotzlib/DotZLib/Deflater.cs
new file mode 100644 (file)
index 0000000..d7b8dcc
--- /dev/null
@@ -0,0 +1,106 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.Diagnostics;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace DotZLib\r
+{\r
+\r
+    /// <summary>\r
+    /// Implements a data compressor, using the deflate algorithm in the ZLib dll\r
+    /// </summary>\r
+       public sealed class Deflater : CodecBase\r
+       {\r
+        #region Dll imports\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]\r
+        private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int deflate(ref ZStream sz, int flush);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int deflateReset(ref ZStream sz);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int deflateEnd(ref ZStream sz);\r
+        #endregion\r
+\r
+        /// <summary>\r
+        /// Constructs an new instance of the <c>Deflater</c>\r
+        /// </summary>\r
+        /// <param name="level">The compression level to use for this <c>Deflater</c></param>\r
+               public Deflater(CompressLevel level) : base()\r
+               {\r
+            int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream));\r
+            if (retval != 0)\r
+                throw new ZLibException(retval, "Could not initialize deflater");\r
+\r
+            resetOutput();\r
+               }\r
+\r
+        /// <summary>\r
+        /// Adds more data to the codec to be processed.\r
+        /// </summary>\r
+        /// <param name="data">Byte array containing the data to be added to the codec</param>\r
+        /// <param name="offset">The index of the first byte to add from <c>data</c></param>\r
+        /// <param name="count">The number of bytes to add</param>\r
+        /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>\r
+        public override void Add(byte[] data, int offset, int count)\r
+        {\r
+            if (data == null) throw new ArgumentNullException();\r
+            if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();\r
+            if ((offset+count) > data.Length) throw new ArgumentException();\r
+            \r
+            int total = count;\r
+            int inputIndex = offset;\r
+            int err = 0;\r
+\r
+            while (err >= 0 && inputIndex < total)\r
+            {\r
+                copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));\r
+                while (err >= 0 && _ztream.avail_in > 0)\r
+                {\r
+                    err = deflate(ref _ztream, (int)FlushTypes.None);\r
+                    if (err == 0)\r
+                        while (_ztream.avail_out == 0)\r
+                        {\r
+                            OnDataAvailable();\r
+                            err = deflate(ref _ztream, (int)FlushTypes.None);\r
+                        }\r
+                    inputIndex += (int)_ztream.total_in;\r
+                }\r
+            }\r
+            setChecksum( _ztream.adler );\r
+        }\r
+\r
+\r
+        /// <summary>\r
+        /// Finishes up any pending data that needs to be processed and handled.\r
+        /// </summary>\r
+        public override void Finish()\r
+        {\r
+            int err;\r
+            do \r
+            {\r
+                err = deflate(ref _ztream, (int)FlushTypes.Finish);\r
+                OnDataAvailable();\r
+            }\r
+            while (err == 0);\r
+            setChecksum( _ztream.adler );\r
+            deflateReset(ref _ztream);\r
+            resetOutput();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Closes the internal zlib deflate stream\r
+        /// </summary>\r
+        protected override void CleanUp() { deflateEnd(ref _ztream); }\r
+\r
+    }\r
+}\r
diff --git a/contrib/dotzlib/DotZLib/DotZLib.cs b/contrib/dotzlib/DotZLib/DotZLib.cs
new file mode 100644 (file)
index 0000000..410deb0
--- /dev/null
@@ -0,0 +1,288 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.IO;\r
+using System.Runtime.InteropServices;\r
+using System.Text;\r
+\r
+\r
+namespace DotZLib\r
+{\r
+\r
+    #region Internal types\r
+\r
+    /// <summary>\r
+    /// Defines constants for the various flush types used with zlib\r
+    /// </summary>\r
+    internal enum FlushTypes \r
+    {\r
+        None,  Partial,  Sync,  Full,  Finish,  Block\r
+    }\r
+\r
+    #region ZStream structure\r
+    // internal mapping of the zlib zstream structure for marshalling\r
+    [StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)]\r
+    internal struct ZStream\r
+    {\r
+        public IntPtr next_in;\r
+        public uint avail_in;\r
+        public uint total_in;\r
+\r
+        public IntPtr next_out;\r
+        public uint avail_out;\r
+        public uint total_out;\r
+\r
+        [MarshalAs(UnmanagedType.LPStr)]\r
+        string msg; \r
+        uint state;\r
+\r
+        uint zalloc;\r
+        uint zfree;\r
+        uint opaque;\r
+\r
+        int data_type;\r
+        public uint adler;\r
+        uint reserved;\r
+    }\r
+\r
+    #endregion\r
+    \r
+    #endregion\r
+\r
+    #region Public enums\r
+    /// <summary>\r
+    /// Defines constants for the available compression levels in zlib\r
+    /// </summary>\r
+    public enum CompressLevel : int\r
+    {\r
+        /// <summary>\r
+        /// The default compression level with a reasonable compromise between compression and speed\r
+        /// </summary>\r
+        Default = -1,   \r
+        /// <summary>\r
+        /// No compression at all. The data are passed straight through.\r
+        /// </summary>\r
+        None = 0,\r
+        /// <summary>\r
+        /// The maximum compression rate available.\r
+        /// </summary>\r
+        Best = 9,   \r
+        /// <summary>\r
+        /// The fastest available compression level.\r
+        /// </summary>\r
+        Fastest = 1\r
+    }\r
+    #endregion\r
+\r
+    #region Exception classes\r
+    /// <summary>\r
+    /// The exception that is thrown when an error occurs on the zlib dll\r
+    /// </summary>\r
+    public class ZLibException : ApplicationException\r
+    {\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified \r
+        /// error message and error code\r
+        /// </summary>\r
+        /// <param name="errorCode">The zlib error code that caused the exception</param>\r
+        /// <param name="msg">A message that (hopefully) describes the error</param>\r
+        public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg))\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified \r
+        /// error code\r
+        /// </summary>\r
+        /// <param name="errorCode">The zlib error code that caused the exception</param>\r
+        public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode))\r
+        {\r
+        }\r
+    }\r
+    #endregion\r
+\r
+    #region Interfaces\r
+\r
+    /// <summary>\r
+    /// Declares methods and properties that enables a running checksum to be calculated \r
+    /// </summary>\r
+    public interface ChecksumGenerator\r
+    {\r
+        /// <summary>\r
+        /// Gets the current value of the checksum\r
+        /// </summary>\r
+        uint Value { get; }\r
+\r
+        /// <summary>\r
+        /// Clears the current checksum to 0\r
+        /// </summary>\r
+        void Reset();\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with an array of bytes\r
+        /// </summary>\r
+        /// <param name="data">The data to update the checksum with</param>\r
+        void Update(byte[] data);\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with part of an array of bytes\r
+        /// </summary>\r
+        /// <param name="data">The data to update the checksum with</param>\r
+        /// <param name="offset">Where in <c>data</c> to start updating</param>\r
+        /// <param name="count">The number of bytes from <c>data</c> to use</param>\r
+        /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>\r
+        /// <exception cref="ArgumentNullException"><c>data</c> is a null reference</exception>\r
+        /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>\r
+        void Update(byte[] data, int offset, int count);\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with the data from a string\r
+        /// </summary>\r
+        /// <param name="data">The string to update the checksum with</param>\r
+        /// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>\r
+        void Update(string data);\r
+\r
+        /// <summary>\r
+        /// Updates the current checksum with the data from a string, using a specific encoding\r
+        /// </summary>\r
+        /// <param name="data">The string to update the checksum with</param>\r
+        /// <param name="encoding">The encoding to use</param>\r
+        void Update(string data, Encoding encoding);\r
+    }\r
+\r
+\r
+    /// <summary>\r
+    /// Represents the method that will be called from a codec when new data\r
+    /// are available.\r
+    /// </summary>\r
+    /// <paramref name="data">The byte array containing the processed data</paramref>\r
+    /// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref>\r
+    /// <paramref name="count">The number of processed bytes available</paramref>\r
+    /// <remarks>On return from this method, the data may be overwritten, so grab it while you can. \r
+    /// You cannot assume that startIndex will be zero.\r
+    /// </remarks>\r
+    public delegate void DataAvailableHandler(byte[] data, int startIndex, int count);\r
+\r
+    /// <summary>\r
+    /// Declares methods and events for implementing compressors/decompressors\r
+    /// </summary>\r
+    public interface Codec\r
+    {\r
+        /// <summary>\r
+        /// Occurs when more processed data are available.\r
+        /// </summary>\r
+        event DataAvailableHandler DataAvailable;\r
+\r
+        /// <summary>\r
+        /// Adds more data to the codec to be processed.\r
+        /// </summary>\r
+        /// <param name="data">Byte array containing the data to be added to the codec</param>\r
+        /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>\r
+        void Add(byte[] data);\r
+\r
+        /// <summary>\r
+        /// Adds more data to the codec to be processed.\r
+        /// </summary>\r
+        /// <param name="data">Byte array containing the data to be added to the codec</param>\r
+        /// <param name="offset">The index of the first byte to add from <c>data</c></param>\r
+        /// <param name="count">The number of bytes to add</param>\r
+        /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>\r
+        void Add(byte[] data, int offset, int count);\r
+\r
+        /// <summary>\r
+        /// Finishes up any pending data that needs to be processed and handled.\r
+        /// </summary>\r
+        void Finish();\r
+\r
+        /// <summary>\r
+        /// Gets the checksum of the data that has been added so far\r
+        /// </summary>\r
+        uint Checksum { get; }\r
+\r
+\r
+    }\r
+\r
+    #endregion\r
+\r
+    #region Classes\r
+    /// <summary>\r
+    /// Encapsulates general information about the ZLib library\r
+    /// </summary>\r
+    public class Info\r
+    {\r
+        #region DLL imports\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern uint zlibCompileFlags();\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern string zlibVersion();\r
+        #endregion\r
+\r
+        #region Private stuff\r
+        private uint _flags;\r
+\r
+        // helper function that unpacks a bitsize mask\r
+        private static int bitSize(uint bits)\r
+        {\r
+            switch (bits)\r
+            {\r
+                case 0: return 16;\r
+                case 1: return 32;\r
+                case 2: return 64;\r
+            }\r
+            return -1;\r
+        }\r
+        #endregion\r
+\r
+        /// <summary>\r
+        /// Constructs an instance of the <c>Info</c> class.\r
+        /// </summary>\r
+        public Info()\r
+        {\r
+            _flags = zlibCompileFlags();\r
+        }\r
+\r
+        /// <summary>\r
+        /// True if the library is compiled with debug info\r
+        /// </summary>\r
+        public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } }\r
+\r
+        /// <summary>\r
+        /// True if the library is compiled with assembly optimizations\r
+        /// </summary>\r
+        public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } }\r
+\r
+        /// <summary>\r
+        /// Gets the size of the unsigned int that was compiled into Zlib\r
+        /// </summary>\r
+        public int SizeOfUInt { get { return bitSize(_flags & 3); } }\r
+\r
+        /// <summary>\r
+        /// Gets the size of the unsigned long that was compiled into Zlib\r
+        /// </summary>\r
+        public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } }\r
+\r
+        /// <summary>\r
+        /// Gets the size of the pointers that were compiled into Zlib\r
+        /// </summary>\r
+        public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } }\r
+\r
+        /// <summary>\r
+        /// Gets the size of the z_off_t type that was compiled into Zlib\r
+        /// </summary>\r
+        public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } }\r
+\r
+        /// <summary>\r
+        /// Gets the version of ZLib as a string, e.g. "1.2.1"\r
+        /// </summary>\r
+        public static string Version { get { return zlibVersion(); } }\r
+    }\r
+\r
+    #endregion\r
+\r
+}\r
diff --git a/contrib/dotzlib/DotZLib/DotZLib.csproj b/contrib/dotzlib/DotZLib/DotZLib.csproj
new file mode 100644 (file)
index 0000000..71eeb85
--- /dev/null
@@ -0,0 +1,141 @@
+<VisualStudioProject>\r
+    <CSHARP\r
+        ProjectType = "Local"\r
+        ProductVersion = "7.10.3077"\r
+        SchemaVersion = "2.0"\r
+        ProjectGuid = "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"\r
+    >\r
+        <Build>\r
+            <Settings\r
+                ApplicationIcon = ""\r
+                AssemblyKeyContainerName = ""\r
+                AssemblyName = "DotZLib"\r
+                AssemblyOriginatorKeyFile = ""\r
+                DefaultClientScript = "JScript"\r
+                DefaultHTMLPageLayout = "Grid"\r
+                DefaultTargetSchema = "IE50"\r
+                DelaySign = "false"\r
+                OutputType = "Library"\r
+                PreBuildEvent = ""\r
+                PostBuildEvent = ""\r
+                RootNamespace = "DotZLib"\r
+                RunPostBuildEvent = "OnBuildSuccess"\r
+                StartupObject = ""\r
+            >\r
+                <Config\r
+                    Name = "Debug"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = "DEBUG;TRACE"\r
+                    DocumentationFile = "docs\DotZLib.xml"\r
+                    DebugSymbols = "true"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "false"\r
+                    NoStdLib = "false"\r
+                    NoWarn = "1591"\r
+                    Optimize = "false"\r
+                    OutputPath = "bin\Debug\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "4"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = "TRACE"\r
+                    DocumentationFile = "docs\DotZLib.xml"\r
+                    DebugSymbols = "false"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "false"\r
+                    NoStdLib = "false"\r
+                    NoWarn = ""\r
+                    Optimize = "true"\r
+                    OutputPath = "bin\Release\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "4"\r
+                />\r
+            </Settings>\r
+            <References>\r
+                <Reference\r
+                    Name = "System"\r
+                    AssemblyName = "System"\r
+                    HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.Data"\r
+                    AssemblyName = "System.Data"\r
+                    HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.XML"\r
+                    AssemblyName = "System.Xml"\r
+                    HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"\r
+                />\r
+                <Reference\r
+                    Name = "nunit.framework"\r
+                    AssemblyName = "nunit.framework"\r
+                    HintPath = "E:\apps\NUnit V2.1\\bin\nunit.framework.dll"\r
+                    AssemblyFolderKey = "hklm\dn\nunit.framework"\r
+                />\r
+            </References>\r
+        </Build>\r
+        <Files>\r
+            <Include>\r
+                <File\r
+                    RelPath = "AssemblyInfo.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "ChecksumImpl.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "CircularBuffer.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "CodecBase.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Deflater.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "DotZLib.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "GZipStream.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Inflater.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "UnitTests.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+            </Include>\r
+        </Files>\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/contrib/dotzlib/DotZLib/GZipStream.cs b/contrib/dotzlib/DotZLib/GZipStream.cs
new file mode 100644 (file)
index 0000000..f861675
--- /dev/null
@@ -0,0 +1,301 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.IO;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace DotZLib\r
+{\r
+       /// <summary>\r
+       /// Implements a compressed <see cref="Stream"/>, in GZip (.gz) format.\r
+       /// </summary>\r
+       public class GZipStream : Stream, IDisposable\r
+       {\r
+        #region Dll Imports\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]\r
+        private static extern IntPtr gzopen(string name, string mode);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int gzclose(IntPtr gzFile);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int gzwrite(IntPtr gzFile, int data, int length);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int gzread(IntPtr gzFile, int data, int length);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int gzgetc(IntPtr gzFile);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int gzputc(IntPtr gzFile, int c);\r
+\r
+        #endregion\r
+\r
+        #region Private data\r
+        private IntPtr _gzFile;\r
+        private bool _isDisposed = false;\r
+        private bool _isWriting;\r
+        #endregion\r
+\r
+        #region Constructors\r
+        /// <summary>\r
+        /// Creates a new file as a writeable GZipStream\r
+        /// </summary>\r
+        /// <param name="fileName">The name of the compressed file to create</param>\r
+        /// <param name="level">The compression level to use when adding data</param>\r
+        /// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>\r
+               public GZipStream(string fileName, CompressLevel level)\r
+               {\r
+            _isWriting = true;\r
+            _gzFile = gzopen(fileName, String.Format("wb{0}", (int)level));\r
+            if (_gzFile == IntPtr.Zero)\r
+                throw new ZLibException(-1, "Could not open " + fileName);\r
+               }\r
+\r
+        /// <summary>\r
+        /// Opens an existing file as a readable GZipStream\r
+        /// </summary>\r
+        /// <param name="fileName">The name of the file to open</param>\r
+        /// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>\r
+        public GZipStream(string fileName)\r
+        {\r
+            _isWriting = false;\r
+            _gzFile = gzopen(fileName, "rb");\r
+            if (_gzFile == IntPtr.Zero)\r
+                throw new ZLibException(-1, "Could not open " + fileName);\r
+\r
+        }\r
+        #endregion\r
+\r
+        #region Access properties\r
+        /// <summary>\r
+        /// Returns true of this stream can be read from, false otherwise\r
+        /// </summary>\r
+        public override bool CanRead\r
+        {\r
+            get\r
+            {\r
+                return !_isWriting;\r
+            }\r
+        }\r
+    \r
+\r
+        /// <summary>\r
+        /// Returns false.\r
+        /// </summary>\r
+        public override bool CanSeek\r
+        {\r
+            get\r
+            {\r
+                return false;\r
+            }\r
+        }\r
+    \r
+        /// <summary>\r
+        /// Returns true if this tsream is writeable, false otherwise\r
+        /// </summary>\r
+        public override bool CanWrite\r
+        {\r
+            get\r
+            {\r
+                return _isWriting;\r
+            }\r
+        }\r
+        #endregion\r
+    \r
+        #region Destructor & IDispose stuff\r
+\r
+        /// <summary>\r
+        /// Destroys this instance\r
+        /// </summary>\r
+        ~GZipStream()\r
+        {\r
+            cleanUp(false);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Closes the external file handle\r
+        /// </summary>\r
+        public void Dispose()\r
+        {\r
+            cleanUp(true);\r
+        }\r
+\r
+        // Does the actual closing of the file handle.\r
+        private void cleanUp(bool isDisposing)\r
+        {\r
+            if (!_isDisposed)\r
+            {\r
+                gzclose(_gzFile);\r
+                _isDisposed = true;\r
+            }\r
+        }\r
+        #endregion\r
+    \r
+        #region Basic reading and writing\r
+        /// <summary>\r
+        /// Attempts to read a number of bytes from the stream.\r
+        /// </summary>\r
+        /// <param name="buffer">The destination data buffer</param>\r
+        /// <param name="offset">The index of the first destination byte in <c>buffer</c></param>\r
+        /// <param name="count">The number of bytes requested</param>\r
+        /// <returns>The number of bytes read</returns>\r
+        /// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>\r
+        /// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>\r
+        /// <exception cref="ArgumentException">If <c>offset</c>  + <c>count</c> is &gt; buffer.Length</exception>\r
+        /// <exception cref="NotSupportedException">If this stream is not readable.</exception>\r
+        /// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>\r
+        public override int Read(byte[] buffer, int offset, int count)\r
+        {\r
+            if (!CanRead) throw new NotSupportedException();\r
+            if (buffer == null) throw new ArgumentNullException();\r
+            if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();\r
+            if ((offset+count) > buffer.Length) throw new ArgumentException();\r
+            if (_isDisposed) throw new ObjectDisposedException("GZipStream");\r
+\r
+            GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);\r
+            int result;\r
+            try\r
+            {\r
+                result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);\r
+                if (result < 0)\r
+                    throw new IOException();\r
+            }\r
+            finally\r
+            {\r
+                h.Free();\r
+            }\r
+            return result;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Attempts to read a single byte from the stream.\r
+        /// </summary>\r
+        /// <returns>The byte that was read, or -1 in case of error or End-Of-File</returns>\r
+        public override int ReadByte()\r
+        {\r
+            if (!CanRead) throw new NotSupportedException();\r
+            if (_isDisposed) throw new ObjectDisposedException("GZipStream");\r
+            return gzgetc(_gzFile);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Writes a number of bytes to the stream\r
+        /// </summary>\r
+        /// <param name="buffer"></param>\r
+        /// <param name="offset"></param>\r
+        /// <param name="count"></param>\r
+        /// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>\r
+        /// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>\r
+        /// <exception cref="ArgumentException">If <c>offset</c>  + <c>count</c> is &gt; buffer.Length</exception>\r
+        /// <exception cref="NotSupportedException">If this stream is not writeable.</exception>\r
+        /// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>\r
+        public override void Write(byte[] buffer, int offset, int count)\r
+        {\r
+            if (!CanWrite) throw new NotSupportedException();\r
+            if (buffer == null) throw new ArgumentNullException();\r
+            if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();\r
+            if ((offset+count) > buffer.Length) throw new ArgumentException();\r
+            if (_isDisposed) throw new ObjectDisposedException("GZipStream");\r
+\r
+            GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);\r
+            try\r
+            {\r
+                int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);\r
+                if (result < 0)\r
+                    throw new IOException();\r
+            }\r
+            finally\r
+            {\r
+                h.Free();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Writes a single byte to the stream\r
+        /// </summary>\r
+        /// <param name="value">The byte to add to the stream.</param>\r
+        /// <exception cref="NotSupportedException">If this stream is not writeable.</exception>\r
+        /// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>\r
+        public override void WriteByte(byte value)\r
+        {\r
+            if (!CanWrite) throw new NotSupportedException();\r
+            if (_isDisposed) throw new ObjectDisposedException("GZipStream");\r
+\r
+            int result = gzputc(_gzFile, (int)value);\r
+            if (result < 0)\r
+                throw new IOException();\r
+        }\r
+        #endregion\r
+\r
+        #region Position & length stuff\r
+        /// <summary>\r
+        /// Not supported.\r
+        /// </summary>\r
+        /// <param name="value"></param>\r
+        /// <exception cref="NotSupportedException">Always thrown</exception>\r
+        public override void SetLength(long value)\r
+        {\r
+            throw new NotSupportedException();\r
+        }\r
+    \r
+        /// <summary>\r
+        ///  Not suppported.\r
+        /// </summary>\r
+        /// <param name="offset"></param>\r
+        /// <param name="origin"></param>\r
+        /// <returns></returns>\r
+        /// <exception cref="NotSupportedException">Always thrown</exception>\r
+        public override long Seek(long offset, SeekOrigin origin)\r
+        {\r
+            throw new NotSupportedException();\r
+        }\r
+    \r
+        /// <summary>\r
+        /// Flushes the <c>GZipStream</c>.\r
+        /// </summary>\r
+        /// <remarks>In this implementation, this method does nothing. This is because excessive\r
+        /// flushing may degrade the achievable compression rates.</remarks>\r
+        public override void Flush()\r
+        {\r
+            // left empty on purpose\r
+        }\r
+    \r
+        /// <summary>\r
+        /// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.\r
+        /// </summary>\r
+        /// <remarks>In this implementation this property is not supported</remarks>\r
+        /// <exception cref="NotSupportedException">Always thrown</exception>\r
+        public override long Position\r
+        {\r
+            get\r
+            {\r
+                throw new NotSupportedException();\r
+            }\r
+            set\r
+            {\r
+                throw new NotSupportedException();\r
+            }\r
+        }\r
+    \r
+        /// <summary>\r
+        /// Gets the size of the stream. Not suppported.\r
+        /// </summary>\r
+        /// <remarks>In this implementation this property is not supported</remarks>\r
+        /// <exception cref="NotSupportedException">Always thrown</exception>\r
+        public override long Length\r
+        {\r
+            get\r
+            {\r
+                throw new NotSupportedException();\r
+            }\r
+        }\r
+        #endregion\r
+    }\r
+}\r
diff --git a/contrib/dotzlib/DotZLib/Inflater.cs b/contrib/dotzlib/DotZLib/Inflater.cs
new file mode 100644 (file)
index 0000000..4e60cda
--- /dev/null
@@ -0,0 +1,105 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.Diagnostics;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace DotZLib\r
+{\r
+    \r
+    /// <summary>\r
+    /// Implements a data decompressor, using the inflate algorithm in the ZLib dll\r
+    /// </summary>\r
+    public class Inflater : CodecBase\r
+       {\r
+        #region Dll imports\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]\r
+        private static extern int inflateInit_(ref ZStream sz, string vs, int size);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int inflate(ref ZStream sz, int flush);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int inflateReset(ref ZStream sz);\r
+\r
+        [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]\r
+        private static extern int inflateEnd(ref ZStream sz);\r
+        #endregion\r
+\r
+        /// <summary>\r
+        /// Constructs an new instance of the <c>Inflater</c>\r
+        /// </summary>\r
+        public Inflater() : base()\r
+               {\r
+            int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream));\r
+            if (retval != 0)\r
+                throw new ZLibException(retval, "Could not initialize inflater");\r
+\r
+            resetOutput();\r
+        }\r
+\r
+\r
+        /// <summary>\r
+        /// Adds more data to the codec to be processed.\r
+        /// </summary>\r
+        /// <param name="data">Byte array containing the data to be added to the codec</param>\r
+        /// <param name="offset">The index of the first byte to add from <c>data</c></param>\r
+        /// <param name="count">The number of bytes to add</param>\r
+        /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>\r
+        public override void Add(byte[] data, int offset, int count)\r
+        {\r
+            if (data == null) throw new ArgumentNullException();\r
+            if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();\r
+            if ((offset+count) > data.Length) throw new ArgumentException();\r
+\r
+            int total = count;\r
+            int inputIndex = offset;\r
+            int err = 0;\r
+\r
+            while (err >= 0 && inputIndex < total)\r
+            {\r
+                copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));\r
+                err = inflate(ref _ztream, (int)FlushTypes.None);\r
+                if (err == 0)\r
+                    while (_ztream.avail_out == 0)\r
+                    {\r
+                        OnDataAvailable();\r
+                        err = inflate(ref _ztream, (int)FlushTypes.None);\r
+                    }\r
+\r
+                inputIndex += (int)_ztream.total_in;\r
+            }\r
+            setChecksum( _ztream.adler );\r
+        }\r
+\r
+\r
+        /// <summary>\r
+        /// Finishes up any pending data that needs to be processed and handled.\r
+        /// </summary>\r
+        public override void Finish()\r
+        {\r
+            int err;\r
+            do \r
+            {\r
+                err = inflate(ref _ztream, (int)FlushTypes.Finish);\r
+                OnDataAvailable();\r
+            }\r
+            while (err == 0);\r
+            setChecksum( _ztream.adler );\r
+            inflateReset(ref _ztream);\r
+            resetOutput();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Closes the internal zlib inflate stream\r
+        /// </summary>\r
+        protected override void CleanUp() { inflateEnd(ref _ztream); }\r
+\r
+\r
+       }\r
+}\r
diff --git a/contrib/dotzlib/DotZLib/UnitTests.cs b/contrib/dotzlib/DotZLib/UnitTests.cs
new file mode 100644 (file)
index 0000000..2f374b6
--- /dev/null
@@ -0,0 +1,274 @@
+//\r
+// Â© Copyright Henrik Ravn 2004\r
+//\r
+// Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+\r
+using System;\r
+using System.Collections;\r
+using System.IO;\r
+\r
+// uncomment the define below to include unit tests\r
+//#define nunit\r
+#if nunit\r
+using NUnit.Framework;\r
+\r
+// Unit tests for the DotZLib class library\r
+// ----------------------------------------\r
+//\r
+// Use this with NUnit 2 from http://www.nunit.org\r
+//\r
+\r
+namespace DotZLibTests\r
+{\r
+    using DotZLib;\r
+\r
+    // helper methods\r
+    internal class Utils\r
+    {\r
+        public static bool byteArrEqual( byte[] lhs, byte[] rhs )\r
+        {\r
+            if (lhs.Length != rhs.Length)\r
+                return false;\r
+            for (int i = lhs.Length-1; i >= 0; --i)\r
+                if (lhs[i] != rhs[i])\r
+                    return false;\r
+            return true;\r
+        }\r
+\r
+    }\r
+\r
+\r
+    [TestFixture]\r
+    public class CircBufferTests\r
+    {\r
+        #region Circular buffer tests\r
+        [Test]\r
+        public void SinglePutGet()\r
+        {\r
+            CircularBuffer buf = new CircularBuffer(10);\r
+            Assert.AreEqual( 0, buf.Size );\r
+            Assert.AreEqual( -1, buf.Get() );\r
+\r
+            Assert.IsTrue(buf.Put( 1 ));\r
+            Assert.AreEqual( 1, buf.Size );\r
+            Assert.AreEqual( 1, buf.Get() );\r
+            Assert.AreEqual( 0, buf.Size );\r
+            Assert.AreEqual( -1, buf.Get() );\r
+        }\r
+\r
+        [Test]\r
+        public void BlockPutGet()\r
+        {\r
+            CircularBuffer buf = new CircularBuffer(10);\r
+            byte[] arr = {1,2,3,4,5,6,7,8,9,10};\r
+            Assert.AreEqual( 10, buf.Put(arr,0,10) );\r
+            Assert.AreEqual( 10, buf.Size );\r
+            Assert.IsFalse( buf.Put(11) );\r
+            Assert.AreEqual( 1, buf.Get() );\r
+            Assert.IsTrue( buf.Put(11) );\r
+\r
+            byte[] arr2 = (byte[])arr.Clone();\r
+            Assert.AreEqual( 9, buf.Get(arr2,1,9) );\r
+            Assert.IsTrue( Utils.byteArrEqual(arr,arr2) );\r
+        }\r
+\r
+        #endregion\r
+    }\r
+\r
+    [TestFixture]\r
+    public class ChecksumTests\r
+    {\r
+        #region CRC32 Tests\r
+        [Test]\r
+        public void CRC32_Null()\r
+        {\r
+            CRC32Checksum crc32 = new CRC32Checksum();\r
+            Assert.AreEqual( 0, crc32.Value );\r
+\r
+            crc32 = new CRC32Checksum(1);\r
+            Assert.AreEqual( 1, crc32.Value );\r
+\r
+            crc32 = new CRC32Checksum(556);\r
+            Assert.AreEqual( 556, crc32.Value );\r
+        }\r
+\r
+        [Test]\r
+        public void CRC32_Data()\r
+        {\r
+            CRC32Checksum crc32 = new CRC32Checksum();\r
+            byte[] data = { 1,2,3,4,5,6,7 };\r
+            crc32.Update(data);\r
+            Assert.AreEqual( 0x70e46888, crc32.Value  );\r
+\r
+            crc32 = new CRC32Checksum();\r
+            crc32.Update("penguin");\r
+            Assert.AreEqual( 0x0e5c1a120, crc32.Value );\r
+\r
+            crc32 = new CRC32Checksum(1);\r
+            crc32.Update("penguin");\r
+            Assert.AreEqual(0x43b6aa94, crc32.Value);\r
+\r
+        }\r
+        #endregion\r
+\r
+        #region Adler tests\r
+\r
+        [Test]\r
+        public void Adler_Null()\r
+        {\r
+            AdlerChecksum adler = new AdlerChecksum();\r
+            Assert.AreEqual(0, adler.Value);\r
+\r
+            adler = new AdlerChecksum(1);\r
+            Assert.AreEqual( 1, adler.Value );\r
+\r
+            adler = new AdlerChecksum(556);\r
+            Assert.AreEqual( 556, adler.Value );\r
+        }\r
+\r
+        [Test]\r
+        public void Adler_Data()\r
+        {\r
+            AdlerChecksum adler = new AdlerChecksum(1);\r
+            byte[] data = { 1,2,3,4,5,6,7 };\r
+            adler.Update(data);\r
+            Assert.AreEqual( 0x5b001d, adler.Value  );\r
+\r
+            adler = new AdlerChecksum();\r
+            adler.Update("penguin");\r
+            Assert.AreEqual(0x0bcf02f6, adler.Value );\r
+\r
+            adler = new AdlerChecksum(1);\r
+            adler.Update("penguin");\r
+            Assert.AreEqual(0x0bd602f7, adler.Value);\r
+\r
+        }\r
+        #endregion\r
+    }\r
+\r
+    [TestFixture]\r
+    public class InfoTests\r
+    {\r
+        #region Info tests\r
+        [Test]\r
+        public void Info_Version()\r
+        {\r
+            Info info = new Info();\r
+            Assert.AreEqual("1.2.2", Info.Version);\r
+            Assert.AreEqual(32, info.SizeOfUInt);\r
+            Assert.AreEqual(32, info.SizeOfULong);\r
+            Assert.AreEqual(32, info.SizeOfPointer);\r
+            Assert.AreEqual(32, info.SizeOfOffset);\r
+        }\r
+        #endregion\r
+    }\r
+\r
+    [TestFixture]\r
+    public class DeflateInflateTests\r
+    {\r
+        #region Deflate tests\r
+        [Test]\r
+        public void Deflate_Init()\r
+        {\r
+            using (Deflater def = new Deflater(CompressLevel.Default))\r
+            {\r
+            }\r
+        }\r
+\r
+        private ArrayList compressedData = new ArrayList();\r
+        private uint adler1;\r
+\r
+        private ArrayList uncompressedData = new ArrayList();\r
+        private uint adler2;\r
+\r
+        public void CDataAvail(byte[] data, int startIndex, int count)\r
+        {\r
+            for (int i = 0; i < count; ++i)\r
+                compressedData.Add(data[i+startIndex]);\r
+        }\r
+\r
+        [Test]\r
+        public void Deflate_Compress()\r
+        {\r
+            compressedData.Clear();\r
+\r
+            byte[] testData = new byte[35000];\r
+            for (int i = 0; i < testData.Length; ++i)\r
+                testData[i] = 5;\r
+\r
+            using (Deflater def = new Deflater((CompressLevel)5))\r
+            {\r
+                def.DataAvailable += new DataAvailableHandler(CDataAvail);\r
+                def.Add(testData);\r
+                def.Finish();\r
+                adler1 = def.Checksum;\r
+            }\r
+        }\r
+        #endregion\r
+\r
+        #region Inflate tests\r
+        [Test]\r
+        public void Inflate_Init()\r
+        {\r
+            using (Inflater inf = new Inflater())\r
+            {\r
+            }\r
+        }\r
+\r
+        private void DDataAvail(byte[] data, int startIndex, int count)\r
+        {\r
+            for (int i = 0; i < count; ++i)\r
+                uncompressedData.Add(data[i+startIndex]);\r
+        }\r
+\r
+        [Test]\r
+        public void Inflate_Expand()\r
+        { \r
+            uncompressedData.Clear();\r
+\r
+            using (Inflater inf = new Inflater())\r
+            {\r
+                inf.DataAvailable += new DataAvailableHandler(DDataAvail);\r
+                inf.Add((byte[])compressedData.ToArray(typeof(byte)));\r
+                inf.Finish();\r
+                adler2 = inf.Checksum;\r
+            }\r
+            Assert.AreEqual( adler1, adler2 );\r
+        }\r
+        #endregion\r
+    }\r
+\r
+    [TestFixture]\r
+    public class GZipStreamTests\r
+    {\r
+        #region GZipStream test\r
+        [Test]\r
+        public void GZipStream_WriteRead()\r
+        {\r
+            using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best))\r
+            {\r
+                BinaryWriter writer = new BinaryWriter(gzOut);\r
+                writer.Write("hi there");\r
+                writer.Write(Math.PI);\r
+                writer.Write(42);\r
+            }\r
+\r
+            using (GZipStream gzIn = new GZipStream("gzstream.gz"))\r
+            {\r
+                BinaryReader reader = new BinaryReader(gzIn);\r
+                string s = reader.ReadString();\r
+                Assert.AreEqual("hi there",s);\r
+                double d = reader.ReadDouble();\r
+                Assert.AreEqual(Math.PI, d);\r
+                int i = reader.ReadInt32();\r
+                Assert.AreEqual(42,i);\r
+            }\r
+\r
+        }\r
+        #endregion\r
+       }\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/contrib/dotzlib/LICENSE_1_0.txt b/contrib/dotzlib/LICENSE_1_0.txt
new file mode 100644 (file)
index 0000000..30aac2c
--- /dev/null
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003\r
+\r
+Permission is hereby granted, free of charge, to any person or organization\r
+obtaining a copy of the software and accompanying documentation covered by\r
+this license (the "Software") to use, reproduce, display, distribute,\r
+execute, and transmit the Software, and to prepare derivative works of the\r
+Software, and to permit third-parties to whom the Software is furnished to\r
+do so, all subject to the following:\r
+\r
+The copyright notices in the Software and this entire statement, including\r
+the above license grant, this restriction and the following disclaimer,\r
+must be included in all copies of the Software, in whole or in part, and\r
+all derivative works of the Software, unless such copies or derivative\r
+works are solely in the form of machine-executable object code generated by\r
+a source language processor.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT\r
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE\r
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,\r
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/contrib/dotzlib/readme.txt b/contrib/dotzlib/readme.txt
new file mode 100644 (file)
index 0000000..210f4b0
--- /dev/null
@@ -0,0 +1,58 @@
+This directory contains a .Net wrapper class library for the ZLib1.dll\r
+\r
+The wrapper includes support for inflating/deflating memory buffers, \r
+.Net streaming wrappers for the gz streams part of zlib, and wrappers\r
+for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.\r
+\r
+Directory structure:\r
+--------------------\r
+\r
+LICENSE_1_0.txt       - License file.\r
+readme.txt            - This file.\r
+DotZLib.chm           - Class library documentation\r
+DotZLib.build         - NAnt build file\r
+DotZLib.sln           - Microsoft Visual Studio 2003 solution file\r
+\r
+DotZLib\*.cs          - Source files for the class library\r
+\r
+Unit tests:\r
+-----------\r
+The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.\r
+To include unit tests in the build, define nunit before building.\r
+\r
+\r
+Build instructions:\r
+-------------------\r
+\r
+1. Using Visual Studio.Net 2003:\r
+   Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)\r
+   will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on \r
+   you are building the release or debug version of the library. Check \r
+   DotZLib/UnitTests.cs for instructions on how to include unit tests in the\r
+   build.\r
+   \r
+2. Using NAnt:\r
+   Open a command prompt with access to the build environment and run nant\r
+   in the same directory as the DotZLib.build file.\r
+   You can define 2 properties on the nant command-line to control the build:\r
+   debug={true|false} to toggle between release/debug builds (default=true).\r
+   nunit={true|false} to include or esclude unit tests (default=true).\r
+   Also the target clean will remove binaries.\r
+   Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release \r
+   or ./DotZLib/bin/debug, depending on whether you are building the release \r
+   or debug version of the library.\r
+\r
+   Examples: \r
+     nant -D:debug=false -D:nunit=false\r
+       will build a release mode version of the library without unit tests.\r
+     nant\r
+       will build a debug version of the library with unit tests \r
+     nant clean\r
+       will remove all previously built files.\r
+\r
+\r
+---------------------------------\r
+Copyright (c) Henrik Ravn 2004\r
+\r
+Use, modification and distribution are subject to the Boost Software License, Version 1.0. \r
+(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
index f2e9e4ffd522b39ed02e0f4430fff31c6475b356..e9e878e116033e9ff2c05e2f1c8ab45ca45278bb 100644 (file)
    unfriendly behavior that if gzappend fails, the gzip file is corrupted.
 
    This program was written to illustrate the use of the new Z_BLOCK option of
-   zlib 1.2.1's inflate() function.  This option returns from inflate() at each
+   zlib 1.2.x's inflate() function.  This option returns from inflate() at each
    block boundary to facilitate locating and modifying the last block bit at
    the start of the final deflate block.  Also whether using Z_BLOCK or not,
-   another required feature of zlib 1.2.1 is that inflate() now provides the
+   another required feature of zlib 1.2.x is that inflate() now provides the
    number of unusued bits in the last input byte used.  gzappend will not work
    with versions of zlib earlier than 1.2.1.
 
index 103d901c91673148e1a836c2b48cd38f426c51b0..f5ddde67da66670d612c42f53b0a6587875ed5c5 100644 (file)
@@ -430,8 +430,8 @@ void FAR *out_desc;
                 }
             }
 
-           /* handle error breaks in while */
-           if (mode == BAD) break;
+            /* handle error breaks in while */
+            if (mode == BAD) break;
 
             /* build code tables */
             state->next = state->codes;
index 5fd5b4a1d519666f90572494ef136b4d94ca24ad..9b48bc54ea7d2951637ea18ca3de05a02d38c834 100644 (file)
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate9_copyright[] =
-   " inflate9 1.2.1.2 Copyright 1995-2004 Mark Adler ";
+   " inflate9 1.2.2 Copyright 1995-2004 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -64,7 +64,7 @@ unsigned short FAR *work;
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
         130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
-        133, 133, 133, 133, 144, 77, 194};
+        133, 133, 133, 133, 144, 199, 198};
     static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
         65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
index 6ddfd3634aa80ae77f9e11b6c4d37b38db9a8fd9..c9e69f27caff5c97bd09aa975f4c4fe3529c5d44 100644 (file)
@@ -94,7 +94,7 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
    uLong size;
 {
     uLong ret;
-    ret = fread(buf, 1, (size_t)size, (FILE *)stream);
+    ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
     return ret;
 }
 
@@ -106,7 +106,7 @@ uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
    uLong size;
 {
     uLong ret;
-    ret = fwrite(buf, 1, (size_t)size, (FILE *)stream);
+    ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
     return ret;
 }
 
index 11b7260b69fd873f04fc90b4aa6be4e7bedad005..a6b06a2082eefb01a1f4d0f557b6f8b783b709ea 100644 (file)
@@ -317,7 +317,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
 
                     printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
                     ret = scanf("%1s",answer);
-                    if (ret != 1) 
+                    if (ret != 1)
                     {
                        exit(EXIT_FAILURE);
                     }
@@ -567,7 +567,7 @@ int main(argc,argv)
         return do_list(uf);
     else if (opt_do_extract==1)
     {
-        if (opt_extractdir && chdir(dirname)) 
+        if (opt_extractdir && chdir(dirname))
         {
           printf("Error changing into %s, aborting\n", dirname);
           exit(-1);
index 363ee131b59be4d597bed1c05b5fdc8e1a084028..c1266bc6c84421ba6e9c5e6fb36bc3946e00c21d 100644 (file)
@@ -62,7 +62,7 @@ uLong* bytesRecovered;
         unsigned int fnsize = READ_16(header + 26); /* file name length */
         unsigned int extsize = READ_16(header + 28); /* extra field length */
         filename[0] = extra[0] = '\0';
-        
+
         /* Header */
         if (fwrite(header, 1, 30, fpOut) == 30) {
           offset += 30;
@@ -70,7 +70,7 @@ uLong* bytesRecovered;
           err = Z_ERRNO;
           break;
         }
-        
+
         /* Filename */
         if (fnsize > 0) {
           if (fread(filename, 1, fnsize, fpZip) == fnsize) {
@@ -103,7 +103,7 @@ uLong* bytesRecovered;
             break;
           }
         }
-        
+
         /* Data */
         {
           int dataSize = cpsize;
@@ -133,7 +133,7 @@ uLong* bytesRecovered;
             }
           }
         }
-        
+
         /* Central directory entry */
         {
           char header[46];
@@ -159,7 +159,7 @@ uLong* bytesRecovered;
           /* Header */
           if (fwrite(header, 1, 46, fpOutCD) == 46) {
             offsetCD += 46;
-            
+
             /* Filename */
             if (fnsize > 0) {
               if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
@@ -172,7 +172,7 @@ uLong* bytesRecovered;
               err = Z_STREAM_ERROR;
               break;
             }
-            
+
             /* Extra field */
             if (extsize > 0) {
               if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
@@ -182,7 +182,7 @@ uLong* bytesRecovered;
                 break;
               }
             }
-            
+
             /* Comment field */
             if (comsize > 0) {
               if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
@@ -192,8 +192,8 @@ uLong* bytesRecovered;
                 break;
               }
             }
-            
-            
+
+
           } else {
             err = Z_ERRNO;
             break;
@@ -225,17 +225,17 @@ uLong* bytesRecovered;
       WRITE_32(header + 12, offsetCD);    /* size of CD */
       WRITE_32(header + 16, offset);      /* offset to CD */
       WRITE_16(header + 20, comsize);     /* comment */
-      
+
       /* Header */
       if (fwrite(header, 1, 22, fpOutCD) == 22) {
-        
+
         /* Comment field */
         if (comsize > 0) {
           if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
             err = Z_ERRNO;
           }
         }
-        
+
       } else {
         err = Z_ERRNO;
       }
@@ -257,14 +257,14 @@ uLong* bytesRecovered;
         fclose(fpOutCD);
       }
     }
-    
+
     /* Close */
     fclose(fpZip);
     fclose(fpOut);
-    
+
     /* Wipe temporary file */
     (void)remove(fileOutTmp);
-    
+
     /* Number of recovered entries */
     if (err == Z_OK) {
       if (nRecovered != NULL) {
index eee78dc56b565b51df368cc65bb5df01c329387e..88b34592bf5ce021640c242c727264e6287edcd7 100644 (file)
@@ -17,14 +17,14 @@ extern "C" {
 
 #include "unzip.h"
 
-/* Repair a ZIP file (missing central directory) 
+/* Repair a ZIP file (missing central directory)
    file: file to recover
    fileOut: output file after recovery
    fileOutTmp: temporary file name used for recovery
 */
-extern int ZEXPORT unzRepair(const char* file, 
-                             const char* fileOut, 
-                             const char* fileOutTmp, 
+extern int ZEXPORT unzRepair(const char* file,
+                             const char* fileOut,
+                             const char* fileOutTmp,
                              uLong* nRecovered,
                              uLong* bytesRecovered);
 
index e804a2af8d43db6946b9cb2efadc7f0ebdae5d52..e14de9e5ba4d5d3d979e285c05586396ffd40fb7 100644 (file)
@@ -1,5 +1,5 @@
 /* unzip.c -- IO for uncompress .zip files using zlib
-   Version 1.01c, August 23th, 2004
+   Version 1.01d, September 22th, 2004
 
    Copyright (C) 1998-2004 Gilles Vollant
 
@@ -1250,10 +1250,12 @@ extern int ZEXPORT unzReadCurrentFile  (file, buf, len)
         pfile_in_zip_read_info->stream.avail_out =
             (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
 
-    if ((len>pfile_in_zip_read_info->rest_read_compressed) &&
-        (pfile_in_zip_read_info->raw))
+    if ((len>pfile_in_zip_read_info->rest_read_compressed+
+           pfile_in_zip_read_info->stream.avail_in) &&
+         (pfile_in_zip_read_info->raw))
         pfile_in_zip_read_info->stream.avail_out =
-            (uInt)pfile_in_zip_read_info->rest_read_compressed; 
+            (uInt)pfile_in_zip_read_info->rest_read_compressed+
+            pfile_in_zip_read_info->stream.avail_in;
 
     while (pfile_in_zip_read_info->stream.avail_out>0)
     {
index ce1444c0d3951885a967e6682c31dba29f307baf..2ccd7fd1ad8021dbbf4bb9452c6d570f64e2a1ab 100644 (file)
@@ -717,9 +717,9 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
     if (comment==NULL)
         size_comment = 0;
     else
-        size_comment = strlen(comment);
+        size_comment = (uInt)strlen(comment);
 
-    size_filename = strlen(filename);
+    size_filename = (uInt)strlen(filename);
 
     if (zipfi == NULL)
         zi->ci.dosDate = 0;
@@ -1126,7 +1126,7 @@ extern int ZEXPORT zipClose (file, global_comment)
     if (global_comment==NULL)
         size_global_comment = 0;
     else
-        size_global_comment = strlen(global_comment);
+        size_global_comment = (uInt)strlen(global_comment);
 
 
     centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
index 3a30768b68c6830bfbabf6fea0c592629ad48d4f..2c391e5986753de7b6d9eeccfe919d543698925f 100644 (file)
@@ -97,7 +97,7 @@ struct attr_item
   struct attr_item  *next;
   char              *fname;
   int                mode;
-  time_t             time; 
+  time_t             time;
 };
 
 enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID };
index 2eb7c6b0e48b3f37c853bc944ec8ffcea33503a0..3ebe25bca6daf14196b5eeed1fbc6ec34abe48ca 100644 (file)
@@ -2,8 +2,8 @@
 \r
 #define IDR_VERSION1  1\r
 IDR_VERSION1   VERSIONINFO     MOVEABLE IMPURE LOADONCALL DISCARDABLE\r
-  FILEVERSION   1,2,1,2\r
-  PRODUCTVERSION 1,2,1,2\r
+  FILEVERSION   1,2,2\r
+  PRODUCTVERSION 1,2,2\r
   FILEFLAGSMASK        VS_FFI_FILEFLAGSMASK\r
   FILEFLAGS    0\r
   FILEOS       VOS_DOS_WINDOWS32\r
@@ -17,7 +17,7 @@ BEGIN
 \r
     BEGIN\r
       VALUE "FileDescription", "zlib data compression library\0"\r
-      VALUE "FileVersion",     "1.2.1.2\0"\r
+      VALUE "FileVersion",     "1.2.2\0"\r
       VALUE "InternalName",    "zlib\0"\r
       VALUE "OriginalFilename",        "zlib.dll\0"\r
       VALUE "ProductName",     "ZLib.DLL\0"\r
diff --git a/crc32.c b/crc32.c
index 0e0488058732f37d342e06a0bbb3446200b35a6c..b39c7e1253e1b1dcaf2a15d1fd4018128b324bc2 100644 (file)
--- a/crc32.c
+++ b/crc32.c
 /* @(#) $Id$ */
 
 /*
-  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection
-  on the static variables used to control the first-use generation of the crc
-  tables.  Therefore if you #define DYNAMIC_CRC_TABLE, you should first call
-  get_crc_table() to initialize the tables before allowing more than on thread
-  to use crc32().
+  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+  protection on the static variables used to control the first-use generation
+  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+  first call get_crc_table() to initialize the tables before allowing more than
+  one thread to use crc32().
  */
 
 #ifdef MAKECRCH
@@ -103,51 +103,51 @@ local void make_crc_table()
 {
     unsigned long c;
     int n, k;
-    unsigned long poly;                                /* polynomial exclusive-or pattern */
+    unsigned long poly;                 /* polynomial exclusive-or pattern */
     /* terms of polynomial defining this crc (except x^32): */
-       static volatile int first = 1;          /* flag to limit concurrent making */
+    static volatile int first = 1;      /* flag to limit concurrent making */
     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
 
-       /* See if another task is already doing this (not thread-safe, but better
-          than nothing -- significantly reduces duration of vulnerability in
-          case the advice about DYNAMIC_CRC_TABLE is ignored) */
-       if (first) {
-               first = 0;
-
-               /* make exclusive-or pattern from polynomial (0xedb88320UL) */
-               poly = 0UL;
-               for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
-                       poly |= 1UL << (31 - p[n]);
-
-               /* generate a crc for every 8-bit value */
-               for (n = 0; n < 256; n++) {
-                       c = (unsigned long)n;
-                       for (k = 0; k < 8; k++)
-                               c = c & 1 ? poly ^ (c >> 1) : c >> 1;
-                       crc_table[0][n] = c;
-               }
+    /* See if another task is already doing this (not thread-safe, but better
+       than nothing -- significantly reduces duration of vulnerability in
+       case the advice about DYNAMIC_CRC_TABLE is ignored) */
+    if (first) {
+        first = 0;
+
+        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+        poly = 0UL;
+        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+            poly |= 1UL << (31 - p[n]);
+
+        /* generate a crc for every 8-bit value */
+        for (n = 0; n < 256; n++) {
+            c = (unsigned long)n;
+            for (k = 0; k < 8; k++)
+                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+            crc_table[0][n] = c;
+        }
 
 #ifdef BYFOUR
-               /* generate crc for each value followed by one, two, and three zeros, and
-                  then the byte reversal of those as well as the first table */
-               for (n = 0; n < 256; n++) {
-                       c = crc_table[0][n];
-                       crc_table[4][n] = REV(c);
-                       for (k = 1; k < 4; k++) {
-                               c = crc_table[0][c & 0xff] ^ (c >> 8);
-                               crc_table[k][n] = c;
-                               crc_table[k + 4][n] = REV(c);
-                       }
-               }
+        /* generate crc for each value followed by one, two, and three zeros,
+           and then the byte reversal of those as well as the first table */
+        for (n = 0; n < 256; n++) {
+            c = crc_table[0][n];
+            crc_table[4][n] = REV(c);
+            for (k = 1; k < 4; k++) {
+                c = crc_table[0][c & 0xff] ^ (c >> 8);
+                crc_table[k][n] = c;
+                crc_table[k + 4][n] = REV(c);
+            }
+        }
 #endif /* BYFOUR */
 
-               crc_table_empty = 0;
-       }
-       else {          /* not first */
-               /* wait for the other guy to finish (not exactly efficient, but rare) */
-               while (crc_table_empty)
-                       ;
-       }
+        crc_table_empty = 0;
+    }
+    else {      /* not first */
+        /* wait for the other guy to finish (not efficient, but rare) */
+        while (crc_table_empty)
+            ;
+    }
 
 #ifdef MAKECRCH
     /* write out CRC tables to crc32.h */
@@ -201,10 +201,10 @@ local void write_table(out, table)
 const unsigned long FAR * ZEXPORT get_crc_table()
 {
 #ifdef DYNAMIC_CRC_TABLE
-       if (crc_table_empty)
-               make_crc_table();
+    if (crc_table_empty)
+        make_crc_table();
 #endif /* DYNAMIC_CRC_TABLE */
-       return (const unsigned long FAR *)crc_table;
+    return (const unsigned long FAR *)crc_table;
 }
 
 /* ========================================================================= */
index b402fe585f4a03f51b83c9826f9cd855584f3b27..0fc53bc1e820c364b127183e5a2f60ac4ce01f10 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -1,5 +1,5 @@
 /* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * Copyright (C) 1995-2004 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -52,7 +52,7 @@
 #include "deflate.h"
 
 const char deflate_copyright[] =
-   " deflate 1.2.1.2 Copyright 1995-2004 Jean-loup Gailly ";
+   " deflate 1.2.2 Copyright 1995-2004 Jean-loup Gailly ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
diff --git a/gzio.c b/gzio.c
index 0ceafff8b691d77acfcdd0d32774c7a2fa1df10d..5e71b0ab3ae892c0c68cf8337567b897a6e35b93 100644 (file)
--- a/gzio.c
+++ b/gzio.c
@@ -455,10 +455,10 @@ int ZEXPORT gzread (file, buf, len)
                     s->z_err = Z_ERRNO;
                     break;
                 }
-               if (feof(s->file)) {        /* avoid error for empty file */
-                   s->z_err = Z_STREAM_END;
-                   break;
-               }
+                if (feof(s->file)) {        /* avoid error for empty file */
+                    s->z_err = Z_STREAM_END;
+                    break;
+                }
             }
             s->stream.next_in = s->inbuf;
         }
index 477b6ea3290c42cc7cb1e4671c288218ea22ca27..262f97c73ac757642cfe37097cebc653e9bc7a5c 100644 (file)
--- a/infback.c
+++ b/infback.c
@@ -434,8 +434,8 @@ void FAR *out_desc;
                 }
             }
 
-           /* handle error breaks in while */
-           if (state->mode == BAD) break;
+            /* handle error breaks in while */
+            if (state->mode == BAD) break;
 
             /* build code tables */
             state->next = state->codes;
index 06ca1de8370e3652aa34a9082212df443dbd76c4..c6d38266d07edd11c8ad7b755e0ea87c9aea2188 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -109,6 +109,7 @@ z_streamp strm;
     state = (struct inflate_state FAR *)strm->state;
     strm->total_in = strm->total_out = state->total = 0;
     strm->msg = Z_NULL;
+    strm->adler = 1;        /* to support ill-conceived Java test suite */
     state->mode = HEAD;
     state->last = 0;
     state->havedict = 0;
@@ -861,8 +862,8 @@ int flush;
                 }
             }
 
-           /* handle error breaks in while */
-           if (state->mode == BAD) break;
+            /* handle error breaks in while */
+            if (state->mode == BAD) break;
 
             /* build code tables */
             state->next = state->codes;
index 0ced3ae4d7b4b944c26fb8266253efad9b8b26db..8a896b2879340f56a828657f38fac0f30cebd0f3 100644 (file)
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.1.2 Copyright 1995-2004 Mark Adler ";
+   " inflate 1.2.2 Copyright 1995-2004 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 194};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 198};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
index 06ebe3d13f82b2b2be09a39e72d0121b89306d4f..800bf079827b7b1215b9ded3f7d373a5e8e124a9 100644 (file)
@@ -1,3 +1,3 @@
-This directory contains files that have not been updated for zlib 1.2.1
+This directory contains files that have not been updated for zlib 1.2.x
 
 (Volunteers are encouraged to help clean this up.  Thanks.)
index a1a401a87cfa838a025af451718dd39a66531e1d..8f16513f89d2a65fa1dd2ff222e6e01443e9bde1 100644 (file)
@@ -418,90 +418,120 @@ SOURCE=..\..\win32\zlib1.rc
 # Begin Source File\r
 \r
 SOURCE=..\..\contrib\masmx86\gvmat32.asm\r
-# PROP Exclude_From_Build 1\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\contrib\masmx86\gvmat32c.c\r
 \r
 !IF  "$(CFG)" == "zlib - Win32 DLL Release"\r
 \r
 # PROP Exclude_From_Build 1\r
-# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL Debug"\r
 \r
 # PROP Exclude_From_Build 1\r
-# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL ASM Release"\r
 \r
-# ADD CPP /I "..\.."\r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_DLL_ASM_Release\r
+InputPath=..\..\contrib\masmx86\gvmat32.asm\r
+InputName=gvmat32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL ASM Debug"\r
 \r
-# ADD CPP /I "..\.."\r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_DLL_ASM_Debug\r
+InputPath=..\..\contrib\masmx86\gvmat32.asm\r
+InputName=gvmat32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB Release"\r
 \r
 # PROP Exclude_From_Build 1\r
-# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB Debug"\r
 \r
 # PROP Exclude_From_Build 1\r
-# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB ASM Release"\r
 \r
-# ADD CPP /I "..\.."\r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_LIB_ASM_Release\r
+InputPath=..\..\contrib\masmx86\gvmat32.asm\r
+InputName=gvmat32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB ASM Debug"\r
 \r
-# ADD CPP /I "..\.."\r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_LIB_ASM_Debug\r
+InputPath=..\..\contrib\masmx86\gvmat32.asm\r
+InputName=gvmat32\r
 \r
-!ENDIF \r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
 \r
-# End Source File\r
-# Begin Source File\r
+# End Custom Build\r
+\r
+!ENDIF \r
 \r
-SOURCE=..\..\contrib\masmx86\inffas32.asm\r
-# PROP Exclude_From_Build 1\r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\contrib\masmx86\gvmat32.obj\r
+SOURCE=..\..\contrib\masmx86\gvmat32c.c\r
 \r
 !IF  "$(CFG)" == "zlib - Win32 DLL Release"\r
 \r
 # PROP Exclude_From_Build 1\r
+# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL Debug"\r
 \r
 # PROP Exclude_From_Build 1\r
+# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL ASM Release"\r
 \r
+# ADD CPP /I "..\.."\r
+\r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL ASM Debug"\r
 \r
+# ADD CPP /I "..\.."\r
+\r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB Release"\r
 \r
 # PROP Exclude_From_Build 1\r
+# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB Debug"\r
 \r
 # PROP Exclude_From_Build 1\r
+# ADD CPP /I "..\.."\r
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB ASM Release"\r
 \r
+# ADD CPP /I "..\.."\r
+\r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB ASM Debug"\r
 \r
+# ADD CPP /I "..\.."\r
+\r
 !ENDIF \r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\contrib\masmx86\inffas32.obj\r
+SOURCE=..\..\contrib\masmx86\inffas32.asm\r
 \r
 !IF  "$(CFG)" == "zlib - Win32 DLL Release"\r
 \r
@@ -513,8 +543,28 @@ SOURCE=..\..\contrib\masmx86\inffas32.obj
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL ASM Release"\r
 \r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_DLL_ASM_Release\r
+InputPath=..\..\contrib\masmx86\inffas32.asm\r
+InputName=inffas32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
+\r
 !ELSEIF  "$(CFG)" == "zlib - Win32 DLL ASM Debug"\r
 \r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_DLL_ASM_Debug\r
+InputPath=..\..\contrib\masmx86\inffas32.asm\r
+InputName=inffas32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
+\r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB Release"\r
 \r
 # PROP Exclude_From_Build 1\r
@@ -525,8 +575,28 @@ SOURCE=..\..\contrib\masmx86\inffas32.obj
 \r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB ASM Release"\r
 \r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_LIB_ASM_Release\r
+InputPath=..\..\contrib\masmx86\inffas32.asm\r
+InputName=inffas32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
+\r
 !ELSEIF  "$(CFG)" == "zlib - Win32 LIB ASM Debug"\r
 \r
+# Begin Custom Build - Assembling...\r
+IntDir=.\Win32_LIB_ASM_Debug\r
+InputPath=..\..\contrib\masmx86\inffas32.asm\r
+InputName=inffas32\r
+\r
+"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"\r
+\r
+# End Custom Build\r
+\r
 !ENDIF \r
 \r
 # End Source File\r
index 9986c6d4c14316e19bcd61a7d76c67f8132aab45..bf142801c198c8ad9014d289f89341af670dac0d 100644 (file)
       <QPG:Files>
          <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
          <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
-         <QPG:Add file="../libz.so.1.2.1.2" install="/opt/lib/" user="root:bin" permission="644"/>
-         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.1.2"/>
-         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.1.2"/>
-         <QPG:Add file="../libz.so.1.2.1.2" install="/opt/lib/" component="slib"/>
+         <QPG:Add file="../libz.so.1.2.2" install="/opt/lib/" user="root:bin" permission="644"/>
+         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.2"/>
+         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.2"/>
+         <QPG:Add file="../libz.so.1.2.2" install="/opt/lib/" component="slib"/>
       </QPG:Files>
 
       <QPG:PackageFilter>
@@ -63,7 +63,7 @@
             </QPM:ProductDescription>
 
             <QPM:ReleaseDescription>
-               <QPM:ReleaseVersion>1.2.1.2</QPM:ReleaseVersion>
+               <QPM:ReleaseVersion>1.2.2</QPM:ReleaseVersion>
                <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
                <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
                <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
index a3ed5ddf30ff6e9666c52fe025dd8ce35ef25cf7..1746a951c3ac7a41f9c9d3588ba905bfae320827 100644 (file)
@@ -175,7 +175,7 @@ in the zlib distribution, or at the following location:
     zlib in other programming languages.  Some of them, like Ada
     (GNAT) and Fortran (GNU G77), have C bindings implemented
     initially on Unix, and relying on the C calling convention.
-    On the other hand, the pre- .NET versions of Microsoft Visual
+    On the other hand, the pre- .Net versions of Microsoft Visual
     Basic require STDCALL, while Borland Delphi prefers, although
     it does not require, FASTCALL.
 
@@ -203,13 +203,11 @@ in the zlib distribution, or at the following location:
     zlib distribution.
 
 
- 8. I need a DLL for my Microsoft .NET project.  What can I do?
+ 8. I need to use zlib in my Microsoft .Net project.  What can I
+    do?
 
-  - We did not implement a COM wrapper around zlib, so you will
-    have to develop it yourself, or to get it from somewhere else.
-
-    If you would be so generous as to contribute such a wrapper,
-    we would like to include it in a future zlib version.
+  - Henrik Ravn has contributed a .Net wrapper around zlib.  Look
+    into contrib/dotzlib/, inside the zlib distribution.
 
 
  9. If my application uses ZLIB1.DLL, should I link it to
diff --git a/win32/VisualC.txt b/win32/VisualC.txt
new file mode 100644 (file)
index 0000000..579a5fc
--- /dev/null
@@ -0,0 +1,3 @@
+
+To build zlib using the Microsoft Visual C++ environment,
+use the appropriate project from the projects/ directory.
index 130493a3605d37ed070f44488a86c8fee6ad1263..162ab8fcb1aaf658c7e4c6212c7494c98cb3f42d 100644 (file)
@@ -5,8 +5,8 @@ VS_VERSION_INFO         VERSIONINFO
 #else
 VS_VERSION_INFO                VERSIONINFO     MOVEABLE IMPURE LOADONCALL DISCARDABLE
 #endif
-  FILEVERSION          1,2,1,2
-  PRODUCTVERSION       1,2,1,2
+  FILEVERSION          1,2,2
+  PRODUCTVERSION       1,2,2
   FILEFLAGSMASK                VS_FFI_FILEFLAGSMASK
 #ifdef _DEBUG
   FILEFLAGS            1
@@ -23,12 +23,12 @@ BEGIN
     //language ID = U.S. English, char set = Windows, Multilingual
     BEGIN
       VALUE "FileDescription", "zlib data compression library\0"
-      VALUE "FileVersion",     "1.2.1.2\0"
+      VALUE "FileVersion",     "1.2.2\0"
       VALUE "InternalName",    "zlib1.dll\0"
       VALUE "LegalCopyright",  "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0"
       VALUE "OriginalFilename",        "zlib1.dll\0"
       VALUE "ProductName",     "zlib\0"
-      VALUE "ProductVersion",  "1.2.1.2\0"
+      VALUE "ProductVersion",  "1.2.2\0"
       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
     END
   END
diff --git a/zlib.3 b/zlib.3
index 54655cd2bcfbafc7e1365b05e5b928a76c45b695..3139e2467f259d6973b45f31e8af79891209d90c 100644 (file)
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
-.TH ZLIB 3 "9 September 2004"
+.TH ZLIB 3 "3 October 2004"
 .SH NAME
 zlib \- compression/decompression library
 .SH SYNOPSIS
@@ -133,7 +133,7 @@ before asking for help.
 Send questions and/or comments to zlib@gzip.org,
 or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
 .SH AUTHORS
-Version 1.2.1.2
+Version 1.2.2
 Copyright (C) 1995-2004 Jean-loup Gailly (jloup@gzip.org)
 and Mark Adler (madler@alumni.caltech.edu).
 .LP
diff --git a/zlib.h b/zlib.h
index 0c9416646687bd3a66cef28dbd3a7d1d73cbd666..b4ddd34395c495e00b32f9ff0c518f065ac2d8a9 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.1.2, September 9th, 2004
+  version 1.2.2, October 3rd, 2004
 
   Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
 
@@ -37,8 +37,8 @@
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.1.2"
-#define ZLIB_VERNUM 0x1212
+#define ZLIB_VERSION "1.2.2"
+#define ZLIB_VERNUM 0x1220
 
 /*
      The 'zlib' compression library provides in-memory compression and
@@ -53,24 +53,22 @@ extern "C" {
   application must provide more input and/or consume the output
   (providing more output space) before each call.
 
-     The compressed data format used by the in-memory functions is the zlib
-  format, which is a zlib wrapper documented in RFC 1950, wrapped around a
-  deflate stream, which is itself documented in RFC 1951.
+     The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
 
      The library also supports reading and writing files in gzip (.gz) format
   with an interface similar to that of stdio using the functions that start
   with "gz".  The gzip format is different from the zlib format.  gzip is a
   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
 
+     This library can optionally read and write gzip streams in memory as well.
+
      The zlib format was designed to be compact and fast for use in memory
   and on communications channels.  The gzip format was designed for single-
   file compression on file systems, has a larger header than zlib to maintain
   directory information, and uses a different, slower check method than zlib.
 
-     This library does not provide any functions to write gzip files in memory.
-  However such functions could be easily written using zlib's deflate function,
-  the documentation in the gzip RFC, and the examples in gzio.c.
-
      The library does not install any signal handler. The decoder checks
   the consistency of the compressed data, so the library should never
   crash even in case of corrupted input.
@@ -478,7 +476,8 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
    16 to windowBits to write a simple gzip header and trailer around the
    compressed data instead of a zlib wrapper. The gzip header will have no
    file name, no extra data, no comment, no modification time (set to zero),
-   no header crc, and the operating system will be set to 255 (unknown).
+   no header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
 
      The memLevel parameter specifies how much memory should be allocated
    for the internal compression state. memLevel=1 uses minimum memory but
@@ -649,7 +648,8 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
      windowBits can also be greater than 15 for optional gzip decoding. Add
    32 to windowBits to enable zlib and gzip decoding with automatic header
    detection, or add 16 to decode only the gzip format (the zlib format will
-   return a Z_DATA_ERROR).
+   return a Z_DATA_ERROR.  If a gzip stream is being decoded, strm->adler is
+   a crc32 instead of an adler32.
 
      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
    memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative