summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-01-29 00:01:04 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-01-29 00:01:04 +0000
commit589c1691425a4f9409b82065e346c2e82aeba331 (patch)
tree79c255bbf431c92086fb9374907d0153dd1f3286 /cpan
parent76f546a2b3e45580650b74c8529f081a41f8af8b (diff)
downloadperl-589c1691425a4f9409b82065e346c2e82aeba331.tar.gz
Update Compress-Raw-Zlib to CPAN version 2.047
[DELTA] 2.047 28 January 2012 * Allow flush to be called multiple times without any intermediate call to deflate and still return Z_OK. In the code below $status was Z_BUF_ERROR before this change. $def->flush(...); $status = $def->flush(...); * Added support for zlibCompileFlags * Set minimum Perl version to 5.6
Diffstat (limited to 'cpan')
-rw-r--r--cpan/Compress-Raw-Zlib/Changes13
-rw-r--r--cpan/Compress-Raw-Zlib/Makefile.PL4
-rw-r--r--cpan/Compress-Raw-Zlib/README8
-rw-r--r--cpan/Compress-Raw-Zlib/Zlib.xs52
-rw-r--r--cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm65
-rw-r--r--cpan/Compress-Raw-Zlib/t/02zlib.t62
6 files changed, 182 insertions, 22 deletions
diff --git a/cpan/Compress-Raw-Zlib/Changes b/cpan/Compress-Raw-Zlib/Changes
index bc0a1a8adc..7070d0fc22 100644
--- a/cpan/Compress-Raw-Zlib/Changes
+++ b/cpan/Compress-Raw-Zlib/Changes
@@ -1,6 +1,19 @@
CHANGES
-------
+ 2.047 28 January 2012
+
+ * Allow flush to be called multiple times without any intermediate
+ call to deflate and still return Z_OK.
+ In the code below $status was Z_BUF_ERROR before this change.
+
+ $def->flush(...);
+ $status = $def->flush(...);
+
+ * Added support for zlibCompileFlags
+
+ * Set minimum Perl version to 5.6
+
2.045 3 December 2011
* Moved FAQ.pod into Zlib.pm
diff --git a/cpan/Compress-Raw-Zlib/Makefile.PL b/cpan/Compress-Raw-Zlib/Makefile.PL
index d999cb483a..377bff48d1 100644
--- a/cpan/Compress-Raw-Zlib/Makefile.PL
+++ b/cpan/Compress-Raw-Zlib/Makefile.PL
@@ -1,7 +1,7 @@
#! perl -w
use strict ;
-require 5.004 ;
+require 5.006 ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
@@ -66,7 +66,7 @@ WriteMakefile(
NAME => 'Compress::Raw::Zlib',
VERSION_FROM => 'lib/Compress/Raw/Zlib.pm',
INC => "-I$ZLIB_INCLUDE" ,
- DEFINE => "-DNO_VIZ $OLD_ZLIB $WALL -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H" ,
+ DEFINE => "-DNO_VIZ -DZ_SOLO $OLD_ZLIB $WALL -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H" ,
XS => { 'Zlib.xs' => 'Zlib.c'},
'depend' => { 'Makefile' => 'config.in' },
'clean' => { FILES => '*.c constants.h constants.xs' },
diff --git a/cpan/Compress-Raw-Zlib/README b/cpan/Compress-Raw-Zlib/README
index bd90ff4e95..93b6e00ce8 100644
--- a/cpan/Compress-Raw-Zlib/README
+++ b/cpan/Compress-Raw-Zlib/README
@@ -1,11 +1,11 @@
Compress-Raw-Zlib
- Version 2.045
+ Version 2.047
- 3rd December 2011
+ 28th January 2012
- Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
+ Copyright (c) 2005-2012 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.
@@ -355,7 +355,7 @@ To help me help you, I need all of the following information:
If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm
for a line like this:
- $VERSION = "2.045" ;
+ $VERSION = "2.047" ;
c. The version of zlib you have used.
If you have successfully installed Compress-Raw-Zlib, this one-liner
diff --git a/cpan/Compress-Raw-Zlib/Zlib.xs b/cpan/Compress-Raw-Zlib/Zlib.xs
index 70713b918e..ebf03ce323 100644
--- a/cpan/Compress-Raw-Zlib/Zlib.xs
+++ b/cpan/Compress-Raw-Zlib/Zlib.xs
@@ -44,6 +44,7 @@
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1210
# define MAGIC_APPEND
+# define AT_LEAST_ZLIB_1_2_1
#endif
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221
@@ -62,6 +63,13 @@
# define AT_LEAST_ZLIB_1_2_3
#endif
+#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1252
+/*
+ Use Z_SOLO to build source means need own malloc/free
+ */
+# define AT_LEAST_ZLIB_1_2_5_2
+#endif
+
#ifdef USE_PPPORT_H
# define NEED_sv_2pvbyte
# define NEED_sv_2pv_nolen
@@ -482,6 +490,20 @@ DispStream(s, message)
}
}
+#ifdef AT_LEAST_ZLIB_1_2_5_2
+voidpf my_zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ return safemalloc(items * size);
+}
+
+
+void my_zcfree (voidpf opaque, voidpf ptr)
+{
+ return safefree(ptr);
+}
+
+#endif
+
static di_stream *
#ifdef CAN_PROTOTYPE
InitStream(void)
@@ -493,8 +515,12 @@ InitStream()
ZMALLOC(s, di_stream) ;
+#ifdef AT_LEAST_ZLIB_1_2_5_2
+ s->stream.zalloc = my_zcalloc;
+ s->stream.zfree = my_zcfree;
+#endif
+
return s ;
-
}
static void
@@ -637,10 +663,19 @@ ZLIB_VERNUM()
RETVAL = (ZLIB_VERSION[0] - '0') << 12 ;
RETVAL += (ZLIB_VERSION[2] - '0') << 8 ;
RETVAL += (ZLIB_VERSION[4] - '0') << 4 ;
+ if (strlen(ZLIB_VERSION) > 5)
+ RETVAL += (ZLIB_VERSION[6] - '0') ;
#endif
OUTPUT:
RETVAL
+
+#ifndef AT_LEAST_ZLIB_1_2_1
+#define zlibCompileFlags() 0
+#endif
+uLong
+zlibCompileFlags()
+
MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib PREFIX = Zip_
#define Zip_adler32(buf, adler) adler32(adler, buf, (uInt)len)
@@ -756,6 +791,9 @@ _deflateInit(flags,level, method, windowBits, memLevel, strategy, bufsize, dicti
err = deflateInit2(&(s->stream), level,
method, windowBits, memLevel, strategy);
+ if (trace)
+ warn(" _deflateInit2 returned %d\n", err);
+
/* Check if a dictionary has been specified */
if (err == Z_OK && SvCUR(dictionary)) {
@@ -1008,6 +1046,7 @@ flush(s, output, f=Z_FINISH)
uInt increment = NO_INIT
uInt prefix = NO_INIT
uLong bufinc = NO_INIT
+ uLong availableout = NO_INIT
CODE:
bufinc = s->bufsize;
@@ -1057,8 +1096,8 @@ flush(s, output, f=Z_FINISH)
#endif
for (;;) {
- if (s->stream.avail_out == 0) {
- /* consumed all the available output, so extend it */
+ if (s->stream.avail_out == 0) {
+ /* consumed all the available output, so extend it */
Sv_Grow(output, SvLEN(output) + bufinc) ;
cur_length += increment ;
s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length ;
@@ -1066,8 +1105,15 @@ flush(s, output, f=Z_FINISH)
s->stream.avail_out = increment;
bufinc *= 2 ;
}
+
+ availableout = s->stream.avail_out ;
+
RETVAL = deflate(&(s->stream), f);
+ /* Ignore the second of two consecutive flushes: */
+ if (availableout == s->stream.avail_out && RETVAL == Z_BUF_ERROR)
+ RETVAL = Z_OK;
+
/* deflate has finished flushing only when it hasn't used up
* all the available space in the output buffer:
*/
diff --git a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm
index 69076879a8..ab7dc5b187 100644
--- a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm
+++ b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm
@@ -1,33 +1,66 @@
package Compress::Raw::Zlib;
-require 5.004 ;
+require 5.006 ;
require Exporter;
use AutoLoader;
use Carp ;
-#use Parse::Parameters;
-
use strict ;
use warnings ;
use bytes ;
-our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
+our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS );
-$VERSION = '2.045';
+$VERSION = '2.047';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@ISA = qw(Exporter);
+%EXPORT_TAGS = ( flush => [qw{
+ Z_NO_FLUSH
+ Z_PARTIAL_FLUSH
+ Z_SYNC_FLUSH
+ Z_FULL_FLUSH
+ Z_FINISH
+ Z_BLOCK
+ }],
+ level => [qw{
+ Z_NO_COMPRESSION
+ Z_BEST_SPEED
+ Z_BEST_COMPRESSION
+ Z_DEFAULT_COMPRESSION
+ }],
+ strategy => [qw{
+ Z_FILTERED
+ Z_HUFFMAN_ONLY
+ Z_RLE
+ Z_FIXED
+ Z_DEFAULT_STRATEGY
+ }],
+ status => [qw{
+ Z_OK
+ Z_STREAM_END
+ Z_NEED_DICT
+ Z_ERRNO
+ Z_STREAM_ERROR
+ Z_DATA_ERROR
+ Z_MEM_ERROR
+ Z_BUF_ERROR
+ Z_VERSION_ERROR
+ }],
+ );
+
+%DEFLATE_CONSTANTS = %EXPORT_TAGS;
+
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
+@DEFLATE_CONSTANTS =
@EXPORT = qw(
- adler32 crc32
-
ZLIB_VERSION
ZLIB_VERNUM
- DEF_WBITS
+
OS_CODE
MAX_MEM_LEVEL
@@ -68,6 +101,8 @@ $VERSION = eval $VERSION;
WANT_GZIP_OR_ZLIB
);
+push @EXPORT, qw(crc32 adler32 DEF_WBITS);
+
use constant WANT_GZIP => 16;
use constant WANT_GZIP_OR_ZLIB => 32;
@@ -605,6 +640,7 @@ Compress::Raw::Zlib - Low-Level Interface to zlib compression library
$crc = crc32_combine($adler1, $adler2, $len2)
my $version = Compress::Raw::Zlib::zlib_version();
+ my $flags = Compress::Raw::Zlib::zlibCompileFlags();
=head1 DESCRIPTION
@@ -1266,6 +1302,17 @@ These functions allow checksums to be merged.
Returns the version of the zlib library.
+=head2 my $flags = Compress::Raw::Zlib::zlibCompileFlags();
+
+Returns the flags indicating compile-time options that were used to build
+the zlib library. See the zlib documentation for a description of the flags
+returned by C<zlibCompileFlags>.
+
+Note that when the zlib sources are built along with this module the
+C<sprintf> flags (bits 24, 25 and 26) should be ignored.
+
+If you are using zlib 1.2.0 or older, C<zlibCompileFlags> will return 0.
+
=head1 The LimitOutput option.
By default C<< $i->inflate($input, $output) >> will uncompress I<all> data
@@ -1542,7 +1589,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2012 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.
diff --git a/cpan/Compress-Raw-Zlib/t/02zlib.t b/cpan/Compress-Raw-Zlib/t/02zlib.t
index 52ad065a6f..6ce990d214 100644
--- a/cpan/Compress-Raw-Zlib/t/02zlib.t
+++ b/cpan/Compress-Raw-Zlib/t/02zlib.t
@@ -24,13 +24,13 @@ BEGIN
my $count = 0 ;
if ($] < 5.005) {
- $count = 230 ;
+ $count = 232 ;
}
elsif ($] >= 5.006) {
- $count = 300 ;
+ $count = 310 ;
}
else {
- $count = 258 ;
+ $count = 268 ;
}
plan tests => $count + $extra;
@@ -39,6 +39,8 @@ BEGIN
}
+my $Zlib_ver = Compress::Raw::Zlib::zlib_version ;
+
my $hello = <<EOM ;
hello world
this is a test
@@ -428,9 +430,13 @@ for my $consume ( 0 .. 1)
}
+SKIP:
{
title 'inflateSync';
+ skip "inflateSync needs zlib 1.2.1 or better, you have $Zlib_ver", 22
+ if ZLIB_VERNUM() < 0x1210 ;
+
# create a deflate stream with flush points
my $hello = "I am a HAL 9000 computer" x 2001 ;
@@ -728,18 +734,26 @@ if ($] >= 5.005)
}
+SKIP:
{
+ skip "InflateScan needs zlib 1.2.1 or better, you have $Zlib_ver", 1
+ if ZLIB_VERNUM() < 0x1210 ;
+
# regression - check that resetLastBlockByte can cope with a NULL
# pointer.
Compress::Raw::Zlib::InflateScan->new->resetLastBlockByte(undef);
ok 1, "resetLastBlockByte(undef) is ok" ;
}
+SKIP:
{
title "gzip mode";
# ================
+ skip "gzip mode needs zlib 1.2.1 or better, you have $Zlib_ver", 13
+ if ZLIB_VERNUM() < 0x1210 ;
+
my $hello = "I am a HAL 9000 computer" ;
my @hello = split('', $hello) ;
my ($err, $x, $X, $status);
@@ -780,6 +794,7 @@ if ($] >= 5.005)
is $GOT, $hello, "uncompressed data matches ok" ;
}
+SKIP:
{
title "gzip error mode";
@@ -788,6 +803,9 @@ if ($] >= 5.005)
# then read with WANT_GZIP_OR_ZLIB - thi swill work
# ================
+ skip "gzip mode needs zlib 1.2.1 or better, you have $Zlib_ver", 12
+ if ZLIB_VERNUM() < 0x1210 ;
+
my $hello = "I am a HAL 9000 computer" ;
my ($err, $x, $X, $status);
@@ -826,14 +844,17 @@ if ($] >= 5.005)
is $GOT, $hello, "uncompressed data matches ok" ;
}
+SKIP:
{
-
title "gzip/zlib error mode";
# Create zlib -
# read with no WANT_GZIP windowbits setting - this will fail
# then read with WANT_GZIP_OR_ZLIB - thi swill work
# ================
+ skip "gzip mode needs zlib 1.2.1 or better, you have $Zlib_ver", 12
+ if ZLIB_VERNUM() < 0x1210 ;
+
my $hello = "I am a HAL 9000 computer" ;
my ($err, $x, $X, $status);
@@ -871,6 +892,39 @@ if ($] >= 5.005)
is $GOT, $hello, "uncompressed data matches ok" ;
}
+{
+ title "zlibCompileFlags";
+
+ my $flags = Compress::Raw::Zlib::zlibCompileFlags;
+
+ if (ZLIB_VERNUM() < 0x1210)
+ {
+ is $flags, 0, "zlibCompileFlags == 0 if < 1.2.1";
+ }
+ else
+ {
+ ok $flags, "zlibCompileFlags != 0 if < 1.2.1";
+ }
+}
+
+{
+ title "repeated calls to flush";
+
+ my $hello = "I am a HAL 9000 computer" ;
+ my ($err, $x, $X, $status);
+
+ ok( ($x, $err) = new Compress::Raw::Zlib::Deflate ( ), "Create deflate object" );
+ isa_ok $x, "Compress::Raw::Zlib::deflateStream" ;
+ cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+
+ $status = $x->deflate($hello, $X) ;
+ cmp_ok $status, '==', Z_OK, "deflate returned Z_OK" ;
+
+ cmp_ok $x->flush($X, Z_SYNC_FLUSH), '==', Z_OK, "flush returned Z_OK" ;
+ cmp_ok $x->flush($X, Z_SYNC_FLUSH), '==', Z_OK, "second flush returned Z_OK" ;
+ is $X, "", "no output from second flush";
+}
+
exit if $] < 5.006 ;
title 'Looping Append test with substr output - substr the end of the string';