From: Rafael Garcia-Suarez Date: Mon, 24 Sep 2007 13:19:10 +0000 (+0000) Subject: Upgrade to Compress::Zlib 2.007 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aa976d0c37399f75e81801ee86455944a2734d9c;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Compress::Zlib 2.007 p4raw-id: //depot/perl@31953 --- diff --git a/ext/Compress/Zlib/Changes b/ext/Compress/Zlib/Changes index bcc74fb..3ee2c93 100644 --- a/ext/Compress/Zlib/Changes +++ b/ext/Compress/Zlib/Changes @@ -1,6 +1,13 @@ CHANGES ------- + 2.007 22 September 20007 + + * lib/Compress/Zlib.pm -- 1.x Backward Compatability issues + gzclose - documented return value was wrong, should be 0 for ok. + gzflush - return value didn't match 1.x, should return 0 if ok. + [rt.cpan.org #29215] and Debian bug #440943 http://bugs.debian.org/440943 + 2.006 1 September 20007 * Makefile.PL diff --git a/ext/Compress/Zlib/README b/ext/Compress/Zlib/README index 24a8317..13f3996 100644 --- a/ext/Compress/Zlib/README +++ b/ext/Compress/Zlib/README @@ -1,9 +1,9 @@ Compress::Zlib - Version 2.006 + Version 2.007 - 1st September 2007 + 22nd September 2007 Copyright (c) 1995-2007 Paul Marquess. All rights reserved. diff --git a/ext/Compress/Zlib/lib/Compress/Zlib.pm b/ext/Compress/Zlib/lib/Compress/Zlib.pm index b4b04cd..ec29575 100644 --- a/ext/Compress/Zlib/lib/Compress/Zlib.pm +++ b/ext/Compress/Zlib/lib/Compress/Zlib.pm @@ -18,7 +18,7 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.006'; +$VERSION = '2.007'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -242,8 +242,8 @@ sub Compress::Zlib::gzFile::gzflush my $gz = $self->[0] ; my $status = $gz->flush($f) ; - _save_gzerr($gz); - return $status ; + my $err = _save_gzerr($gz); + return $status ? 0 : $err; } sub Compress::Zlib::gzFile::gzclose @@ -252,8 +252,8 @@ sub Compress::Zlib::gzFile::gzclose my $gz = $self->[0] ; my $status = $gz->close() ; - _save_gzerr($gz); - return ! $status ; + my $err = _save_gzerr($gz); + return $status ? 0 : $err; } sub Compress::Zlib::gzFile::gzeof @@ -806,7 +806,7 @@ you fully understand the implications of what it does - overuse of C can seriously degrade the level of compression achieved. See the C documentation for details. -Returns 1 on success, 0 on failure. +Returns 0 on success. =item B<$offset = $gz-Egztell() ;> @@ -831,7 +831,7 @@ Returns 1 on success, 0 on failure. Closes the compressed file. Any pending data is flushed to the file before it is closed. -Returns 1 on success, 0 on failure. +Returns 0 on success. =item B<$gz-Egzsetparams($level, $strategy> diff --git a/ext/Compress/Zlib/t/03zlib-v1.t b/ext/Compress/Zlib/t/03zlib-v1.t index 99a80f9..7358f4a 100644 --- a/ext/Compress/Zlib/t/03zlib-v1.t +++ b/ext/Compress/Zlib/t/03zlib-v1.t @@ -23,10 +23,10 @@ BEGIN my $count = 0 ; if ($] < 5.005) { - $count = 383 ; + $count = 390 ; } else { - $count = 394 ; + $count = 401 ; } @@ -1168,3 +1168,21 @@ sub trickle is slurp($name), $data1 . $data2 . $trailing, "got expected data from slurp" ; is trickle($name), $data1 . $data2 . $trailing, "got expected data from trickle" ; } + +{ + title "gzclose & gzflush return codes"; + # rt.29215 + + my $lex = new LexFile my $name ; + my $data1 = "the is some text"; + my $status; + + $fil = gzopen($name, "wb") ; + ok $fil, "opened first file"; + is $fil->gzwrite($data1), length $data1, "write data1" ; + $status = $fil->gzflush(0xfff); + ok $status, "flush not ok" ; + is $status, Z_STREAM_ERROR; + ok ! $fil->gzflush(), "flush ok" ; + ok ! $fil->gzclose(), "Closed"; +} diff --git a/ext/Compress/Zlib/t/14gzopen.t b/ext/Compress/Zlib/t/14gzopen.t index 805bb0d..85970d2 100644 --- a/ext/Compress/Zlib/t/14gzopen.t +++ b/ext/Compress/Zlib/t/14gzopen.t @@ -95,7 +95,7 @@ is $gzerrno, 0; is $fil->gzwrite($number), $num_len, "gzwrite returned $num_len" ; is $gzerrno, 0, 'gzerrno is 0'; -ok $fil->gzflush(Z_FINISH) ; +ok ! $fil->gzflush(Z_FINISH) ; is $gzerrno, 0, 'gzerrno is 0';