summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2014-02-02 12:15:01 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2014-02-02 12:15:01 +0000
commitfdaa82e46637bc8c3411a4f3995beb0c3e77cea3 (patch)
tree62252ac207cd3d055ea36f851ef66d7994ee6cdd /cpan
parentf36edc68cf35f994421e6733ba1e189240cf5c5e (diff)
downloadperl-fdaa82e46637bc8c3411a4f3995beb0c3e77cea3.tar.gz
Update Compress-Raw-Bzip2 to CPAN version 2.064
[DELTA] 2.064 1 February 2014 * [PATCH] Handle non-PVs better [#91558]
Diffstat (limited to 'cpan')
-rw-r--r--cpan/Compress-Raw-Bzip2/Bzip2.xs14
-rw-r--r--cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm4
-rw-r--r--cpan/Compress-Raw-Bzip2/t/000prereq.t2
-rw-r--r--cpan/Compress-Raw-Bzip2/t/19nonpv.t91
4 files changed, 102 insertions, 9 deletions
diff --git a/cpan/Compress-Raw-Bzip2/Bzip2.xs b/cpan/Compress-Raw-Bzip2/Bzip2.xs
index 825724424a..17924c7898 100644
--- a/cpan/Compress-Raw-Bzip2/Bzip2.xs
+++ b/cpan/Compress-Raw-Bzip2/Bzip2.xs
@@ -485,6 +485,7 @@ bzdeflate (s, buf, output)
uInt increment = NO_INIT
int RETVAL = 0;
uInt bufinc = NO_INIT
+ STRLEN origlen = NO_INIT
CODE:
bufinc = s->bufsize;
@@ -496,8 +497,8 @@ bzdeflate (s, buf, output)
if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
croak("Wide character in " COMPRESS_CLASS "::bzdeflate input parameter");
#endif
- s->stream.next_in = (char*)SvPV_nomg_nolen(buf) ;
- s->stream.avail_in = SvCUR(buf) ;
+ s->stream.next_in = (char*)SvPV_nomg(buf, origlen) ;
+ s->stream.avail_in = origlen;
/* and retrieve the output buffer */
output = deRef_l(output, "deflate") ;
@@ -532,7 +533,7 @@ bzdeflate (s, buf, output)
}
s->compressedBytes += cur_length + increment - s->stream.avail_out ;
- s->uncompressedBytes += SvCUR(buf) - s->stream.avail_in ;
+ s->uncompressedBytes += origlen - s->stream.avail_in ;
s->last_error = RETVAL ;
if (RETVAL == BZ_RUN_OK) {
@@ -725,6 +726,7 @@ bzinflate (s, buf, output)
uInt increment = 0;
uInt bufinc = NO_INIT
STRLEN na = NO_INIT ;
+ STRLEN origlen = NO_INIT
PREINIT:
#ifdef UTF8_AVAILABLE
bool out_utf8 = FALSE;
@@ -745,8 +747,8 @@ bzinflate (s, buf, output)
#endif
/* initialise the input buffer */
- s->stream.next_in = (char*)SvPV_nomg_nolen(buf) ;
- s->stream.avail_in = SvCUR(buf);
+ s->stream.next_in = (char*)SvPV_nomg(buf, origlen) ;
+ s->stream.avail_in = origlen;
/* and retrieve the output buffer */
output = deRef_l(output, "bzinflate") ;
@@ -824,7 +826,7 @@ bzinflate (s, buf, output)
s->bytesInflated = cur_length + increment - s->stream.avail_out - prefix_length;
s->uncompressedBytes += s->bytesInflated ;
- s->compressedBytes += SvCUR(buf) - s->stream.avail_in ;
+ s->compressedBytes += origlen - s->stream.avail_in ;
SvPOK_only(output);
SvCUR_set(output, prefix_length + s->bytesInflated) ;
diff --git a/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm b/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm
index dd54517518..037ba43715 100644
--- a/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm
+++ b/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm
@@ -11,7 +11,7 @@ use Carp ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.063';
+$VERSION = '2.064';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -378,7 +378,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 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-Bzip2/t/000prereq.t b/cpan/Compress-Raw-Bzip2/t/000prereq.t
index a93ee9a217..df43d677b1 100644
--- a/cpan/Compress-Raw-Bzip2/t/000prereq.t
+++ b/cpan/Compress-Raw-Bzip2/t/000prereq.t
@@ -19,7 +19,7 @@ BEGIN
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.063';
+ my $VERSION = '2.064';
my @NAMES = qw(
);
diff --git a/cpan/Compress-Raw-Bzip2/t/19nonpv.t b/cpan/Compress-Raw-Bzip2/t/19nonpv.t
new file mode 100644
index 0000000000..15d53b92ca
--- /dev/null
+++ b/cpan/Compress-Raw-Bzip2/t/19nonpv.t
@@ -0,0 +1,91 @@
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use strict;
+use warnings;
+
+use Test::More ;
+use CompTestUtils;
+
+BEGIN
+{
+ # use Test::NoWarnings, if available
+ my $extra = 0 ;
+ $extra = 1
+ if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
+
+ plan tests => 21 + $extra ;
+
+ use_ok('Compress::Raw::Bzip2', 2) ;
+}
+
+
+
+my $hello = <<EOM ;
+hello world
+this is a test
+EOM
+
+my $len = length $hello ;
+
+
+{
+
+ title "bzdeflate/bzinflate - non-PV buffers";
+ # ==============================
+
+ my $hello = *hello;
+ $hello = *hello;
+ my ($err, $x, $X, $status);
+
+ ok( ($x, $err) = new Compress::Raw::Bzip2(0), "Create bzdeflate object" );
+ ok $x, "Compress::Raw::Bzip2 ok" ;
+ cmp_ok $err, '==', BZ_OK, "status is BZ_OK" ;
+
+ is $x->uncompressedBytes(), 0, "uncompressedBytes() == 0" ;
+ is $x->compressedBytes(), 0, "compressedBytes() == 0" ;
+
+ my $Answer = *Answer;
+ $Answer = *Answer;
+ $status = $x->bzdeflate($hello, $Answer) ;
+ cmp_ok $status, '==', BZ_RUN_OK, "bzdeflate returned BZ_RUN_OK" ;
+
+ $X = *X;
+ cmp_ok $x->bzflush($X), '==', BZ_RUN_OK, "bzflush returned BZ_RUN_OK" ;
+ $Answer .= $X ;
+
+ is $x->uncompressedBytes(), length $hello, "uncompressedBytes ok" ;
+ is $x->compressedBytes(), length $Answer, "compressedBytes ok" ;
+
+ $X = *X;
+ cmp_ok $x->bzclose($X), '==', BZ_STREAM_END, "bzclose returned BZ_STREAM_END";
+ $Answer .= $X ;
+
+ my @Answer = split('', $Answer) ;
+
+ my $k;
+ ok(($k, $err) = new Compress::Raw::Bunzip2(0, 0));
+ ok $k, "Compress::Raw::Bunzip2 ok" ;
+ cmp_ok $err, '==', BZ_OK, "status is BZ_OK" ;
+
+ is $k->compressedBytes(), 0, "compressedBytes() == 0" ;
+ is $k->uncompressedBytes(), 0, "uncompressedBytes() == 0" ;
+ my $GOT = *GOT;
+ $GOT = *GOT;
+ my $Z;
+ $status = $k->bzinflate($Answer, $GOT) ;
+
+
+ cmp_ok $status, '==', BZ_STREAM_END, "Got BZ_STREAM_END" ;
+ is $GOT, $hello, "uncompressed data matches ok" ;
+ is $k->compressedBytes(), length $Answer, "compressedBytes ok" ;
+ is $k->uncompressedBytes(), length $hello , "uncompressedBytes ok";
+
+}
+
+