r23313 - in /trunk/libcompress-raw-zlib-perl: Changes META.yml README Zlib.xs debian/changelog lib/Compress/Raw/Zlib.pm private/MakeUtil.pm t/000prereq.t t/02zlib.t

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Jul 16 19:23:16 UTC 2008


Author: dmn
Date: Wed Jul 16 19:23:14 2008
New Revision: 23313

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=23313
Log:
New upstream release

Modified:
    trunk/libcompress-raw-zlib-perl/Changes
    trunk/libcompress-raw-zlib-perl/META.yml
    trunk/libcompress-raw-zlib-perl/README
    trunk/libcompress-raw-zlib-perl/Zlib.xs
    trunk/libcompress-raw-zlib-perl/debian/changelog
    trunk/libcompress-raw-zlib-perl/lib/Compress/Raw/Zlib.pm
    trunk/libcompress-raw-zlib-perl/private/MakeUtil.pm
    trunk/libcompress-raw-zlib-perl/t/000prereq.t
    trunk/libcompress-raw-zlib-perl/t/02zlib.t

Modified: trunk/libcompress-raw-zlib-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/Changes?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/Changes (original)
+++ trunk/libcompress-raw-zlib-perl/Changes Wed Jul 16 19:23:14 2008
@@ -1,6 +1,14 @@
 CHANGES
 -------
 
+  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.

Modified: trunk/libcompress-raw-zlib-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/META.yml?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/META.yml (original)
+++ trunk/libcompress-raw-zlib-perl/META.yml Wed Jul 16 19:23:14 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Compress-Raw-Zlib
-version:             2.011
+version:             2.012
 abstract:            Low-Level Interface to zlib compression library
 license:             perl
 author:              

Modified: trunk/libcompress-raw-zlib-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/README?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/README (original)
+++ trunk/libcompress-raw-zlib-perl/README Wed Jul 16 19:23:14 2008
@@ -1,9 +1,9 @@
 
                              Compress-Raw-Zlib
 
-                             Version 2.011
-
-                               17th May 2008
+                             Version 2.012
+
+                              15th July 2008
 
        Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
           This program is free software; you can redistribute it
@@ -326,7 +326,7 @@
         If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm
         for a line like this:
 
-          $VERSION = "2.011" ;
+          $VERSION = "2.012" ;
 
      c. The version of zlib you have used.
         If you have successfully installed Compress-Raw-Zlib, this one-liner

Modified: trunk/libcompress-raw-zlib-perl/Zlib.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/Zlib.xs?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/Zlib.xs (original)
+++ trunk/libcompress-raw-zlib-perl/Zlib.xs Wed Jul 16 19:23:14 2008
@@ -48,6 +48,10 @@
 
 #if  defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221
 #  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
@@ -808,6 +812,19 @@
             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) ;
 	}
@@ -1297,8 +1314,9 @@
     }
     s->bytesInflated = 0;
     
-    while (1) {
-
+    RETVAL = Z_OK;
+
+    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) ;
@@ -1331,8 +1349,6 @@
             SvCUR(s->dictionary));
         }
 
-        if (RETVAL != Z_OK) 
-            break;
     }
 #ifdef NEED_DUMMY_BYTE_AT_END 
     if (eof && RETVAL == Z_OK) {

Modified: trunk/libcompress-raw-zlib-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/debian/changelog?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/debian/changelog (original)
+++ trunk/libcompress-raw-zlib-perl/debian/changelog Wed Jul 16 19:23:14 2008
@@ -1,3 +1,9 @@
+libcompress-raw-zlib-perl (2.012-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Damyan Ivanov <dmn at debian.org>  Wed, 16 Jul 2008 22:20:45 +0300
+
 libcompress-raw-zlib-perl (2.011-2) unstable; urgency=low
 
   * add use-debian-zlib.patch, changing configure.in to use vendor zlib

Modified: trunk/libcompress-raw-zlib-perl/lib/Compress/Raw/Zlib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/lib/Compress/Raw/Zlib.pm?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/lib/Compress/Raw/Zlib.pm (original)
+++ trunk/libcompress-raw-zlib-perl/lib/Compress/Raw/Zlib.pm Wed Jul 16 19:23:14 2008
@@ -13,7 +13,7 @@
 use bytes ;
 our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
 
-$VERSION = '2.011';
+$VERSION = '2.012';
 $XS_VERSION = $VERSION; 
 $VERSION = eval $VERSION;
 
@@ -62,8 +62,13 @@
         Z_SYNC_FLUSH
         Z_UNKNOWN
         Z_VERSION_ERROR
+
+        WANT_GZIP
+        WANT_GZIP_OR_ZLIB
 );
 
+use constant WANT_GZIP           => 16;
+use constant WANT_GZIP_OR_ZLIB   => 32;
 
 sub AUTOLOAD {
     my($constname);
@@ -361,10 +366,14 @@
     $flags |= FLAG_CRC    if $got->value('CRC32') ;
     $flags |= FLAG_ADLER  if $got->value('ADLER32') ;
 
+    my $windowBits =  $got->value('WindowBits');
+    $windowBits += MAX_WBITS()
+        if ($windowBits & MAX_WBITS()) == 0 ;
+
     _deflateInit($flags,
                 $got->value('Level'), 
                 $got->value('Method'), 
-                $got->value('WindowBits'), 
+                $windowBits, 
                 $got->value('MemLevel'), 
                 $got->value('Strategy'), 
                 $got->value('Bufsize'),
@@ -398,7 +407,11 @@
     $flags |= FLAG_ADLER  if $got->value('ADLER32') ;
     $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ;
 
-    _inflateInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), 
+    my $windowBits =  $got->value('WindowBits');
+    $windowBits += MAX_WBITS()
+        if ($windowBits & MAX_WBITS()) == 0 ;
+
+    _inflateInit($flags, $windowBits, $got->value('Bufsize'), 
                  $got->value('Dictionary')) ;
 }
 
@@ -607,7 +620,7 @@
 C<Z_NO_COMPRESSION>, C<Z_BEST_SPEED>, C<Z_BEST_COMPRESSION>, and
 C<Z_DEFAULT_COMPRESSION>.
 
-The default is Z_DEFAULT_COMPRESSION.
+The default is C<Z_DEFAULT_COMPRESSION>.
 
 =item B<-Method>
 
@@ -616,10 +629,18 @@
 
 =item B<-WindowBits>
 
+To compress an RFC 1950 data stream, set C<WindowBits> to a positive
+number between 8 and 15.
+
+To compress an RFC 1951 data stream, set C<WindowBits> to C<-MAX_WBITS>.
+
+To compress an RFC 1952 data stream (i.e. gzip), set C<WindowBits> to
+C<WANT_GZIP>.
+
 For a definition of the meaning and valid values for C<WindowBits>
 refer to the I<zlib> documentation for I<deflateInit2>.
 
-Defaults to MAX_WBITS.
+Defaults to C<MAX_WBITS>.
 
 =item B<-MemLevel>
 
@@ -883,14 +904,20 @@
 =item B<-WindowBits>
 
 To uncompress an RFC 1950 data stream, set C<WindowBits> to a positive
-number.
+number between 8 and 15.
 
 To uncompress an RFC 1951 data stream, set C<WindowBits> to C<-MAX_WBITS>.
+
+To uncompress an RFC 1952 data stream (i.e. gzip), set C<WindowBits> to
+C<WANT_GZIP>.
+
+To auto-detect and uncompress an RFC 1950 or RFC 1952 data stream (i.e.
+gzip), set C<WindowBits> to C<WANT_GZIP_OR_ZLIB>.
 
 For a full definition of the meaning and valid values for C<WindowBits>
 refer to the I<zlib> documentation for I<inflateInit2>.
 
-Defaults to MAX_WBITS.
+Defaults to C<MAX_WBITS>.
 
 =item B<-Bufsize>
 

Modified: trunk/libcompress-raw-zlib-perl/private/MakeUtil.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/private/MakeUtil.pm?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/private/MakeUtil.pm (original)
+++ trunk/libcompress-raw-zlib-perl/private/MakeUtil.pm Wed Jul 16 19:23:14 2008
@@ -49,6 +49,11 @@
 
     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:

Modified: trunk/libcompress-raw-zlib-perl/t/000prereq.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/t/000prereq.t?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/t/000prereq.t (original)
+++ trunk/libcompress-raw-zlib-perl/t/000prereq.t Wed Jul 16 19:23:14 2008
@@ -19,7 +19,7 @@
         if eval { require Test::NoWarnings ;  import Test::NoWarnings; 1 };
 
 
-    my $VERSION = '2.011';
+    my $VERSION = '2.012';
     my @NAMES = qw(
 			
 			);

Modified: trunk/libcompress-raw-zlib-perl/t/02zlib.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcompress-raw-zlib-perl/t/02zlib.t?rev=23313&op=diff
==============================================================================
--- trunk/libcompress-raw-zlib-perl/t/02zlib.t (original)
+++ trunk/libcompress-raw-zlib-perl/t/02zlib.t Wed Jul 16 19:23:14 2008
@@ -24,13 +24,13 @@
 
     my $count = 0 ;
     if ($] < 5.005) {
-        $count = 189 ;
+        $count = 229 ;
     }
     elsif ($] >= 5.006) {
-        $count = 243 ;
+        $count = 283 ;
     }
     else {
-        $count = 201 ;
+        $count = 241 ;
     }
 
     plan tests => $count + $extra;
@@ -726,6 +726,142 @@
     ok 1, "resetLastBlockByte(undef) is ok" ;
 }
 
+{
+
+    title "gzip mode";
+    # ================
+
+    my $hello = "I am a HAL 9000 computer" ;
+    my @hello = split('', $hello) ;
+    my ($err, $x, $X, $status); 
+ 
+    ok( ($x, $err) = new Compress::Raw::Zlib::Deflate ( 
+            WindowBits => WANT_GZIP ,
+            AppendOutput => 1
+        ), "Create deflate object" );
+    ok $x, "Compress::Raw::Zlib::Deflate ok" ;
+    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_OK, "flush returned Z_OK" ;
+     
+    my ($k, $GOT); 
+    ($k, $err) = new Compress::Raw::Zlib::Inflate( 
+            WindowBits => WANT_GZIP ,
+            ConsumeInput => 0 ,
+            AppendOutput => 1);
+    ok $k, "Compress::Raw::Zlib::Inflate WANT_GZIP ok" ;
+    cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+ 
+    $status = $k->inflate($X, $GOT) ;
+    cmp_ok $status, '==', Z_STREAM_END, "Got Z_STREAM_END" ;
+    is $GOT, $hello, "uncompressed data matches ok" ;
+
+    $GOT = '';
+    ($k, $err) = new Compress::Raw::Zlib::Inflate( 
+            WindowBits => WANT_GZIP_OR_ZLIB ,
+            AppendOutput => 1);
+    ok $k, "Compress::Raw::Zlib::Inflate WANT_GZIP_OR_ZLIB ok" ;
+    cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+ 
+    $status = $k->inflate($X, $GOT) ;
+    cmp_ok $status, '==', Z_STREAM_END, "Got Z_STREAM_END" ;
+    is $GOT, $hello, "uncompressed data matches ok" ;
+}
+
+{
+
+    title "gzip error mode";
+    # Create gzip -
+    # read with no special windowbits setting - this will fail
+    # then read with WANT_GZIP_OR_ZLIB - thi swill work
+    # ================
+
+    my $hello = "I am a HAL 9000 computer" ;
+    my ($err, $x, $X, $status); 
+ 
+    ok( ($x, $err) = new Compress::Raw::Zlib::Deflate ( 
+            WindowBits => WANT_GZIP ,
+            AppendOutput => 1
+        ), "Create deflate object" );
+    ok $x, "Compress::Raw::Zlib::Deflate ok" ;
+    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_OK, "flush returned Z_OK" ;
+     
+    my ($k, $GOT); 
+    ($k, $err) = new Compress::Raw::Zlib::Inflate( 
+            WindowBits => MAX_WBITS ,
+            ConsumeInput => 0 ,
+            AppendOutput => 1);
+    ok $k, "Compress::Raw::Zlib::Inflate WANT_GZIP ok" ;
+    cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+ 
+    $status = $k->inflate($X, $GOT) ;
+    cmp_ok $status, '==', Z_DATA_ERROR, "Got Z_DATA_ERROR" ;
+
+    $GOT = '';
+    ($k, $err) = new Compress::Raw::Zlib::Inflate( 
+            WindowBits => WANT_GZIP_OR_ZLIB ,
+            AppendOutput => 1);
+    ok $k, "Compress::Raw::Zlib::Inflate WANT_GZIP_OR_ZLIB ok" ;
+    cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+ 
+    $status = $k->inflate($X, $GOT) ;
+    cmp_ok $status, '==', Z_STREAM_END, "Got Z_STREAM_END" ;
+    is $GOT, $hello, "uncompressed data matches ok" ;
+}
+
+{
+
+    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
+    # ================
+
+    my $hello = "I am a HAL 9000 computer" ;
+    my ($err, $x, $X, $status); 
+ 
+    ok( ($x, $err) = new Compress::Raw::Zlib::Deflate ( 
+            AppendOutput => 1
+        ), "Create deflate object" );
+    ok $x, "Compress::Raw::Zlib::Deflate ok" ;
+    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_OK, "flush returned Z_OK" ;
+     
+    my ($k, $GOT); 
+    ($k, $err) = new Compress::Raw::Zlib::Inflate( 
+            WindowBits => WANT_GZIP ,
+            ConsumeInput => 0 ,
+            AppendOutput => 1);
+    ok $k, "Compress::Raw::Zlib::Inflate WANT_GZIP ok" ;
+    cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+ 
+    $status = $k->inflate($X, $GOT) ;
+    cmp_ok $status, '==', Z_DATA_ERROR, "Got Z_DATA_ERROR" ;
+
+    $GOT = '';
+    ($k, $err) = new Compress::Raw::Zlib::Inflate( 
+            WindowBits => WANT_GZIP_OR_ZLIB ,
+            AppendOutput => 1);
+    ok $k, "Compress::Raw::Zlib::Inflate WANT_GZIP_OR_ZLIB ok" ;
+    cmp_ok $err, '==', Z_OK, "status is Z_OK" ;
+ 
+    $status = $k->inflate($X, $GOT) ;
+    cmp_ok $status, '==', Z_STREAM_END, "Got Z_STREAM_END" ;
+    is $GOT, $hello, "uncompressed data matches ok" ;
+}
+
 exit if $] < 5.006 ;
 
 title 'Looping Append test with substr output - substr the end of the string';




More information about the Pkg-perl-cvs-commits mailing list