IO-Compress-Zlib-2.004, and Compress-Zlib-2.004.
p4raw-id: //depot/perl@30458
CHANGES
-------
+ 2.004 3 March 2007
+
+ * Fixed lvalue substr issue
+
+ * Remove redundant code from Zlib.xs
+
2.003 2 January 2007
* Added explicit version checking
: ()
),
+ ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
+ ('LICENSE' => 'perl') : ()),
+
) ;
my @names = qw(
Compress::Raw::Zlib
- Version 2.003
+ Version 2.004
- 2nd January 2007
+ 3rd March 2007
Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
$VERSION = "1.05" ;
- c. The version of zlib you have installed.
+ c. The version of zlib you have used.
If you have successfully installed Compress::Raw::Zlib, this one-liner
will tell you:
* Created : 22nd January 1996
* Version : 2.000
*
- * Copyright (c) 1995-2005 Paul Marquess. All rights reserved.
+ * Copyright (c) 1995-2007 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.
*
typedef di_stream * Compress__Raw__Zlib__inflateStream ;
typedef di_stream * Compress__Raw__Zlib__inflateScanStream ;
-#define GZERRNO "Compress::Zlib::gzerrno"
-
#define ZMALLOC(to, typ) ((to = (typ *)safemalloc(sizeof(typ))), \
Zero(to,1,typ))
return errstr ;
}
-#if 0
-static void
-#ifdef CAN_PROTOTYPE
-SetGzErrorNo(int error_no)
-#else
-SetGzErrorNo(error_no)
-int error_no ;
-#endif
-{
- dTHX;
- char * errstr ;
- SV * gzerror_sv = perl_get_sv(GZERRNO, FALSE) ;
-
- if (error_no == Z_ERRNO) {
- error_no = errno ;
- errstr = Strerror(errno) ;
- }
- else
- /* errstr = gzerror(fil, &error_no) ; */
- errstr = (char*) my_z_errmsg[2 - error_no];
-
- if (SvIV(gzerror_sv) != error_no) {
- sv_setiv(gzerror_sv, error_no) ;
- sv_setpv(gzerror_sv, errstr) ;
- SvIOK_on(gzerror_sv) ;
- }
-
-}
-
-
-static void
-#ifdef CAN_PROTOTYPE
-SetGzError(gzFile file)
-#else
-SetGzError(file)
-gzFile file ;
-#endif
-{
- int error_no ;
-
- (void)gzerror(file, &error_no) ;
- SetGzErrorNo(error_no) ;
-}
-
-#endif
#ifdef MAGIC_APPEND
if (RETVAL == Z_OK) {
SvPOK_only(output);
SvCUR_set(output, cur_length + increment - s->stream.avail_out) ;
+ SvSETMAGIC(output);
}
OUTPUT:
RETVAL
- output
void
if (RETVAL == Z_OK) {
SvPOK_only(output);
SvCUR_set(output, cur_length + increment - s->stream.avail_out) ;
+ SvSETMAGIC(output);
}
OUTPUT:
RETVAL
- output
DualType
if (out_utf8)
sv_utf8_upgrade(output);
#endif
+ SvSETMAGIC(output);
if (s->flags & FLAG_CRC32 )
s->crc32 = crc32(s->crc32,
}
OUTPUT:
RETVAL
- buf
- output
uLong
inflateCount(s)
}
OUTPUT:
RETVAL
- buf
void
DESTROY(s)
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.003';
+$VERSION = '2.004';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
ok my $k = new Compress::Raw::Zlib::Inflate ( -AppendOutput => 1,
-ConsumeInput => 1 ) ;
-# cmp_ok $k->inflate(substr($X, 0, -1), $Z), '==', Z_STREAM_END ; ;
- cmp_ok $k->inflate(substr($X, 0), $Z), '==', Z_STREAM_END ; ;
+ cmp_ok $k->inflate(substr($X, 0, -1), $Z), '==', Z_STREAM_END ; ;
ok $hello eq $Z ;
is $X, $append;
cmp_ok $x->flush(substr($Answer, length($Answer))), '==', Z_OK ;
+ #cmp_ok length $Answer, ">", 0 ;
+
my @Answer = split('', $Answer) ;
+
my $k;
ok(($k, $err) = new Compress::Raw::Zlib::Inflate(-AppendOutput => 1) );
CHANGES
-------
+ 2.004 3 March 2007
+
+ * rewrote memGzip using IO::Compress::Gzip::gzip
+
2.003 2 January 2007
* Added explicit version checking
use strict ;
require 5.004 ;
-$::VERSION = '2.003' ;
+$::VERSION = '2.004' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
: ()
),
+ ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
+ ('LICENSE' => 'perl') : ()),
+
) ;
# end of file Makefile.PL
Compress::Zlib
- Version 2.003
+ Version 2.004
- 2nd January 2007
+ 3rd March 2007
Copyright (c) 1995-2007 Paul Marquess. All rights reserved.
use IO::Handle ;
use Scalar::Util qw(dualvar);
-use IO::Compress::Base::Common 2.003 ;
-use Compress::Raw::Zlib 2.003 ;
-use IO::Compress::Gzip 2.003 ;
-use IO::Uncompress::Gunzip 2.003 ;
+use IO::Compress::Base::Common 2.004 ;
+use Compress::Raw::Zlib 2.004 ;
+use IO::Compress::Gzip 2.004 ;
+use IO::Uncompress::Gunzip 2.004 ;
use strict ;
use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.003';
+$VERSION = '2.004';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.003 ;
+use IO::Compress::Gzip::Constants 2.004 ;
sub memGzip($)
{
- my $x = new Compress::Raw::Zlib::Deflate(
- -AppendOutput => 1,
- -CRC32 => 1,
- -ADLER32 => 0,
- -Level => Z_BEST_COMPRESSION(),
- -WindowBits => - MAX_WBITS(),
- )
- or return undef ;
-
- # write a minimal gzip header
- my $output = GZIP_MINIMUM_HEADER ;
-
+ my $out;
+
# if the deflation buffer isn't a reference, make it one
my $string = (ref $_[0] ? $_[0] : \$_[0]) ;
- my $status = $x->deflate($string, \$output) ;
- $status == Z_OK()
+ IO::Compress::Gzip::gzip($string, \$out, Minimal => 1)
or return undef ;
-
- $status = $x->flush(\$output) ;
- $status == Z_OK()
- or return undef ;
-
- return $output . pack("V V", $x->crc32(), $x->total_in()) ;
-
+
+ return $out;
}
ok $k = inflateInit() ;
- #$Z = $k->inflate(substr($Y, 0, -1)) ;
- $Z = $k->inflate(substr($Y, 0)) ;
+ $Z = $k->inflate(substr($Y, 0, -1)) ;
+ #$Z = $k->inflate(substr($Y, 0)) ;
ok $contents eq $Z ;
is $Y, $append;
CHANGES
-------
+ 2.004 3 March 2007
+
+ * Made seek less wasteful of memory.
+
2.003 2 January 2007
* Added explicit version checking
: ()
),
+ ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
+ ('LICENSE' => 'perl') : ()),
+
) ;
# end of file Makefile.PL
IO::Compress::Base
- Version 2.003
+ Version 2.004
- 2nd January 2007
+ 3rd March 2007
Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.003 ;
+use IO::Compress::Base::Common 2.004 ;
use IO::File ;
use Scalar::Util qw(blessed readonly);
use Symbol;
use bytes;
-our (@ISA, $VERSION, $got_encode);
+our (@ISA, $VERSION);
#@ISA = qw(Exporter IO::File);
-$VERSION = '2.003';
+$VERSION = '2.004';
#Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16.
-#$got_encode = 0;
-#eval
-#{
-# require Encode;
-# Encode->import('encode', 'find_encoding');
-#};
-#
-#$got_encode = 1 unless $@;
-
sub saveStatus
{
my $self = shift ;
{
# Generic Parameters
'AutoClose' => [1, 1, Parse_boolean, 0],
- #'Encoding' => [1, 1, Parse_any, undef],
+ #'Encode' => [1, 1, Parse_any, undef],
'Strict' => [0, 1, Parse_boolean, 1],
'Append' => [1, 1, Parse_boolean, 0],
'BinModeIn' => [1, 1, Parse_boolean, 0],
-# TODO - encoding
-# if ($got->parsed('Encoding')) {
-# $obj->croakError("$class: Encode module needed to use -Encoding")
-# if ! $got_encode;
-#
-# my $want_encoding = $got->value('Encoding');
-# my $encoding = find_encoding($want_encoding);
-#
-# $obj->croakError("$class: Encoding '$want_encoding' is not available")
-# if ! $encoding;
-#
-# *$obj->{Encoding} = $encoding;
-# }
+ if ($got->parsed('Encode')) {
+ my $want_encoding = $got->value('Encode');
+ *$obj->{Encoding} = getEncoding($obj, $class, $want_encoding);
+ }
$obj->ckParams($got)
or $obj->croakError("${class}: " . $obj->error());
return 0 if ! defined $$buffer || length $$buffer == 0 ;
- my $buffer_length = defined $$buffer ? length($$buffer) : 0 ;
- *$self->{UnCompSize}->add($buffer_length) ;
+ if (*$self->{Encoding}) {
+ $$buffer = *$self->{Encoding}->encode($$buffer);
+ }
$self->filterUncompressed($buffer);
-# if (*$self->{Encoding}) {
-# $$buffer = *$self->{Encoding}->encode($$buffer);
-# }
+ my $buffer_length = defined $$buffer ? length($$buffer) : 0 ;
+ *$self->{UnCompSize}->add($buffer_length) ;
my $outBuffer='';
my $status = *$self->{Compress}->compr($buffer, $outBuffer) ;
use File::GlobMapper;
require Exporter;
-our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS);
+our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
@ISA = qw(Exporter);
-$VERSION = '2.003';
+$VERSION = '2.004';
@EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput
isaFileGlobString cleanFileGlobString oneTarget
setBinModeInput setBinModeOutput
ckInOutParams
createSelfTiedObject
+ getEncoding
WANT_CODE
WANT_EXT
use constant STATUS_ENDSTREAM => 1;
use constant STATUS_EOF => 2;
use constant STATUS_ERROR => -1;
-#use constant STATUS_OK => 0;
-#use constant STATUS_ENDSTREAM => 1;
-#use constant STATUS_ERROR => 2;
-#use constant STATUS_EOF => 3;
+sub hasEncode()
+{
+ if (! defined $HAS_ENCODE) {
+ eval
+ {
+ require Encode;
+ Encode->import();
+ };
+
+ $HAS_ENCODE = $@ ? 0 : 1 ;
+ }
+
+ return $HAS_ENCODE;
+}
+
+sub getEncoding($$$)
+{
+ my $obj = shift;
+ my $class = shift ;
+ my $want_encoding = shift ;
+
+ $obj->croakError("$class: Encode module needed to use -Encode")
+ if ! hasEncode();
+
+ my $encoding = Encode::find_encoding($want_encoding);
+
+ $obj->croakError("$class: Encoding '$want_encoding' is not available")
+ if ! $encoding;
+
+ return $encoding;
+}
+
our ($needBinmode);
$needBinmode = ($^O eq 'MSWin32' ||
($] >= 5.006 && eval ' ${^UNICODE} || ${^UTF8LOCALE} '))
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.003 ;
+use IO::Uncompress::Base 2.004 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.003 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.003 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.003 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.003 ;';
-
- eval ' use IO::Uncompress::Bunzip2 2.003 ;';
- eval ' use IO::Uncompress::UnLzop 2.003 ;';
- eval ' use IO::Uncompress::Gunzip 2.003 ;';
- eval ' use IO::Uncompress::Inflate 2.003 ;';
- eval ' use IO::Uncompress::RawInflate 2.003 ;';
- eval ' use IO::Uncompress::Unzip 2.003 ;';
- eval ' use IO::Uncompress::UnLzf 2.003 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.004 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.004 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.004 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.004 ;';
+
+ eval ' use IO::Uncompress::Bunzip2 2.004 ;';
+ eval ' use IO::Uncompress::UnLzop 2.004 ;';
+ eval ' use IO::Uncompress::Gunzip 2.004 ;';
+ eval ' use IO::Uncompress::Inflate 2.004 ;';
+ eval ' use IO::Uncompress::RawInflate 2.004 ;';
+ eval ' use IO::Uncompress::Unzip 2.004 ;';
+ eval ' use IO::Uncompress::UnLzf 2.004 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.003 qw(:Parse);
+ use IO::Compress::Base::Common 2.004 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
@ISA = qw(Exporter );
-$VERSION = '2.003';
+$VERSION = '2.004';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.003 ;
+use IO::Compress::Base::Common 2.004 ;
#use Parse::Parameters ;
use IO::File ;
'Scan' => [1, 1, Parse_boolean, 0],
'InputLength' => [1, 1, Parse_unsigned, undef],
'BinModeOut' => [1, 1, Parse_boolean, 0],
+ #'Encode' => [1, 1, Parse_any, undef],
+
#'ConsumeInput' => [1, 1, Parse_boolean, 0],
$self->getExtraParams(),
*$obj->{Buffer} = \$buff ;
}
+ if ($got->parsed('Encode')) {
+ my $want_encoding = $got->value('Encode');
+ *$obj->{Encoding} = getEncoding($obj, $class, $want_encoding);
+ }
+
*$obj->{InputLength} = $got->parsed('InputLength')
? $got->value('InputLength')
$self->postBlockChk($buffer, $before_len) == STATUS_OK
or return G_ERR;
- $self->filterUncompressed($buffer);
-
- # TODO uncompress filter goes here
-
-
$buf_len = length($$buffer) - $before_len;
-
*$self->{CompSize}->add($beforeC_len - length $temp_buf) ;
*$self->{InflatedBytesRead} += $buf_len ;
*$self->{TotalInflatedBytesRead} += $buf_len ;
*$self->{UnCompSize}->add($buf_len) ;
+
+ $self->filterUncompressed($buffer);
+
+ if (*$self->{Encoding}) {
+ $$buffer = *$self->{Encoding}->decode($$buffer);
+ }
}
if ($status == STATUS_ENDSTREAM) {
# Walk the file to the new offset
my $offset = $target - $here ;
- my $buffer ;
- $self->read($buffer, $offset) == $offset
- or return 0 ;
+ my $got;
+ while (($got = $self->read(my $buffer, min($offset, *$self->{BlockSize})) ) > 0)
+ {
+ $offset -= $got;
+ last if $offset == 0 ;
+ }
- return 1 ;
+ return $offset == 0 ? 1 : 0 ;
}
sub fileno
CHANGES
-------
+ 2.004 3 March 2007
+
+ * IO::Compress::Zip
+
+ - Added Zip64 documentation.
+
+ - Fixed extended timestamp.
+ Creation time isn't available in Unix so only store the
+ modification time and the last access time in the extended field.
+
+ - Fixed file mode.
+
+ - Added ExtAttr option to control the value of the "external file
+ attributes" field in the central directory.
+
+ - Added Unix2 extended attribute ("Ux").
+ This stores the UID & GID.
+
+ * IO::Compress::Gzip
+
+ - Fixed 050interop-gzip.t for Windows
+
2.003 2 January 2007
* Added explicit version checking
use strict ;
require 5.004 ;
-$::VERSION = '2.003' ;
+$::VERSION = '2.004' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
: ()
),
+ ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
+ ('LICENSE' => 'perl') : ()),
+
) ;
# end of file Makefile.PL
IO::Compress::Zlib
- Version 2.003
+ Version 2.004
- 2nd January 2007
+ 3rd March 2007
Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(:Status);
+use IO::Compress::Base::Common 2.004 qw(:Status);
-use Compress::Raw::Zlib 2.003 qw(Z_OK Z_FINISH MAX_WBITS) ;
+use Compress::Raw::Zlib 2.004 qw(Z_OK Z_FINISH MAX_WBITS) ;
our ($VERSION);
-$VERSION = '2.003';
+$VERSION = '2.004';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(:Status);
+use IO::Compress::Base::Common 2.004 qw(:Status);
our ($VERSION);
-$VERSION = '2.003';
+$VERSION = '2.004';
sub mkCompObject
{
require Exporter ;
-use IO::Compress::RawDeflate 2.003 ;
+use IO::Compress::RawDeflate 2.004 ;
-use Compress::Raw::Zlib 2.003 ;
-use IO::Compress::Zlib::Constants 2.003 ;
-use IO::Compress::Base::Common 2.003 qw(createSelfTiedObject);
+use Compress::Raw::Zlib 2.004 ;
+use IO::Compress::Zlib::Constants 2.004 ;
+use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
use bytes;
-use IO::Compress::RawDeflate 2.003 ;
+use IO::Compress::RawDeflate 2.004 ;
-use Compress::Raw::Zlib 2.003 ;
-use IO::Compress::Base::Common 2.003 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.003 ;
-use IO::Compress::Zlib::Extra 2.003 ;
+use Compress::Raw::Zlib 2.004 ;
+use IO::Compress::Base::Common 2.004 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.004 ;
+use IO::Compress::Zlib::Extra 2.004 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);
-$VERSION = '2.003';
+$VERSION = '2.004';
@ISA = qw(Exporter);
use bytes;
-use IO::Compress::Base 2.003 ;
-use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject);
-use IO::Compress::Adapter::Deflate 2.003 ;
+use IO::Compress::Base 2.004 ;
+use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
+use IO::Compress::Adapter::Deflate 2.004 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.003 qw(:Parse);
- use Compress::Raw::Zlib 2.003 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.004 qw(:Parse);
+ use Compress::Raw::Zlib 2.004 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
return (
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject);
-use IO::Compress::RawDeflate 2.003 ;
-use IO::Compress::Adapter::Deflate 2.003 ;
-use IO::Compress::Adapter::Identity 2.003 ;
-use IO::Compress::Zlib::Extra 2.003 ;
-use IO::Compress::Zip::Constants 2.003 ;
+use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
+use IO::Compress::RawDeflate 2.004 ;
+use IO::Compress::Adapter::Deflate 2.004 ;
+use IO::Compress::Adapter::Identity 2.004 ;
+use IO::Compress::Zlib::Extra 2.004 ;
+use IO::Compress::Zip::Constants 2.004 ;
-use Compress::Raw::Zlib 2.003 qw(crc32) ;
+use Compress::Raw::Zlib 2.004 qw(crc32) ;
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.003 ;
+ import IO::Compress::Adapter::Bzip2 2.004 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.003 ;
+ import IO::Compress::Bzip2 2.004 ;
} ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
my $extra = '';
my $ctlExtra = '';
my $empty = 0;
+ my $osCode = $param->value('OS_Code') ;
+ my $extFileAttr = 0 ;
if (*$self->{ZipData}{Zip64}) {
$empty = 0xFFFF;
$ctlExtra .= mkExtendedTime($param->value('MTime'));
}
- # if ( $param->value('UID'))
- # {
- # $extra .= mkUnixExtra( $param->value('UID'), $param->value('GID'));
- # $ctlExtra .= mkUnixExtra();
- # }
+ if ( $param->value('UID') && $osCode == ZIP_OS_CODE_UNIX)
+ {
+ $extra .= mkUnix2Extra( $param->value('UID'), $param->value('GID'));
+ $ctlExtra .= mkUnix2Extra();
+ }
+
+ # TODO - this code assumes Unix.
+ #$extFileAttr = 0666 << 16
+ # if $osCode == ZIP_OS_CODE_UNIX ;
+
+ $extFileAttr = $param->value('ExtAttr')
+ if defined $param->value('ExtAttr') ;
$extra .= $param->value('ExtraFieldLocal')
if defined $param->value('ExtraFieldLocal');
if defined $param->value('ExtraFieldCentral');
}
-
- # TODO - this code assumes Unix.
- my $extAttr = 0;
- $extAttr = $param->value('Mode') << 16
- if defined $param->value('Mode') ;
-
my $gpFlag = 0 ;
$gpFlag |= ZIP_GP_FLAG_STREAMING_MASK
if *$self->{ZipData}{Stream} ;
$ctl .= pack 'v', length $comment ; # file comment length
$ctl .= pack 'v', 0 ; # disk number start
$ctl .= pack 'v', $ifa ; # internal file attributes
- $ctl .= pack 'V', $extAttr ; # external file attributes
+ $ctl .= pack 'V', $extFileAttr ; # external file attributes
if (! *$self->{ZipData}{Zip64}) {
$ctl .= pack 'V', *$self->{ZipData}{Offset}->get32bit() ; # offset to local header
}
{
my $self = shift ;
- use IO::Compress::Base::Common 2.003 qw(:Parse);
- use Compress::Raw::Zlib 2.003 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.004 qw(:Parse);
+ use Compress::Raw::Zlib 2.004 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
my @Bzip2 = ();
'Name' => [0, 1, Parse_any, ''],
'Time' => [0, 1, Parse_any, undef],
'exTime' => [0, 1, Parse_any, undef],
+ 'ExtAttr' => [0, 1, Parse_any, 0],
'OS_Code' => [0, 1, Parse_unsigned, $Compress::Raw::Zlib::gzip_os_code],
'TextFlag' => [0, 1, Parse_boolean, 0],
{
$params->value('MTime' => $mtime) ;
$params->value('ATime' => $atime) ;
- $params->value('CTime' => $ctime) ;
+ $params->value('CTime' => undef) ; # No Creation time
}
- $params->value('Mode' => $mode) ;
+ $params->value('ExtAttr' => $mode << 16)
+ if ! $params->parsed('ExtAttr');
$params->value('UID' => $uid) ;
$params->value('GID' => $gid) ;
$bit <<= 1 ;
}
- #return "UT" . pack("v C", length($times) + 1, $flags) . $times;
return IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_EXT_TIMESTAMP,
pack("C", $flags) . $times);
}
-sub mkUnixExtra
+sub mkUnix2Extra
{
my $ids = '';
for my $id (@_)
$ids .= pack("v", $id);
}
- #return "Ux" . pack("v", length $ids) . $ids;
- return IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_INFO_ZIP_UNIX, $ids);
+ return IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_INFO_ZIP_UNIX2,
+ $ids);
}
-
The primary purpose of this module is to provide streaming write access to
zip files and buffers. It is not a general-purpose file archiver. If that
is what you want, check out C<Archive::Zip>.
+At present three compression methods are supported by IO::Compress::Zip,
+namely Store (no compression at all), Deflate and Bzip2.
+
+Note that to create Bzip2 content, the module C<IO::Compress::Bzip2> must
+be installed.
+
In addition, if C<$input> is a simple filename, the default values for
-the C<Name>, C<Time> and C<exTime> options will be sourced from that file.
+the C<Name>, C<Time>, C<ExtAttr> and C<exTime> options will be sourced from that file.
If you do not want to use these defaults they can be overridden by
-explicitly setting the C<Name>, C<Time> and C<exTime> options or by setting the
+explicitly setting the C<Name>, C<Time>, C<ExtAttr> and C<exTime> options or by setting the
C<Minimal> parameter.
This field defaults to the time the C<IO::Compress::Zip> object was created
if this option is not specified.
+=item C<< ExtAttr => $attr >>
+
+This option controls the "external file attributes" field in the central
+header of the zip file. This is a 4 byte field.
+
+This option defaults to 0.
+
=item C<< exTime => [$atime, $mtime, $ctime] >>
This option expects an array reference with exactly three elements:
header to the three values, $atime, $mtime, $ctime and sets the extended
timestamp field in the central zip header to C<$mtime>.
+If any of the three values is C<undef> that time value will not be used.
+So, for example, to set only the C<$mtime> you would use this
+
+ exTime => [undef, $mtime, undef]
+
If the C<Minimal> option is set to true, this option will be ignored.
By default no extended time field is created.
The default is 1.
+=item C<< Zip64 => 0|1 >>
+
+Create a Zip64 zip file/buffer. This option should only be used if you want
+to store files larger than 4 Gig.
+If you intend to manipulate the Zip64 zip files created with this module
+using an external zip/unzip make sure that it supports streaming Zip64.
+
+In particular, if you are using Info-Zip you need to have zip version 3.x
+or better to update a Zip64 archive and unzip version 6.x to read a zip64
+archive. At the time of writing both are beta status.
+
+When the C<Zip64> option is enabled, the C<Stream> option I<must> be
+enabled as well.
+
+The default is 0.
=item C<< TextFlag => 0|1 >>
ExtraField => $rawdata
+The Extended Time field, set using the C<exTime> option, is an example of
+an extended field.
+
If the C<Minimal> option is set to true, this option will be ignored.
=item C<< Minimal => 1|0 >>
If specified, this option will disable the creation of all extended fields
-in the zip local and central headers.
+in the zip local and central headers. So the C<exTime>, C<ExtraFieldLocal>
+and C<ExtraFieldCentral> options will be ignored.
This parameter defaults to 0.
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.003';
+$VERSION = '2.004';
@ISA = qw(Exporter);
ZIP_CM_STORE
ZIP_CM_DEFLATE
ZIP_CM_BZIP2
+ ZIP_CM_LZMA
ZIP_LOCAL_HDR_SIG
ZIP_DATA_HDR_SIG
ZIP_EXTRA_ID_ZIP64
ZIP_EXTRA_ID_EXT_TIMESTAMP
- ZIP_EXTRA_ID_INFO_ZIP_UNIX
+ ZIP_EXTRA_ID_INFO_ZIP_UNIX2
+
+ ZIP_OS_CODE_UNIX
+ ZIP_OS_CODE_DEFAULT
ZIP_IFA_TEXT_MASK
use constant ZIP_CM_STORE => 0 ;
use constant ZIP_CM_DEFLATE => 8 ;
use constant ZIP_CM_BZIP2 => 12 ;
+use constant ZIP_CM_LZMA => 14 ; # Not Supported yet
# General Purpose Flag
use constant ZIP_GP_FLAG_ENCRYPTED_MASK => 1 ;
use constant ZIP64_ARCHIVE_EXTRA_SIG => 0x08064b50;
use constant ZIP64_DIGITAL_SIGNATURE_SIG => 0x05054b50;
+use constant ZIP_OS_CODE_UNIX => 3;
+use constant ZIP_OS_CODE_DEFAULT => 3;
+
# Extra Field ID's
use constant ZIP_EXTRA_ID_ZIP64 => pack "v", 1;
use constant ZIP_EXTRA_ID_EXT_TIMESTAMP => "UT";
-use constant ZIP_EXTRA_ID_INFO_ZIP_UNIX => "Ux";
+use constant ZIP_EXTRA_ID_INFO_ZIP_UNIX2 => "Ux";
use constant ZIP64_MIN_VERSION => 45;
ZIP_CM_STORE() => 20,
ZIP_CM_DEFLATE() => 20,
ZIP_CM_BZIP2() => 46,
+ ZIP_CM_LZMA() => 63,
);
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.003';
+$VERSION = '2.004';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.003';
+$VERSION = '2.004';
-use IO::Compress::Gzip::Constants 2.003 ;
+use IO::Compress::Gzip::Constants 2.004 ;
sub ExtraFieldError
{
use strict;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(:Status);
+use IO::Compress::Base::Common 2.004 qw(:Status);
our ($VERSION);
-$VERSION = '2.003';
+$VERSION = '2.004';
-use Compress::Raw::Zlib 2.003 ();
+use Compress::Raw::Zlib 2.004 ();
sub mkUncompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(:Status);
-use Compress::Raw::Zlib 2.003 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.004 qw(:Status);
+use Compress::Raw::Zlib 2.004 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.003';
+$VERSION = '2.004';
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.003 ();
+use IO::Uncompress::Adapter::Inflate 2.004 ();
-use IO::Uncompress::Base 2.003 ;
-use IO::Uncompress::Gunzip 2.003 ;
-use IO::Uncompress::Inflate 2.003 ;
-use IO::Uncompress::RawInflate 2.003 ;
-use IO::Uncompress::Unzip 2.003 ;
+use IO::Uncompress::Base 2.004 ;
+use IO::Uncompress::Gunzip 2.004 ;
+use IO::Uncompress::Inflate 2.004 ;
+use IO::Uncompress::RawInflate 2.004 ;
+use IO::Uncompress::Unzip 2.004 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
sub getExtraParams
{
- use IO::Compress::Base::Common 2.003 qw(:Parse);
+ use IO::Compress::Base::Common 2.004 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.003 ;
+use IO::Uncompress::RawInflate 2.004 ;
-use Compress::Raw::Zlib 2.003 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.003 ;
-use IO::Compress::Zlib::Extra 2.003 ;
+use Compress::Raw::Zlib 2.004 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.004 ;
+use IO::Compress::Zlib::Extra 2.004 ;
require Exporter ;
$GunzipError = '';
-$VERSION = '2.003';
+$VERSION = '2.004';
sub new
{
sub getExtraParams
{
- use IO::Compress::Base::Common 2.003 qw(:Parse);
+ use IO::Compress::Base::Common 2.004 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.003 ;
+use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.004 ;
-use IO::Uncompress::RawInflate 2.003 ;
+use IO::Uncompress::RawInflate 2.004 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.003 ;
-use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject);
+use Compress::Raw::Zlib 2.004 ;
+use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.003 ;
-use IO::Uncompress::Adapter::Inflate 2.003 ;
+use IO::Uncompress::Base 2.004 ;
+use IO::Uncompress::Adapter::Inflate 2.004 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.003';
+$VERSION = '2.004';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.003 ;
-use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Identity 2.003 ;
-use IO::Compress::Zlib::Extra 2.003 ;
-use IO::Compress::Zip::Constants 2.003 ;
+use IO::Uncompress::RawInflate 2.004 ;
+use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Identity 2.004 ;
+use IO::Compress::Zlib::Extra 2.004 ;
+use IO::Compress::Zip::Constants 2.004 ;
-use Compress::Raw::Zlib 2.003 qw(crc32) ;
+use Compress::Raw::Zlib 2.004 qw(crc32) ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.003';
+$VERSION = '2.004';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
sub getExtraParams
{
- use IO::Compress::Base::Common 2.003 qw(:Parse);
+ use IO::Compress::Base::Common 2.004 qw(:Parse);
return (
BEGIN {
# Check external gzip is available
- my $name = 'gzip';
- for my $dir (reverse split ":", $ENV{PATH})
+ my $name = $^O =~ /mswin/i ? 'gzip.exe' : 'gzip';
+ my $split = $^O =~ /mswin/i ? ";" : ":";
+
+ for my $dir (reverse split $split, $ENV{PATH})
{
$GZIP = "$dir/$name"
if -x "$dir/$name" ;
$extra = 1
if $st ;
- plan(tests => 639 + $extra) ;
+ plan(tests => 641 + $extra) ;
}
sub myGZreadFile
my %opts = () ;
my $iow = new $CompressClass $name, %opts;
+ is $iow->input_line_number, undef;
$iow->print($str) ;
+ is $iow->input_line_number, undef;
$iow->close ;
my @tmp;
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 166 + $extra ;
+ plan tests => 165 + $extra ;
}
my $Error = getErrorRef($CompressClass);
my $UnError = getErrorRef($UncompressClass);
-
-
-
- # Check zlib_version and ZLIB_VERSION are the same.
- is Compress::Raw::Zlib::zlib_version, ZLIB_VERSION,
- "ZLIB_VERSION matches Compress::Raw::Zlib::zlib_version" ;
-
# Tests
# destination is a file that doesn't exist -- should work ok unless AnyDeflate
# destination isn't compressed at all