mirror of git://gcc.gnu.org/git/gcc.git
This commit was generated by cvs2svn to compensate for changes in r104181,
which included commits to RCS files with non-trunk default branches. From-SVN: r104182
This commit is contained in:
parent
303ae446cf
commit
3ec980b182
|
|
@ -118,6 +118,6 @@
|
||||||
&MODLIB/INFTREES &MODLIB/TREES +
|
&MODLIB/INFTREES &MODLIB/TREES +
|
||||||
&MODLIB/UNCOMPR &MODLIB/ZUTIL) +
|
&MODLIB/UNCOMPR &MODLIB/ZUTIL) +
|
||||||
SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
|
SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
|
||||||
TEXT('ZLIB 1.2.1') TGTRLS(V4R4M0)
|
TEXT('ZLIB 1.2.3') TGTRLS(V4R4M0)
|
||||||
|
|
||||||
ENDPGM
|
ENDPGM
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
ZLIB version 1.2.1 for AS400 installation instructions
|
ZLIB version 1.2.3 for AS400 installation instructions
|
||||||
|
|
||||||
I) From an AS400 *SAVF file:
|
I) From an AS400 *SAVF file:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
* ZLIB.INC - Interface to the general purpose compression library
|
* ZLIB.INC - Interface to the general purpose compression library
|
||||||
*
|
*
|
||||||
* ILE RPG400 version by Patrick Monnerat, DATASPHERE.
|
* ILE RPG400 version by Patrick Monnerat, DATASPHERE.
|
||||||
* Version 1.2.1
|
* Version 1.2.3
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* WARNING:
|
* WARNING:
|
||||||
|
|
@ -20,8 +20,12 @@
|
||||||
* Constants
|
* Constants
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
D ZLIB_VERSION C '1.2.1' Header's version
|
* Versioning information.
|
||||||
D ZLIB_VERNUM C X'1210'
|
*
|
||||||
|
D ZLIB_VERSION C '1.2.3'
|
||||||
|
D ZLIB_VERNUM C X'1230'
|
||||||
|
*
|
||||||
|
* Other equates.
|
||||||
*
|
*
|
||||||
D Z_NO_FLUSH C 0
|
D Z_NO_FLUSH C 0
|
||||||
D Z_SYNC_FLUSH C 2
|
D Z_SYNC_FLUSH C 2
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
-- --
|
-- --
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
-- Continuous test for ZLib multithreading. If the test is fail
|
-- Continuous test for ZLib multithreading. If the test would fail
|
||||||
-- Wou should provide thread safe allocation routines for the Z_Stream.
|
-- we should provide thread safe allocation routines for the Z_Stream.
|
||||||
--
|
--
|
||||||
-- $Id: mtest.adb,v 1.2 2003/08/12 12:11:05 vagul Exp $
|
-- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
|
||||||
|
|
||||||
with ZLib;
|
with ZLib;
|
||||||
with Ada.Streams;
|
with Ada.Streams;
|
||||||
|
|
@ -148,6 +148,9 @@ procedure MTest is
|
||||||
|
|
||||||
pragma Unreferenced (Test);
|
pragma Unreferenced (Test);
|
||||||
|
|
||||||
|
Dummy : Character;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
null;
|
Ada.Text_IO.Get_Immediate (Dummy);
|
||||||
|
Stop := True;
|
||||||
end MTest;
|
end MTest;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: read.adb,v 1.7 2003/08/12 12:12:35 vagul Exp $
|
-- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
|
||||||
|
|
||||||
-- Test/demo program for the generic read interface.
|
-- Test/demo program for the generic read interface.
|
||||||
|
|
||||||
|
|
@ -68,7 +68,11 @@ procedure Read is
|
||||||
-- ZLib.Read
|
-- ZLib.Read
|
||||||
-- reading data from the File_In.
|
-- reading data from the File_In.
|
||||||
|
|
||||||
procedure Read is new ZLib.Read (Read, Read_Buffer, Read_First, Read_Last);
|
procedure Read is new ZLib.Read
|
||||||
|
(Read,
|
||||||
|
Read_Buffer,
|
||||||
|
Rest_First => Read_First,
|
||||||
|
Rest_Last => Read_Last);
|
||||||
|
|
||||||
----------
|
----------
|
||||||
-- Read --
|
-- Read --
|
||||||
|
|
@ -103,6 +107,7 @@ procedure Read is
|
||||||
Pack_Size := 0;
|
Pack_Size := 0;
|
||||||
Offset := 1;
|
Offset := 1;
|
||||||
Read_First := Read_Buffer'Last + 1;
|
Read_First := Read_Buffer'Last + 1;
|
||||||
|
Read_Last := Read_Buffer'Last;
|
||||||
end Reset;
|
end Reset;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,34 @@
|
||||||
|
ZLib for Ada thick binding (ZLib.Ada)
|
||||||
ZLib for Ada thick binding (ZLib.Ada)
|
Release 1.3
|
||||||
Release 1.2
|
|
||||||
|
|
||||||
ZLib.Ada is a thick binding interface to the popular ZLib data
|
ZLib.Ada is a thick binding interface to the popular ZLib data
|
||||||
compression library, available at http://www.gzip.org/zlib/.
|
compression library, available at http://www.gzip.org/zlib/.
|
||||||
It provides Ada-style access to the ZLib C library.
|
It provides Ada-style access to the ZLib C library.
|
||||||
|
|
||||||
|
|
||||||
Here are the main changes since ZLib.Ada 1.1:
|
Here are the main changes since ZLib.Ada 1.2:
|
||||||
|
|
||||||
- The default header type has a name "Default" now. Auto is used only for
|
- Attension: ZLib.Read generic routine have a initialization requirement
|
||||||
automatic GZip/ZLib header detection.
|
for Read_Last parameter now. It is a bit incompartible with previous version,
|
||||||
|
but extends functionality, we could use new parameters Allow_Read_Some and
|
||||||
|
Flush now.
|
||||||
|
|
||||||
- Added test for multitasking mtest.adb.
|
- Added Is_Open routines to ZLib and ZLib.Streams packages.
|
||||||
|
|
||||||
- Added GNAT project file zlib.gpr.
|
- Add pragma Assert to check Stream_Element is 8 bit.
|
||||||
|
|
||||||
|
- Fix extraction to buffer with exact known decompressed size. Error reported by
|
||||||
|
Steve Sangwine.
|
||||||
|
|
||||||
|
- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits
|
||||||
|
computers. Patch provided by Pascal Obry.
|
||||||
|
|
||||||
|
- Add Status_Error exception definition.
|
||||||
|
|
||||||
|
- 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
|
You should have the ZLib library already build on your computer, before
|
||||||
building ZLib.Ada. Make the directory of ZLib.Ada sources current and
|
building ZLib.Ada. Make the directory of ZLib.Ada sources current and
|
||||||
|
|
@ -30,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>
|
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.
|
1. Make a project with all *.ads and *.adb files from the distribution.
|
||||||
2. Build the libz.a library from the ZLib C sources.
|
2. Build the libz.a library from the ZLib C sources.
|
||||||
|
|
@ -40,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.
|
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 source files test.adb and read.adb are small demo programs that show
|
||||||
the main functionality of ZLib.Ada.
|
the main functionality of ZLib.Ada.
|
||||||
|
|
@ -50,3 +61,5 @@ The routines from the package specifications are commented.
|
||||||
|
|
||||||
Homepage: http://zlib-ada.sourceforge.net/
|
Homepage: http://zlib-ada.sourceforge.net/
|
||||||
Author: Dmitriy Anisimkov <anisimkov@yahoo.com>
|
Author: Dmitriy Anisimkov <anisimkov@yahoo.com>
|
||||||
|
|
||||||
|
Contributors: Pascal Obry <pascal@obry.org>, Steve Sangwine <sjs@essex.ac.uk>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: zlib-streams.adb,v 1.9 2003/08/12 13:15:31 vagul Exp $
|
-- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
|
||||||
|
|
||||||
with Ada.Unchecked_Deallocation;
|
with Ada.Unchecked_Deallocation;
|
||||||
|
|
||||||
|
|
@ -90,6 +90,7 @@ package body ZLib.Streams is
|
||||||
|
|
||||||
Stream.Buffer := new Buffer_Subtype;
|
Stream.Buffer := new Buffer_Subtype;
|
||||||
Stream.Rest_First := Stream.Buffer'Last + 1;
|
Stream.Rest_First := Stream.Buffer'Last + 1;
|
||||||
|
Stream.Rest_Last := Stream.Buffer'Last;
|
||||||
end if;
|
end if;
|
||||||
end Create;
|
end Create;
|
||||||
|
|
||||||
|
|
@ -113,6 +114,15 @@ package body ZLib.Streams is
|
||||||
end loop;
|
end loop;
|
||||||
end Flush;
|
end Flush;
|
||||||
|
|
||||||
|
-------------
|
||||||
|
-- Is_Open --
|
||||||
|
-------------
|
||||||
|
|
||||||
|
function Is_Open (Stream : Stream_Type) return Boolean is
|
||||||
|
begin
|
||||||
|
return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
|
||||||
|
end Is_Open;
|
||||||
|
|
||||||
----------
|
----------
|
||||||
-- Read --
|
-- Read --
|
||||||
----------
|
----------
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: zlib-streams.ads,v 1.11 2003/08/12 13:15:31 vagul Exp $
|
-- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
|
||||||
|
|
||||||
package ZLib.Streams is
|
package ZLib.Streams is
|
||||||
|
|
||||||
|
|
@ -77,6 +77,8 @@ package ZLib.Streams is
|
||||||
-- !!! When the Need_Header is False ZLib-Ada is using undocumented
|
-- !!! When the Need_Header is False ZLib-Ada is using undocumented
|
||||||
-- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
|
-- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
|
||||||
|
|
||||||
|
function Is_Open (Stream : Stream_Type) return Boolean;
|
||||||
|
|
||||||
procedure Close (Stream : in out Stream_Type);
|
procedure Close (Stream : in out Stream_Type);
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: zlib-thin.adb,v 1.6 2003/01/21 15:26:37 vagul Exp $
|
-- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
|
||||||
|
|
||||||
package body ZLib.Thin is
|
package body ZLib.Thin is
|
||||||
|
|
||||||
ZLIB_VERSION : constant Chars_Ptr :=
|
ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
|
||||||
Interfaces.C.Strings.New_String ("1.1.4");
|
|
||||||
|
|
||||||
Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
|
Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
|
||||||
|
|
||||||
|
|
@ -37,14 +36,6 @@ package body ZLib.Thin is
|
||||||
-- Deflate_Init --
|
-- Deflate_Init --
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
function Deflate_Init
|
|
||||||
(strm : in Z_Streamp;
|
|
||||||
level : in Int := Z_DEFAULT_COMPRESSION)
|
|
||||||
return Int is
|
|
||||||
begin
|
|
||||||
return deflateInit (strm, level, ZLIB_VERSION, Z_Stream_Size);
|
|
||||||
end Deflate_Init;
|
|
||||||
|
|
||||||
function Deflate_Init
|
function Deflate_Init
|
||||||
(strm : Z_Streamp;
|
(strm : Z_Streamp;
|
||||||
level : Int;
|
level : Int;
|
||||||
|
|
@ -69,16 +60,15 @@ package body ZLib.Thin is
|
||||||
-- Inflate_Init --
|
-- Inflate_Init --
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
function Inflate_Init (strm : Z_Streamp) return Int is
|
|
||||||
begin
|
|
||||||
return inflateInit (strm, ZLIB_VERSION, Z_Stream_Size);
|
|
||||||
end Inflate_Init;
|
|
||||||
|
|
||||||
function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
|
function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
|
||||||
begin
|
begin
|
||||||
return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
|
return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
|
||||||
end Inflate_Init;
|
end Inflate_Init;
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
-- Last_Error_Message --
|
||||||
|
------------------------
|
||||||
|
|
||||||
function Last_Error_Message (Strm : in Z_Stream) return String is
|
function Last_Error_Message (Strm : in Z_Stream) return String is
|
||||||
use Interfaces.C.Strings;
|
use Interfaces.C.Strings;
|
||||||
begin
|
begin
|
||||||
|
|
@ -89,54 +79,28 @@ package body ZLib.Thin is
|
||||||
end if;
|
end if;
|
||||||
end Last_Error_Message;
|
end Last_Error_Message;
|
||||||
|
|
||||||
-------------
|
|
||||||
-- Need_In --
|
|
||||||
-------------
|
|
||||||
|
|
||||||
function Need_In (strm : Z_Stream) return Boolean is
|
|
||||||
begin
|
|
||||||
return strm.Avail_In = 0;
|
|
||||||
end Need_In;
|
|
||||||
|
|
||||||
--------------
|
|
||||||
-- Need_Out --
|
|
||||||
--------------
|
|
||||||
|
|
||||||
function Need_Out (strm : Z_Stream) return Boolean is
|
|
||||||
begin
|
|
||||||
return strm.Avail_Out = 0;
|
|
||||||
end Need_Out;
|
|
||||||
|
|
||||||
------------
|
------------
|
||||||
-- Set_In --
|
-- Set_In --
|
||||||
------------
|
------------
|
||||||
|
|
||||||
procedure Set_In
|
procedure Set_In
|
||||||
(Strm : in out Z_Stream;
|
(Strm : in out Z_Stream;
|
||||||
Buffer : in Byte_Access;
|
Buffer : in Voidp;
|
||||||
Size : in UInt) is
|
Size : in UInt) is
|
||||||
begin
|
begin
|
||||||
Strm.Next_In := Buffer;
|
Strm.Next_In := Buffer;
|
||||||
Strm.Avail_In := Size;
|
Strm.Avail_In := Size;
|
||||||
end Set_In;
|
end Set_In;
|
||||||
|
|
||||||
procedure Set_In
|
|
||||||
(Strm : in out Z_Stream;
|
|
||||||
Buffer : in Voidp;
|
|
||||||
Size : in UInt) is
|
|
||||||
begin
|
|
||||||
Set_In (Strm, Bytes.To_Pointer (Buffer), Size);
|
|
||||||
end Set_In;
|
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
-- Set_Mem_Func --
|
-- Set_Mem_Func --
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
procedure Set_Mem_Func
|
procedure Set_Mem_Func
|
||||||
(Strm : in out Z_Stream;
|
(Strm : in out Z_Stream;
|
||||||
Opaque : in Voidp;
|
Opaque : in Voidp;
|
||||||
Alloc : in alloc_func;
|
Alloc : in alloc_func;
|
||||||
Free : in free_func) is
|
Free : in free_func) is
|
||||||
begin
|
begin
|
||||||
Strm.opaque := Opaque;
|
Strm.opaque := Opaque;
|
||||||
Strm.zalloc := Alloc;
|
Strm.zalloc := Alloc;
|
||||||
|
|
@ -149,21 +113,13 @@ package body ZLib.Thin is
|
||||||
|
|
||||||
procedure Set_Out
|
procedure Set_Out
|
||||||
(Strm : in out Z_Stream;
|
(Strm : in out Z_Stream;
|
||||||
Buffer : in Byte_Access;
|
Buffer : in Voidp;
|
||||||
Size : in UInt) is
|
Size : in UInt) is
|
||||||
begin
|
begin
|
||||||
Strm.Next_Out := Buffer;
|
Strm.Next_Out := Buffer;
|
||||||
Strm.Avail_Out := Size;
|
Strm.Avail_Out := Size;
|
||||||
end Set_Out;
|
end Set_Out;
|
||||||
|
|
||||||
procedure Set_Out
|
|
||||||
(Strm : in out Z_Stream;
|
|
||||||
Buffer : in Voidp;
|
|
||||||
Size : in UInt) is
|
|
||||||
begin
|
|
||||||
Set_Out (Strm, Bytes.To_Pointer (Buffer), Size);
|
|
||||||
end Set_Out;
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Total_In --
|
-- Total_In --
|
||||||
--------------
|
--------------
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,11 @@
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: zlib-thin.ads,v 1.8 2003/08/12 13:16:51 vagul Exp $
|
-- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
|
||||||
|
|
||||||
with Interfaces.C.Strings;
|
with Interfaces.C.Strings;
|
||||||
with System.Address_To_Access_Conversions;
|
|
||||||
|
with System;
|
||||||
|
|
||||||
private package ZLib.Thin is
|
private package ZLib.Thin is
|
||||||
|
|
||||||
|
|
@ -36,18 +37,18 @@ private package ZLib.Thin is
|
||||||
-- zconf.h:216
|
-- zconf.h:216
|
||||||
type Int is new Interfaces.C.int;
|
type Int is new Interfaces.C.int;
|
||||||
|
|
||||||
type ULong is new Interfaces.C.unsigned; -- 32 bits or more
|
type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
|
||||||
-- zconf.h:217
|
-- zconf.h:217
|
||||||
subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
|
subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
|
||||||
|
|
||||||
type ULong_Access is access ULong;
|
type ULong_Access is access ULong;
|
||||||
type Int_Access is access Int;
|
type Int_Access is access Int;
|
||||||
|
|
||||||
subtype Voidp is System.Address; -- zconf.h:232
|
subtype Voidp is System.Address; -- zconf.h:232
|
||||||
|
|
||||||
package Bytes is new System.Address_To_Access_Conversions (Byte);
|
subtype Byte_Access is Voidp;
|
||||||
|
|
||||||
subtype Byte_Access is Bytes.Object_Pointer;
|
|
||||||
|
|
||||||
|
Nul : constant Voidp := System.Null_Address;
|
||||||
-- end from zconf
|
-- end from zconf
|
||||||
|
|
||||||
Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
|
Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
|
||||||
|
|
@ -251,12 +252,6 @@ private package ZLib.Thin is
|
||||||
stream_size : Int)
|
stream_size : Int)
|
||||||
return Int;
|
return Int;
|
||||||
|
|
||||||
function Deflate_Init
|
|
||||||
(strm : in Z_Streamp;
|
|
||||||
level : in Int := Z_DEFAULT_COMPRESSION)
|
|
||||||
return Int;
|
|
||||||
pragma Inline (Deflate_Init);
|
|
||||||
|
|
||||||
function deflateInit2
|
function deflateInit2
|
||||||
(strm : Z_Streamp;
|
(strm : Z_Streamp;
|
||||||
level : Int;
|
level : Int;
|
||||||
|
|
@ -284,9 +279,6 @@ private package ZLib.Thin is
|
||||||
stream_size : Int)
|
stream_size : Int)
|
||||||
return Int;
|
return Int;
|
||||||
|
|
||||||
function Inflate_Init (strm : Z_Streamp) return Int;
|
|
||||||
pragma Inline (Inflate_Init);
|
|
||||||
|
|
||||||
function inflateInit2
|
function inflateInit2
|
||||||
(strm : in Z_Streamp;
|
(strm : in Z_Streamp;
|
||||||
windowBits : in Int;
|
windowBits : in Int;
|
||||||
|
|
@ -318,32 +310,12 @@ private package ZLib.Thin is
|
||||||
-- has dropped to zero. The application must initialize zalloc, zfree and
|
-- has dropped to zero. The application must initialize zalloc, zfree and
|
||||||
-- opaque before calling the init function.
|
-- opaque before calling the init function.
|
||||||
|
|
||||||
function Need_In (strm : in Z_Stream) return Boolean;
|
|
||||||
-- return true when we do not need to setup Next_In and Avail_In fields.
|
|
||||||
pragma Inline (Need_In);
|
|
||||||
|
|
||||||
function Need_Out (strm : in Z_Stream) return Boolean;
|
|
||||||
-- return true when we do not need to setup Next_Out and Avail_Out field.
|
|
||||||
pragma Inline (Need_Out);
|
|
||||||
|
|
||||||
procedure Set_In
|
|
||||||
(Strm : in out Z_Stream;
|
|
||||||
Buffer : in Byte_Access;
|
|
||||||
Size : in UInt);
|
|
||||||
pragma Inline (Set_In);
|
|
||||||
|
|
||||||
procedure Set_In
|
procedure Set_In
|
||||||
(Strm : in out Z_Stream;
|
(Strm : in out Z_Stream;
|
||||||
Buffer : in Voidp;
|
Buffer : in Voidp;
|
||||||
Size : in UInt);
|
Size : in UInt);
|
||||||
pragma Inline (Set_In);
|
pragma Inline (Set_In);
|
||||||
|
|
||||||
procedure Set_Out
|
|
||||||
(Strm : in out Z_Stream;
|
|
||||||
Buffer : in Byte_Access;
|
|
||||||
Size : in UInt);
|
|
||||||
pragma Inline (Set_Out);
|
|
||||||
|
|
||||||
procedure Set_Out
|
procedure Set_Out
|
||||||
(Strm : in out Z_Stream;
|
(Strm : in out Z_Stream;
|
||||||
Buffer : in Voidp;
|
Buffer : in Voidp;
|
||||||
|
|
@ -388,19 +360,13 @@ private package ZLib.Thin is
|
||||||
|
|
||||||
function zlibCompileFlags return ULong;
|
function zlibCompileFlags return ULong;
|
||||||
|
|
||||||
function deflatePrime
|
|
||||||
(strm : Z_Streamp;
|
|
||||||
bits : Int;
|
|
||||||
value : Int)
|
|
||||||
return Int;
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Z_Stream is record -- zlib.h:68
|
type Z_Stream is record -- zlib.h:68
|
||||||
Next_In : Byte_Access; -- next input byte
|
Next_In : Voidp := Nul; -- next input byte
|
||||||
Avail_In : UInt := 0; -- number of bytes available at next_in
|
Avail_In : UInt := 0; -- number of bytes available at next_in
|
||||||
Total_In : ULong := 0; -- total nb of input bytes read so far
|
Total_In : ULong := 0; -- total nb of input bytes read so far
|
||||||
Next_Out : Byte_Access; -- next output byte should be put there
|
Next_Out : Voidp := Nul; -- next output byte should be put there
|
||||||
Avail_Out : UInt := 0; -- remaining free space at next_out
|
Avail_Out : UInt := 0; -- remaining free space at next_out
|
||||||
Total_Out : ULong := 0; -- total nb of bytes output so far
|
Total_Out : ULong := 0; -- total nb of bytes output so far
|
||||||
msg : Chars_Ptr; -- last error message, NULL if no error
|
msg : Chars_Ptr; -- last error message, NULL if no error
|
||||||
|
|
@ -460,14 +426,13 @@ private
|
||||||
pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
|
pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
|
||||||
pragma Import (C, get_crc_table, "get_crc_table");
|
pragma Import (C, get_crc_table, "get_crc_table");
|
||||||
|
|
||||||
-- added in zlib 1.2.1:
|
-- since zlib 1.2.0:
|
||||||
|
|
||||||
pragma Import (C, inflateCopy, "inflateCopy");
|
pragma Import (C, inflateCopy, "inflateCopy");
|
||||||
pragma Import (C, compressBound, "compressBound");
|
pragma Import (C, compressBound, "compressBound");
|
||||||
pragma Import (C, deflateBound, "deflateBound");
|
pragma Import (C, deflateBound, "deflateBound");
|
||||||
pragma Import (C, gzungetc, "gzungetc");
|
pragma Import (C, gzungetc, "gzungetc");
|
||||||
pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
|
pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
|
||||||
pragma Import (C, deflatePrime, "deflatePrime");
|
|
||||||
|
|
||||||
pragma Import (C, inflateBackInit, "inflateBackInit_");
|
pragma Import (C, inflateBackInit, "inflateBackInit_");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
-- ZLib for Ada thick binding. --
|
-- ZLib for Ada thick binding. --
|
||||||
-- --
|
-- --
|
||||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
|
||||||
-- --
|
-- --
|
||||||
-- Open source license information is in the zlib.ads file. --
|
-- Open source license information is in the zlib.ads file. --
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: zlib.adb,v 1.19 2003/07/13 16:02:19 vagul Exp $
|
-- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
|
||||||
|
|
||||||
with Ada.Exceptions;
|
with Ada.Exceptions;
|
||||||
with Ada.Unchecked_Conversion;
|
with Ada.Unchecked_Conversion;
|
||||||
|
|
@ -34,7 +34,7 @@ package body ZLib is
|
||||||
VERSION_ERROR);
|
VERSION_ERROR);
|
||||||
|
|
||||||
type Flate_Step_Function is access
|
type Flate_Step_Function is access
|
||||||
function (Strm : Thin.Z_Streamp; flush : Thin.Int) return Thin.Int;
|
function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
|
||||||
pragma Convention (C, Flate_Step_Function);
|
pragma Convention (C, Flate_Step_Function);
|
||||||
|
|
||||||
type Flate_End_Function is access
|
type Flate_End_Function is access
|
||||||
|
|
@ -82,13 +82,13 @@ package body ZLib is
|
||||||
Flush_Finish : constant array (Boolean) of Flush_Mode
|
Flush_Finish : constant array (Boolean) of Flush_Mode
|
||||||
:= (True => Finish, False => No_Flush);
|
:= (True => Finish, False => No_Flush);
|
||||||
|
|
||||||
procedure Raise_Error (Stream : Z_Stream);
|
procedure Raise_Error (Stream : in Z_Stream);
|
||||||
pragma Inline (Raise_Error);
|
pragma Inline (Raise_Error);
|
||||||
|
|
||||||
procedure Raise_Error (Message : String);
|
procedure Raise_Error (Message : in String);
|
||||||
pragma Inline (Raise_Error);
|
pragma Inline (Raise_Error);
|
||||||
|
|
||||||
procedure Check_Error (Stream : Z_Stream; Code : Thin.Int);
|
procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
|
||||||
|
|
||||||
procedure Free is new Ada.Unchecked_Deallocation
|
procedure Free is new Ada.Unchecked_Deallocation
|
||||||
(Z_Stream, Z_Stream_Access);
|
(Z_Stream, Z_Stream_Access);
|
||||||
|
|
@ -118,7 +118,7 @@ package body ZLib is
|
||||||
-- Check_Error --
|
-- Check_Error --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
procedure Check_Error (Stream : Z_Stream; Code : Thin.Int) is
|
procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
|
||||||
use type Thin.Int;
|
use type Thin.Int;
|
||||||
begin
|
begin
|
||||||
if Code /= Thin.Z_OK then
|
if Code /= Thin.Z_OK then
|
||||||
|
|
@ -138,10 +138,11 @@ package body ZLib is
|
||||||
is
|
is
|
||||||
Code : Thin.Int;
|
Code : Thin.Int;
|
||||||
begin
|
begin
|
||||||
Code := Flate (Filter.Compression).Done
|
if not Ignore_Error and then not Is_Open (Filter) then
|
||||||
(To_Thin_Access (Filter.Strm));
|
raise Status_Error;
|
||||||
|
end if;
|
||||||
|
|
||||||
Filter.Opened := False;
|
Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
|
||||||
|
|
||||||
if Ignore_Error or else Code = Thin.Z_OK then
|
if Ignore_Error or else Code = Thin.Z_OK then
|
||||||
Free (Filter.Strm);
|
Free (Filter.Strm);
|
||||||
|
|
@ -154,7 +155,7 @@ package body ZLib is
|
||||||
Ada.Exceptions.Raise_Exception
|
Ada.Exceptions.Raise_Exception
|
||||||
(ZLib_Error'Identity,
|
(ZLib_Error'Identity,
|
||||||
Return_Code_Enum'Image (Return_Code (Code))
|
Return_Code_Enum'Image (Return_Code (Code))
|
||||||
& ": " & Error_Message);
|
& ": " & Error_Message);
|
||||||
end;
|
end;
|
||||||
end if;
|
end if;
|
||||||
end Close;
|
end Close;
|
||||||
|
|
@ -170,10 +171,9 @@ package body ZLib is
|
||||||
is
|
is
|
||||||
use Thin;
|
use Thin;
|
||||||
begin
|
begin
|
||||||
return Unsigned_32 (crc32
|
return Unsigned_32 (crc32 (ULong (CRC),
|
||||||
(ULong (CRC),
|
Data'Address,
|
||||||
Bytes.To_Pointer (Data'Address),
|
Data'Length));
|
||||||
Data'Length));
|
|
||||||
end CRC32;
|
end CRC32;
|
||||||
|
|
||||||
procedure CRC32
|
procedure CRC32
|
||||||
|
|
@ -192,13 +192,17 @@ package body ZLib is
|
||||||
Level : in Compression_Level := Default_Compression;
|
Level : in Compression_Level := Default_Compression;
|
||||||
Strategy : in Strategy_Type := Default_Strategy;
|
Strategy : in Strategy_Type := Default_Strategy;
|
||||||
Method : in Compression_Method := Deflated;
|
Method : in Compression_Method := Deflated;
|
||||||
Window_Bits : in Window_Bits_Type := 15;
|
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
|
||||||
Memory_Level : in Memory_Level_Type := 8;
|
Memory_Level : in Memory_Level_Type := Default_Memory_Level;
|
||||||
Header : in Header_Type := Default)
|
Header : in Header_Type := Default)
|
||||||
is
|
is
|
||||||
use type Thin.Int;
|
use type Thin.Int;
|
||||||
Win_Bits : Thin.Int := Thin.Int (Window_Bits);
|
Win_Bits : Thin.Int := Thin.Int (Window_Bits);
|
||||||
begin
|
begin
|
||||||
|
if Is_Open (Filter) then
|
||||||
|
raise Status_Error;
|
||||||
|
end if;
|
||||||
|
|
||||||
-- We allow ZLib to make header only in case of default header type.
|
-- We allow ZLib to make header only in case of default header type.
|
||||||
-- Otherwise we would either do header by ourselfs, or do not do
|
-- Otherwise we would either do header by ourselfs, or do not do
|
||||||
-- header at all.
|
-- header at all.
|
||||||
|
|
@ -216,10 +220,9 @@ package body ZLib is
|
||||||
Filter.Offset := Simple_GZip_Header'Last + 1;
|
Filter.Offset := Simple_GZip_Header'Last + 1;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
Filter.Strm := new Z_Stream;
|
Filter.Strm := new Z_Stream;
|
||||||
Filter.Compression := True;
|
Filter.Compression := True;
|
||||||
Filter.Stream_End := False;
|
Filter.Stream_End := False;
|
||||||
Filter.Opened := True;
|
|
||||||
Filter.Header := Header;
|
Filter.Header := Header;
|
||||||
|
|
||||||
if Thin.Deflate_Init
|
if Thin.Deflate_Init
|
||||||
|
|
@ -255,18 +258,18 @@ package body ZLib is
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
procedure Generic_Translate
|
procedure Generic_Translate
|
||||||
(Filter : in out ZLib.Filter_Type;
|
(Filter : in out ZLib.Filter_Type;
|
||||||
In_Buffer_Size : Integer := Default_Buffer_Size;
|
In_Buffer_Size : in Integer := Default_Buffer_Size;
|
||||||
Out_Buffer_Size : Integer := Default_Buffer_Size)
|
Out_Buffer_Size : in Integer := Default_Buffer_Size)
|
||||||
is
|
is
|
||||||
In_Buffer : Stream_Element_Array
|
In_Buffer : Stream_Element_Array
|
||||||
(1 .. Stream_Element_Offset (In_Buffer_Size));
|
(1 .. Stream_Element_Offset (In_Buffer_Size));
|
||||||
Out_Buffer : Stream_Element_Array
|
Out_Buffer : Stream_Element_Array
|
||||||
(1 .. Stream_Element_Offset (Out_Buffer_Size));
|
(1 .. Stream_Element_Offset (Out_Buffer_Size));
|
||||||
Last : Stream_Element_Offset;
|
Last : Stream_Element_Offset;
|
||||||
In_Last : Stream_Element_Offset;
|
In_Last : Stream_Element_Offset;
|
||||||
In_First : Stream_Element_Offset;
|
In_First : Stream_Element_Offset;
|
||||||
Out_Last : Stream_Element_Offset;
|
Out_Last : Stream_Element_Offset;
|
||||||
begin
|
begin
|
||||||
Main : loop
|
Main : loop
|
||||||
Data_In (In_Buffer, Last);
|
Data_In (In_Buffer, Last);
|
||||||
|
|
@ -275,18 +278,21 @@ package body ZLib is
|
||||||
|
|
||||||
loop
|
loop
|
||||||
Translate
|
Translate
|
||||||
(Filter,
|
(Filter => Filter,
|
||||||
In_Buffer (In_First .. Last),
|
In_Data => In_Buffer (In_First .. Last),
|
||||||
In_Last,
|
In_Last => In_Last,
|
||||||
Out_Buffer,
|
Out_Data => Out_Buffer,
|
||||||
Out_Last,
|
Out_Last => Out_Last,
|
||||||
Flush_Finish (Last < In_Buffer'First));
|
Flush => Flush_Finish (Last < In_Buffer'First));
|
||||||
|
|
||||||
Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
|
if Out_Buffer'First <= Out_Last then
|
||||||
|
Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
|
||||||
|
end if;
|
||||||
|
|
||||||
exit Main when Stream_End (Filter);
|
exit Main when Stream_End (Filter);
|
||||||
|
|
||||||
-- The end of in buffer.
|
-- The end of in buffer.
|
||||||
|
|
||||||
exit when In_Last = Last;
|
exit when In_Last = Last;
|
||||||
|
|
||||||
In_First := In_Last + 1;
|
In_First := In_Last + 1;
|
||||||
|
|
@ -301,7 +307,7 @@ package body ZLib is
|
||||||
|
|
||||||
procedure Inflate_Init
|
procedure Inflate_Init
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Window_Bits : in Window_Bits_Type := 15;
|
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
|
||||||
Header : in Header_Type := Default)
|
Header : in Header_Type := Default)
|
||||||
is
|
is
|
||||||
use type Thin.Int;
|
use type Thin.Int;
|
||||||
|
|
@ -320,6 +326,10 @@ package body ZLib is
|
||||||
end Check_Version;
|
end Check_Version;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if Is_Open (Filter) then
|
||||||
|
raise Status_Error;
|
||||||
|
end if;
|
||||||
|
|
||||||
case Header is
|
case Header is
|
||||||
when None =>
|
when None =>
|
||||||
Check_Version;
|
Check_Version;
|
||||||
|
|
@ -344,10 +354,9 @@ package body ZLib is
|
||||||
when Default => null;
|
when Default => null;
|
||||||
end case;
|
end case;
|
||||||
|
|
||||||
Filter.Strm := new Z_Stream;
|
Filter.Strm := new Z_Stream;
|
||||||
Filter.Compression := False;
|
Filter.Compression := False;
|
||||||
Filter.Stream_End := False;
|
Filter.Stream_End := False;
|
||||||
Filter.Opened := True;
|
|
||||||
Filter.Header := Header;
|
Filter.Header := Header;
|
||||||
|
|
||||||
if Thin.Inflate_Init
|
if Thin.Inflate_Init
|
||||||
|
|
@ -357,16 +366,25 @@ package body ZLib is
|
||||||
end if;
|
end if;
|
||||||
end Inflate_Init;
|
end Inflate_Init;
|
||||||
|
|
||||||
|
-------------
|
||||||
|
-- Is_Open --
|
||||||
|
-------------
|
||||||
|
|
||||||
|
function Is_Open (Filter : in Filter_Type) return Boolean is
|
||||||
|
begin
|
||||||
|
return Filter.Strm /= null;
|
||||||
|
end Is_Open;
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
-- Raise_Error --
|
-- Raise_Error --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
procedure Raise_Error (Message : String) is
|
procedure Raise_Error (Message : in String) is
|
||||||
begin
|
begin
|
||||||
Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
|
Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
|
||||||
end Raise_Error;
|
end Raise_Error;
|
||||||
|
|
||||||
procedure Raise_Error (Stream : Z_Stream) is
|
procedure Raise_Error (Stream : in Z_Stream) is
|
||||||
begin
|
begin
|
||||||
Raise_Error (Last_Error_Message (Stream));
|
Raise_Error (Last_Error_Message (Stream));
|
||||||
end Raise_Error;
|
end Raise_Error;
|
||||||
|
|
@ -378,21 +396,29 @@ package body ZLib is
|
||||||
procedure Read
|
procedure Read
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Item : out Ada.Streams.Stream_Element_Array;
|
Item : out Ada.Streams.Stream_Element_Array;
|
||||||
Last : out Ada.Streams.Stream_Element_Offset)
|
Last : out Ada.Streams.Stream_Element_Offset;
|
||||||
|
Flush : in Flush_Mode := No_Flush)
|
||||||
is
|
is
|
||||||
In_Last : Stream_Element_Offset;
|
In_Last : Stream_Element_Offset;
|
||||||
Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
|
Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
|
||||||
|
V_Flush : Flush_Mode := Flush;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
|
pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
|
||||||
|
pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
|
||||||
|
|
||||||
loop
|
loop
|
||||||
if Rest_First > Buffer'Last then
|
if Rest_Last = Buffer'First - 1 then
|
||||||
|
V_Flush := Finish;
|
||||||
|
|
||||||
|
elsif Rest_First > Rest_Last then
|
||||||
Read (Buffer, Rest_Last);
|
Read (Buffer, Rest_Last);
|
||||||
Rest_First := Buffer'First;
|
Rest_First := Buffer'First;
|
||||||
end if;
|
|
||||||
|
|
||||||
pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
|
if Rest_Last < Buffer'First then
|
||||||
|
V_Flush := Finish;
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
|
||||||
Translate
|
Translate
|
||||||
(Filter => Filter,
|
(Filter => Filter,
|
||||||
|
|
@ -400,11 +426,13 @@ package body ZLib is
|
||||||
In_Last => In_Last,
|
In_Last => In_Last,
|
||||||
Out_Data => Item (Item_First .. Item'Last),
|
Out_Data => Item (Item_First .. Item'Last),
|
||||||
Out_Last => Last,
|
Out_Last => Last,
|
||||||
Flush => Flush_Finish (Rest_Last < Rest_First));
|
Flush => V_Flush);
|
||||||
|
|
||||||
Rest_First := In_Last + 1;
|
Rest_First := In_Last + 1;
|
||||||
|
|
||||||
exit when Last = Item'Last or else Stream_End (Filter);
|
exit when Stream_End (Filter)
|
||||||
|
or else Last = Item'Last
|
||||||
|
or else (Last >= Item'First and then Allow_Read_Some);
|
||||||
|
|
||||||
Item_First := Last + 1;
|
Item_First := Last + 1;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
@ -489,11 +517,11 @@ package body ZLib is
|
||||||
Code : Thin.Int;
|
Code : Thin.Int;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Filter.Opened = False then
|
if not Is_Open (Filter) then
|
||||||
raise ZLib_Error;
|
raise Status_Error;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if Out_Data'Length = 0 then
|
if Out_Data'Length = 0 and then In_Data'Length = 0 then
|
||||||
raise Constraint_Error;
|
raise Constraint_Error;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
|
@ -514,7 +542,6 @@ package body ZLib is
|
||||||
- Stream_Element_Offset (Avail_In (Filter.Strm.all));
|
- Stream_Element_Offset (Avail_In (Filter.Strm.all));
|
||||||
Out_Last := Out_Data'Last
|
Out_Last := Out_Data'Last
|
||||||
- Stream_Element_Offset (Avail_Out (Filter.Strm.all));
|
- Stream_Element_Offset (Avail_Out (Filter.Strm.all));
|
||||||
|
|
||||||
end Translate_Auto;
|
end Translate_Auto;
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
@ -529,7 +556,7 @@ package body ZLib is
|
||||||
Out_Last : out Ada.Streams.Stream_Element_Offset;
|
Out_Last : out Ada.Streams.Stream_Element_Offset;
|
||||||
Flush : in Flush_Mode)
|
Flush : in Flush_Mode)
|
||||||
is
|
is
|
||||||
Out_First : Stream_Element_Offset;
|
Out_First : Stream_Element_Offset;
|
||||||
|
|
||||||
procedure Add_Data (Data : in Stream_Element_Array);
|
procedure Add_Data (Data : in Stream_Element_Array);
|
||||||
-- Add data to stream from the Filter.Offset till necessary,
|
-- Add data to stream from the Filter.Offset till necessary,
|
||||||
|
|
@ -596,7 +623,7 @@ package body ZLib is
|
||||||
Add_Data (Simple_GZip_Header);
|
Add_Data (Simple_GZip_Header);
|
||||||
|
|
||||||
Translate_Auto
|
Translate_Auto
|
||||||
(Filter => Filter,
|
(Filter => Filter,
|
||||||
In_Data => In_Data,
|
In_Data => In_Data,
|
||||||
In_Last => In_Last,
|
In_Last => In_Last,
|
||||||
Out_Data => Out_Data (Out_First .. Out_Data'Last),
|
Out_Data => Out_Data (Out_First .. Out_Data'Last),
|
||||||
|
|
@ -604,7 +631,6 @@ package body ZLib is
|
||||||
Flush => Flush);
|
Flush => Flush);
|
||||||
|
|
||||||
CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
|
CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
|
||||||
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if Filter.Stream_End and then Out_Last <= Out_Data'Last then
|
if Filter.Stream_End and then Out_Last <= Out_Data'Last then
|
||||||
|
|
@ -642,10 +668,11 @@ package body ZLib is
|
||||||
procedure Write
|
procedure Write
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Item : in Ada.Streams.Stream_Element_Array;
|
Item : in Ada.Streams.Stream_Element_Array;
|
||||||
Flush : in Flush_Mode)
|
Flush : in Flush_Mode := No_Flush)
|
||||||
is
|
is
|
||||||
Buffer : Stream_Element_Array (1 .. Buffer_Size);
|
Buffer : Stream_Element_Array (1 .. Buffer_Size);
|
||||||
In_Last, Out_Last : Stream_Element_Offset;
|
In_Last : Stream_Element_Offset;
|
||||||
|
Out_Last : Stream_Element_Offset;
|
||||||
In_First : Stream_Element_Offset := Item'First;
|
In_First : Stream_Element_Offset := Item'First;
|
||||||
begin
|
begin
|
||||||
if Item'Length = 0 and Flush = No_Flush then
|
if Item'Length = 0 and Flush = No_Flush then
|
||||||
|
|
@ -654,7 +681,7 @@ package body ZLib is
|
||||||
|
|
||||||
loop
|
loop
|
||||||
Translate
|
Translate
|
||||||
(Filter => Filter,
|
(Filter => Filter,
|
||||||
In_Data => Item (In_First .. Item'Last),
|
In_Data => Item (In_First .. Item'Last),
|
||||||
In_Last => In_Last,
|
In_Last => In_Last,
|
||||||
Out_Data => Buffer,
|
Out_Data => Buffer,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
-- ZLib for Ada thick binding. --
|
-- ZLib for Ada thick binding. --
|
||||||
-- --
|
-- --
|
||||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
|
||||||
-- --
|
-- --
|
||||||
-- This library is free software; you can redistribute it and/or modify --
|
-- This library is free software; you can redistribute it and/or modify --
|
||||||
-- it under the terms of the GNU General Public License as published by --
|
-- it under the terms of the GNU General Public License as published by --
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
-- covered by the GNU Public License. --
|
-- covered by the GNU Public License. --
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- $Id: zlib.ads,v 1.17 2003/08/12 13:19:07 vagul Exp $
|
-- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $
|
||||||
|
|
||||||
with Ada.Streams;
|
with Ada.Streams;
|
||||||
|
|
||||||
|
|
@ -33,7 +33,8 @@ with Interfaces;
|
||||||
|
|
||||||
package ZLib is
|
package ZLib is
|
||||||
|
|
||||||
ZLib_Error : exception;
|
ZLib_Error : exception;
|
||||||
|
Status_Error : exception;
|
||||||
|
|
||||||
type Compression_Level is new Integer range -1 .. 9;
|
type Compression_Level is new Integer range -1 .. 9;
|
||||||
|
|
||||||
|
|
@ -55,12 +56,15 @@ package ZLib is
|
||||||
|
|
||||||
subtype Count is Ada.Streams.Stream_Element_Count;
|
subtype Count is Ada.Streams.Stream_Element_Count;
|
||||||
|
|
||||||
|
Default_Memory_Level : constant Memory_Level_Type := 8;
|
||||||
|
Default_Window_Bits : constant Window_Bits_Type := 15;
|
||||||
|
|
||||||
----------------------------------
|
----------------------------------
|
||||||
-- Compression method constants --
|
-- Compression method constants --
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Deflated : constant Compression_Method;
|
Deflated : constant Compression_Method;
|
||||||
-- Only one method allowed in this ZLib version.
|
-- Only one method allowed in this ZLib version
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
-- Compression level constants --
|
-- Compression level constants --
|
||||||
|
|
@ -79,21 +83,29 @@ package ZLib is
|
||||||
-- Regular way for compression, no flush
|
-- Regular way for compression, no flush
|
||||||
|
|
||||||
Partial_Flush : constant Flush_Mode;
|
Partial_Flush : constant Flush_Mode;
|
||||||
-- will be removed, use Z_SYNC_FLUSH instead
|
-- Will be removed, use Z_SYNC_FLUSH instead
|
||||||
|
|
||||||
Sync_Flush : constant Flush_Mode;
|
Sync_Flush : constant Flush_Mode;
|
||||||
-- all pending output is flushed to the output buffer and the output
|
-- All pending output is flushed to the output buffer and the output
|
||||||
-- is aligned on a byte boundary, so that the decompressor can get all
|
-- is aligned on a byte boundary, so that the decompressor can get all
|
||||||
-- input data available so far. (In particular avail_in is zero after the
|
-- input data available so far. (In particular avail_in is zero after the
|
||||||
-- call if enough output space has been provided before the call.)
|
-- call if enough output space has been provided before the call.)
|
||||||
-- Flushing may degrade compression for some compression algorithms and so
|
-- Flushing may degrade compression for some compression algorithms and so
|
||||||
-- it should be used only when necessary.
|
-- it should be used only when necessary.
|
||||||
|
|
||||||
|
Block_Flush : constant Flush_Mode;
|
||||||
|
-- Z_BLOCK requests that inflate() stop
|
||||||
|
-- if and when it get to the next deflate block boundary. When decoding the
|
||||||
|
-- zlib or gzip format, this will cause inflate() to return immediately
|
||||||
|
-- after the header and before the first block. When doing a raw inflate,
|
||||||
|
-- inflate() will go ahead and process the first block, and will return
|
||||||
|
-- when it gets to the end of that block, or when it runs out of data.
|
||||||
|
|
||||||
Full_Flush : constant Flush_Mode;
|
Full_Flush : constant Flush_Mode;
|
||||||
-- all output is flushed as with SYNC_FLUSH, and the compression state
|
-- All output is flushed as with SYNC_FLUSH, and the compression state
|
||||||
-- is reset so that decompression can restart from this point if previous
|
-- is reset so that decompression can restart from this point if previous
|
||||||
-- compressed data has been damaged or if random access is desired. Using
|
-- compressed data has been damaged or if random access is desired. Using
|
||||||
-- FULL_FLUSH too often can seriously degrade the compression.
|
-- Full_Flush too often can seriously degrade the compression.
|
||||||
|
|
||||||
Finish : constant Flush_Mode;
|
Finish : constant Flush_Mode;
|
||||||
-- Just for tell the compressor that input data is complete.
|
-- Just for tell the compressor that input data is complete.
|
||||||
|
|
@ -111,7 +123,7 @@ package ZLib is
|
||||||
|
|
||||||
Default_Buffer_Size : constant := 4096;
|
Default_Buffer_Size : constant := 4096;
|
||||||
|
|
||||||
type Filter_Type is limited private;
|
type Filter_Type is tagged limited private;
|
||||||
-- The filter is for compression and for decompression.
|
-- The filter is for compression and for decompression.
|
||||||
-- The usage of the type is depend of its initialization.
|
-- The usage of the type is depend of its initialization.
|
||||||
|
|
||||||
|
|
@ -124,8 +136,8 @@ package ZLib is
|
||||||
Level : in Compression_Level := Default_Compression;
|
Level : in Compression_Level := Default_Compression;
|
||||||
Strategy : in Strategy_Type := Default_Strategy;
|
Strategy : in Strategy_Type := Default_Strategy;
|
||||||
Method : in Compression_Method := Deflated;
|
Method : in Compression_Method := Deflated;
|
||||||
Window_Bits : in Window_Bits_Type := 15;
|
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
|
||||||
Memory_Level : in Memory_Level_Type := 8;
|
Memory_Level : in Memory_Level_Type := Default_Memory_Level;
|
||||||
Header : in Header_Type := Default);
|
Header : in Header_Type := Default);
|
||||||
-- Compressor initialization.
|
-- Compressor initialization.
|
||||||
-- When Header parameter is Auto or Default, then default zlib header
|
-- When Header parameter is Auto or Default, then default zlib header
|
||||||
|
|
@ -136,7 +148,7 @@ package ZLib is
|
||||||
|
|
||||||
procedure Inflate_Init
|
procedure Inflate_Init
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Window_Bits : in Window_Bits_Type := 15;
|
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
|
||||||
Header : in Header_Type := Default);
|
Header : in Header_Type := Default);
|
||||||
-- Decompressor initialization.
|
-- Decompressor initialization.
|
||||||
-- Default header type mean that ZLib default header is expecting in the
|
-- Default header type mean that ZLib default header is expecting in the
|
||||||
|
|
@ -146,10 +158,14 @@ package ZLib is
|
||||||
-- input compressed stream.
|
-- input compressed stream.
|
||||||
-- Auto header type mean that header type (GZip or Native) would be
|
-- Auto header type mean that header type (GZip or Native) would be
|
||||||
-- detected automatically in the input stream.
|
-- detected automatically in the input stream.
|
||||||
-- Note that header types parameter values None, GZip and Auto is
|
-- Note that header types parameter values None, GZip and Auto are
|
||||||
-- supporting for inflate routine only in ZLib versions 1.2.0.2 and later.
|
-- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
|
||||||
-- Deflate_Init is supporting all header types.
|
-- Deflate_Init is supporting all header types.
|
||||||
|
|
||||||
|
function Is_Open (Filter : in Filter_Type) return Boolean;
|
||||||
|
pragma Inline (Is_Open);
|
||||||
|
-- Is the filter opened for compression or decompression.
|
||||||
|
|
||||||
procedure Close
|
procedure Close
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Ignore_Error : in Boolean := False);
|
Ignore_Error : in Boolean := False);
|
||||||
|
|
@ -167,31 +183,31 @@ package ZLib is
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
In_Buffer_Size : in Integer := Default_Buffer_Size;
|
In_Buffer_Size : in Integer := Default_Buffer_Size;
|
||||||
Out_Buffer_Size : in Integer := Default_Buffer_Size);
|
Out_Buffer_Size : in Integer := Default_Buffer_Size);
|
||||||
-- Compressing/decompressing data arrived from Data_In routine
|
-- Compress/decompress data fetch from Data_In routine and pass the result
|
||||||
-- to the Data_Out routine. User should provide Data_In and Data_Out
|
-- to the Data_Out routine. User should provide Data_In and Data_Out
|
||||||
-- for compression/decompression data flow.
|
-- for compression/decompression data flow.
|
||||||
-- Compression or decompression depend on initialization of Filter.
|
-- Compression or decompression depend on Filter initialization.
|
||||||
|
|
||||||
function Total_In (Filter : in Filter_Type) return Count;
|
function Total_In (Filter : in Filter_Type) return Count;
|
||||||
pragma Inline (Total_In);
|
pragma Inline (Total_In);
|
||||||
-- Return total number of input bytes read so far.
|
-- Returns total number of input bytes read so far
|
||||||
|
|
||||||
function Total_Out (Filter : in Filter_Type) return Count;
|
function Total_Out (Filter : in Filter_Type) return Count;
|
||||||
pragma Inline (Total_Out);
|
pragma Inline (Total_Out);
|
||||||
-- Return total number of bytes output so far.
|
-- Returns total number of bytes output so far
|
||||||
|
|
||||||
function CRC32
|
function CRC32
|
||||||
(CRC : in Unsigned_32;
|
(CRC : in Unsigned_32;
|
||||||
Data : in Ada.Streams.Stream_Element_Array)
|
Data : in Ada.Streams.Stream_Element_Array)
|
||||||
return Unsigned_32;
|
return Unsigned_32;
|
||||||
pragma Inline (CRC32);
|
pragma Inline (CRC32);
|
||||||
-- Calculate CRC32, it could be necessary for make gzip format.
|
-- Compute CRC32, it could be necessary for make gzip format
|
||||||
|
|
||||||
procedure CRC32
|
procedure CRC32
|
||||||
(CRC : in out Unsigned_32;
|
(CRC : in out Unsigned_32;
|
||||||
Data : in Ada.Streams.Stream_Element_Array);
|
Data : in Ada.Streams.Stream_Element_Array);
|
||||||
pragma Inline (CRC32);
|
pragma Inline (CRC32);
|
||||||
-- Calculate CRC32, it could be necessary for make gzip format.
|
-- Compute CRC32, it could be necessary for make gzip format
|
||||||
|
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
-- Below is more complex low level routines. --
|
-- Below is more complex low level routines. --
|
||||||
|
|
@ -204,15 +220,11 @@ package ZLib is
|
||||||
Out_Data : out Ada.Streams.Stream_Element_Array;
|
Out_Data : out Ada.Streams.Stream_Element_Array;
|
||||||
Out_Last : out Ada.Streams.Stream_Element_Offset;
|
Out_Last : out Ada.Streams.Stream_Element_Offset;
|
||||||
Flush : in Flush_Mode);
|
Flush : in Flush_Mode);
|
||||||
-- Compressing/decompressing the datas from In_Data buffer to the
|
-- Compress/decompress the In_Data buffer and place the result into
|
||||||
-- Out_Data buffer.
|
-- Out_Data. In_Last is the index of last element from In_Data accepted by
|
||||||
-- In_Data is incoming data portion,
|
-- the Filter. Out_Last is the last element of the received data from
|
||||||
-- In_Last is the index of last element from In_Data accepted by the
|
-- Filter. To tell the filter that incoming data are complete put the
|
||||||
-- Filter.
|
-- Flush parameter to Finish.
|
||||||
-- Out_Data is the buffer for output data from the filter.
|
|
||||||
-- Out_Last is the last element of the received data from Filter.
|
|
||||||
-- To tell the filter that incoming data is complete put the
|
|
||||||
-- Flush parameter to FINISH.
|
|
||||||
|
|
||||||
function Stream_End (Filter : in Filter_Type) return Boolean;
|
function Stream_End (Filter : in Filter_Type) return Boolean;
|
||||||
pragma Inline (Stream_End);
|
pragma Inline (Stream_End);
|
||||||
|
|
@ -239,10 +251,9 @@ package ZLib is
|
||||||
procedure Write
|
procedure Write
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Item : in Ada.Streams.Stream_Element_Array;
|
Item : in Ada.Streams.Stream_Element_Array;
|
||||||
Flush : in Flush_Mode);
|
Flush : in Flush_Mode := No_Flush);
|
||||||
-- Compressing/Decompressing data from Item to the
|
-- Compress/Decompress data from Item to the generic parameter procedure
|
||||||
-- generic parameter procedure Write.
|
-- Write. Output buffer size could be set in Buffer_Size generic parameter.
|
||||||
-- Output buffer size could be set in Buffer_Size generic parameter.
|
|
||||||
|
|
||||||
generic
|
generic
|
||||||
with procedure Read
|
with procedure Read
|
||||||
|
|
@ -257,33 +268,41 @@ package ZLib is
|
||||||
|
|
||||||
Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
|
Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
|
||||||
-- Rest_First have to be initialized to Buffer'Last + 1
|
-- Rest_First have to be initialized to Buffer'Last + 1
|
||||||
|
-- Rest_Last have to be initialized to Buffer'Last
|
||||||
-- before usage.
|
-- before usage.
|
||||||
|
|
||||||
|
Allow_Read_Some : in Boolean := False;
|
||||||
|
-- Is it allowed to return Last < Item'Last before end of data.
|
||||||
|
|
||||||
procedure Read
|
procedure Read
|
||||||
(Filter : in out Filter_Type;
|
(Filter : in out Filter_Type;
|
||||||
Item : out Ada.Streams.Stream_Element_Array;
|
Item : out Ada.Streams.Stream_Element_Array;
|
||||||
Last : out Ada.Streams.Stream_Element_Offset);
|
Last : out Ada.Streams.Stream_Element_Offset;
|
||||||
-- Compressing/Decompressing data from generic parameter
|
Flush : in Flush_Mode := No_Flush);
|
||||||
-- procedure Read to the Item.
|
-- Compress/Decompress data from generic parameter procedure Read to the
|
||||||
-- User should provide Buffer for the operation
|
-- Item. User should provide Buffer and initialized Rest_First, Rest_Last
|
||||||
-- and Rest_First variable first time initialized to the Buffer'Last + 1.
|
-- indicators. If Allow_Read_Some is True, Read routines could return
|
||||||
|
-- Last < Item'Last only at end of stream.
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
use Ada.Streams;
|
use Ada.Streams;
|
||||||
|
|
||||||
type Flush_Mode is new Integer range 0 .. 4;
|
pragma Assert (Ada.Streams.Stream_Element'Size = 8);
|
||||||
|
pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
|
||||||
|
|
||||||
|
type Flush_Mode is new Integer range 0 .. 5;
|
||||||
|
|
||||||
type Compression_Method is new Integer range 8 .. 8;
|
type Compression_Method is new Integer range 8 .. 8;
|
||||||
|
|
||||||
type Strategy_Type is new Integer range 0 .. 3;
|
type Strategy_Type is new Integer range 0 .. 3;
|
||||||
|
|
||||||
No_Flush : constant Flush_Mode := 0;
|
No_Flush : constant Flush_Mode := 0;
|
||||||
|
Partial_Flush : constant Flush_Mode := 1;
|
||||||
Sync_Flush : constant Flush_Mode := 2;
|
Sync_Flush : constant Flush_Mode := 2;
|
||||||
Full_Flush : constant Flush_Mode := 3;
|
Full_Flush : constant Flush_Mode := 3;
|
||||||
Finish : constant Flush_Mode := 4;
|
Finish : constant Flush_Mode := 4;
|
||||||
Partial_Flush : constant Flush_Mode := 1;
|
Block_Flush : constant Flush_Mode := 5;
|
||||||
-- will be removed, use Z_SYNC_FLUSH instead
|
|
||||||
|
|
||||||
Filtered : constant Strategy_Type := 1;
|
Filtered : constant Strategy_Type := 1;
|
||||||
Huffman_Only : constant Strategy_Type := 2;
|
Huffman_Only : constant Strategy_Type := 2;
|
||||||
|
|
@ -296,7 +315,7 @@ private
|
||||||
|
|
||||||
type Z_Stream_Access is access all Z_Stream;
|
type Z_Stream_Access is access all Z_Stream;
|
||||||
|
|
||||||
type Filter_Type is record
|
type Filter_Type is tagged limited record
|
||||||
Strm : Z_Stream_Access;
|
Strm : Z_Stream_Access;
|
||||||
Compression : Boolean;
|
Compression : Boolean;
|
||||||
Stream_End : Boolean;
|
Stream_End : Boolean;
|
||||||
|
|
@ -304,8 +323,6 @@ private
|
||||||
CRC : Unsigned_32;
|
CRC : Unsigned_32;
|
||||||
Offset : Stream_Element_Offset;
|
Offset : Stream_Element_Offset;
|
||||||
-- Offset for gzip header/footer output.
|
-- Offset for gzip header/footer output.
|
||||||
|
|
||||||
Opened : Boolean := False;
|
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
end ZLib;
|
end ZLib;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ project Zlib is
|
||||||
for Languages use ("Ada");
|
for Languages use ("Ada");
|
||||||
for Source_Dirs use (".");
|
for Source_Dirs use (".");
|
||||||
for Object_Dir use ".";
|
for Object_Dir use ".";
|
||||||
for Main use ("test.adb", "mtest.adb", "read.adb");
|
for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo");
|
||||||
|
|
||||||
package Compiler is
|
package Compiler is
|
||||||
for Default_Switches ("ada") use ("-gnatwbcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");
|
for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");
|
||||||
end Compiler;
|
end Compiler;
|
||||||
|
|
||||||
package Linker is
|
package Linker is
|
||||||
|
|
@ -18,4 +18,3 @@ project Zlib is
|
||||||
end Builder;
|
end Builder;
|
||||||
|
|
||||||
end Zlib;
|
end Zlib;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
|
||||||
const OutBuf: Pointer; BufSize: Integer);
|
const OutBuf: Pointer; BufSize: Integer);
|
||||||
|
|
||||||
const
|
const
|
||||||
zlib_version = '1.2.1';
|
zlib_version = '1.2.3';
|
||||||
|
|
||||||
type
|
type
|
||||||
EZlibError = class(Exception);
|
EZlibError = class(Exception);
|
||||||
|
|
@ -344,7 +344,7 @@ begin
|
||||||
strm.avail_out := OutBytes;
|
strm.avail_out := OutBytes;
|
||||||
DCheck(inflateInit_(strm, zlib_version, sizeof(strm)));
|
DCheck(inflateInit_(strm, zlib_version, sizeof(strm)));
|
||||||
try
|
try
|
||||||
while DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END do
|
while DCheck(inflate(strm, Z_NO_FLUSH)) <> Z_STREAM_END do
|
||||||
begin
|
begin
|
||||||
P := OutBuf;
|
P := OutBuf;
|
||||||
Inc(OutBytes, BufInc);
|
Inc(OutBytes, BufInc);
|
||||||
|
|
@ -510,7 +510,7 @@ begin
|
||||||
Result := Count - FZRec.avail_out;
|
Result := Count - FZRec.avail_out;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
FZRec.next_in := FBuffer;
|
FZRec.next_in := FBuffer;
|
||||||
FStrmPos := FStrm.Position;
|
FStrmPos := FStrm.Position;
|
||||||
Progress(Self);
|
Progress(Self);
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
|
|
@ -430,6 +430,9 @@ void FAR *out_desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* handle error breaks in while */
|
||||||
|
if (mode == BAD) break;
|
||||||
|
|
||||||
/* build code tables */
|
/* build code tables */
|
||||||
state->next = state->codes;
|
state->next = state->codes;
|
||||||
lencode = (code const FAR *)(state->next);
|
lencode = (code const FAR *)(state->next);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
* zlib.h must be included before this header file.
|
* zlib.h must be included before this header file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
|
ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
|
||||||
in_func in, void FAR *in_desc,
|
in_func in, void FAR *in_desc,
|
||||||
out_func out, void FAR *out_desc));
|
out_func out, void FAR *out_desc));
|
||||||
|
|
@ -27,3 +31,7 @@ ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm,
|
||||||
#define inflateBack9Init(strm, window) \
|
#define inflateBack9Init(strm, window) \
|
||||||
inflateBack9Init_((strm), (window), \
|
inflateBack9Init_((strm), (window), \
|
||||||
ZLIB_VERSION, sizeof(z_stream))
|
ZLIB_VERSION, sizeof(z_stream))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftree9.c -- generate Huffman trees for efficient decoding
|
/* inftree9.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2005 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate9_copyright[] =
|
const char inflate9_copyright[] =
|
||||||
" inflate9 1.2.1 Copyright 1995-2003 Mark Adler ";
|
" inflate9 1.2.3 Copyright 1995-2005 Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
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
|
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 */
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||||
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
||||||
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
||||||
133, 133, 133, 133, 144, 76, 66};
|
133, 133, 133, 133, 144, 201, 196};
|
||||||
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
||||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
||||||
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||||
|
|
@ -128,7 +128,7 @@ unsigned short FAR *work;
|
||||||
left -= count[len];
|
left -= count[len];
|
||||||
if (left < 0) return -1; /* over-subscribed */
|
if (left < 0) return -1; /* over-subscribed */
|
||||||
}
|
}
|
||||||
if (left > 0 && (type == CODES || (codes - count[0] != 1)))
|
if (left > 0 && (type == CODES || max != 1))
|
||||||
return -1; /* incomplete set */
|
return -1; /* incomplete set */
|
||||||
|
|
||||||
/* generate offsets into symbol table for each length for sorting */
|
/* generate offsets into symbol table for each length for sorting */
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
||||||
exhaustive search was 1004 code structures (850 for length/literals
|
exhaustive search was 1444 code structures (852 for length/literals
|
||||||
and 154 for distances, the latter actually the result of an
|
and 592 for distances, the latter actually the result of an
|
||||||
exhaustive search). The true maximum is not known, but the value
|
exhaustive search). The true maximum is not known, but the value
|
||||||
below is more than safe. */
|
below is more than safe. */
|
||||||
#define ENOUGH 1440
|
#define ENOUGH 2048
|
||||||
#define MAXD 154
|
#define MAXD 592
|
||||||
|
|
||||||
/* Type of code to build for inftable() */
|
/* Type of code to build for inftable() */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -188,17 +188,8 @@
|
||||||
/*
|
/*
|
||||||
* typedef enum inflate_mode consts, in inflate.h
|
* typedef enum inflate_mode consts, in inflate.h
|
||||||
*/
|
*/
|
||||||
#ifndef NO_GUNZIP
|
|
||||||
#define GUNZIP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GUNZIP
|
|
||||||
#define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */
|
#define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */
|
||||||
#define INFLATE_MODE_BAD 26
|
#define INFLATE_MODE_BAD 26
|
||||||
#else
|
|
||||||
#define INFLATE_MODE_TYPE 3
|
|
||||||
#define INFLATE_MODE_BAD 17
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined( USE_MMX ) && ! defined( NO_MMX )
|
#if ! defined( USE_MMX ) && ! defined( NO_MMX )
|
||||||
|
|
|
||||||
|
|
@ -1,408 +1,413 @@
|
||||||
|
|
||||||
; match.asm -- Pentium-Pro optimized version of longest_match()
|
; match.asm -- Pentium-Pro optimized version of longest_match()
|
||||||
;
|
;
|
||||||
; Updated for zlib 1.1.3 and converted to MASM 6.1x
|
; Updated for zlib 1.1.3 and converted to MASM 6.1x
|
||||||
; Copyright (C) 2000 Dan Higdon <hdan@kinesoft.com>
|
; Copyright (C) 2000 Dan Higdon <hdan@kinesoft.com>
|
||||||
; and Chuck Walbourn <chuckw@kinesoft.com>
|
; and Chuck Walbourn <chuckw@kinesoft.com>
|
||||||
; Corrections by Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
; Corrections by Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
||||||
;
|
;
|
||||||
; This is free software; you can redistribute it and/or modify it
|
; This is free software; you can redistribute it and/or modify it
|
||||||
; under the terms of the GNU General Public License.
|
; under the terms of the GNU General Public License.
|
||||||
|
|
||||||
; Based on match.S
|
; Based on match.S
|
||||||
; Written for zlib 1.1.2
|
; Written for zlib 1.1.2
|
||||||
; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
|
; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
|
||||||
|
;
|
||||||
.686P
|
; Modified by Gilles Vollant (2005) for add gzhead and gzindex
|
||||||
.MODEL FLAT
|
|
||||||
|
.686P
|
||||||
;===========================================================================
|
.MODEL FLAT
|
||||||
; EQUATES
|
|
||||||
;===========================================================================
|
;===========================================================================
|
||||||
|
; EQUATES
|
||||||
MAX_MATCH EQU 258
|
;===========================================================================
|
||||||
MIN_MATCH EQU 3
|
|
||||||
MIN_LOOKAHEAD EQU (MAX_MATCH + MIN_MATCH + 1)
|
MAX_MATCH EQU 258
|
||||||
MAX_MATCH_8 EQU ((MAX_MATCH + 7) AND (NOT 7))
|
MIN_MATCH EQU 3
|
||||||
|
MIN_LOOKAHEAD EQU (MAX_MATCH + MIN_MATCH + 1)
|
||||||
;===========================================================================
|
MAX_MATCH_8 EQU ((MAX_MATCH + 7) AND (NOT 7))
|
||||||
; STRUCTURES
|
|
||||||
;===========================================================================
|
;===========================================================================
|
||||||
|
; STRUCTURES
|
||||||
; This STRUCT assumes a 4-byte alignment
|
;===========================================================================
|
||||||
|
|
||||||
DEFLATE_STATE STRUCT
|
; This STRUCT assumes a 4-byte alignment
|
||||||
ds_strm dd ?
|
|
||||||
ds_status dd ?
|
DEFLATE_STATE STRUCT
|
||||||
ds_pending_buf dd ?
|
ds_strm dd ?
|
||||||
ds_pending_buf_size dd ?
|
ds_status dd ?
|
||||||
ds_pending_out dd ?
|
ds_pending_buf dd ?
|
||||||
ds_pending dd ?
|
ds_pending_buf_size dd ?
|
||||||
ds_wrap dd ?
|
ds_pending_out dd ?
|
||||||
ds_data_type db ?
|
ds_pending dd ?
|
||||||
ds_method db ?
|
ds_wrap dd ?
|
||||||
db ? ; padding
|
; gzhead and gzindex are added in zlib 1.2.2.2 (see deflate.h)
|
||||||
db ? ; padding
|
ds_gzhead dd ?
|
||||||
ds_last_flush dd ?
|
ds_gzindex dd ?
|
||||||
ds_w_size dd ? ; used
|
ds_data_type db ?
|
||||||
ds_w_bits dd ?
|
ds_method db ?
|
||||||
ds_w_mask dd ? ; used
|
db ? ; padding
|
||||||
ds_window dd ? ; used
|
db ? ; padding
|
||||||
ds_window_size dd ?
|
ds_last_flush dd ?
|
||||||
ds_prev dd ? ; used
|
ds_w_size dd ? ; used
|
||||||
ds_head dd ?
|
ds_w_bits dd ?
|
||||||
ds_ins_h dd ?
|
ds_w_mask dd ? ; used
|
||||||
ds_hash_size dd ?
|
ds_window dd ? ; used
|
||||||
ds_hash_bits dd ?
|
ds_window_size dd ?
|
||||||
ds_hash_mask dd ?
|
ds_prev dd ? ; used
|
||||||
ds_hash_shift dd ?
|
ds_head dd ?
|
||||||
ds_block_start dd ?
|
ds_ins_h dd ?
|
||||||
ds_match_length dd ? ; used
|
ds_hash_size dd ?
|
||||||
ds_prev_match dd ? ; used
|
ds_hash_bits dd ?
|
||||||
ds_match_available dd ?
|
ds_hash_mask dd ?
|
||||||
ds_strstart dd ? ; used
|
ds_hash_shift dd ?
|
||||||
ds_match_start dd ? ; used
|
ds_block_start dd ?
|
||||||
ds_lookahead dd ? ; used
|
ds_match_length dd ? ; used
|
||||||
ds_prev_length dd ? ; used
|
ds_prev_match dd ? ; used
|
||||||
ds_max_chain_length dd ? ; used
|
ds_match_available dd ?
|
||||||
ds_max_laxy_match dd ?
|
ds_strstart dd ? ; used
|
||||||
ds_level dd ?
|
ds_match_start dd ? ; used
|
||||||
ds_strategy dd ?
|
ds_lookahead dd ? ; used
|
||||||
ds_good_match dd ? ; used
|
ds_prev_length dd ? ; used
|
||||||
ds_nice_match dd ? ; used
|
ds_max_chain_length dd ? ; used
|
||||||
|
ds_max_laxy_match dd ?
|
||||||
; Don't need anymore of the struct for match
|
ds_level dd ?
|
||||||
DEFLATE_STATE ENDS
|
ds_strategy dd ?
|
||||||
|
ds_good_match dd ? ; used
|
||||||
;===========================================================================
|
ds_nice_match dd ? ; used
|
||||||
; CODE
|
|
||||||
;===========================================================================
|
; Don't need anymore of the struct for match
|
||||||
_TEXT SEGMENT
|
DEFLATE_STATE ENDS
|
||||||
|
|
||||||
;---------------------------------------------------------------------------
|
;===========================================================================
|
||||||
; match_init
|
; CODE
|
||||||
;---------------------------------------------------------------------------
|
;===========================================================================
|
||||||
ALIGN 4
|
_TEXT SEGMENT
|
||||||
PUBLIC _match_init
|
|
||||||
_match_init PROC
|
;---------------------------------------------------------------------------
|
||||||
; no initialization needed
|
; match_init
|
||||||
ret
|
;---------------------------------------------------------------------------
|
||||||
_match_init ENDP
|
ALIGN 4
|
||||||
|
PUBLIC _match_init
|
||||||
;---------------------------------------------------------------------------
|
_match_init PROC
|
||||||
; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
|
; no initialization needed
|
||||||
;---------------------------------------------------------------------------
|
ret
|
||||||
ALIGN 4
|
_match_init ENDP
|
||||||
|
|
||||||
PUBLIC _longest_match
|
;---------------------------------------------------------------------------
|
||||||
_longest_match PROC
|
; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
; Since this code uses EBP for a scratch register, the stack frame must
|
ALIGN 4
|
||||||
; be manually constructed and referenced relative to the ESP register.
|
|
||||||
|
PUBLIC _longest_match
|
||||||
; Stack image
|
_longest_match PROC
|
||||||
; Variables
|
|
||||||
chainlenwmask = 0 ; high word: current chain len
|
; Since this code uses EBP for a scratch register, the stack frame must
|
||||||
; low word: s->wmask
|
; be manually constructed and referenced relative to the ESP register.
|
||||||
window = 4 ; local copy of s->window
|
|
||||||
windowbestlen = 8 ; s->window + bestlen
|
; Stack image
|
||||||
scanend = 12 ; last two bytes of string
|
; Variables
|
||||||
scanstart = 16 ; first two bytes of string
|
chainlenwmask = 0 ; high word: current chain len
|
||||||
scanalign = 20 ; dword-misalignment of string
|
; low word: s->wmask
|
||||||
nicematch = 24 ; a good enough match size
|
window = 4 ; local copy of s->window
|
||||||
bestlen = 28 ; size of best match so far
|
windowbestlen = 8 ; s->window + bestlen
|
||||||
scan = 32 ; ptr to string wanting match
|
scanend = 12 ; last two bytes of string
|
||||||
varsize = 36 ; number of bytes (also offset to last saved register)
|
scanstart = 16 ; first two bytes of string
|
||||||
|
scanalign = 20 ; dword-misalignment of string
|
||||||
; Saved Registers (actually pushed into place)
|
nicematch = 24 ; a good enough match size
|
||||||
ebx_save = 36
|
bestlen = 28 ; size of best match so far
|
||||||
edi_save = 40
|
scan = 32 ; ptr to string wanting match
|
||||||
esi_save = 44
|
varsize = 36 ; number of bytes (also offset to last saved register)
|
||||||
ebp_save = 48
|
|
||||||
|
; Saved Registers (actually pushed into place)
|
||||||
; Parameters
|
ebx_save = 36
|
||||||
retaddr = 52
|
edi_save = 40
|
||||||
deflatestate = 56
|
esi_save = 44
|
||||||
curmatch = 60
|
ebp_save = 48
|
||||||
|
|
||||||
; Save registers that the compiler may be using
|
; Parameters
|
||||||
push ebp
|
retaddr = 52
|
||||||
push edi
|
deflatestate = 56
|
||||||
push esi
|
curmatch = 60
|
||||||
push ebx
|
|
||||||
|
; Save registers that the compiler may be using
|
||||||
; Allocate local variable space
|
push ebp
|
||||||
sub esp,varsize
|
push edi
|
||||||
|
push esi
|
||||||
; Retrieve the function arguments. ecx will hold cur_match
|
push ebx
|
||||||
; throughout the entire function. edx will hold the pointer to the
|
|
||||||
; deflate_state structure during the function's setup (before
|
; Allocate local variable space
|
||||||
; entering the main loop).
|
sub esp,varsize
|
||||||
|
|
||||||
mov edx, [esp+deflatestate]
|
; Retrieve the function arguments. ecx will hold cur_match
|
||||||
ASSUME edx:PTR DEFLATE_STATE
|
; throughout the entire function. edx will hold the pointer to the
|
||||||
|
; deflate_state structure during the function's setup (before
|
||||||
mov ecx, [esp+curmatch]
|
; entering the main loop).
|
||||||
|
|
||||||
; uInt wmask = s->w_mask;
|
mov edx, [esp+deflatestate]
|
||||||
; unsigned chain_length = s->max_chain_length;
|
ASSUME edx:PTR DEFLATE_STATE
|
||||||
; if (s->prev_length >= s->good_match) {
|
|
||||||
; chain_length >>= 2;
|
mov ecx, [esp+curmatch]
|
||||||
; }
|
|
||||||
|
; uInt wmask = s->w_mask;
|
||||||
mov eax, [edx].ds_prev_length
|
; unsigned chain_length = s->max_chain_length;
|
||||||
mov ebx, [edx].ds_good_match
|
; if (s->prev_length >= s->good_match) {
|
||||||
cmp eax, ebx
|
; chain_length >>= 2;
|
||||||
mov eax, [edx].ds_w_mask
|
; }
|
||||||
mov ebx, [edx].ds_max_chain_length
|
|
||||||
jl SHORT LastMatchGood
|
mov eax, [edx].ds_prev_length
|
||||||
shr ebx, 2
|
mov ebx, [edx].ds_good_match
|
||||||
LastMatchGood:
|
cmp eax, ebx
|
||||||
|
mov eax, [edx].ds_w_mask
|
||||||
; chainlen is decremented once beforehand so that the function can
|
mov ebx, [edx].ds_max_chain_length
|
||||||
; use the sign flag instead of the zero flag for the exit test.
|
jl SHORT LastMatchGood
|
||||||
; It is then shifted into the high word, to make room for the wmask
|
shr ebx, 2
|
||||||
; value, which it will always accompany.
|
LastMatchGood:
|
||||||
|
|
||||||
dec ebx
|
; chainlen is decremented once beforehand so that the function can
|
||||||
shl ebx, 16
|
; use the sign flag instead of the zero flag for the exit test.
|
||||||
or ebx, eax
|
; It is then shifted into the high word, to make room for the wmask
|
||||||
mov [esp+chainlenwmask], ebx
|
; value, which it will always accompany.
|
||||||
|
|
||||||
; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
dec ebx
|
||||||
|
shl ebx, 16
|
||||||
mov eax, [edx].ds_nice_match
|
or ebx, eax
|
||||||
mov ebx, [edx].ds_lookahead
|
mov [esp+chainlenwmask], ebx
|
||||||
cmp ebx, eax
|
|
||||||
jl SHORT LookaheadLess
|
; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
||||||
mov ebx, eax
|
|
||||||
LookaheadLess:
|
mov eax, [edx].ds_nice_match
|
||||||
mov [esp+nicematch], ebx
|
mov ebx, [edx].ds_lookahead
|
||||||
|
cmp ebx, eax
|
||||||
;/* register Bytef *scan = s->window + s->strstart; */
|
jl SHORT LookaheadLess
|
||||||
|
mov ebx, eax
|
||||||
mov esi, [edx].ds_window
|
LookaheadLess:
|
||||||
mov [esp+window], esi
|
mov [esp+nicematch], ebx
|
||||||
mov ebp, [edx].ds_strstart
|
|
||||||
lea edi, [esi+ebp]
|
;/* register Bytef *scan = s->window + s->strstart; */
|
||||||
mov [esp+scan],edi
|
|
||||||
|
mov esi, [edx].ds_window
|
||||||
;/* Determine how many bytes the scan ptr is off from being */
|
mov [esp+window], esi
|
||||||
;/* dword-aligned. */
|
mov ebp, [edx].ds_strstart
|
||||||
|
lea edi, [esi+ebp]
|
||||||
mov eax, edi
|
mov [esp+scan],edi
|
||||||
neg eax
|
|
||||||
and eax, 3
|
;/* Determine how many bytes the scan ptr is off from being */
|
||||||
mov [esp+scanalign], eax
|
;/* dword-aligned. */
|
||||||
|
|
||||||
;/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
|
mov eax, edi
|
||||||
;/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
|
neg eax
|
||||||
|
and eax, 3
|
||||||
mov eax, [edx].ds_w_size
|
mov [esp+scanalign], eax
|
||||||
sub eax, MIN_LOOKAHEAD
|
|
||||||
sub ebp, eax
|
;/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
|
||||||
jg SHORT LimitPositive
|
;/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
|
||||||
xor ebp, ebp
|
|
||||||
LimitPositive:
|
mov eax, [edx].ds_w_size
|
||||||
|
sub eax, MIN_LOOKAHEAD
|
||||||
;/* int best_len = s->prev_length; */
|
sub ebp, eax
|
||||||
|
jg SHORT LimitPositive
|
||||||
mov eax, [edx].ds_prev_length
|
xor ebp, ebp
|
||||||
mov [esp+bestlen], eax
|
LimitPositive:
|
||||||
|
|
||||||
;/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
|
;/* int best_len = s->prev_length; */
|
||||||
|
|
||||||
add esi, eax
|
mov eax, [edx].ds_prev_length
|
||||||
mov [esp+windowbestlen], esi
|
mov [esp+bestlen], eax
|
||||||
|
|
||||||
;/* register ush scan_start = *(ushf*)scan; */
|
;/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
|
||||||
;/* register ush scan_end = *(ushf*)(scan+best_len-1); */
|
|
||||||
;/* Posf *prev = s->prev; */
|
add esi, eax
|
||||||
|
mov [esp+windowbestlen], esi
|
||||||
movzx ebx, WORD PTR[edi]
|
|
||||||
mov [esp+scanstart], ebx
|
;/* register ush scan_start = *(ushf*)scan; */
|
||||||
movzx ebx, WORD PTR[eax+edi-1]
|
;/* register ush scan_end = *(ushf*)(scan+best_len-1); */
|
||||||
mov [esp+scanend], ebx
|
;/* Posf *prev = s->prev; */
|
||||||
mov edi, [edx].ds_prev
|
|
||||||
|
movzx ebx, WORD PTR[edi]
|
||||||
;/* Jump into the main loop. */
|
mov [esp+scanstart], ebx
|
||||||
|
movzx ebx, WORD PTR[eax+edi-1]
|
||||||
mov edx, [esp+chainlenwmask]
|
mov [esp+scanend], ebx
|
||||||
jmp SHORT LoopEntry
|
mov edi, [edx].ds_prev
|
||||||
|
|
||||||
;/* do {
|
;/* Jump into the main loop. */
|
||||||
; * match = s->window + cur_match;
|
|
||||||
; * if (*(ushf*)(match+best_len-1) != scan_end ||
|
mov edx, [esp+chainlenwmask]
|
||||||
; * *(ushf*)match != scan_start) continue;
|
jmp SHORT LoopEntry
|
||||||
; * [...]
|
|
||||||
; * } while ((cur_match = prev[cur_match & wmask]) > limit
|
;/* do {
|
||||||
; * && --chain_length != 0);
|
; * match = s->window + cur_match;
|
||||||
; *
|
; * if (*(ushf*)(match+best_len-1) != scan_end ||
|
||||||
; * Here is the inner loop of the function. The function will spend the
|
; * *(ushf*)match != scan_start) continue;
|
||||||
; * majority of its time in this loop, and majority of that time will
|
; * [...]
|
||||||
; * be spent in the first ten instructions.
|
; * } while ((cur_match = prev[cur_match & wmask]) > limit
|
||||||
; *
|
; * && --chain_length != 0);
|
||||||
; * Within this loop:
|
; *
|
||||||
; * %ebx = scanend
|
; * Here is the inner loop of the function. The function will spend the
|
||||||
; * %ecx = curmatch
|
; * majority of its time in this loop, and majority of that time will
|
||||||
; * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
|
; * be spent in the first ten instructions.
|
||||||
; * %esi = windowbestlen - i.e., (window + bestlen)
|
; *
|
||||||
; * %edi = prev
|
; * Within this loop:
|
||||||
; * %ebp = limit
|
; * %ebx = scanend
|
||||||
; */
|
; * %ecx = curmatch
|
||||||
|
; * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
|
||||||
ALIGN 4
|
; * %esi = windowbestlen - i.e., (window + bestlen)
|
||||||
LookupLoop:
|
; * %edi = prev
|
||||||
and ecx, edx
|
; * %ebp = limit
|
||||||
movzx ecx, WORD PTR[edi+ecx*2]
|
; */
|
||||||
cmp ecx, ebp
|
|
||||||
jbe LeaveNow
|
ALIGN 4
|
||||||
sub edx, 000010000H
|
LookupLoop:
|
||||||
js LeaveNow
|
and ecx, edx
|
||||||
|
movzx ecx, WORD PTR[edi+ecx*2]
|
||||||
LoopEntry:
|
cmp ecx, ebp
|
||||||
movzx eax, WORD PTR[esi+ecx-1]
|
jbe LeaveNow
|
||||||
cmp eax, ebx
|
sub edx, 000010000H
|
||||||
jnz SHORT LookupLoop
|
js LeaveNow
|
||||||
|
|
||||||
mov eax, [esp+window]
|
LoopEntry:
|
||||||
movzx eax, WORD PTR[eax+ecx]
|
movzx eax, WORD PTR[esi+ecx-1]
|
||||||
cmp eax, [esp+scanstart]
|
cmp eax, ebx
|
||||||
jnz SHORT LookupLoop
|
jnz SHORT LookupLoop
|
||||||
|
|
||||||
;/* Store the current value of chainlen. */
|
mov eax, [esp+window]
|
||||||
|
movzx eax, WORD PTR[eax+ecx]
|
||||||
mov [esp+chainlenwmask], edx
|
cmp eax, [esp+scanstart]
|
||||||
|
jnz SHORT LookupLoop
|
||||||
;/* Point %edi to the string under scrutiny, and %esi to the string we */
|
|
||||||
;/* are hoping to match it up with. In actuality, %esi and %edi are */
|
;/* Store the current value of chainlen. */
|
||||||
;/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
|
|
||||||
;/* initialized to -(MAX_MATCH_8 - scanalign). */
|
mov [esp+chainlenwmask], edx
|
||||||
|
|
||||||
mov esi, [esp+window]
|
;/* Point %edi to the string under scrutiny, and %esi to the string we */
|
||||||
mov edi, [esp+scan]
|
;/* are hoping to match it up with. In actuality, %esi and %edi are */
|
||||||
add esi, ecx
|
;/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
|
||||||
mov eax, [esp+scanalign]
|
;/* initialized to -(MAX_MATCH_8 - scanalign). */
|
||||||
mov edx, -MAX_MATCH_8
|
|
||||||
lea edi, [edi+eax+MAX_MATCH_8]
|
mov esi, [esp+window]
|
||||||
lea esi, [esi+eax+MAX_MATCH_8]
|
mov edi, [esp+scan]
|
||||||
|
add esi, ecx
|
||||||
;/* Test the strings for equality, 8 bytes at a time. At the end,
|
mov eax, [esp+scanalign]
|
||||||
; * adjust %edx so that it is offset to the exact byte that mismatched.
|
mov edx, -MAX_MATCH_8
|
||||||
; *
|
lea edi, [edi+eax+MAX_MATCH_8]
|
||||||
; * We already know at this point that the first three bytes of the
|
lea esi, [esi+eax+MAX_MATCH_8]
|
||||||
; * strings match each other, and they can be safely passed over before
|
|
||||||
; * starting the compare loop. So what this code does is skip over 0-3
|
;/* Test the strings for equality, 8 bytes at a time. At the end,
|
||||||
; * bytes, as much as necessary in order to dword-align the %edi
|
; * adjust %edx so that it is offset to the exact byte that mismatched.
|
||||||
; * pointer. (%esi will still be misaligned three times out of four.)
|
; *
|
||||||
; *
|
; * We already know at this point that the first three bytes of the
|
||||||
; * It should be confessed that this loop usually does not represent
|
; * strings match each other, and they can be safely passed over before
|
||||||
; * much of the total running time. Replacing it with a more
|
; * starting the compare loop. So what this code does is skip over 0-3
|
||||||
; * straightforward "rep cmpsb" would not drastically degrade
|
; * bytes, as much as necessary in order to dword-align the %edi
|
||||||
; * performance.
|
; * pointer. (%esi will still be misaligned three times out of four.)
|
||||||
; */
|
; *
|
||||||
|
; * It should be confessed that this loop usually does not represent
|
||||||
LoopCmps:
|
; * much of the total running time. Replacing it with a more
|
||||||
mov eax, DWORD PTR[esi+edx]
|
; * straightforward "rep cmpsb" would not drastically degrade
|
||||||
xor eax, DWORD PTR[edi+edx]
|
; * performance.
|
||||||
jnz SHORT LeaveLoopCmps
|
; */
|
||||||
|
|
||||||
mov eax, DWORD PTR[esi+edx+4]
|
LoopCmps:
|
||||||
xor eax, DWORD PTR[edi+edx+4]
|
mov eax, DWORD PTR[esi+edx]
|
||||||
jnz SHORT LeaveLoopCmps4
|
xor eax, DWORD PTR[edi+edx]
|
||||||
|
jnz SHORT LeaveLoopCmps
|
||||||
add edx, 8
|
|
||||||
jnz SHORT LoopCmps
|
mov eax, DWORD PTR[esi+edx+4]
|
||||||
jmp LenMaximum
|
xor eax, DWORD PTR[edi+edx+4]
|
||||||
ALIGN 4
|
jnz SHORT LeaveLoopCmps4
|
||||||
|
|
||||||
LeaveLoopCmps4:
|
add edx, 8
|
||||||
add edx, 4
|
jnz SHORT LoopCmps
|
||||||
|
jmp LenMaximum
|
||||||
LeaveLoopCmps:
|
ALIGN 4
|
||||||
test eax, 00000FFFFH
|
|
||||||
jnz SHORT LenLower
|
LeaveLoopCmps4:
|
||||||
|
add edx, 4
|
||||||
add edx, 2
|
|
||||||
shr eax, 16
|
LeaveLoopCmps:
|
||||||
|
test eax, 00000FFFFH
|
||||||
LenLower:
|
jnz SHORT LenLower
|
||||||
sub al, 1
|
|
||||||
adc edx, 0
|
add edx, 2
|
||||||
|
shr eax, 16
|
||||||
;/* Calculate the length of the match. If it is longer than MAX_MATCH, */
|
|
||||||
;/* then automatically accept it as the best possible match and leave. */
|
LenLower:
|
||||||
|
sub al, 1
|
||||||
lea eax, [edi+edx]
|
adc edx, 0
|
||||||
mov edi, [esp+scan]
|
|
||||||
sub eax, edi
|
;/* Calculate the length of the match. If it is longer than MAX_MATCH, */
|
||||||
cmp eax, MAX_MATCH
|
;/* then automatically accept it as the best possible match and leave. */
|
||||||
jge SHORT LenMaximum
|
|
||||||
|
lea eax, [edi+edx]
|
||||||
;/* If the length of the match is not longer than the best match we */
|
mov edi, [esp+scan]
|
||||||
;/* have so far, then forget it and return to the lookup loop. */
|
sub eax, edi
|
||||||
|
cmp eax, MAX_MATCH
|
||||||
mov edx, [esp+deflatestate]
|
jge SHORT LenMaximum
|
||||||
mov ebx, [esp+bestlen]
|
|
||||||
cmp eax, ebx
|
;/* If the length of the match is not longer than the best match we */
|
||||||
jg SHORT LongerMatch
|
;/* have so far, then forget it and return to the lookup loop. */
|
||||||
mov esi, [esp+windowbestlen]
|
|
||||||
mov edi, [edx].ds_prev
|
mov edx, [esp+deflatestate]
|
||||||
mov ebx, [esp+scanend]
|
mov ebx, [esp+bestlen]
|
||||||
mov edx, [esp+chainlenwmask]
|
cmp eax, ebx
|
||||||
jmp LookupLoop
|
jg SHORT LongerMatch
|
||||||
ALIGN 4
|
mov esi, [esp+windowbestlen]
|
||||||
|
mov edi, [edx].ds_prev
|
||||||
;/* s->match_start = cur_match; */
|
mov ebx, [esp+scanend]
|
||||||
;/* best_len = len; */
|
mov edx, [esp+chainlenwmask]
|
||||||
;/* if (len >= nice_match) break; */
|
jmp LookupLoop
|
||||||
;/* scan_end = *(ushf*)(scan+best_len-1); */
|
ALIGN 4
|
||||||
|
|
||||||
LongerMatch:
|
;/* s->match_start = cur_match; */
|
||||||
mov ebx, [esp+nicematch]
|
;/* best_len = len; */
|
||||||
mov [esp+bestlen], eax
|
;/* if (len >= nice_match) break; */
|
||||||
mov [edx].ds_match_start, ecx
|
;/* scan_end = *(ushf*)(scan+best_len-1); */
|
||||||
cmp eax, ebx
|
|
||||||
jge SHORT LeaveNow
|
LongerMatch:
|
||||||
mov esi, [esp+window]
|
mov ebx, [esp+nicematch]
|
||||||
add esi, eax
|
mov [esp+bestlen], eax
|
||||||
mov [esp+windowbestlen], esi
|
mov [edx].ds_match_start, ecx
|
||||||
movzx ebx, WORD PTR[edi+eax-1]
|
cmp eax, ebx
|
||||||
mov edi, [edx].ds_prev
|
jge SHORT LeaveNow
|
||||||
mov [esp+scanend], ebx
|
mov esi, [esp+window]
|
||||||
mov edx, [esp+chainlenwmask]
|
add esi, eax
|
||||||
jmp LookupLoop
|
mov [esp+windowbestlen], esi
|
||||||
ALIGN 4
|
movzx ebx, WORD PTR[edi+eax-1]
|
||||||
|
mov edi, [edx].ds_prev
|
||||||
;/* Accept the current string, with the maximum possible length. */
|
mov [esp+scanend], ebx
|
||||||
|
mov edx, [esp+chainlenwmask]
|
||||||
LenMaximum:
|
jmp LookupLoop
|
||||||
mov edx, [esp+deflatestate]
|
ALIGN 4
|
||||||
mov DWORD PTR[esp+bestlen], MAX_MATCH
|
|
||||||
mov [edx].ds_match_start, ecx
|
;/* Accept the current string, with the maximum possible length. */
|
||||||
|
|
||||||
;/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
|
LenMaximum:
|
||||||
;/* return s->lookahead; */
|
mov edx, [esp+deflatestate]
|
||||||
|
mov DWORD PTR[esp+bestlen], MAX_MATCH
|
||||||
LeaveNow:
|
mov [edx].ds_match_start, ecx
|
||||||
mov edx, [esp+deflatestate]
|
|
||||||
mov ebx, [esp+bestlen]
|
;/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
|
||||||
mov eax, [edx].ds_lookahead
|
;/* return s->lookahead; */
|
||||||
cmp ebx, eax
|
|
||||||
jg SHORT LookaheadRet
|
LeaveNow:
|
||||||
mov eax, ebx
|
mov edx, [esp+deflatestate]
|
||||||
LookaheadRet:
|
mov ebx, [esp+bestlen]
|
||||||
|
mov eax, [edx].ds_lookahead
|
||||||
; Restore the stack and return from whence we came.
|
cmp ebx, eax
|
||||||
|
jg SHORT LookaheadRet
|
||||||
add esp, varsize
|
mov eax, ebx
|
||||||
pop ebx
|
LookaheadRet:
|
||||||
pop esi
|
|
||||||
pop edi
|
; Restore the stack and return from whence we came.
|
||||||
pop ebp
|
|
||||||
ret
|
add esp, varsize
|
||||||
|
pop ebx
|
||||||
_longest_match ENDP
|
pop esi
|
||||||
|
pop edi
|
||||||
_TEXT ENDS
|
pop ebp
|
||||||
END
|
ret
|
||||||
|
|
||||||
|
_longest_match ENDP
|
||||||
|
|
||||||
|
_TEXT ENDS
|
||||||
|
END
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,206 +1,62 @@
|
||||||
/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86
|
/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86
|
||||||
* Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
|
* Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
|
||||||
* File written by Gilles Vollant, by modifiying the longest_match
|
* File written by Gilles Vollant, by modifiying the longest_match
|
||||||
* from Jean-loup Gailly in deflate.c
|
* from Jean-loup Gailly in deflate.c
|
||||||
* it prepare all parameters and call the assembly longest_match_gvasm
|
* it prepare all parameters and call the assembly longest_match_gvasm
|
||||||
* longest_match execute standard C code is wmask != 0x7fff
|
* longest_match execute standard C code is wmask != 0x7fff
|
||||||
* (assembly code is faster with a fixed wmask)
|
* (assembly code is faster with a fixed wmask)
|
||||||
*
|
*
|
||||||
*/
|
* Read comment at beginning of gvmat32.asm for more information
|
||||||
|
*/
|
||||||
#include "deflate.h"
|
|
||||||
|
#if defined(ASMV) && (!defined(NOOLDPENTIUMCODE))
|
||||||
#ifdef ASMV
|
#include "deflate.h"
|
||||||
#define NIL 0
|
|
||||||
|
/* if your C compiler don't add underline before function name,
|
||||||
#define UNALIGNED_OK
|
define ADD_UNDERLINE_ASMFUNC */
|
||||||
|
#ifdef ADD_UNDERLINE_ASMFUNC
|
||||||
|
#define longest_match_7fff _longest_match_7fff
|
||||||
/* if your C compiler don't add underline before function name,
|
#define longest_match_686 _longest_match_686
|
||||||
define ADD_UNDERLINE_ASMFUNC */
|
#define cpudetect32 _cpudetect32
|
||||||
#ifdef ADD_UNDERLINE_ASMFUNC
|
#endif
|
||||||
#define longest_match_7fff _longest_match_7fff
|
|
||||||
#define longest_match_686 _longest_match_686
|
|
||||||
#define cpudetect32 _cpudetect32
|
unsigned long cpudetect32();
|
||||||
#endif
|
|
||||||
|
uInt longest_match_c(
|
||||||
|
deflate_state *s,
|
||||||
|
IPos cur_match); /* current match */
|
||||||
void match_init()
|
|
||||||
{
|
|
||||||
}
|
uInt longest_match_7fff(
|
||||||
|
deflate_state *s,
|
||||||
unsigned long cpudetect32();
|
IPos cur_match); /* current match */
|
||||||
|
|
||||||
uInt longest_match_c(
|
uInt longest_match_686(
|
||||||
deflate_state *s,
|
deflate_state *s,
|
||||||
IPos cur_match); /* current match */
|
IPos cur_match); /* current match */
|
||||||
|
|
||||||
|
|
||||||
uInt longest_match_7fff(
|
static uInt iIsPPro=2;
|
||||||
deflate_state *s,
|
|
||||||
IPos cur_match); /* current match */
|
void match_init ()
|
||||||
|
{
|
||||||
uInt longest_match_686(
|
iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
|
||||||
deflate_state *s,
|
}
|
||||||
IPos cur_match); /* current match */
|
|
||||||
|
uInt longest_match(
|
||||||
uInt longest_match(
|
deflate_state *s,
|
||||||
deflate_state *s,
|
IPos cur_match) /* current match */
|
||||||
IPos cur_match) /* current match */
|
{
|
||||||
{
|
if (iIsPPro!=0)
|
||||||
static uInt iIsPPro=2;
|
return longest_match_686(s,cur_match);
|
||||||
|
|
||||||
if ((s->w_mask == 0x7fff) && (iIsPPro==0))
|
if (s->w_mask != 0x7fff)
|
||||||
return longest_match_7fff(s,cur_match);
|
return longest_match_686(s,cur_match);
|
||||||
|
|
||||||
if (iIsPPro==1)
|
/* now ((s->w_mask == 0x7fff) && (iIsPPro==0)) */
|
||||||
return longest_match_686(s,cur_match);
|
return longest_match_7fff(s,cur_match);
|
||||||
|
}
|
||||||
if (iIsPPro==2)
|
|
||||||
iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
|
|
||||||
|
#endif /* defined(ASMV) && (!defined(NOOLDPENTIUMCODE)) */
|
||||||
return longest_match_c(s,cur_match);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uInt longest_match_c(s, cur_match)
|
|
||||||
deflate_state *s;
|
|
||||||
IPos cur_match; /* current match */
|
|
||||||
{
|
|
||||||
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
|
||||||
register Bytef *scan = s->window + s->strstart; /* current string */
|
|
||||||
register Bytef *match; /* matched string */
|
|
||||||
register int len; /* length of current match */
|
|
||||||
int best_len = s->prev_length; /* best match length so far */
|
|
||||||
int nice_match = s->nice_match; /* stop if match long enough */
|
|
||||||
IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
|
|
||||||
s->strstart - (IPos)MAX_DIST(s) : NIL;
|
|
||||||
/* Stop when cur_match becomes <= limit. To simplify the code,
|
|
||||||
* we prevent matches with the string of window index 0.
|
|
||||||
*/
|
|
||||||
Posf *prev = s->prev;
|
|
||||||
uInt wmask = s->w_mask;
|
|
||||||
|
|
||||||
#ifdef UNALIGNED_OK
|
|
||||||
/* Compare two bytes at a time. Note: this is not always beneficial.
|
|
||||||
* Try with and without -DUNALIGNED_OK to check.
|
|
||||||
*/
|
|
||||||
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
|
|
||||||
register ush scan_start = *(ushf*)scan;
|
|
||||||
register ush scan_end = *(ushf*)(scan+best_len-1);
|
|
||||||
#else
|
|
||||||
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
|
|
||||||
register Byte scan_end1 = scan[best_len-1];
|
|
||||||
register Byte scan_end = scan[best_len];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
|
||||||
* It is easy to get rid of this optimization if necessary.
|
|
||||||
*/
|
|
||||||
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
|
||||||
|
|
||||||
/* Do not waste too much time if we already have a good match: */
|
|
||||||
if (s->prev_length >= s->good_match) {
|
|
||||||
chain_length >>= 2;
|
|
||||||
}
|
|
||||||
/* Do not look for matches beyond the end of the input. This is necessary
|
|
||||||
* to make deflate deterministic.
|
|
||||||
*/
|
|
||||||
if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
|
||||||
|
|
||||||
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
|
||||||
|
|
||||||
do {
|
|
||||||
Assert(cur_match < s->strstart, "no future");
|
|
||||||
match = s->window + cur_match;
|
|
||||||
|
|
||||||
/* Skip to next match if the match length cannot increase
|
|
||||||
* or if the match length is less than 2:
|
|
||||||
*/
|
|
||||||
#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
|
|
||||||
/* This code assumes sizeof(unsigned short) == 2. Do not use
|
|
||||||
* UNALIGNED_OK if your compiler uses a different size.
|
|
||||||
*/
|
|
||||||
if (*(ushf*)(match+best_len-1) != scan_end ||
|
|
||||||
*(ushf*)match != scan_start) continue;
|
|
||||||
|
|
||||||
/* It is not necessary to compare scan[2] and match[2] since they are
|
|
||||||
* always equal when the other bytes match, given that the hash keys
|
|
||||||
* are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
|
|
||||||
* strstart+3, +5, ... up to strstart+257. We check for insufficient
|
|
||||||
* lookahead only every 4th comparison; the 128th check will be made
|
|
||||||
* at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
|
|
||||||
* necessary to put more guard bytes at the end of the window, or
|
|
||||||
* to check more often for insufficient lookahead.
|
|
||||||
*/
|
|
||||||
Assert(scan[2] == match[2], "scan[2]?");
|
|
||||||
scan++, match++;
|
|
||||||
do {
|
|
||||||
} while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
|
||||||
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
|
||||||
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
|
||||||
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
|
||||||
scan < strend);
|
|
||||||
/* The funny "do {}" generates better code on most compilers */
|
|
||||||
|
|
||||||
/* Here, scan <= window+strstart+257 */
|
|
||||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
|
||||||
if (*scan == *match) scan++;
|
|
||||||
|
|
||||||
len = (MAX_MATCH - 1) - (int)(strend-scan);
|
|
||||||
scan = strend - (MAX_MATCH-1);
|
|
||||||
|
|
||||||
#else /* UNALIGNED_OK */
|
|
||||||
|
|
||||||
if (match[best_len] != scan_end ||
|
|
||||||
match[best_len-1] != scan_end1 ||
|
|
||||||
*match != *scan ||
|
|
||||||
*++match != scan[1]) continue;
|
|
||||||
|
|
||||||
/* The check at best_len-1 can be removed because it will be made
|
|
||||||
* again later. (This heuristic is not always a win.)
|
|
||||||
* It is not necessary to compare scan[2] and match[2] since they
|
|
||||||
* are always equal when the other bytes match, given that
|
|
||||||
* the hash keys are equal and that HASH_BITS >= 8.
|
|
||||||
*/
|
|
||||||
scan += 2, match++;
|
|
||||||
Assert(*scan == *match, "match[2]?");
|
|
||||||
|
|
||||||
/* We check for insufficient lookahead only every 8th comparison;
|
|
||||||
* the 256th check will be made at strstart+258.
|
|
||||||
*/
|
|
||||||
do {
|
|
||||||
} while (*++scan == *++match && *++scan == *++match &&
|
|
||||||
*++scan == *++match && *++scan == *++match &&
|
|
||||||
*++scan == *++match && *++scan == *++match &&
|
|
||||||
*++scan == *++match && *++scan == *++match &&
|
|
||||||
scan < strend);
|
|
||||||
|
|
||||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
|
||||||
|
|
||||||
len = MAX_MATCH - (int)(strend - scan);
|
|
||||||
scan = strend - MAX_MATCH;
|
|
||||||
|
|
||||||
#endif /* UNALIGNED_OK */
|
|
||||||
|
|
||||||
if (len > best_len) {
|
|
||||||
s->match_start = cur_match;
|
|
||||||
best_len = len;
|
|
||||||
if (len >= nice_match) break;
|
|
||||||
#ifdef UNALIGNED_OK
|
|
||||||
scan_end = *(ushf*)(scan+best_len-1);
|
|
||||||
#else
|
|
||||||
scan_end1 = scan[best_len-1];
|
|
||||||
scan_end = scan[best_len];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} while ((cur_match = prev[cur_match & wmask]) > limit
|
|
||||||
&& --chain_length != 0);
|
|
||||||
|
|
||||||
if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
|
|
||||||
return s->lookahead;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ASMV */
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,3 +1,3 @@
|
||||||
cl /I..\.. /O2 /c gvmat32c.c
|
cl /DASMV /I..\.. /O2 /c gvmat32c.c
|
||||||
ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm
|
ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm
|
||||||
ml /coff /Zi /c /Flinffas32.lst inffas32.asm
|
ml /coff /Zi /c /Flinffas32.lst inffas32.asm
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
/* crypt.h -- base code for crypt/uncrypt ZIPfile
|
/* crypt.h -- base code for crypt/uncrypt ZIPfile
|
||||||
|
|
||||||
|
|
||||||
Version 1.00, September 10th, 2003
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
Copyright (C) 1998-2003 Gilles Vollant
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
|
||||||
This code is a modified version of crypting code in Infozip distribution
|
This code is a modified version of crypting code in Infozip distribution
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
/* ioapi.c -- IO base function header for compress/uncompress .zip
|
/* ioapi.c -- IO base function header for compress/uncompress .zip
|
||||||
files using zlib + zip or unzip API
|
files using zlib + zip or unzip API
|
||||||
|
|
||||||
Version 1.00, September 10th, 2003
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
Copyright (C) 1998-2003 Gilles Vollant
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -94,7 +94,7 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
|
||||||
uLong size;
|
uLong size;
|
||||||
{
|
{
|
||||||
uLong ret;
|
uLong ret;
|
||||||
ret = fread(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +106,7 @@ uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
|
||||||
uLong size;
|
uLong size;
|
||||||
{
|
{
|
||||||
uLong ret;
|
uLong ret;
|
||||||
ret = fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||||
files using zlib + zip or unzip API
|
files using zlib + zip or unzip API
|
||||||
|
|
||||||
Version 1.00, September 10th, 2003
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
Copyright (C) 1998-2003 Gilles Vollant
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ZLIBIOAPI_H
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
files using zlib + zip or unzip API
|
files using zlib + zip or unzip API
|
||||||
This IO API version uses the Win32 API (for Microsoft Windows)
|
This IO API version uses the Win32 API (for Microsoft Windows)
|
||||||
|
|
||||||
Version 1.00, September 10th, 2003
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
Copyright (C) 1998-2003 Gilles Vollant
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
files using zlib + zip or unzip API
|
files using zlib + zip or unzip API
|
||||||
This IO API version uses the Win32 API (for Microsoft Windows)
|
This IO API version uses the Win32 API (for Microsoft Windows)
|
||||||
|
|
||||||
Version 1.00, September 10th, 2003
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
Copyright (C) 1998-2003 Gilles Vollant
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ unit zlibpas;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
ZLIB_VERSION = '1.2.1';
|
ZLIB_VERSION = '1.2.3';
|
||||||
|
|
||||||
type
|
type
|
||||||
alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
|
alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* puff.c
|
* puff.c
|
||||||
* Copyright (C) 2002, 2003 Mark Adler
|
* Copyright (C) 2002-2004 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in puff.h
|
* For conditions of distribution and use, see copyright notice in puff.h
|
||||||
* version 1.7, 3 Mar 2003
|
* version 1.8, 9 Jan 2004
|
||||||
*
|
*
|
||||||
* puff.c is a simple inflate written to be an unambiguous way to specify the
|
* puff.c is a simple inflate written to be an unambiguous way to specify the
|
||||||
* deflate format. It is not written for speed but rather simplicity. As a
|
* deflate format. It is not written for speed but rather simplicity. As a
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
* 1.6 7 Aug 2002 - Minor format changes
|
* 1.6 7 Aug 2002 - Minor format changes
|
||||||
* 1.7 3 Mar 2003 - Added test code for distribution
|
* 1.7 3 Mar 2003 - Added test code for distribution
|
||||||
* - Added zlib-like license
|
* - Added zlib-like license
|
||||||
|
* 1.8 9 Jan 2004 - Added some comments on no distance codes case
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
|
#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
|
||||||
|
|
@ -577,6 +578,9 @@ local int fixed(struct state *s)
|
||||||
* block is fewer bits), but it is allowed by the format. So incomplete
|
* block is fewer bits), but it is allowed by the format. So incomplete
|
||||||
* literal/length codes of one symbol should also be permitted.
|
* literal/length codes of one symbol should also be permitted.
|
||||||
*
|
*
|
||||||
|
* - If there are only literal codes and no lengths, then there are no distance
|
||||||
|
* codes. This is represented by one distance code with zero bits.
|
||||||
|
*
|
||||||
* - The list of up to 286 length/literal lengths and up to 30 distance lengths
|
* - The list of up to 286 length/literal lengths and up to 30 distance lengths
|
||||||
* are themselves compressed using Huffman codes and run-length encoding. In
|
* are themselves compressed using Huffman codes and run-length encoding. In
|
||||||
* the list of code lengths, a 0 symbol means no code, a 1..15 symbol means
|
* the list of code lengths, a 0 symbol means no code, a 1..15 symbol means
|
||||||
|
|
|
||||||
|
|
@ -1,149 +1,275 @@
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdio.h>
|
#include <stdlib.h>
|
||||||
#include <stdlib.h>
|
#include <windows.h>
|
||||||
#include <windows.h>
|
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr)
|
|
||||||
{
|
void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B)
|
||||||
FILE* stream;
|
{
|
||||||
void* ptr;
|
R->HighPart = A.HighPart - B.HighPart;
|
||||||
int retVal=1;
|
if (A.LowPart >= B.LowPart)
|
||||||
stream=fopen(filename, "rb");
|
R->LowPart = A.LowPart - B.LowPart;
|
||||||
if (stream==NULL)
|
else
|
||||||
return 0;
|
{
|
||||||
|
R->LowPart = A.LowPart - B.LowPart;
|
||||||
fseek(stream,0,SEEK_END);
|
R->HighPart --;
|
||||||
|
}
|
||||||
*plFileSize=ftell(stream);
|
}
|
||||||
fseek(stream,0,SEEK_SET);
|
|
||||||
ptr=malloc((*plFileSize)+1);
|
#ifdef _M_X64
|
||||||
if (ptr==NULL)
|
// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc
|
||||||
retVal=0;
|
unsigned __int64 __rdtsc(void);
|
||||||
else
|
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||||
{
|
{
|
||||||
if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize))
|
// printf("rdtsc = %I64x\n",__rdtsc());
|
||||||
retVal=0;
|
pbeginTime64->QuadPart=__rdtsc();
|
||||||
}
|
}
|
||||||
fclose(stream);
|
|
||||||
*pFilePtr=ptr;
|
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||||
return retVal;
|
{
|
||||||
}
|
LARGE_INTEGER LIres;
|
||||||
|
unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart));
|
||||||
int main(int argc, char *argv[])
|
LIres.QuadPart=res;
|
||||||
{
|
// printf("rdtsc = %I64x\n",__rdtsc());
|
||||||
int BlockSizeCompress=0x8000;
|
return LIres;
|
||||||
int BlockSizeUncompress=0x8000;
|
}
|
||||||
int cprLevel=Z_DEFAULT_COMPRESSION ;
|
#else
|
||||||
long lFileSize;
|
#ifdef _M_IX86
|
||||||
unsigned char* FilePtr;
|
void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
|
||||||
long lBufferSizeCpr;
|
{
|
||||||
long lBufferSizeUncpr;
|
DWORD dwEdx,dwEax;
|
||||||
long lCompressedSize=0;
|
_asm
|
||||||
unsigned char* CprPtr;
|
{
|
||||||
unsigned char* UncprPtr;
|
rdtsc
|
||||||
long lSizeCpr,lSizeUncpr;
|
mov dwEax,eax
|
||||||
DWORD dwGetTick;
|
mov dwEdx,edx
|
||||||
|
}
|
||||||
if (argc<=1)
|
pbeginTime64->LowPart=dwEax;
|
||||||
{
|
pbeginTime64->HighPart=dwEdx;
|
||||||
printf("run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n");
|
}
|
||||||
return 0;
|
|
||||||
}
|
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||||
|
{
|
||||||
if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0)
|
myGetRDTSC32(pbeginTime64);
|
||||||
{
|
}
|
||||||
printf("error reading %s\n",argv[1]);
|
|
||||||
return 1;
|
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||||
}
|
{
|
||||||
else printf("file %s read, %u bytes\n",argv[1],lFileSize);
|
LARGE_INTEGER LIres,endTime64;
|
||||||
|
myGetRDTSC32(&endTime64);
|
||||||
if (argc>=3)
|
|
||||||
BlockSizeCompress=atol(argv[2]);
|
LIres.LowPart=LIres.HighPart=0;
|
||||||
|
MyDoMinus64(&LIres,endTime64,beginTime64);
|
||||||
if (argc>=4)
|
return LIres;
|
||||||
BlockSizeUncompress=atol(argv[3]);
|
}
|
||||||
|
#else
|
||||||
if (argc>=5)
|
void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
|
||||||
cprLevel=(int)atol(argv[4]);
|
{
|
||||||
|
}
|
||||||
lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;
|
|
||||||
lBufferSizeUncpr = lBufferSizeCpr;
|
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||||
|
{
|
||||||
CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress);
|
}
|
||||||
UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress);
|
|
||||||
|
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||||
dwGetTick=GetTickCount();
|
{
|
||||||
{
|
LARGE_INTEGER lr;
|
||||||
z_stream zcpr;
|
lr.QuadPart=0;
|
||||||
int ret=Z_OK;
|
return lr;
|
||||||
long lOrigToDo = lFileSize;
|
}
|
||||||
long lOrigDone = 0;
|
#endif
|
||||||
int step=0;
|
#endif
|
||||||
memset(&zcpr,0,sizeof(z_stream));
|
|
||||||
deflateInit(&zcpr,cprLevel);
|
void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf)
|
||||||
|
{
|
||||||
zcpr.next_in = FilePtr;
|
if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(pbeginTime64)))
|
||||||
zcpr.next_out = CprPtr;
|
{
|
||||||
|
pbeginTime64->LowPart = GetTickCount();
|
||||||
|
pbeginTime64->HighPart = 0;
|
||||||
do
|
}
|
||||||
{
|
}
|
||||||
long all_read_before = zcpr.total_in;
|
|
||||||
zcpr.avail_in = min(lOrigToDo,BlockSizeCompress);
|
DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||||
zcpr.avail_out = BlockSizeCompress;
|
{
|
||||||
ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH);
|
LARGE_INTEGER endTime64,ticksPerSecond,ticks;
|
||||||
lOrigDone += (zcpr.total_in-all_read_before);
|
DWORDLONG ticksShifted,tickSecShifted;
|
||||||
lOrigToDo -= (zcpr.total_in-all_read_before);
|
DWORD dwLog=16+0;
|
||||||
step++;
|
DWORD dwRet;
|
||||||
} while (ret==Z_OK);
|
if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(&endTime64)))
|
||||||
|
dwRet = (GetTickCount() - beginTime64.LowPart)*1;
|
||||||
lSizeCpr=zcpr.total_out;
|
else
|
||||||
deflateEnd(&zcpr);
|
{
|
||||||
dwGetTick=GetTickCount()-dwGetTick;
|
MyDoMinus64(&ticks,endTime64,beginTime64);
|
||||||
printf("total compress size = %u, in %u step\n",lSizeCpr,step);
|
QueryPerformanceFrequency(&ticksPerSecond);
|
||||||
printf("time = %u msec = %f sec\n\n",dwGetTick,dwGetTick/(double)1000.);
|
|
||||||
}
|
|
||||||
|
{
|
||||||
dwGetTick=GetTickCount();
|
ticksShifted = Int64ShrlMod32(*(DWORDLONG*)&ticks,dwLog);
|
||||||
{
|
tickSecShifted = Int64ShrlMod32(*(DWORDLONG*)&ticksPerSecond,dwLog);
|
||||||
z_stream zcpr;
|
|
||||||
int ret=Z_OK;
|
}
|
||||||
long lOrigToDo = lSizeCpr;
|
|
||||||
long lOrigDone = 0;
|
dwRet = (DWORD)((((DWORD)ticksShifted)*1000)/(DWORD)(tickSecShifted));
|
||||||
int step=0;
|
dwRet *=1;
|
||||||
memset(&zcpr,0,sizeof(z_stream));
|
}
|
||||||
inflateInit(&zcpr);
|
return dwRet;
|
||||||
|
}
|
||||||
zcpr.next_in = CprPtr;
|
|
||||||
zcpr.next_out = UncprPtr;
|
int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr)
|
||||||
|
{
|
||||||
|
FILE* stream;
|
||||||
do
|
void* ptr;
|
||||||
{
|
int retVal=1;
|
||||||
long all_read_before = zcpr.total_in;
|
stream=fopen(filename, "rb");
|
||||||
zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress);
|
if (stream==NULL)
|
||||||
zcpr.avail_out = BlockSizeUncompress;
|
return 0;
|
||||||
ret=inflate(&zcpr,Z_SYNC_FLUSH);
|
|
||||||
lOrigDone += (zcpr.total_in-all_read_before);
|
fseek(stream,0,SEEK_END);
|
||||||
lOrigToDo -= (zcpr.total_in-all_read_before);
|
|
||||||
step++;
|
*plFileSize=ftell(stream);
|
||||||
} while (ret==Z_OK);
|
fseek(stream,0,SEEK_SET);
|
||||||
|
ptr=malloc((*plFileSize)+1);
|
||||||
lSizeUncpr=zcpr.total_out;
|
if (ptr==NULL)
|
||||||
inflateEnd(&zcpr);
|
retVal=0;
|
||||||
dwGetTick=GetTickCount()-dwGetTick;
|
else
|
||||||
printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step);
|
{
|
||||||
printf("time = %u msec = %f sec\n\n",dwGetTick,dwGetTick/(double)1000.);
|
if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize))
|
||||||
}
|
retVal=0;
|
||||||
|
}
|
||||||
if (lSizeUncpr==lFileSize)
|
fclose(stream);
|
||||||
{
|
*pFilePtr=ptr;
|
||||||
if (memcmp(FilePtr,UncprPtr,lFileSize)==0)
|
return retVal;
|
||||||
printf("compare ok\n");
|
}
|
||||||
|
|
||||||
}
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
return 0;
|
int BlockSizeCompress=0x8000;
|
||||||
|
int BlockSizeUncompress=0x8000;
|
||||||
}
|
int cprLevel=Z_DEFAULT_COMPRESSION ;
|
||||||
|
long lFileSize;
|
||||||
|
unsigned char* FilePtr;
|
||||||
|
long lBufferSizeCpr;
|
||||||
|
long lBufferSizeUncpr;
|
||||||
|
long lCompressedSize=0;
|
||||||
|
unsigned char* CprPtr;
|
||||||
|
unsigned char* UncprPtr;
|
||||||
|
long lSizeCpr,lSizeUncpr;
|
||||||
|
DWORD dwGetTick,dwMsecQP;
|
||||||
|
LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc;
|
||||||
|
|
||||||
|
if (argc<=1)
|
||||||
|
{
|
||||||
|
printf("run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0)
|
||||||
|
{
|
||||||
|
printf("error reading %s\n",argv[1]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else printf("file %s read, %u bytes\n",argv[1],lFileSize);
|
||||||
|
|
||||||
|
if (argc>=3)
|
||||||
|
BlockSizeCompress=atol(argv[2]);
|
||||||
|
|
||||||
|
if (argc>=4)
|
||||||
|
BlockSizeUncompress=atol(argv[3]);
|
||||||
|
|
||||||
|
if (argc>=5)
|
||||||
|
cprLevel=(int)atol(argv[4]);
|
||||||
|
|
||||||
|
lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;
|
||||||
|
lBufferSizeUncpr = lBufferSizeCpr;
|
||||||
|
|
||||||
|
CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress);
|
||||||
|
|
||||||
|
BeginCountPerfCounter(&li_qp,TRUE);
|
||||||
|
dwGetTick=GetTickCount();
|
||||||
|
BeginCountRdtsc(&li_rdtsc);
|
||||||
|
{
|
||||||
|
z_stream zcpr;
|
||||||
|
int ret=Z_OK;
|
||||||
|
long lOrigToDo = lFileSize;
|
||||||
|
long lOrigDone = 0;
|
||||||
|
int step=0;
|
||||||
|
memset(&zcpr,0,sizeof(z_stream));
|
||||||
|
deflateInit(&zcpr,cprLevel);
|
||||||
|
|
||||||
|
zcpr.next_in = FilePtr;
|
||||||
|
zcpr.next_out = CprPtr;
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
long all_read_before = zcpr.total_in;
|
||||||
|
zcpr.avail_in = min(lOrigToDo,BlockSizeCompress);
|
||||||
|
zcpr.avail_out = BlockSizeCompress;
|
||||||
|
ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH);
|
||||||
|
lOrigDone += (zcpr.total_in-all_read_before);
|
||||||
|
lOrigToDo -= (zcpr.total_in-all_read_before);
|
||||||
|
step++;
|
||||||
|
} while (ret==Z_OK);
|
||||||
|
|
||||||
|
lSizeCpr=zcpr.total_out;
|
||||||
|
deflateEnd(&zcpr);
|
||||||
|
dwGetTick=GetTickCount()-dwGetTick;
|
||||||
|
dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
|
||||||
|
dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
|
||||||
|
printf("total compress size = %u, in %u step\n",lSizeCpr,step);
|
||||||
|
printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
|
||||||
|
printf("defcpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
|
||||||
|
printf("defcpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
CprPtr=(unsigned char*)realloc(CprPtr,lSizeCpr);
|
||||||
|
UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress);
|
||||||
|
|
||||||
|
BeginCountPerfCounter(&li_qp,TRUE);
|
||||||
|
dwGetTick=GetTickCount();
|
||||||
|
BeginCountRdtsc(&li_rdtsc);
|
||||||
|
{
|
||||||
|
z_stream zcpr;
|
||||||
|
int ret=Z_OK;
|
||||||
|
long lOrigToDo = lSizeCpr;
|
||||||
|
long lOrigDone = 0;
|
||||||
|
int step=0;
|
||||||
|
memset(&zcpr,0,sizeof(z_stream));
|
||||||
|
inflateInit(&zcpr);
|
||||||
|
|
||||||
|
zcpr.next_in = CprPtr;
|
||||||
|
zcpr.next_out = UncprPtr;
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
long all_read_before = zcpr.total_in;
|
||||||
|
zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress);
|
||||||
|
zcpr.avail_out = BlockSizeUncompress;
|
||||||
|
ret=inflate(&zcpr,Z_SYNC_FLUSH);
|
||||||
|
lOrigDone += (zcpr.total_in-all_read_before);
|
||||||
|
lOrigToDo -= (zcpr.total_in-all_read_before);
|
||||||
|
step++;
|
||||||
|
} while (ret==Z_OK);
|
||||||
|
|
||||||
|
lSizeUncpr=zcpr.total_out;
|
||||||
|
inflateEnd(&zcpr);
|
||||||
|
dwGetTick=GetTickCount()-dwGetTick;
|
||||||
|
dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
|
||||||
|
dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
|
||||||
|
printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step);
|
||||||
|
printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
|
||||||
|
printf("uncpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
|
||||||
|
printf("uncpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lSizeUncpr==lFileSize)
|
||||||
|
{
|
||||||
|
if (memcmp(FilePtr,UncprPtr,lFileSize)==0)
|
||||||
|
printf("compare ok\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
Building instructions for the DLL versions of Zlib 1.21
|
Building instructions for the DLL versions of Zlib 1.2.3
|
||||||
=======================================================
|
========================================================
|
||||||
|
|
||||||
This directory contains projects that build zlib and minizip using
|
This directory contains projects that build zlib and minizip using
|
||||||
Microsoft Visual C++ 7.0/7.1.
|
Microsoft Visual C++ 7.0/7.1, and Visual C++ .
|
||||||
|
|
||||||
You don't need to build these projects yourself. You can download the
|
You don't need to build these projects yourself. You can download the
|
||||||
binaries from:
|
binaries from:
|
||||||
|
|
@ -11,18 +11,36 @@ binaries from:
|
||||||
More information can be found at this site.
|
More information can be found at this site.
|
||||||
|
|
||||||
|
|
||||||
Build instructions
|
Build instructions for Visual Studio 7.x (32 bits)
|
||||||
------------------
|
--------------------------------------------------
|
||||||
- Unzip zlib*.zip and copy the files from contrib\vstudio\vc7,
|
- Uncompress current zlib, including all contrib/* files
|
||||||
from contrib\vstudio\masmx86 and from contrib\minizip into the same
|
|
||||||
directory.
|
|
||||||
- Download the crtdll library from
|
- Download the crtdll library from
|
||||||
http://www.winimage.com/zLibDll/crtdll.zip
|
http://www.winimage.com/zLibDll/crtdll.zip
|
||||||
Unzip crtdll.zip to extract crtdll.lib.
|
Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc7.
|
||||||
- If you are using x86, use the Release target.
|
- Open contrib\vstudio\vc7\zlibvc.sln with Microsoft Visual C++ 7.x
|
||||||
- Open zlibvc.sln with Microsoft Visual C++ 7.0 or 7.1
|
|
||||||
(Visual Studio .Net 2002 or 2003).
|
(Visual Studio .Net 2002 or 2003).
|
||||||
|
|
||||||
|
Build instructions for Visual Studio 2005 (32 bits or 64 bits)
|
||||||
|
--------------------------------------------------------------
|
||||||
|
- Uncompress current zlib, including all contrib/* files
|
||||||
|
- For 32 bits only: download the crtdll library from
|
||||||
|
http://www.winimage.com/zLibDll/crtdll.zip
|
||||||
|
Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc8.
|
||||||
|
- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0
|
||||||
|
|
||||||
|
Build instructions for Visual Studio 2005 64 bits, PSDK compiler
|
||||||
|
----------------------------------------------------------------
|
||||||
|
at the time of writing this text file, Visual Studio 2005 (and
|
||||||
|
Microsoft Visual C++ 8.0) is on the beta 2 stage.
|
||||||
|
Using you can get the free 64 bits compiler from Platform SDK,
|
||||||
|
which is NOT a beta, and compile using the Visual studio 2005 IDE
|
||||||
|
see http://www.winimage.com/misc/sdk64onvs2005/ for instruction
|
||||||
|
|
||||||
|
- Uncompress current zlib, including all contrib/* files
|
||||||
|
- start Visual Studio 2005 from a platform SDK command prompt, using
|
||||||
|
the /useenv switch
|
||||||
|
- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0
|
||||||
|
|
||||||
|
|
||||||
Important
|
Important
|
||||||
---------
|
---------
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\minizip"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
|
@ -63,6 +64,7 @@
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
OmitFramePointers="TRUE"
|
OmitFramePointers="TRUE"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\minizip"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="4"
|
RuntimeLibrary="4"
|
||||||
|
|
@ -104,7 +106,7 @@
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
||||||
<File
|
<File
|
||||||
RelativePath="miniunz.c">
|
RelativePath="..\..\minizip\miniunz.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
@ -116,7 +118,7 @@
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath="zlibwapi.lib">
|
RelativePath="ReleaseDll\zlibwapi.lib">
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\minizip"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
|
@ -63,6 +64,7 @@
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
OmitFramePointers="TRUE"
|
OmitFramePointers="TRUE"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\minizip"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="4"
|
RuntimeLibrary="4"
|
||||||
|
|
@ -104,7 +106,7 @@
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
||||||
<File
|
<File
|
||||||
RelativePath="minizip.c">
|
RelativePath="..\..\minizip\minizip.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
@ -116,7 +118,7 @@
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath="zlibwapi.lib">
|
RelativePath="ReleaseDll\zlibwapi.lib">
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
#define IDR_VERSION1 1
|
#define IDR_VERSION1 1
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
FILEVERSION 1,2,1,0
|
FILEVERSION 1,2,3,0
|
||||||
PRODUCTVERSION 1,2,1,0
|
PRODUCTVERSION 1,2,3,0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
FILEOS VOS_DOS_WINDOWS32
|
||||||
|
|
@ -17,7 +17,7 @@ BEGIN
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression library\0"
|
VALUE "FileDescription", "zlib data compression library\0"
|
||||||
VALUE "FileVersion", "1.2.1.0\0"
|
VALUE "FileVersion", "1.2.3.0\0"
|
||||||
VALUE "InternalName", "zlib\0"
|
VALUE "InternalName", "zlib\0"
|
||||||
VALUE "OriginalFilename", "zlib.dll\0"
|
VALUE "OriginalFilename", "zlib.dll\0"
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
VALUE "ProductName", "ZLib.DLL\0"
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
RuntimeLibrary="5"
|
RuntimeLibrary="5"
|
||||||
|
|
@ -61,6 +62,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -102,6 +104,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;ASMV;ASMINF"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;ASMV;ASMINF"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -117,7 +120,7 @@
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
AdditionalOptions="gvmat32.obj inffas32.obj /NODEFAULTLIB "
|
AdditionalOptions="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj /NODEFAULTLIB "
|
||||||
OutputFile=".\zlibstat\zlibstat.lib"
|
OutputFile=".\zlibstat\zlibstat.lib"
|
||||||
SuppressStartupBanner="TRUE"/>
|
SuppressStartupBanner="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
|
|
@ -144,6 +147,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
|
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -182,49 +186,49 @@
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="">
|
Filter="">
|
||||||
<File
|
<File
|
||||||
RelativePath=".\adler32.c">
|
RelativePath="..\..\..\adler32.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\compress.c">
|
RelativePath="..\..\..\compress.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\crc32.c">
|
RelativePath="..\..\..\crc32.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\deflate.c">
|
RelativePath="..\..\..\deflate.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\gvmat32c.c">
|
RelativePath="..\..\masmx86\gvmat32c.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\gzio.c">
|
RelativePath="..\..\..\gzio.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\infback.c">
|
RelativePath="..\..\..\infback.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inffast.c">
|
RelativePath="..\..\..\inffast.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inflate.c">
|
RelativePath="..\..\..\inflate.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inftrees.c">
|
RelativePath="..\..\..\inftrees.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ioapi.c">
|
RelativePath="..\..\minizip\ioapi.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\trees.c">
|
RelativePath="..\..\..\trees.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\uncompr.c">
|
RelativePath="..\..\..\uncompr.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\unzip.c">
|
RelativePath="..\..\minizip\unzip.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zip.c">
|
RelativePath="..\..\minizip\zip.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zlib.rc">
|
RelativePath=".\zlib.rc">
|
||||||
|
|
@ -233,7 +237,7 @@
|
||||||
RelativePath=".\zlibvc.def">
|
RelativePath=".\zlibvc.def">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zutil.c">
|
RelativePath="..\..\..\zutil.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj",
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testZlibDll", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
ConfigName.0 = Debug
|
ConfigName.0 = Debug
|
||||||
|
|
@ -58,6 +60,16 @@ Global
|
||||||
{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32
|
{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32
|
||||||
{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
|
{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
|
||||||
{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
|
{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.Build.0 = Debug|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.ActiveCfg = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.Build.0 = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.ActiveCfg = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.Build.0 = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.Build.0 = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
|
||||||
|
{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
|
PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
|
|
@ -35,7 +36,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="gvmat32.obj inffas32.obj"
|
AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
|
||||||
OutputFile=".\DebugDll\zlibwapi.dll"
|
OutputFile=".\DebugDll\zlibwapi.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
|
|
@ -72,10 +73,12 @@
|
||||||
IntermediateDirectory=".\zlibDllWithoutAsm"
|
IntermediateDirectory=".\zlibDllWithoutAsm"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
WholeProgramOptimization="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
|
PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -134,10 +137,12 @@
|
||||||
IntermediateDirectory=".\zlibDllWithoutCrtDll"
|
IntermediateDirectory=".\zlibDllWithoutCrtDll"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
WholeProgramOptimization="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
|
PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -156,7 +161,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="gvmat32.obj inffas32.obj "
|
AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
|
||||||
OutputFile=".\zlibDllWithoutCrtDll\zlibwapi.dll"
|
OutputFile=".\zlibDllWithoutCrtDll\zlibwapi.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
|
|
@ -196,10 +201,12 @@
|
||||||
IntermediateDirectory=".\zlibvc__"
|
IntermediateDirectory=".\zlibvc__"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
WholeProgramOptimization="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
|
PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -256,10 +263,12 @@
|
||||||
IntermediateDirectory=".\ReleaseDll"
|
IntermediateDirectory=".\ReleaseDll"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
WholeProgramOptimization="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
|
||||||
PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
|
PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
ExceptionHandling="FALSE"
|
ExceptionHandling="FALSE"
|
||||||
|
|
@ -278,7 +287,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="gvmat32.obj inffas32.obj crtdll.lib"
|
AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj crtdll.lib"
|
||||||
OutputFile=".\ReleaseDll\zlibwapi.dll"
|
OutputFile=".\ReleaseDll\zlibwapi.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
|
|
@ -318,19 +327,19 @@
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">
|
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">
|
||||||
<File
|
<File
|
||||||
RelativePath=".\adler32.c">
|
RelativePath="..\..\..\adler32.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\compress.c">
|
RelativePath="..\..\..\compress.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\crc32.c">
|
RelativePath="..\..\..\crc32.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\deflate.c">
|
RelativePath="..\..\..\deflate.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\gvmat32c.c">
|
RelativePath="..\..\masmx86\gvmat32c.c">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="ReleaseWithoutAsm|Win32"
|
Name="ReleaseWithoutAsm|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
|
|
@ -339,34 +348,34 @@
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\gzio.c">
|
RelativePath="..\..\..\gzio.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\infback.c">
|
RelativePath="..\..\..\infback.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inffast.c">
|
RelativePath="..\..\..\inffast.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inflate.c">
|
RelativePath="..\..\..\inflate.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inftrees.c">
|
RelativePath="..\..\..\inftrees.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ioapi.c">
|
RelativePath="..\..\minizip\ioapi.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\iowin32.c">
|
RelativePath="..\..\minizip\iowin32.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\trees.c">
|
RelativePath="..\..\..\trees.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\uncompr.c">
|
RelativePath="..\..\..\uncompr.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\unzip.c">
|
RelativePath="..\..\minizip\unzip.c">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32">
|
Name="Release|Win32">
|
||||||
<Tool
|
<Tool
|
||||||
|
|
@ -376,7 +385,7 @@
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zip.c">
|
RelativePath="..\..\minizip\zip.c">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32">
|
Name="Release|Win32">
|
||||||
<Tool
|
<Tool
|
||||||
|
|
@ -392,38 +401,38 @@
|
||||||
RelativePath=".\zlibvc.def">
|
RelativePath=".\zlibvc.def">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zutil.c">
|
RelativePath="..\..\..\zutil.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl;fi;fd">
|
Filter="h;hpp;hxx;hm;inl;fi;fd">
|
||||||
<File
|
<File
|
||||||
RelativePath=".\deflate.h">
|
RelativePath="..\..\..\deflate.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\infblock.h">
|
RelativePath="..\..\..\infblock.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\infcodes.h">
|
RelativePath="..\..\..\infcodes.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inffast.h">
|
RelativePath="..\..\..\inffast.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\inftrees.h">
|
RelativePath="..\..\..\inftrees.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\infutil.h">
|
RelativePath="..\..\..\infutil.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zconf.h">
|
RelativePath="..\..\..\zconf.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zlib.h">
|
RelativePath="..\..\..\zlib.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\zutil.h">
|
RelativePath="..\..\..\zutil.h">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
# test works out-of-the-box, installs `somewhere' on demand
|
# test works out-of-the-box, installs `somewhere' on demand
|
||||||
|
|
||||||
# Toolflags:
|
# Toolflags:
|
||||||
CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah
|
CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah
|
||||||
C++flags = -c -depend !Depend -IC: -throwback
|
C++flags = -c -depend !Depend -IC: -throwback
|
||||||
Linkflags = -aif -c++ -o $@
|
Linkflags = -aif -c++ -o $@
|
||||||
ObjAsmflags = -throwback -NoCache -depend !Depend
|
ObjAsmflags = -throwback -NoCache -depend !Depend
|
||||||
CMHGflags =
|
CMHGflags =
|
||||||
LibFileflags = -c -l -o $@
|
LibFileflags = -c -l -o $@
|
||||||
Squeezeflags = -o $@
|
Squeezeflags = -o $@
|
||||||
|
|
||||||
# change the line below to where _you_ want the library installed.
|
# change the line below to where _you_ want the library installed.
|
||||||
|
|
@ -17,10 +17,10 @@ libdest = lib:zlib
|
||||||
# Final targets:
|
# Final targets:
|
||||||
@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
|
@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
|
||||||
@.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
|
@.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
|
||||||
@.o.uncompr @.o.zutil
|
@.o.uncompr @.o.zutil
|
||||||
LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
|
LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
|
||||||
@.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
|
@.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
|
||||||
@.o.trees @.o.uncompr @.o.zutil
|
@.o.trees @.o.uncompr @.o.zutil
|
||||||
test: @.minigzip @.example @.lib
|
test: @.minigzip @.example @.lib
|
||||||
@copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
|
@copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
|
||||||
@echo running tests: hang on.
|
@echo running tests: hang on.
|
||||||
|
|
@ -41,9 +41,9 @@ test: @.minigzip @.example @.lib
|
||||||
@/@.example @.fred @.fred
|
@/@.example @.fred @.fred
|
||||||
@echo that will have given lots of hello!'s.
|
@echo that will have given lots of hello!'s.
|
||||||
|
|
||||||
@.minigzip: @.o.minigzip @.lib C:o.Stubs
|
@.minigzip: @.o.minigzip @.lib C:o.Stubs
|
||||||
Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
|
Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
|
||||||
@.example: @.o.example @.lib C:o.Stubs
|
@.example: @.o.example @.lib C:o.Stubs
|
||||||
Link $(Linkflags) @.o.example @.lib C:o.Stubs
|
Link $(Linkflags) @.o.example @.lib C:o.Stubs
|
||||||
|
|
||||||
install: @.lib
|
install: @.lib
|
||||||
|
|
|
||||||
|
|
@ -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.)
|
(Volunteers are encouraged to help clean this up. Thanks.)
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
<QPG:Files>
|
<QPG:Files>
|
||||||
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
|
<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="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||||
<QPG:Add file="../libz.so.1.2.1" install="/opt/lib/" user="root:bin" permission="644"/>
|
<QPG:Add file="../libz.so.1.2.3" 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"/>
|
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.3"/>
|
||||||
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.1"/>
|
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3"/>
|
||||||
<QPG:Add file="../libz.so.1.2.1" install="/opt/lib/" component="slib"/>
|
<QPG:Add file="../libz.so.1.2.3" install="/opt/lib/" component="slib"/>
|
||||||
</QPG:Files>
|
</QPG:Files>
|
||||||
|
|
||||||
<QPG:PackageFilter>
|
<QPG:PackageFilter>
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
</QPM:ProductDescription>
|
</QPM:ProductDescription>
|
||||||
|
|
||||||
<QPM:ReleaseDescription>
|
<QPM:ReleaseDescription>
|
||||||
<QPM:ReleaseVersion>1.2.1</QPM:ReleaseVersion>
|
<QPM:ReleaseVersion>1.2.3</QPM:ReleaseVersion>
|
||||||
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
|
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
|
||||||
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
|
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
|
||||||
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
|
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
</QPM:Script>
|
</QPM:Script>
|
||||||
</QPM:ProductInstallationProcedure>
|
</QPM:ProductInstallationProcedure>
|
||||||
</QPM:PackageManifest>
|
</QPM:PackageManifest>
|
||||||
|
|
||||||
<QPM:Launch>
|
<QPM:Launch>
|
||||||
</QPM:Launch>
|
</QPM:Launch>
|
||||||
</QPG:PackageFilter>
|
</QPG:PackageFilter>
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
</QPM:OrderDependency>
|
</QPM:OrderDependency>
|
||||||
</QPM:ProductInstallationProcedure>
|
</QPM:ProductInstallationProcedure>
|
||||||
</QPM:PackageManifest>
|
</QPM:PackageManifest>
|
||||||
|
|
||||||
<QPM:Launch>
|
<QPM:Launch>
|
||||||
</QPM:Launch>
|
</QPM:Launch>
|
||||||
</QPG:PackageFilter>
|
</QPG:PackageFilter>
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
</QPM:OrderDependency>
|
</QPM:OrderDependency>
|
||||||
</QPM:ProductInstallationProcedure>
|
</QPM:ProductInstallationProcedure>
|
||||||
</QPM:PackageManifest>
|
</QPM:PackageManifest>
|
||||||
|
|
||||||
<QPM:Launch>
|
<QPM:Launch>
|
||||||
</QPM:Launch>
|
</QPM:Launch>
|
||||||
</QPG:PackageFilter>
|
</QPG:PackageFilter>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ in the zlib distribution, or at the following location:
|
||||||
1. What is ZLIB1.DLL, and how can I get it?
|
1. What is ZLIB1.DLL, and how can I get it?
|
||||||
|
|
||||||
- ZLIB1.DLL is the official build of zlib as a DLL.
|
- ZLIB1.DLL is the official build of zlib as a DLL.
|
||||||
(Please remark the symbol '1' in the name.)
|
(Please remark the character '1' in the name.)
|
||||||
|
|
||||||
Pointers to a precompiled ZLIB1.DLL can be found in the zlib
|
Pointers to a precompiled ZLIB1.DLL can be found in the zlib
|
||||||
web site at:
|
web site at:
|
||||||
|
|
@ -37,20 +37,19 @@ in the zlib distribution, or at the following location:
|
||||||
and build settings. If you do build the DLL yourself, please
|
and build settings. If you do build the DLL yourself, please
|
||||||
make sure that it complies with all the above requirements,
|
make sure that it complies with all the above requirements,
|
||||||
and it runs with the precompiled test programs, bundled with
|
and it runs with the precompiled test programs, bundled with
|
||||||
the original ZLIB1.DLL distribution and available at the zlib
|
the original ZLIB1.DLL distribution.
|
||||||
web site.
|
|
||||||
|
|
||||||
If, for any reason, you need to build an incompatible DLL,
|
If, for any reason, you need to build an incompatible DLL,
|
||||||
please use a different name.
|
please use a different file name.
|
||||||
|
|
||||||
|
|
||||||
2. Why did you change the name of the DLL to ZLIB1.DLL?
|
2. Why did you change the name of the DLL to ZLIB1.DLL?
|
||||||
What happened to the old ZLIB.DLL?
|
What happened to the old ZLIB.DLL?
|
||||||
|
|
||||||
- The old ZLIB.DLL, built from zlib-1.1.x and earlier, required
|
- The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required
|
||||||
compilation settings that were incompatible to those used by a
|
compilation settings that were incompatible to those used by
|
||||||
static build. The DLL settings were supposed to be enabled by
|
a static build. The DLL settings were supposed to be enabled
|
||||||
defining the macro ZLIB_DLL, before including "zlib.h".
|
by defining the macro ZLIB_DLL, before including "zlib.h".
|
||||||
Incorrect handling of this macro was silently accepted at
|
Incorrect handling of this macro was silently accepted at
|
||||||
build time, resulting in two major problems:
|
build time, resulting in two major problems:
|
||||||
|
|
||||||
|
|
@ -65,8 +64,8 @@ in the zlib distribution, or at the following location:
|
||||||
functions. Failure to do so resulted in creating binaries
|
functions. Failure to do so resulted in creating binaries
|
||||||
that were unable to run with the official ZLIB.DLL build.
|
that were unable to run with the official ZLIB.DLL build.
|
||||||
|
|
||||||
The only possible solution that we could foresee was to make a
|
The only possible solution that we could foresee was to make
|
||||||
binary-incompatible change in the DLL interfacing, in order to
|
a binary-incompatible change in the DLL interface, in order to
|
||||||
remove the dependency on the ZLIB_DLL macro, and to release
|
remove the dependency on the ZLIB_DLL macro, and to release
|
||||||
the new DLL under a different name.
|
the new DLL under a different name.
|
||||||
|
|
||||||
|
|
@ -85,17 +84,13 @@ in the zlib distribution, or at the following location:
|
||||||
|
|
||||||
- In principle, you can do it by assigning calling convention
|
- In principle, you can do it by assigning calling convention
|
||||||
keywords to the macros ZEXPORT and ZEXPORTVA. In practice,
|
keywords to the macros ZEXPORT and ZEXPORTVA. In practice,
|
||||||
it depends on what you mean by "an old ZLIB.DLL", because
|
it depends on what you mean by "an old ZLIB.DLL", because the
|
||||||
the old DLL exists in several mutually-incompatible versions.
|
old DLL exists in several mutually-incompatible versions.
|
||||||
|
You have to find out first what kind of calling convention is
|
||||||
If you have a compiled application that works with a certain
|
being used in your particular ZLIB.DLL build, and to use the
|
||||||
ZLIB.DLL without any known security issues, there is hardly
|
same one in the new build. If you don't know what this is all
|
||||||
a need to rebuild the DLL from new sources only to link it to
|
about, you might be better off if you would just leave the old
|
||||||
the old app binary. But if you really want to do it, you have
|
DLL intact.
|
||||||
to find out first what kind of calling convention uses your
|
|
||||||
particular ZLIB.DLL build, and to use the same one in the new
|
|
||||||
build. If you don't know what this is all about, you might be
|
|
||||||
better off if you would just forget it.
|
|
||||||
|
|
||||||
|
|
||||||
4. Can I compile my application using the new zlib interface, and
|
4. Can I compile my application using the new zlib interface, and
|
||||||
|
|
@ -170,19 +165,19 @@ in the zlib distribution, or at the following location:
|
||||||
the K&R-style function prototypes, where the argument types
|
the K&R-style function prototypes, where the argument types
|
||||||
are not specified; but that is another story for another day.
|
are not specified; but that is another story for another day.
|
||||||
|
|
||||||
The fact that remains is that CDECL is the default convention.
|
The remaining fact is that CDECL is the default convention.
|
||||||
Even if an explicit convention (such as STDCALL or FASTCALL)
|
Even if an explicit convention is hard-coded into the function
|
||||||
is hard-coded into the function prototypes inside C headers,
|
prototypes inside C headers, problems may appear. The
|
||||||
problems may appear. One problem, for example, deals with the
|
necessity to expose the convention in users' callbacks is one
|
||||||
necessity to expose the convention in users' callbacks.
|
of these problems.
|
||||||
|
|
||||||
The calling convention issues are also important when using
|
The calling convention issues are also important when using
|
||||||
zlib in other programming languages. Some of them, like Ada
|
zlib in other programming languages. Some of them, like Ada
|
||||||
(GNAT) and Fortran (GNU G77), have C bindings implemented
|
(GNAT) and Fortran (GNU G77), have C bindings implemented
|
||||||
initially on Unix, and relying on the C calling convention.
|
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
|
Basic require STDCALL, while Borland Delphi prefers, although
|
||||||
it does not require) FASTCALL.
|
it does not require, FASTCALL.
|
||||||
|
|
||||||
In fairness to all possible uses of zlib outside the C
|
In fairness to all possible uses of zlib outside the C
|
||||||
programming language, we choose the default "C" convention.
|
programming language, we choose the default "C" convention.
|
||||||
|
|
@ -208,7 +203,14 @@ in the zlib distribution, or at the following location:
|
||||||
zlib distribution.
|
zlib distribution.
|
||||||
|
|
||||||
|
|
||||||
8. If my application uses ZLIB1.DLL, should I link it to
|
8. I need to use zlib in my Microsoft .NET project. What can I
|
||||||
|
do?
|
||||||
|
|
||||||
|
- 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
|
||||||
MSVCRT.DLL? Why?
|
MSVCRT.DLL? Why?
|
||||||
|
|
||||||
- It is not required, but it is recommended to link your
|
- It is not required, but it is recommended to link your
|
||||||
|
|
@ -223,8 +225,8 @@ in the zlib distribution, or at the following location:
|
||||||
depend on it should also be linked to MSVCRT.DLL.
|
depend on it should also be linked to MSVCRT.DLL.
|
||||||
|
|
||||||
|
|
||||||
9. Why are you saying that ZLIB1.DLL and my application must be
|
10. Why are you saying that ZLIB1.DLL and my application should
|
||||||
linked to the same C run-time (CRT) library? I linked my
|
be linked to the same C run-time (CRT) library? I linked my
|
||||||
application and my DLLs to different C libraries (e.g. my
|
application and my DLLs to different C libraries (e.g. my
|
||||||
application to a static library, and my DLLs to MSVCRT.DLL),
|
application to a static library, and my DLLs to MSVCRT.DLL),
|
||||||
and everything works fine.
|
and everything works fine.
|
||||||
|
|
@ -255,11 +257,11 @@ in the zlib distribution, or at the following location:
|
||||||
and DLLs are avoiding the corruption of each of the CRTs'
|
and DLLs are avoiding the corruption of each of the CRTs'
|
||||||
internal states, maybe by careful design, or maybe by fortune.
|
internal states, maybe by careful design, or maybe by fortune.
|
||||||
|
|
||||||
Also note that linking ZLIB1.DLL to non-Microsoft CRTs (such
|
Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such
|
||||||
as those provided by Borland) raises similar problems.
|
as those provided by Borland, raises similar problems.
|
||||||
|
|
||||||
|
|
||||||
10. Why are you linking ZLIB1.DLL to MSVCRT.DLL?
|
11. Why are you linking ZLIB1.DLL to MSVCRT.DLL?
|
||||||
|
|
||||||
- MSVCRT.DLL exists on every Windows 95 with a new service pack
|
- MSVCRT.DLL exists on every Windows 95 with a new service pack
|
||||||
installed, or with Microsoft Internet Explorer 4 or later, and
|
installed, or with Microsoft Internet Explorer 4 or later, and
|
||||||
|
|
@ -269,21 +271,14 @@ in the zlib distribution, or at the following location:
|
||||||
software provider for free.
|
software provider for free.
|
||||||
|
|
||||||
The fact that MSVCRT.DLL does not exist on a virgin Windows 95
|
The fact that MSVCRT.DLL does not exist on a virgin Windows 95
|
||||||
is not so problematic. The number of Windows 95 installations
|
is not so problematic. Windows 95 is scarcely found nowadays,
|
||||||
is rapidly decreasing, Microsoft stopped supporting it a long
|
Microsoft ended its support a long time ago, and many recent
|
||||||
time ago, and many recent applications from various vendors,
|
applications from various vendors, including Microsoft, do not
|
||||||
including Microsoft, do not even run on it. Furthermore, no
|
even run on it. Furthermore, no serious user should run
|
||||||
serious user should run Windows 95 without a proper update
|
Windows 95 without a proper update installed.
|
||||||
installed.
|
|
||||||
|
|
||||||
There is also the fact that the mainstream C compilers for
|
|
||||||
Windows are Microsoft Visual C++ 6.0, and gcc/MinGW. Both
|
|
||||||
are producing executables that link to MSVCRT.DLL by default,
|
|
||||||
without offering other dynamic CRTs as alternatives easy to
|
|
||||||
select by users.
|
|
||||||
|
|
||||||
|
|
||||||
11. Why are you not linking ZLIB1.DLL to
|
12. Why are you not linking ZLIB1.DLL to
|
||||||
<<my favorite C run-time library>> ?
|
<<my favorite C run-time library>> ?
|
||||||
|
|
||||||
- We considered and abandoned the following alternatives:
|
- We considered and abandoned the following alternatives:
|
||||||
|
|
@ -294,27 +289,60 @@ in the zlib distribution, or at the following location:
|
||||||
to a static C library, you may as well consider linking zlib
|
to a static C library, you may as well consider linking zlib
|
||||||
in statically, too.
|
in statically, too.
|
||||||
|
|
||||||
* Linking ZLIB1.DLL to CRTDLL.DLL looks very appealing,
|
* Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because
|
||||||
because CRTDLL.DLL is present on every Win32 installation.
|
CRTDLL.DLL is present on every Win32 installation.
|
||||||
Unfortunately, it has a series of problems: it raises
|
Unfortunately, it has a series of problems: it does not
|
||||||
difficulties when using it with C++ code, it does not work
|
work properly with Microsoft's C++ libraries, it does not
|
||||||
with 64-bit file offsets, (and so on...), and Microsoft
|
provide support for 64-bit file offsets, (and so on...),
|
||||||
discontinued its support a long time ago.
|
and Microsoft discontinued its support a long time ago.
|
||||||
|
|
||||||
* Linking ZLIB1.DLL to MSVCR70.DLL, supplied with the
|
* Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied
|
||||||
Microsoft .NET platform and Visual C++ 7.0 or newer, is not
|
with the Microsoft .NET platform, and Visual C++ 7.0/7.1,
|
||||||
a good option. Although it is available for free download
|
raises problems related to the status of ZLIB1.DLL as a
|
||||||
and distribution, its presence is scarce on today's Win32
|
system component. According to the Microsoft Knowledge Base
|
||||||
installations. If it will ever become more popular than
|
article KB326922 "INFO: Redistribution of the Shared C
|
||||||
MSVCRT.DLL and will be pre-installed on the future Win32
|
Runtime Component in Visual C++ .NET", MSVCR70.DLL and
|
||||||
systems, we will probably think again about it.
|
MSVCR71.DLL are not supposed to function as system DLLs,
|
||||||
|
because they may clash with MSVCRT.DLL. Instead, the
|
||||||
|
application's installer is supposed to put these DLLs
|
||||||
|
(if needed) in the application's private directory.
|
||||||
|
If ZLIB1.DLL depends on a non-system runtime, it cannot
|
||||||
|
function as a redistributable system component.
|
||||||
|
|
||||||
* Linking ZLIB1.DLL to NTDLL.DLL is not possible.
|
* Linking ZLIB1.DLL to non-Microsoft runtimes, such as
|
||||||
NTDLL.DLL exports only a part of the C library, and only on
|
Borland's, or Cygwin's, raises problems related to the
|
||||||
Windows NT systems.
|
reliable presence of these runtimes on Win32 systems.
|
||||||
|
It's easier to let the DLL build of zlib up to the people
|
||||||
|
who distribute these runtimes, and who may proceed as
|
||||||
|
explained in the answer to Question 14.
|
||||||
|
|
||||||
|
|
||||||
12. I need to link my own DLL build to a CRT different than
|
13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL,
|
||||||
|
how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0
|
||||||
|
(Visual Studio .NET) or newer?
|
||||||
|
|
||||||
|
- Due to the problems explained in the Microsoft Knowledge Base
|
||||||
|
article KB326922 (see the previous answer), the C runtime that
|
||||||
|
comes with the VC7 environment is no longer considered a
|
||||||
|
system component. That is, it should not be assumed that this
|
||||||
|
runtime exists, or may be installed in a system directory.
|
||||||
|
Since ZLIB1.DLL is supposed to be a system component, it may
|
||||||
|
not depend on a non-system component.
|
||||||
|
|
||||||
|
In order to link ZLIB1.DLL and your application to MSVCRT.DLL
|
||||||
|
in VC7, you need the library of Visual C++ 6.0 or older. If
|
||||||
|
you don't have this library at hand, it's probably best not to
|
||||||
|
use ZLIB1.DLL.
|
||||||
|
|
||||||
|
We are hoping that, in the future, Microsoft will provide a
|
||||||
|
way to build applications linked to a proper system runtime,
|
||||||
|
from the Visual C++ environment. Until then, you have a
|
||||||
|
couple of alternatives, such as linking zlib in statically.
|
||||||
|
If your application requires dynamic linking, you may proceed
|
||||||
|
as explained in the answer to Question 14.
|
||||||
|
|
||||||
|
|
||||||
|
14. I need to link my own DLL build to a CRT different than
|
||||||
MSVCRT.DLL. What can I do?
|
MSVCRT.DLL. What can I do?
|
||||||
|
|
||||||
- Feel free to rebuild the DLL from the zlib sources, and link
|
- Feel free to rebuild the DLL from the zlib sources, and link
|
||||||
|
|
@ -330,7 +358,7 @@ in the zlib distribution, or at the following location:
|
||||||
CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL.
|
CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL.
|
||||||
|
|
||||||
|
|
||||||
13. May I include additional pieces of code that I find useful,
|
15. May I include additional pieces of code that I find useful,
|
||||||
link them in ZLIB1.DLL, and export them?
|
link them in ZLIB1.DLL, and export them?
|
||||||
|
|
||||||
- No. A legitimate build of ZLIB1.DLL must not include code
|
- No. A legitimate build of ZLIB1.DLL must not include code
|
||||||
|
|
@ -338,14 +366,12 @@ in the zlib distribution, or at the following location:
|
||||||
But you can make your own private DLL build, under a different
|
But you can make your own private DLL build, under a different
|
||||||
file name, as suggested in the previous answer.
|
file name, as suggested in the previous answer.
|
||||||
|
|
||||||
For example, in Borland Delphi and C++ Builder, zlib is a part
|
For example, zlib is a part of the VCL library, distributed
|
||||||
of the standard VCL library. If an application links to VCL
|
with Borland Delphi and C++ Builder. The DLL build of VCL
|
||||||
dynamically, the name of the distributable binary (VCLxx.DLL)
|
is a redistributable file, named VCLxx.DLL.
|
||||||
does not posess any danger of clashing with a legitimate but
|
|
||||||
incompatible ZLIB1.DLL.
|
|
||||||
|
|
||||||
|
|
||||||
14. May I remove some functionality out of ZLIB1.DLL, by enabling
|
16. May I remove some functionality out of ZLIB1.DLL, by enabling
|
||||||
macros like NO_GZCOMPRESS or NO_GZIP at compile time?
|
macros like NO_GZCOMPRESS or NO_GZIP at compile time?
|
||||||
|
|
||||||
- No. A legitimate build of ZLIB1.DLL must provide the complete
|
- No. A legitimate build of ZLIB1.DLL must provide the complete
|
||||||
|
|
@ -354,7 +380,7 @@ in the zlib distribution, or at the following location:
|
||||||
different file name, as suggested in the previous answer.
|
different file name, as suggested in the previous answer.
|
||||||
|
|
||||||
|
|
||||||
15. I made my own ZLIB1.DLL build. Can I test it for compliance?
|
17. I made my own ZLIB1.DLL build. Can I test it for compliance?
|
||||||
|
|
||||||
- We prefer that you download the official DLL from the zlib
|
- We prefer that you download the official DLL from the zlib
|
||||||
web site. If you need something peculiar from this DLL, you
|
web site. If you need something peculiar from this DLL, you
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ VS_VERSION_INFO VERSIONINFO
|
||||||
#else
|
#else
|
||||||
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
#endif
|
#endif
|
||||||
FILEVERSION 1,2,1,0
|
FILEVERSION 1,2,2,0
|
||||||
PRODUCTVERSION 1,2,1,0
|
PRODUCTVERSION 1,2,2,0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 1
|
FILEFLAGS 1
|
||||||
|
|
@ -23,12 +23,12 @@ BEGIN
|
||||||
//language ID = U.S. English, char set = Windows, Multilingual
|
//language ID = U.S. English, char set = Windows, Multilingual
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression library\0"
|
VALUE "FileDescription", "zlib data compression library\0"
|
||||||
VALUE "FileVersion", "1.2.1\0"
|
VALUE "FileVersion", "1.2.3\0"
|
||||||
VALUE "InternalName", "zlib1.dll\0"
|
VALUE "InternalName", "zlib1.dll\0"
|
||||||
VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
|
VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0"
|
||||||
VALUE "OriginalFilename", "zlib1.dll\0"
|
VALUE "OriginalFilename", "zlib1.dll\0"
|
||||||
VALUE "ProductName", "zlib\0"
|
VALUE "ProductName", "zlib\0"
|
||||||
VALUE "ProductVersion", "1.2.1\0"
|
VALUE "ProductVersion", "1.2.3\0"
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue