865 lines
27 KiB
Diff
865 lines
27 KiB
Diff
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/Changes.cc perl-5.10.0/ext/Compress/Raw/Zlib/Changes
|
|
--- perl-5.10.0/ext/Compress/Raw/Zlib/Changes.cc 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/Compress/Raw/Zlib/Changes 2009-06-03 10:42:12.000000000 +0200
|
|
@@ -1,6 +1,62 @@
|
|
CHANGES
|
|
-------
|
|
|
|
+ 2.020 3 June 2009
|
|
+
|
|
+ * Minor documentation update.
|
|
+
|
|
+ 2.019 4 May 2009
|
|
+
|
|
+ * No Changes
|
|
+
|
|
+ 2.018 3 May 2009
|
|
+
|
|
+ * No Changes
|
|
+
|
|
+ 2.017 28 March 2009
|
|
+
|
|
+ * Added 'LimitOutput' option
|
|
+
|
|
+ * Removed MAN3PODS from Makefile.PL
|
|
+
|
|
+ * Fixed coring issue when LimitOutput was used.
|
|
+
|
|
+ * Documented Compress::Raw::Zlib::zlib_version()
|
|
+
|
|
+ * Documented Compress::Raw::Zlib::deflateReset()
|
|
+ [RT #40566]
|
|
+
|
|
+ 2.015 3 September 2008
|
|
+
|
|
+ * Makefile.PL
|
|
+ Backout changes made in 2.014
|
|
+
|
|
+ 2.014 2 September 2008
|
|
+
|
|
+ * Makefile.PL
|
|
+ Updated to check for indirect dependencies.
|
|
+
|
|
+ 2.012 15 July 2008
|
|
+
|
|
+ * Document the gzip flags that WindowBits can take.
|
|
+
|
|
+ * Allow a dictionary to be used with a raw inflate.
|
|
+ Needs zlib 1.2.2.1 or better.
|
|
+ [RT #36046]
|
|
+
|
|
+ 2.011 5 May 2008
|
|
+
|
|
+ * A C++-style comment sneaked in with the last update. Fixed.
|
|
+ [core patch #33828]
|
|
+
|
|
+ 2.010 5 May 2008
|
|
+
|
|
+ * No Changes
|
|
+
|
|
+ 2.009 20 April 2008
|
|
+
|
|
+ * No Changes
|
|
+
|
|
2.008 2 November 2007
|
|
|
|
* Minor documentation changes in README
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/Makefile.PL.cc perl-5.10.0/ext/Compress/Raw/Zlib/Makefile.PL
|
|
--- perl-5.10.0/ext/Compress/Raw/Zlib/Makefile.PL.cc 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/Compress/Raw/Zlib/Makefile.PL 2009-03-29 00:08:40.000000000 +0100
|
|
@@ -77,24 +77,11 @@ WriteMakefile(
|
|
},
|
|
|
|
(
|
|
- $ENV{SKIP_FOR_CORE}
|
|
- ? (MAN3PODS => {})
|
|
- : ()
|
|
- ),
|
|
-
|
|
- (
|
|
$BUILD_ZLIB
|
|
? zlib_files($ZLIB_LIB)
|
|
: (LIBS => [ "-L$ZLIB_LIB -lz " ])
|
|
),
|
|
|
|
- (
|
|
- $] >= 5.005
|
|
- ? (ABSTRACT_FROM => 'lib/Compress/Raw/Zlib.pm',
|
|
- AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
|
|
- : ()
|
|
- ),
|
|
-
|
|
INSTALLDIRS => ($] >= 5.009 ? 'perl' : 'site'),
|
|
|
|
((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/pm_to_blib.cc perl-5.10.0/ext/Compress/Raw/Zlib/pm_to_blib
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/private/MakeUtil.pm.cc perl-5.10.0/ext/Compress/Raw/Zlib/private/MakeUtil.pm
|
|
--- perl-5.10.0/ext/Compress/Raw/Zlib/private/MakeUtil.pm.cc 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/Compress/Raw/Zlib/private/MakeUtil.pm 2008-09-02 15:14:33.000000000 +0200
|
|
@@ -6,6 +6,8 @@ use strict ;
|
|
use Config qw(%Config);
|
|
use File::Copy;
|
|
|
|
+my $VERSION = '1.0';
|
|
+
|
|
|
|
BEGIN
|
|
{
|
|
@@ -47,6 +49,11 @@ sub MY::postamble
|
|
|
|
my @files = getPerlFiles('MANIFEST');
|
|
|
|
+ # Note: Once you remove all the layers of shell/makefile escaping
|
|
+ # the regular expression below reads
|
|
+ #
|
|
+ # /^\s*local\s*\(\s*\$^W\s*\)/
|
|
+ #
|
|
my $postamble = '
|
|
|
|
MyTrebleCheck:
|
|
@@ -290,6 +297,83 @@ sub doUpDownViaCopy
|
|
}
|
|
}
|
|
|
|
+
|
|
+sub FindBrokenDependencies
|
|
+{
|
|
+ my $version = shift ;
|
|
+ my %thisModule = map { $_ => 1} @_;
|
|
+
|
|
+ my @modules = qw(
|
|
+ IO::Compress::Base
|
|
+ IO::Compress::Base::Common
|
|
+ IO::Uncompress::Base
|
|
+
|
|
+ Compress::Raw::Zlib
|
|
+ Compress::Raw::Bzip2
|
|
+
|
|
+ IO::Compress::RawDeflate
|
|
+ IO::Uncompress::RawInflate
|
|
+ IO::Compress::Deflate
|
|
+ IO::Uncompress::Inflate
|
|
+ IO::Compress::Gzip
|
|
+ IO::Compress::Gzip::Constants
|
|
+ IO::Uncompress::Gunzip
|
|
+ IO::Compress::Zip
|
|
+ IO::Uncompress::Unzip
|
|
+
|
|
+ IO::Compress::Bzip2
|
|
+ IO::Uncompress::Bunzip2
|
|
+
|
|
+ IO::Compress::Lzf
|
|
+ IO::Uncompress::UnLzf
|
|
+
|
|
+ IO::Compress::Lzop
|
|
+ IO::Uncompress::UnLzop
|
|
+
|
|
+ Compress::Zlib
|
|
+ );
|
|
+
|
|
+ my @broken = ();
|
|
+
|
|
+ foreach my $module ( grep { ! $thisModule{$_} } @modules)
|
|
+ {
|
|
+ my $hasVersion = getInstalledVersion($module);
|
|
+
|
|
+ # No need to upgrade if the module isn't installed at all
|
|
+ next
|
|
+ if ! defined $hasVersion;
|
|
+
|
|
+ # If already have C::Z version 1, then an upgrade to any of the
|
|
+ # IO::Compress modules will not break it.
|
|
+ next
|
|
+ if $module eq 'Compress::Zlib' && $hasVersion < 2;
|
|
+
|
|
+ if ($hasVersion < $version)
|
|
+ {
|
|
+ push @broken, $module
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return @broken;
|
|
+}
|
|
+
|
|
+sub getInstalledVersion
|
|
+{
|
|
+ my $module = shift;
|
|
+ my $version;
|
|
+
|
|
+ eval " require $module; ";
|
|
+
|
|
+ if ($@ eq '')
|
|
+ {
|
|
+ no strict 'refs';
|
|
+ $version = ${ $module . "::VERSION" };
|
|
+ $version = 0
|
|
+ }
|
|
+
|
|
+ return $version;
|
|
+}
|
|
+
|
|
package MakeUtil ;
|
|
|
|
1;
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/README.cc perl-5.10.0/ext/Compress/Raw/Zlib/README
|
|
--- perl-5.10.0/ext/Compress/Raw/Zlib/README.cc 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/Compress/Raw/Zlib/README 2009-06-03 10:36:58.000000000 +0200
|
|
@@ -1,16 +1,14 @@
|
|
|
|
Compress-Raw-Zlib
|
|
|
|
- Version 2.008
|
|
+ Version 2.020
|
|
|
|
- 2nd November 2007
|
|
+ 3rd June 2009
|
|
|
|
-
|
|
- Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
|
|
+ Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
|
|
This program is free software; you can redistribute it
|
|
and/or modify it under the same terms as Perl itself.
|
|
|
|
-
|
|
The directory zlib-src contains a subset of the
|
|
source files copied directly from zlib version 1.2.3.
|
|
These files are Copyright(C) 1995-2005
|
|
@@ -18,39 +16,27 @@
|
|
Full source for the zlib library is available at
|
|
http://www.zlib.org
|
|
|
|
-
|
|
-
|
|
DESCRIPTION
|
|
-----------
|
|
|
|
-
|
|
This module provides a Perl interface to the zlib compression library.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
PREREQUISITES
|
|
-------------
|
|
|
|
Before you can build Compress-Raw-Zlib you need to have the following
|
|
installed on your system:
|
|
|
|
-
|
|
* A C compiler
|
|
|
|
* Perl 5.004 or better.
|
|
|
|
-
|
|
-
|
|
By default, Compress-Raw-Zlib will build its own private copy of the
|
|
zlib library. If you want to use a different version of
|
|
zlib, follow the instructions in the section called
|
|
"Controlling the version of zlib used by Compress-Raw-Zlib"
|
|
later in this document.
|
|
|
|
-
|
|
-
|
|
BUILDING THE MODULE
|
|
-------------------
|
|
|
|
@@ -61,8 +47,6 @@ using this sequence of commands:
|
|
make
|
|
make test
|
|
|
|
-
|
|
-
|
|
INSTALLATION
|
|
------------
|
|
|
|
@@ -70,9 +54,6 @@ To install Compress-Raw-Zlib, run the co
|
|
|
|
make install
|
|
|
|
-
|
|
-
|
|
-
|
|
Controlling the version of zlib used by Compress-Raw-Zlib
|
|
----------------------------------------------------------
|
|
|
|
@@ -92,7 +73,6 @@ zlib library is used:
|
|
Note that if you intend to use either Option 2 or 3, you need to have
|
|
zlib version 1.0.5 or better.
|
|
|
|
-
|
|
The contents of the file config.in are used to control which of the
|
|
three options is actually used. This file is read during the
|
|
|
|
@@ -101,8 +81,6 @@ three options is actually used. This fil
|
|
step of the build, so remember to make any required changes to config.in
|
|
before building this module.
|
|
|
|
-
|
|
-
|
|
Option 1
|
|
--------
|
|
|
|
@@ -169,10 +147,9 @@ Setting the Gzip OS Code
|
|
------------------------
|
|
|
|
Every gzip stream stores a byte in its header to identify the Operating
|
|
-System that was used to create the gzip stream. When you build
|
|
-Compress-Raw-Zlib it will attempt to determine the value that is correct for
|
|
-your Operating System. This will then be used by IO::Gzip as the default
|
|
-value for the OS byte in all gzip headers it creates.
|
|
+System that was used to create the gzip stream. When you build Compress-Raw-Zlib it will attempt to determine the value that is correct for
|
|
+your Operating System. This will then be used by IO::Compress::Gzip as the
|
|
+default value for the OS byte in all gzip headers it creates.
|
|
|
|
The variable GZIP_OS_CODE in the config.in file controls the setting of
|
|
this value when building Compress-Raw-Zlib. If GZIP_OS_CODE is set to
|
|
@@ -197,16 +174,37 @@ If you find you have to change this valu
|
|
detected is incorrect, please take a few moments to contact the author of
|
|
this module.
|
|
|
|
-
|
|
-
|
|
TROUBLESHOOTING
|
|
---------------
|
|
|
|
+Undefined Symbol gzsetparams
|
|
+----------------------------
|
|
|
|
+If you get the error shown below when you run the Compress-Raw-Zlib test
|
|
+harness it probably means you are running a copy of zlib that is
|
|
+version 1.0.5 or older.
|
|
|
|
+t/01version.........Can't load 'blib/arch/auto/Compress/Zlib/Zlib.so' for
|
|
+ module Compress::Raw::Zlib: blib/arch/auto/Compress/Raw/Zlib/Zlib.so:
|
|
+ undefined symbol: gzsetparams at ...
|
|
|
|
+There are two ways to fix this problem:
|
|
|
|
+ 1. Upgrade to the latest version of zlib.
|
|
|
|
+ 2. Edit config.in and set the OLD_ZLIB variable to True.
|
|
+
|
|
+Test Harness 01version fails
|
|
+----------------------------
|
|
+If the 01version test harness fails, and the problem isn't covered by the
|
|
+scenario above, it probably means that you have two versions of
|
|
+zlib installed on your system.
|
|
+
|
|
+Run the command below to see if this is indeed the case
|
|
+
|
|
+ make test TEST_VERBOSE=1 TEST_FILES=t/01version.t
|
|
+
|
|
+Try removing the one you don't want to use and rebuild.
|
|
|
|
Solaris build fails with "language optional software package not installed"
|
|
---------------------------------------------------------------------------
|
|
@@ -245,9 +243,6 @@ may vary.
|
|
If that doesn't work for you, it's time to make changes to the Makefile
|
|
by hand. Good luck!
|
|
|
|
-
|
|
-
|
|
-
|
|
Solaris build fails with "gcc: unrecognized option `-KPIC'"
|
|
-----------------------------------------------------------
|
|
|
|
@@ -285,10 +280,6 @@ I've had a report that when building Com
|
|
is necessary to have first built the zlib library with the -fpic
|
|
option.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
Linux Notes
|
|
-----------
|
|
|
|
@@ -307,9 +298,6 @@ This usually means that you have not ins
|
|
for zlib. Check for an RPM that start with "zlib-devel" in your Linux
|
|
distribution.
|
|
|
|
-
|
|
-
|
|
-
|
|
Win32 Notes
|
|
-----------
|
|
|
|
@@ -318,15 +306,11 @@ it ships with a pre-compiled version of
|
|
newer version of Compress-Raw-Zlib is available run this from the command
|
|
prompt
|
|
|
|
- C:\> ppm verify -upgrade Compress-Zlib
|
|
-
|
|
+ C:\> ppm verify -upgrade Compress-Raw-Zlib
|
|
|
|
If you are not running Activestate Perl and you don't have access
|
|
to a C compiler, you will not be able to build and install this module.
|
|
|
|
-
|
|
-
|
|
-
|
|
Win32 & Cygwin Notes
|
|
--------------------
|
|
|
|
@@ -338,7 +322,6 @@ Windows.
|
|
The workaround is to install Compress-Raw-Zlib manually using the
|
|
instructions given at the start of this file.
|
|
|
|
-
|
|
FEEDBACK
|
|
--------
|
|
|
|
@@ -372,8 +355,7 @@ To help me help you, I need all of the f
|
|
If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm
|
|
for a line like this:
|
|
|
|
- $VERSION = "2.008" ;
|
|
-
|
|
+ $VERSION = "2.020" ;
|
|
|
|
c. The version of zlib you have used.
|
|
If you have successfully installed Compress-Raw-Zlib, this one-liner
|
|
@@ -381,10 +363,8 @@ To help me help you, I need all of the f
|
|
|
|
perl -MCompress::Raw::Zlib -e "print q[zlib ver ]. Compress::Raw::Zlib::ZLIB_VERSION.qq[\n]"
|
|
|
|
-
|
|
If not, look at the beginning of the file zlib.h.
|
|
|
|
-
|
|
2. If you are having problems building Compress-Raw-Zlib, send me a
|
|
complete log of what happened. Start by unpacking the Compress-Raw-Zlib
|
|
module into a fresh directory and keep a log of all the steps
|
|
@@ -394,5 +374,4 @@ To help me help you, I need all of the f
|
|
make
|
|
make test TEST_VERBOSE=1
|
|
|
|
-
|
|
Paul Marquess <pmqs@cpan.org>
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/typemap.cc perl-5.10.0/ext/Compress/Raw/Zlib/typemap
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/adler32.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/adler32.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/compress.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/compress.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/crc32.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/crc32.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/crc32.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/crc32.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/deflate.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/deflate.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/deflate.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/deflate.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/infback.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/infback.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inffast.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inffast.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inffast.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inffast.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inffixed.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inffixed.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inflate.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inflate.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inflate.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inflate.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inftrees.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inftrees.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inftrees.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/inftrees.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/trees.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/trees.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/trees.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/trees.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/uncompr.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/uncompr.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zconf.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zconf.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zlib.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zlib.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zutil.c.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zutil.c
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zutil.h.cc perl-5.10.0/ext/Compress/Raw/Zlib/zlib-src/zutil.h
|
|
diff -up perl-5.10.0/ext/Compress/Raw/Zlib/Zlib.xs.cc perl-5.10.0/ext/Compress/Raw/Zlib/Zlib.xs
|
|
--- perl-5.10.0/ext/Compress/Raw/Zlib/Zlib.xs.cc 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/Compress/Raw/Zlib/Zlib.xs 2009-03-26 10:40:57.000000000 +0100
|
|
@@ -3,7 +3,7 @@
|
|
* Created : 22nd January 1996
|
|
* Version : 2.000
|
|
*
|
|
- * Copyright (c) 1995-2007 Paul Marquess. All rights reserved.
|
|
+ * Copyright (c) 1995-2009 Paul Marquess. All rights reserved.
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the same terms as Perl itself.
|
|
*
|
|
@@ -50,6 +50,10 @@
|
|
# define AT_LEAST_ZLIB_1_2_2_1
|
|
#endif
|
|
|
|
+#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1222
|
|
+# define AT_LEAST_ZLIB_1_2_2_2
|
|
+#endif
|
|
+
|
|
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1223
|
|
# define AT_LEAST_ZLIB_1_2_2_3
|
|
#endif
|
|
@@ -64,6 +68,11 @@
|
|
# include "ppport.h"
|
|
#endif
|
|
|
|
+#if PERL_REVISION == 5 && PERL_VERSION == 9
|
|
+ /* For Andreas */
|
|
+# define sv_pvbyte_force(sv,lp) sv_pvbyten_force(sv,lp)
|
|
+#endif
|
|
+
|
|
#if PERL_REVISION == 5 && (PERL_VERSION < 8 || (PERL_VERSION == 8 && PERL_SUBVERSION < 4 ))
|
|
|
|
# ifdef SvPVbyte_force
|
|
@@ -103,6 +112,7 @@ typedef struct di_stream {
|
|
#define FLAG_CRC32 2
|
|
#define FLAG_ADLER32 4
|
|
#define FLAG_CONSUME_INPUT 8
|
|
+#define FLAG_LIMIT_OUTPUT 16
|
|
uLong crc32 ;
|
|
uLong adler32 ;
|
|
z_stream stream;
|
|
@@ -228,7 +238,8 @@ typedef di_stream * Compress__Raw__Zlib_
|
|
#define adlerInitial adler32(0L, Z_NULL, 0)
|
|
#define crcInitial crc32(0L, Z_NULL, 0)
|
|
|
|
-static const char * const my_z_errmsg[] = {
|
|
+/* static const char * const my_z_errmsg[] = { */
|
|
+static const char my_z_errmsg[][32] = {
|
|
"need dictionary", /* Z_NEED_DICT 2 */
|
|
"stream end", /* Z_STREAM_END 1 */
|
|
"", /* Z_OK 0 */
|
|
@@ -460,6 +471,8 @@ DispStream(s, message)
|
|
printf(" CRC32 %s\n", EnDis(FLAG_CRC32));
|
|
printf(" ADLER32 %s\n", EnDis(FLAG_ADLER32));
|
|
printf(" CONSUME %s\n", EnDis(FLAG_CONSUME_INPUT));
|
|
+ printf(" LIMIT %s\n", EnDis(FLAG_LIMIT_OUTPUT));
|
|
+
|
|
|
|
#ifdef MAGIC_APPEND
|
|
printf(" window 0x%p\n", s->window);
|
|
@@ -510,7 +523,7 @@ PostInitStream(s, flags, bufsize, window
|
|
|
|
static SV*
|
|
#ifdef CAN_PROTOTYPE
|
|
-deRef(SV * sv, char * string)
|
|
+deRef(SV * sv, const char * string)
|
|
#else
|
|
deRef(sv, string)
|
|
SV * sv ;
|
|
@@ -528,6 +541,8 @@ char * string;
|
|
case SVt_PVHV:
|
|
case SVt_PVCV:
|
|
croak("%s: buffer parameter is not a SCALAR reference", string);
|
|
+ default:
|
|
+ break;
|
|
}
|
|
if (SvROK(sv))
|
|
croak("%s: buffer parameter is a reference to a reference", string) ;
|
|
@@ -542,7 +557,7 @@ char * string;
|
|
|
|
static SV*
|
|
#ifdef CAN_PROTOTYPE
|
|
-deRef_l(SV * sv, char * string)
|
|
+deRef_l(SV * sv, const char * string)
|
|
#else
|
|
deRef_l(sv, string)
|
|
SV * sv ;
|
|
@@ -565,6 +580,8 @@ char * string ;
|
|
case SVt_PVHV:
|
|
case SVt_PVCV:
|
|
croak("%s: buffer parameter is not a SCALAR reference", string);
|
|
+ default:
|
|
+ break;
|
|
}
|
|
if (SvROK(sv))
|
|
croak("%s: buffer parameter is a reference to a reference", string) ;
|
|
@@ -802,6 +819,19 @@ _inflateInit(flags, windowBits, bufsize,
|
|
s = NULL ;
|
|
}
|
|
else if (SvCUR(dictionary)) {
|
|
+#ifdef AT_LEAST_ZLIB_1_2_2_1
|
|
+ /* Zlib 1.2.2.1 or better allows a dictionary with raw inflate */
|
|
+ if (s->WindowBits < 0) {
|
|
+ err = inflateSetDictionary(&(s->stream),
|
|
+ (const Bytef*)SvPVbyte_nolen(dictionary),
|
|
+ SvCUR(dictionary));
|
|
+ if (err != Z_OK) {
|
|
+ Safefree(s) ;
|
|
+ s = NULL ;
|
|
+ }
|
|
+ }
|
|
+ else
|
|
+#endif
|
|
/* Dictionary specified - take a copy for use in inflate */
|
|
s->dictionary = newSVsv(dictionary) ;
|
|
}
|
|
@@ -1246,7 +1276,7 @@ inflate (s, buf, output, eof=FALSE)
|
|
bool eof
|
|
uInt cur_length = 0;
|
|
uInt prefix_length = 0;
|
|
- uInt increment = 0;
|
|
+ int increment = 0;
|
|
STRLEN stmp = NO_INIT
|
|
uLong bufinc = NO_INIT
|
|
PREINIT:
|
|
@@ -1280,22 +1310,39 @@ inflate (s, buf, output, eof=FALSE)
|
|
if((s->flags & FLAG_APPEND) != FLAG_APPEND) {
|
|
SvCUR_set(output, 0);
|
|
}
|
|
+
|
|
+ /* Assume no output buffer - the code below will update if there is any available */
|
|
+ s->stream.avail_out = 0;
|
|
+
|
|
+
|
|
if (SvLEN(output)) {
|
|
prefix_length = cur_length = SvCUR(output) ;
|
|
- s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length;
|
|
- increment = SvLEN(output) - cur_length - 1;
|
|
- s->stream.avail_out = increment;
|
|
- }
|
|
- else {
|
|
- s->stream.avail_out = 0;
|
|
+
|
|
+ if (s->flags & FLAG_LIMIT_OUTPUT && SvLEN(output) - cur_length - 1 < bufinc)
|
|
+ {
|
|
+ Sv_Grow(output, bufinc + cur_length + 1) ;
|
|
+ }
|
|
+
|
|
+ /* Only setup the stream output pointers if there is spare
|
|
+ capacity in the outout SV
|
|
+ */
|
|
+ if (SvLEN(output) > cur_length + 1)
|
|
+ {
|
|
+ s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length;
|
|
+ increment = SvLEN(output) - cur_length - 1;
|
|
+ s->stream.avail_out = increment;
|
|
+ }
|
|
}
|
|
+
|
|
+
|
|
s->bytesInflated = 0;
|
|
|
|
- while (1) {
|
|
+ RETVAL = Z_OK;
|
|
|
|
- if (s->stream.avail_out == 0 ) {
|
|
+ while (RETVAL == Z_OK) {
|
|
+ if (s->stream.avail_out == 0) {
|
|
/* out of space in the output buffer so make it bigger */
|
|
- Sv_Grow(output, SvLEN(output) + bufinc) ;
|
|
+ Sv_Grow(output, SvLEN(output) + bufinc +1) ;
|
|
cur_length += increment ;
|
|
s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length ;
|
|
increment = bufinc ;
|
|
@@ -1303,10 +1350,30 @@ inflate (s, buf, output, eof=FALSE)
|
|
bufinc *= 2 ;
|
|
}
|
|
|
|
+ /* printf("INFLATE Availl In %d, Out %d\n", s->stream.avail_in,
|
|
+ s->stream.avail_out);
|
|
+DispStream(s, "BEFORE");
|
|
+Perl_sv_dump(output); */
|
|
RETVAL = inflate(&(s->stream), Z_SYNC_FLUSH);
|
|
+ /* printf("INFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
|
|
+ GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out); */
|
|
+
|
|
+
|
|
+ if (RETVAL == Z_NEED_DICT && s->dictionary) {
|
|
+ s->dict_adler = s->stream.adler ;
|
|
+ RETVAL = inflateSetDictionary(&(s->stream),
|
|
+ (const Bytef*)SvPVbyte_nolen(s->dictionary),
|
|
+ SvCUR(s->dictionary));
|
|
+ if (RETVAL == Z_OK)
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ if (s->flags & FLAG_LIMIT_OUTPUT &&
|
|
+ (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR ))
|
|
+ break;
|
|
|
|
if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
|
|
- RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
|
|
+ RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
|
|
break ;
|
|
|
|
if (RETVAL == Z_BUF_ERROR) {
|
|
@@ -1317,19 +1384,9 @@ inflate (s, buf, output, eof=FALSE)
|
|
break ;
|
|
}
|
|
}
|
|
-
|
|
- if (RETVAL == Z_NEED_DICT && s->dictionary) {
|
|
- s->dict_adler = s->stream.adler ;
|
|
- RETVAL = inflateSetDictionary(&(s->stream),
|
|
- (const Bytef*)SvPVbyte_nolen(s->dictionary),
|
|
- SvCUR(s->dictionary));
|
|
- }
|
|
-
|
|
- if (RETVAL != Z_OK)
|
|
- break;
|
|
}
|
|
#ifdef NEED_DUMMY_BYTE_AT_END
|
|
- if (eof && RETVAL == Z_OK) {
|
|
+ if (eof && RETVAL == Z_OK && s->flags & FLAG_LIMIT_OUTPUT == 0) {
|
|
Bytef* nextIn = s->stream.next_in;
|
|
uInt availIn = s->stream.avail_in;
|
|
s->stream.next_in = (Bytef*) " ";
|
|
@@ -1350,8 +1407,8 @@ inflate (s, buf, output, eof=FALSE)
|
|
#endif
|
|
|
|
s->last_error = RETVAL ;
|
|
- if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_DATA_ERROR) {
|
|
- unsigned in ;
|
|
+ if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
|
|
+ unsigned in ;
|
|
|
|
s->bytesInflated = cur_length + increment - s->stream.avail_out - prefix_length;
|
|
s->uncompressedBytes += s->bytesInflated ;
|
|
@@ -1377,7 +1434,7 @@ inflate (s, buf, output, eof=FALSE)
|
|
SvCUR(output)-prefix_length) ;
|
|
|
|
/* fix the input buffer */
|
|
- if (s->flags & FLAG_CONSUME_INPUT) {
|
|
+ if (s->flags & FLAG_CONSUME_INPUT || s->flags & FLAG_LIMIT_OUTPUT) {
|
|
in = s->stream.avail_in ;
|
|
SvCUR_set(buf, in) ;
|
|
if (in)
|
|
@@ -1385,6 +1442,7 @@ inflate (s, buf, output, eof=FALSE)
|
|
*SvEND(buf) = '\0';
|
|
SvSETMAGIC(buf);
|
|
}
|
|
+
|
|
}
|
|
OUTPUT:
|
|
RETVAL
|
|
diff -up perl-5.10.0/lib/Compress/Raw/FAQ.pod.cc perl-5.10.0/lib/Compress/Raw/FAQ.pod
|
|
--- perl-5.10.0/lib/Compress/Raw/FAQ.pod.cc 2009-06-08 12:36:21.579210608 +0200
|
|
+++ perl-5.10.0/lib/Compress/Raw/FAQ.pod 2009-06-03 10:37:02.000000000 +0200
|
|
@@ -0,0 +1,142 @@
|
|
+
|
|
+=head1 NAME
|
|
+
|
|
+Compress::Raw::Zlib::FAQ -- Frequently Asked Questions about Compress::Raw::Zlib
|
|
+
|
|
+=head1 DESCRIPTION
|
|
+
|
|
+Common questions answered.
|
|
+
|
|
+=head2 Compatibility with Unix compress/uncompress.
|
|
+
|
|
+This module is not compatible with Unix C<compress>.
|
|
+
|
|
+If you have the C<uncompress> program available, you can use this to read
|
|
+compressed files
|
|
+
|
|
+ open F, "uncompress -c $filename |";
|
|
+ while (<F>)
|
|
+ {
|
|
+ ...
|
|
+
|
|
+Alternatively, if you have the C<gunzip> program available, you can use
|
|
+this to read compressed files
|
|
+
|
|
+ open F, "gunzip -c $filename |";
|
|
+ while (<F>)
|
|
+ {
|
|
+ ...
|
|
+
|
|
+and this to write compress files, if you have the C<compress> program
|
|
+available
|
|
+
|
|
+ open F, "| compress -c $filename ";
|
|
+ print F "data";
|
|
+ ...
|
|
+ close F ;
|
|
+
|
|
+=head2 Accessing .tar.Z files
|
|
+
|
|
+See previous FAQ item.
|
|
+
|
|
+If the C<Archive::Tar> module is installed and either the C<uncompress> or
|
|
+C<gunzip> programs are available, you can use one of these workarounds to
|
|
+read C<.tar.Z> files.
|
|
+
|
|
+Firstly with C<uncompress>
|
|
+
|
|
+ use strict;
|
|
+ use warnings;
|
|
+ use Archive::Tar;
|
|
+
|
|
+ open F, "uncompress -c $filename |";
|
|
+ my $tar = Archive::Tar->new(*F);
|
|
+ ...
|
|
+
|
|
+and this with C<gunzip>
|
|
+
|
|
+ use strict;
|
|
+ use warnings;
|
|
+ use Archive::Tar;
|
|
+
|
|
+ open F, "gunzip -c $filename |";
|
|
+ my $tar = Archive::Tar->new(*F);
|
|
+ ...
|
|
+
|
|
+Similarly, if the C<compress> program is available, you can use this to
|
|
+write a C<.tar.Z> file
|
|
+
|
|
+ use strict;
|
|
+ use warnings;
|
|
+ use Archive::Tar;
|
|
+ use IO::File;
|
|
+
|
|
+ my $fh = new IO::File "| compress -c >$filename";
|
|
+ my $tar = Archive::Tar->new();
|
|
+ ...
|
|
+ $tar->write($fh);
|
|
+ $fh->close ;
|
|
+
|
|
+=head2 Accessing Zip Files
|
|
+
|
|
+This module does not support reading/writing zip files.
|
|
+
|
|
+Support for reading/writing zip files is included with the
|
|
+C<IO::Compress::Zip> and C<IO::Uncompress::Unzip> modules.
|
|
+
|
|
+The primary focus of the C<IO::Compress::Zip> and C<IO::Uncompress::Unzip>
|
|
+modules is to provide an C<IO::File> compatible streaming read/write
|
|
+interface to zip files/buffers. They are not fully flegged archivers. If
|
|
+you are looking for an archiver check out the C<Archive::Zip> module. You
|
|
+can find it on CPAN at
|
|
+
|
|
+ http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz
|
|
+
|
|
+=head2 Zlib Library Version Support
|
|
+
|
|
+By default C<Compress::Raw::Zlib> will build with a private copy of version
|
|
+1.2.3 of the zlib library. (See the F<README> file for details of
|
|
+how to override this behaviour)
|
|
+
|
|
+If you decide to use a different version of the zlib library, you need to be
|
|
+aware of the following issues
|
|
+
|
|
+=over 5
|
|
+
|
|
+=item *
|
|
+
|
|
+First off, you must have zlib 1.0.5 or better.
|
|
+
|
|
+=item *
|
|
+
|
|
+You need to have zlib 1.2.1 or better if you want to use the C<-Merge>
|
|
+option with C<IO::Compress::Gzip>, C<IO::Compress::Deflate> and
|
|
+C<IO::Compress::RawDeflate>.
|
|
+
|
|
+=back
|
|
+
|
|
+=head1 SEE ALSO
|
|
+
|
|
+L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
|
|
+
|
|
+L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
|
|
+
|
|
+L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
|
|
+L<Archive::Tar|Archive::Tar>,
|
|
+L<IO::Zlib|IO::Zlib>
|
|
+
|
|
+=head1 AUTHOR
|
|
+
|
|
+This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
+
|
|
+=head1 MODIFICATION HISTORY
|
|
+
|
|
+See the Changes file.
|
|
+
|
|
+=head1 COPYRIGHT AND LICENSE
|
|
+
|
|
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
|
|
+
|
|
+This program is free software; you can redistribute it and/or
|
|
+modify it under the same terms as Perl itself.
|
|
+
|