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
Compress::Zlib
- Version 2.006
+ Version 2.007
- 1st September 2007
+ 22nd September 2007
Copyright (c) 1995-2007 Paul Marquess. All rights reserved.
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.006';
+$VERSION = '2.007';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
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
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
can seriously degrade the level of compression achieved. See the C<zlib>
documentation for details.
-Returns 1 on success, 0 on failure.
+Returns 0 on success.
=item B<$offset = $gz-E<gt>gztell() ;>
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-E<gt>gzsetparams($level, $strategy>
my $count = 0 ;
if ($] < 5.005) {
- $count = 383 ;
+ $count = 390 ;
}
else {
- $count = 394 ;
+ $count = 401 ;
}
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";
+}
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';