From: paul Date: Sat, 9 Jan 2010 18:32:51 +0000 (+0000) Subject: 2.024 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b5fd1d4b111acc07bae6fc8d66a179438294985;p=p5sagit%2Fp5-mst-13.2.git 2.024 --- diff --git a/MANIFEST b/MANIFEST index 6474872..4c725d6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -233,21 +233,15 @@ cpan/Class-ISA/lib/Class/ISA.pm Class::ISA cpan/Class-ISA/t/00_about_verbose.t Tests for Class::ISA cpan/Class-ISA/t/01_old_junk.t Tests for Class::ISA cpan/Compress-Raw-Bzip2/bzip2-src/blocksort.c -cpan/Compress-Raw-Bzip2/bzip2-src/bzip2.c -cpan/Compress-Raw-Bzip2/bzip2-src/bzip2recover.c cpan/Compress-Raw-Bzip2/bzip2-src/bzlib.c cpan/Compress-Raw-Bzip2/bzip2-src/bzlib.h cpan/Compress-Raw-Bzip2/bzip2-src/bzlib_private.h cpan/Compress-Raw-Bzip2/bzip2-src/compress.c cpan/Compress-Raw-Bzip2/bzip2-src/crctable.c cpan/Compress-Raw-Bzip2/bzip2-src/decompress.c -cpan/Compress-Raw-Bzip2/bzip2-src/dlltest.c cpan/Compress-Raw-Bzip2/bzip2-src/huffman.c cpan/Compress-Raw-Bzip2/bzip2-src/LICENSE -cpan/Compress-Raw-Bzip2/bzip2-src/mk251.c cpan/Compress-Raw-Bzip2/bzip2-src/randtable.c -cpan/Compress-Raw-Bzip2/bzip2-src/spewG.c -cpan/Compress-Raw-Bzip2/bzip2-src/unzcrash.c cpan/Compress-Raw-Bzip2/Bzip2.xs cpan/Compress-Raw-Bzip2/Changes cpan/Compress-Raw-Bzip2/fallback/constants.h diff --git a/cpan/Compress-Raw-Bzip2/Bzip2.xs b/cpan/Compress-Raw-Bzip2/Bzip2.xs index c343e8a..7c15ee6 100644 --- a/cpan/Compress-Raw-Bzip2/Bzip2.xs +++ b/cpan/Compress-Raw-Bzip2/Bzip2.xs @@ -3,7 +3,7 @@ * Created : 5th October 2005 * Version : 2.000 * - * Copyright (c) 2005-2007 Paul Marquess. All rights reserved. + * Copyright (c) 2005-2010 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/Changes b/cpan/Compress-Raw-Bzip2/Changes index a8e2fbf..843352b 100644 --- a/cpan/Compress-Raw-Bzip2/Changes +++ b/cpan/Compress-Raw-Bzip2/Changes @@ -1,5 +1,13 @@ CHANGES ------- + 2.023 9 November 2009 + + * Removed redundant bzip2 source files from the bzip2-src directory. + [RT# 47225] + + * Fixed instance where $[ should have been $] in t/01bzip2.t + Thanks to Robin Barker and zefram [RT #50764] for independantly + spotting the issue. 2.021 30 August 2009 diff --git a/cpan/Compress-Raw-Bzip2/README b/cpan/Compress-Raw-Bzip2/README index 21ff6bc..94d35cf 100644 --- a/cpan/Compress-Raw-Bzip2/README +++ b/cpan/Compress-Raw-Bzip2/README @@ -1,11 +1,11 @@ Compress-Raw-Bzip2 - Version 2.021 + Version 2.024 - 30th August 2009 + 7th January 2010 - Copyright (c) 2005-2009 Paul Marquess. All rights reserved. + Copyright (c) 2005-2010 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. @@ -164,7 +164,7 @@ To help me help you, I need all of the following information: If you haven't installed Compress-Raw-Bzip2 then search Compress::Raw::Bzip2.pm for a line like this: - $VERSION = "2.021" ; + $VERSION = "2.024" ; c. The version of bzip2 you have used. If you have successfully installed Compress-Raw-Bzip2, this one-liner diff --git a/cpan/Compress-Raw-Bzip2/bzip2-src/bzip2.c b/cpan/Compress-Raw-Bzip2/bzip2-src/bzip2.c deleted file mode 100644 index 011edfa..0000000 --- a/cpan/Compress-Raw-Bzip2/bzip2-src/bzip2.c +++ /dev/null @@ -1,2042 +0,0 @@ - -/*-----------------------------------------------------------*/ -/*--- A block-sorting, lossless compressor bzip2.c ---*/ -/*-----------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -/* Place a 1 beside your platform, and 0 elsewhere. - Generic 32-bit Unix. - Also works on 64-bit Unix boxes. - This is the default. -*/ -#define BZ_UNIX 1 - -/*-- - Win32, as seen by Jacob Navia's excellent - port of (Chris Fraser & David Hanson)'s excellent - lcc compiler. Or with MS Visual C. - This is selected automatically if compiled by a compiler which - defines _WIN32, not including the Cygwin GCC. ---*/ -#define BZ_LCCWIN32 0 - -#if defined(_WIN32) && !defined(__CYGWIN__) -#undef BZ_LCCWIN32 -#define BZ_LCCWIN32 1 -#undef BZ_UNIX -#define BZ_UNIX 0 -#endif - - -/*---------------------------------------------*/ -/*-- - Some stuff for all platforms. ---*/ - -#include -#include -#include -#include -#include -#include -#include -#include "bzlib.h" - -#define ERROR_IF_EOF(i) { if ((i) == EOF) ioError(); } -#define ERROR_IF_NOT_ZERO(i) { if ((i) != 0) ioError(); } -#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); } - - -/*---------------------------------------------*/ -/*-- - Platform-specific stuff. ---*/ - -#if BZ_UNIX -# include -# include -# include -# include -# include -# include - -# define PATH_SEP '/' -# define MY_LSTAT lstat -# define MY_STAT stat -# define MY_S_ISREG S_ISREG -# define MY_S_ISDIR S_ISDIR - -# define APPEND_FILESPEC(root, name) \ - root=snocString((root), (name)) - -# define APPEND_FLAG(root, name) \ - root=snocString((root), (name)) - -# define SET_BINARY_MODE(fd) /**/ - -# ifdef __GNUC__ -# define NORETURN __attribute__ ((noreturn)) -# else -# define NORETURN /**/ -# endif - -# ifdef __DJGPP__ -# include -# include -# undef MY_LSTAT -# undef MY_STAT -# define MY_LSTAT stat -# define MY_STAT stat -# undef SET_BINARY_MODE -# define SET_BINARY_MODE(fd) \ - do { \ - int retVal = setmode ( fileno ( fd ), \ - O_BINARY ); \ - ERROR_IF_MINUS_ONE ( retVal ); \ - } while ( 0 ) -# endif - -# ifdef __CYGWIN__ -# include -# include -# undef SET_BINARY_MODE -# define SET_BINARY_MODE(fd) \ - do { \ - int retVal = setmode ( fileno ( fd ), \ - O_BINARY ); \ - ERROR_IF_MINUS_ONE ( retVal ); \ - } while ( 0 ) -# endif -#endif /* BZ_UNIX */ - - - -#if BZ_LCCWIN32 -# include -# include -# include - -# define NORETURN /**/ -# define PATH_SEP '\\' -# define MY_LSTAT _stat -# define MY_STAT _stat -# define MY_S_ISREG(x) ((x) & _S_IFREG) -# define MY_S_ISDIR(x) ((x) & _S_IFDIR) - -# define APPEND_FLAG(root, name) \ - root=snocString((root), (name)) - -# define APPEND_FILESPEC(root, name) \ - root = snocString ((root), (name)) - -# define SET_BINARY_MODE(fd) \ - do { \ - int retVal = setmode ( fileno ( fd ), \ - O_BINARY ); \ - ERROR_IF_MINUS_ONE ( retVal ); \ - } while ( 0 ) - -#endif /* BZ_LCCWIN32 */ - - -/*---------------------------------------------*/ -/*-- - Some more stuff for all platforms :-) ---*/ - -typedef char Char; -typedef unsigned char Bool; -typedef unsigned char UChar; -typedef int Int32; -typedef unsigned int UInt32; -typedef short Int16; -typedef unsigned short UInt16; - -#define True ((Bool)1) -#define False ((Bool)0) - -/*-- - IntNative is your platform's `native' int size. - Only here to avoid probs with 64-bit platforms. ---*/ -typedef int IntNative; - - -/*---------------------------------------------------*/ -/*--- Misc (file handling) data decls ---*/ -/*---------------------------------------------------*/ - -Int32 verbosity; -Bool keepInputFiles, smallMode, deleteOutputOnInterrupt; -Bool forceOverwrite, testFailsExist, unzFailsExist, noisy; -Int32 numFileNames, numFilesProcessed, blockSize100k; -Int32 exitValue; - -/*-- source modes; F==file, I==stdin, O==stdout --*/ -#define SM_I2O 1 -#define SM_F2O 2 -#define SM_F2F 3 - -/*-- operation modes --*/ -#define OM_Z 1 -#define OM_UNZ 2 -#define OM_TEST 3 - -Int32 opMode; -Int32 srcMode; - -#define FILE_NAME_LEN 1034 - -Int32 longestFileName; -Char inName [FILE_NAME_LEN]; -Char outName[FILE_NAME_LEN]; -Char tmpName[FILE_NAME_LEN]; -Char *progName; -Char progNameReally[FILE_NAME_LEN]; -FILE *outputHandleJustInCase; -Int32 workFactor; - -static void panic ( const Char* ) NORETURN; -static void ioError ( void ) NORETURN; -static void outOfMemory ( void ) NORETURN; -static void configError ( void ) NORETURN; -static void crcError ( void ) NORETURN; -static void cleanUpAndFail ( Int32 ) NORETURN; -static void compressedStreamEOF ( void ) NORETURN; - -static void copyFileName ( Char*, Char* ); -static void* myMalloc ( Int32 ); -static void applySavedFileAttrToOutputFile ( IntNative fd ); - - - -/*---------------------------------------------------*/ -/*--- An implementation of 64-bit ints. Sigh. ---*/ -/*--- Roll on widespread deployment of ANSI C9X ! ---*/ -/*---------------------------------------------------*/ - -typedef - struct { UChar b[8]; } - UInt64; - - -static -void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 ) -{ - n->b[7] = (UChar)((hi32 >> 24) & 0xFF); - n->b[6] = (UChar)((hi32 >> 16) & 0xFF); - n->b[5] = (UChar)((hi32 >> 8) & 0xFF); - n->b[4] = (UChar) (hi32 & 0xFF); - n->b[3] = (UChar)((lo32 >> 24) & 0xFF); - n->b[2] = (UChar)((lo32 >> 16) & 0xFF); - n->b[1] = (UChar)((lo32 >> 8) & 0xFF); - n->b[0] = (UChar) (lo32 & 0xFF); -} - - -static -double uInt64_to_double ( UInt64* n ) -{ - Int32 i; - double base = 1.0; - double sum = 0.0; - for (i = 0; i < 8; i++) { - sum += base * (double)(n->b[i]); - base *= 256.0; - } - return sum; -} - - -static -Bool uInt64_isZero ( UInt64* n ) -{ - Int32 i; - for (i = 0; i < 8; i++) - if (n->b[i] != 0) return 0; - return 1; -} - - -/* Divide *n by 10, and return the remainder. */ -static -Int32 uInt64_qrm10 ( UInt64* n ) -{ - UInt32 rem, tmp; - Int32 i; - rem = 0; - for (i = 7; i >= 0; i--) { - tmp = rem * 256 + n->b[i]; - n->b[i] = tmp / 10; - rem = tmp % 10; - } - return rem; -} - - -/* ... and the Whole Entire Point of all this UInt64 stuff is - so that we can supply the following function. -*/ -static -void uInt64_toAscii ( char* outbuf, UInt64* n ) -{ - Int32 i, q; - UChar buf[32]; - Int32 nBuf = 0; - UInt64 n_copy = *n; - do { - q = uInt64_qrm10 ( &n_copy ); - buf[nBuf] = q + '0'; - nBuf++; - } while (!uInt64_isZero(&n_copy)); - outbuf[nBuf] = 0; - for (i = 0; i < nBuf; i++) - outbuf[i] = buf[nBuf-i-1]; -} - - -/*---------------------------------------------------*/ -/*--- Processing of complete files and streams ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------*/ -static -Bool myfeof ( FILE* f ) -{ - Int32 c = fgetc ( f ); - if (c == EOF) return True; - ungetc ( c, f ); - return False; -} - - -/*---------------------------------------------*/ -static -void compressStream ( FILE *stream, FILE *zStream ) -{ - BZFILE* bzf = NULL; - UChar ibuf[5000]; - Int32 nIbuf; - UInt32 nbytes_in_lo32, nbytes_in_hi32; - UInt32 nbytes_out_lo32, nbytes_out_hi32; - Int32 bzerr, bzerr_dummy, ret; - - SET_BINARY_MODE(stream); - SET_BINARY_MODE(zStream); - - if (ferror(stream)) goto errhandler_io; - if (ferror(zStream)) goto errhandler_io; - - bzf = BZ2_bzWriteOpen ( &bzerr, zStream, - blockSize100k, verbosity, workFactor ); - if (bzerr != BZ_OK) goto errhandler; - - if (verbosity >= 2) fprintf ( stderr, "\n" ); - - while (True) { - - if (myfeof(stream)) break; - nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream ); - if (ferror(stream)) goto errhandler_io; - if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf ); - if (bzerr != BZ_OK) goto errhandler; - - } - - BZ2_bzWriteClose64 ( &bzerr, bzf, 0, - &nbytes_in_lo32, &nbytes_in_hi32, - &nbytes_out_lo32, &nbytes_out_hi32 ); - if (bzerr != BZ_OK) goto errhandler; - - if (ferror(zStream)) goto errhandler_io; - ret = fflush ( zStream ); - if (ret == EOF) goto errhandler_io; - if (zStream != stdout) { - Int32 fd = fileno ( zStream ); - if (fd < 0) goto errhandler_io; - applySavedFileAttrToOutputFile ( fd ); - ret = fclose ( zStream ); - outputHandleJustInCase = NULL; - if (ret == EOF) goto errhandler_io; - } - outputHandleJustInCase = NULL; - if (ferror(stream)) goto errhandler_io; - ret = fclose ( stream ); - if (ret == EOF) goto errhandler_io; - - if (verbosity >= 1) { - if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) { - fprintf ( stderr, " no data compressed.\n"); - } else { - Char buf_nin[32], buf_nout[32]; - UInt64 nbytes_in, nbytes_out; - double nbytes_in_d, nbytes_out_d; - uInt64_from_UInt32s ( &nbytes_in, - nbytes_in_lo32, nbytes_in_hi32 ); - uInt64_from_UInt32s ( &nbytes_out, - nbytes_out_lo32, nbytes_out_hi32 ); - nbytes_in_d = uInt64_to_double ( &nbytes_in ); - nbytes_out_d = uInt64_to_double ( &nbytes_out ); - uInt64_toAscii ( buf_nin, &nbytes_in ); - uInt64_toAscii ( buf_nout, &nbytes_out ); - fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, " - "%5.2f%% saved, %s in, %s out.\n", - nbytes_in_d / nbytes_out_d, - (8.0 * nbytes_out_d) / nbytes_in_d, - 100.0 * (1.0 - nbytes_out_d / nbytes_in_d), - buf_nin, - buf_nout - ); - } - } - - return; - - errhandler: - BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, - &nbytes_in_lo32, &nbytes_in_hi32, - &nbytes_out_lo32, &nbytes_out_hi32 ); - switch (bzerr) { - case BZ_CONFIG_ERROR: - configError(); break; - case BZ_MEM_ERROR: - outOfMemory (); break; - case BZ_IO_ERROR: - errhandler_io: - ioError(); break; - default: - panic ( "compress:unexpected error" ); - } - - panic ( "compress:end" ); - /*notreached*/ -} - - - -/*---------------------------------------------*/ -static -Bool uncompressStream ( FILE *zStream, FILE *stream ) -{ - BZFILE* bzf = NULL; - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; - UChar obuf[5000]; - UChar unused[BZ_MAX_UNUSED]; - Int32 nUnused; - void* unusedTmpV; - UChar* unusedTmp; - - nUnused = 0; - streamNo = 0; - - SET_BINARY_MODE(stream); - SET_BINARY_MODE(zStream); - - if (ferror(stream)) goto errhandler_io; - if (ferror(zStream)) goto errhandler_io; - - while (True) { - - bzf = BZ2_bzReadOpen ( - &bzerr, zStream, verbosity, - (int)smallMode, unused, nUnused - ); - if (bzf == NULL || bzerr != BZ_OK) goto errhandler; - streamNo++; - - while (bzerr == BZ_OK) { - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); - if (bzerr == BZ_DATA_ERROR_MAGIC) goto trycat; - if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0) - fwrite ( obuf, sizeof(UChar), nread, stream ); - if (ferror(stream)) goto errhandler_io; - } - if (bzerr != BZ_STREAM_END) goto errhandler; - - BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused ); - if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" ); - - unusedTmp = (UChar*)unusedTmpV; - for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i]; - - BZ2_bzReadClose ( &bzerr, bzf ); - if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" ); - - if (nUnused == 0 && myfeof(zStream)) break; - } - - closeok: - if (ferror(zStream)) goto errhandler_io; - if (stream != stdout) { - Int32 fd = fileno ( stream ); - if (fd < 0) goto errhandler_io; - applySavedFileAttrToOutputFile ( fd ); - } - ret = fclose ( zStream ); - if (ret == EOF) goto errhandler_io; - - if (ferror(stream)) goto errhandler_io; - ret = fflush ( stream ); - if (ret != 0) goto errhandler_io; - if (stream != stdout) { - ret = fclose ( stream ); - outputHandleJustInCase = NULL; - if (ret == EOF) goto errhandler_io; - } - outputHandleJustInCase = NULL; - if (verbosity >= 2) fprintf ( stderr, "\n " ); - return True; - - trycat: - if (forceOverwrite) { - rewind(zStream); - while (True) { - if (myfeof(zStream)) break; - nread = fread ( obuf, sizeof(UChar), 5000, zStream ); - if (ferror(zStream)) goto errhandler_io; - if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream ); - if (ferror(stream)) goto errhandler_io; - } - goto closeok; - } - - errhandler: - BZ2_bzReadClose ( &bzerr_dummy, bzf ); - switch (bzerr) { - case BZ_CONFIG_ERROR: - configError(); break; - case BZ_IO_ERROR: - errhandler_io: - ioError(); break; - case BZ_DATA_ERROR: - crcError(); - case BZ_MEM_ERROR: - outOfMemory(); - case BZ_UNEXPECTED_EOF: - compressedStreamEOF(); - case BZ_DATA_ERROR_MAGIC: - if (zStream != stdin) fclose(zStream); - if (stream != stdout) fclose(stream); - if (streamNo == 1) { - return False; - } else { - if (noisy) - fprintf ( stderr, - "\n%s: %s: trailing garbage after EOF ignored\n", - progName, inName ); - return True; - } - default: - panic ( "decompress:unexpected error" ); - } - - panic ( "decompress:end" ); - return True; /*notreached*/ -} - - -/*---------------------------------------------*/ -static -Bool testStream ( FILE *zStream ) -{ - BZFILE* bzf = NULL; - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; - UChar obuf[5000]; - UChar unused[BZ_MAX_UNUSED]; - Int32 nUnused; - void* unusedTmpV; - UChar* unusedTmp; - - nUnused = 0; - streamNo = 0; - - SET_BINARY_MODE(zStream); - if (ferror(zStream)) goto errhandler_io; - - while (True) { - - bzf = BZ2_bzReadOpen ( - &bzerr, zStream, verbosity, - (int)smallMode, unused, nUnused - ); - if (bzf == NULL || bzerr != BZ_OK) goto errhandler; - streamNo++; - - while (bzerr == BZ_OK) { - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); - if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler; - } - if (bzerr != BZ_STREAM_END) goto errhandler; - - BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused ); - if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" ); - - unusedTmp = (UChar*)unusedTmpV; - for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i]; - - BZ2_bzReadClose ( &bzerr, bzf ); - if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" ); - if (nUnused == 0 && myfeof(zStream)) break; - - } - - if (ferror(zStream)) goto errhandler_io; - ret = fclose ( zStream ); - if (ret == EOF) goto errhandler_io; - - if (verbosity >= 2) fprintf ( stderr, "\n " ); - return True; - - errhandler: - BZ2_bzReadClose ( &bzerr_dummy, bzf ); - if (verbosity == 0) - fprintf ( stderr, "%s: %s: ", progName, inName ); - switch (bzerr) { - case BZ_CONFIG_ERROR: - configError(); break; - case BZ_IO_ERROR: - errhandler_io: - ioError(); break; - case BZ_DATA_ERROR: - fprintf ( stderr, - "data integrity (CRC) error in data\n" ); - return False; - case BZ_MEM_ERROR: - outOfMemory(); - case BZ_UNEXPECTED_EOF: - fprintf ( stderr, - "file ends unexpectedly\n" ); - return False; - case BZ_DATA_ERROR_MAGIC: - if (zStream != stdin) fclose(zStream); - if (streamNo == 1) { - fprintf ( stderr, - "bad magic number (file not created by bzip2)\n" ); - return False; - } else { - if (noisy) - fprintf ( stderr, - "trailing garbage after EOF ignored\n" ); - return True; - } - default: - panic ( "test:unexpected error" ); - } - - panic ( "test:end" ); - return True; /*notreached*/ -} - - -/*---------------------------------------------------*/ -/*--- Error [non-] handling grunge ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------*/ -static -void setExit ( Int32 v ) -{ - if (v > exitValue) exitValue = v; -} - - -/*---------------------------------------------*/ -static -void cadvise ( void ) -{ - if (noisy) - fprintf ( - stderr, - "\nIt is possible that the compressed file(s) have become corrupted.\n" - "You can use the -tvv option to test integrity of such files.\n\n" - "You can use the `bzip2recover' program to attempt to recover\n" - "data from undamaged sections of corrupted files.\n\n" - ); -} - - -/*---------------------------------------------*/ -static -void showFileNames ( void ) -{ - if (noisy) - fprintf ( - stderr, - "\tInput file = %s, output file = %s\n", - inName, outName - ); -} - - -/*---------------------------------------------*/ -static -void cleanUpAndFail ( Int32 ec ) -{ - IntNative retVal; - struct MY_STAT statBuf; - - if ( srcMode == SM_F2F - && opMode != OM_TEST - && deleteOutputOnInterrupt ) { - - /* Check whether input file still exists. Delete output file - only if input exists to avoid loss of data. Joerg Prante, 5 - January 2002. (JRS 06-Jan-2002: other changes in 1.0.2 mean - this is less likely to happen. But to be ultra-paranoid, we - do the check anyway.) */ - retVal = MY_STAT ( inName, &statBuf ); - if (retVal == 0) { - if (noisy) - fprintf ( stderr, - "%s: Deleting output file %s, if it exists.\n", - progName, outName ); - if (outputHandleJustInCase != NULL) - fclose ( outputHandleJustInCase ); - retVal = remove ( outName ); - if (retVal != 0) - fprintf ( stderr, - "%s: WARNING: deletion of output file " - "(apparently) failed.\n", - progName ); - } else { - fprintf ( stderr, - "%s: WARNING: deletion of output file suppressed\n", - progName ); - fprintf ( stderr, - "%s: since input file no longer exists. Output file\n", - progName ); - fprintf ( stderr, - "%s: `%s' may be incomplete.\n", - progName, outName ); - fprintf ( stderr, - "%s: I suggest doing an integrity test (bzip2 -tv)" - " of it.\n", - progName ); - } - } - - if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) { - fprintf ( stderr, - "%s: WARNING: some files have not been processed:\n" - "%s: %d specified on command line, %d not processed yet.\n\n", - progName, progName, - numFileNames, numFileNames - numFilesProcessed ); - } - setExit(ec); - exit(exitValue); -} - - -/*---------------------------------------------*/ -static -void panic ( const Char* s ) -{ - fprintf ( stderr, - "\n%s: PANIC -- internal consistency error:\n" - "\t%s\n" - "\tThis is a BUG. Please report it to me at:\n" - "\tjseward@bzip.org\n", - progName, s ); - showFileNames(); - cleanUpAndFail( 3 ); -} - - -/*---------------------------------------------*/ -static -void crcError ( void ) -{ - fprintf ( stderr, - "\n%s: Data integrity error when decompressing.\n", - progName ); - showFileNames(); - cadvise(); - cleanUpAndFail( 2 ); -} - - -/*---------------------------------------------*/ -static -void compressedStreamEOF ( void ) -{ - if (noisy) { - fprintf ( stderr, - "\n%s: Compressed file ends unexpectedly;\n\t" - "perhaps it is corrupted? *Possible* reason follows.\n", - progName ); - perror ( progName ); - showFileNames(); - cadvise(); - } - cleanUpAndFail( 2 ); -} - - -/*---------------------------------------------*/ -static -void ioError ( void ) -{ - fprintf ( stderr, - "\n%s: I/O or other error, bailing out. " - "Possible reason follows.\n", - progName ); - perror ( progName ); - showFileNames(); - cleanUpAndFail( 1 ); -} - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/*---------------------------------------------*/ -static -void mySignalCatcher ( IntNative n ) -{ - fprintf ( stderr, - "\n%s: Control-C or similar caught, quitting.\n", - progName ); - cleanUpAndFail(1); -} - - -/*---------------------------------------------*/ -static -void mySIGSEGVorSIGBUScatcher ( IntNative n ) -{ - if (opMode == OM_Z) - fprintf ( - stderr, - "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n" - "\n" - " Possible causes are (most likely first):\n" - " (1) This computer has unreliable memory or cache hardware\n" - " (a surprisingly common problem; try a different machine.)\n" - " (2) A bug in the compiler used to create this executable\n" - " (unlikely, if you didn't compile bzip2 yourself.)\n" - " (3) A real bug in bzip2 -- I hope this should never be the case.\n" - " The user's manual, Section 4.3, has more info on (1) and (2).\n" - " \n" - " If you suspect this is a bug in bzip2, or are unsure about (1)\n" - " or (2), feel free to report it to me at: jseward@bzip.org.\n" - " Section 4.3 of the user's manual describes the info a useful\n" - " bug report should have. If the manual is available on your\n" - " system, please try and read it before mailing me. If you don't\n" - " have the manual or can't be bothered to read it, mail me anyway.\n" - "\n", - progName ); - else - fprintf ( - stderr, - "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n" - "\n" - " Possible causes are (most likely first):\n" - " (1) The compressed data is corrupted, and bzip2's usual checks\n" - " failed to detect this. Try bzip2 -tvv my_file.bz2.\n" - " (2) This computer has unreliable memory or cache hardware\n" - " (a surprisingly common problem; try a different machine.)\n" - " (3) A bug in the compiler used to create this executable\n" - " (unlikely, if you didn't compile bzip2 yourself.)\n" - " (4) A real bug in bzip2 -- I hope this should never be the case.\n" - " The user's manual, Section 4.3, has more info on (2) and (3).\n" - " \n" - " If you suspect this is a bug in bzip2, or are unsure about (2)\n" - " or (3), feel free to report it to me at: jseward@bzip.org.\n" - " Section 4.3 of the user's manual describes the info a useful\n" - " bug report should have. If the manual is available on your\n" - " system, please try and read it before mailing me. If you don't\n" - " have the manual or can't be bothered to read it, mail me anyway.\n" - "\n", - progName ); - - showFileNames(); - if (opMode == OM_Z) - cleanUpAndFail( 3 ); else - { cadvise(); cleanUpAndFail( 2 ); } -} - -#ifdef __cplusplus -} -#endif - -/*---------------------------------------------*/ -static -void outOfMemory ( void ) -{ - fprintf ( stderr, - "\n%s: couldn't allocate enough memory\n", - progName ); - showFileNames(); - cleanUpAndFail(1); -} - - -/*---------------------------------------------*/ -static -void configError ( void ) -{ - fprintf ( stderr, - "bzip2: I'm not configured correctly for this platform!\n" - "\tI require Int32, Int16 and Char to have sizes\n" - "\tof 4, 2 and 1 bytes to run properly, and they don't.\n" - "\tProbably you can fix this by defining them correctly,\n" - "\tand recompiling. Bye!\n" ); - setExit(3); - exit(exitValue); -} - - -/*---------------------------------------------------*/ -/*--- The main driver machinery ---*/ -/*---------------------------------------------------*/ - -/* All rather crufty. The main problem is that input files - are stat()d multiple times before use. This should be - cleaned up. -*/ - -/*---------------------------------------------*/ -static -void pad ( Char *s ) -{ - Int32 i; - if ( (Int32)strlen(s) >= longestFileName ) return; - for (i = 1; i <= longestFileName - (Int32)strlen(s); i++) - fprintf ( stderr, " " ); -} - - -/*---------------------------------------------*/ -static -void copyFileName ( Char* to, Char* from ) -{ - if ( strlen(from) > FILE_NAME_LEN-10 ) { - fprintf ( - stderr, - "bzip2: file name\n`%s'\n" - "is suspiciously (more than %d chars) long.\n" - "Try using a reasonable file name instead. Sorry! :-)\n", - from, FILE_NAME_LEN-10 - ); - setExit(1); - exit(exitValue); - } - - strncpy(to,from,FILE_NAME_LEN-10); - to[FILE_NAME_LEN-10]='\0'; -} - - -/*---------------------------------------------*/ -static -Bool fileExists ( Char* name ) -{ - FILE *tmp = fopen ( name, "rb" ); - Bool exists = (tmp != NULL); - if (tmp != NULL) fclose ( tmp ); - return exists; -} - - -/*---------------------------------------------*/ -/* Open an output file safely with O_EXCL and good permissions. - This avoids a race condition in versions < 1.0.2, in which - the file was first opened and then had its interim permissions - set safely. We instead use open() to create the file with - the interim permissions required. (--- --- rw-). - - For non-Unix platforms, if we are not worrying about - security issues, simple this simply behaves like fopen. -*/ -static -FILE* fopen_output_safely ( Char* name, const char* mode ) -{ -# if BZ_UNIX - FILE* fp; - IntNative fh; - fh = open(name, O_WRONLY|O_CREAT|O_EXCL, S_IWUSR|S_IRUSR); - if (fh == -1) return NULL; - fp = fdopen(fh, mode); - if (fp == NULL) close(fh); - return fp; -# else - return fopen(name, mode); -# endif -} - - -/*---------------------------------------------*/ -/*-- - if in doubt, return True ---*/ -static -Bool notAStandardFile ( Char* name ) -{ - IntNative i; - struct MY_STAT statBuf; - - i = MY_LSTAT ( name, &statBuf ); - if (i != 0) return True; - if (MY_S_ISREG(statBuf.st_mode)) return False; - return True; -} - - -/*---------------------------------------------*/ -/*-- - rac 11/21/98 see if file has hard links to it ---*/ -static -Int32 countHardLinks ( Char* name ) -{ - IntNative i; - struct MY_STAT statBuf; - - i = MY_LSTAT ( name, &statBuf ); - if (i != 0) return 0; - return (statBuf.st_nlink - 1); -} - - -/*---------------------------------------------*/ -/* Copy modification date, access date, permissions and owner from the - source to destination file. We have to copy this meta-info off - into fileMetaInfo before starting to compress / decompress it, - because doing it afterwards means we get the wrong access time. - - To complicate matters, in compress() and decompress() below, the - sequence of tests preceding the call to saveInputFileMetaInfo() - involves calling fileExists(), which in turn establishes its result - by attempting to fopen() the file, and if successful, immediately - fclose()ing it again. So we have to assume that the fopen() call - does not cause the access time field to be updated. - - Reading of the man page for stat() (man 2 stat) on RedHat 7.2 seems - to imply that merely doing open() will not affect the access time. - Therefore we merely need to hope that the C library only does - open() as a result of fopen(), and not any kind of read()-ahead - cleverness. - - It sounds pretty fragile to me. Whether this carries across - robustly to arbitrary Unix-like platforms (or even works robustly - on this one, RedHat 7.2) is unknown to me. Nevertheless ... -*/ -#if BZ_UNIX -static -struct MY_STAT fileMetaInfo; -#endif - -static -void saveInputFileMetaInfo ( Char *srcName ) -{ -# if BZ_UNIX - IntNative retVal; - /* Note use of stat here, not lstat. */ - retVal = MY_STAT( srcName, &fileMetaInfo ); - ERROR_IF_NOT_ZERO ( retVal ); -# endif -} - - -static -void applySavedTimeInfoToOutputFile ( Char *dstName ) -{ -# if BZ_UNIX - IntNative retVal; - struct utimbuf uTimBuf; - - uTimBuf.actime = fileMetaInfo.st_atime; - uTimBuf.modtime = fileMetaInfo.st_mtime; - - retVal = utime ( dstName, &uTimBuf ); - ERROR_IF_NOT_ZERO ( retVal ); -# endif -} - -static -void applySavedFileAttrToOutputFile ( IntNative fd ) -{ -# if BZ_UNIX - IntNative retVal; - - retVal = fchmod ( fd, fileMetaInfo.st_mode ); - ERROR_IF_NOT_ZERO ( retVal ); - - (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid ); - /* chown() will in many cases return with EPERM, which can - be safely ignored. - */ -# endif -} - - -/*---------------------------------------------*/ -static -Bool containsDubiousChars ( Char* name ) -{ -# if BZ_UNIX - /* On unix, files can contain any characters and the file expansion - * is performed by the shell. - */ - return False; -# else /* ! BZ_UNIX */ - /* On non-unix (Win* platforms), wildcard characters are not allowed in - * filenames. - */ - for (; *name != '\0'; name++) - if (*name == '?' || *name == '*') return True; - return False; -# endif /* BZ_UNIX */ -} - - -/*---------------------------------------------*/ -#define BZ_N_SUFFIX_PAIRS 4 - -const Char* zSuffix[BZ_N_SUFFIX_PAIRS] - = { ".bz2", ".bz", ".tbz2", ".tbz" }; -const Char* unzSuffix[BZ_N_SUFFIX_PAIRS] - = { "", "", ".tar", ".tar" }; - -static -Bool hasSuffix ( Char* s, const Char* suffix ) -{ - Int32 ns = strlen(s); - Int32 nx = strlen(suffix); - if (ns < nx) return False; - if (strcmp(s + ns - nx, suffix) == 0) return True; - return False; -} - -static -Bool mapSuffix ( Char* name, - const Char* oldSuffix, - const Char* newSuffix ) -{ - if (!hasSuffix(name,oldSuffix)) return False; - name[strlen(name)-strlen(oldSuffix)] = 0; - strcat ( name, newSuffix ); - return True; -} - - -/*---------------------------------------------*/ -static -void compress ( Char *name ) -{ - FILE *inStr; - FILE *outStr; - Int32 n, i; - struct MY_STAT statBuf; - - deleteOutputOnInterrupt = False; - - if (name == NULL && srcMode != SM_I2O) - panic ( "compress: bad modes\n" ); - - switch (srcMode) { - case SM_I2O: - copyFileName ( inName, (Char*)"(stdin)" ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - case SM_F2F: - copyFileName ( inName, name ); - copyFileName ( outName, name ); - strcat ( outName, ".bz2" ); - break; - case SM_F2O: - copyFileName ( inName, name ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - } - - if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { - if (noisy) - fprintf ( stderr, "%s: There are no files matching `%s'.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode != SM_I2O && !fileExists ( inName ) ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - } - for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) { - if (hasSuffix(inName, zSuffix[i])) { - if (noisy) - fprintf ( stderr, - "%s: Input file %s already has %s suffix.\n", - progName, inName, zSuffix[i] ); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F || srcMode == SM_F2O ) { - MY_STAT(inName, &statBuf); - if ( MY_S_ISDIR(statBuf.st_mode) ) { - fprintf( stderr, - "%s: Input file %s is a directory.\n", - progName,inName); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) { - if (noisy) - fprintf ( stderr, "%s: Input file %s is not a normal file.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode == SM_F2F && fileExists ( outName ) ) { - if (forceOverwrite) { - remove(outName); - } else { - fprintf ( stderr, "%s: Output file %s already exists.\n", - progName, outName ); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && - (n=countHardLinks ( inName )) > 0) { - fprintf ( stderr, "%s: Input file %s has %d other link%s.\n", - progName, inName, n, n > 1 ? "s" : "" ); - setExit(1); - return; - } - - if ( srcMode == SM_F2F ) { - /* Save the file's meta-info before we open it. Doing it later - means we mess up the access times. */ - saveInputFileMetaInfo ( inName ); - } - - switch ( srcMode ) { - - case SM_I2O: - inStr = stdin; - outStr = stdout; - if ( isatty ( fileno ( stdout ) ) ) { - fprintf ( stderr, - "%s: I won't write compressed data to a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - setExit(1); - return; - }; - break; - - case SM_F2O: - inStr = fopen ( inName, "rb" ); - outStr = stdout; - if ( isatty ( fileno ( stdout ) ) ) { - fprintf ( stderr, - "%s: I won't write compressed data to a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - }; - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - }; - break; - - case SM_F2F: - inStr = fopen ( inName, "rb" ); - outStr = fopen_output_safely ( outName, "wb" ); - if ( outStr == NULL) { - fprintf ( stderr, "%s: Can't create output file %s: %s.\n", - progName, outName, strerror(errno) ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - } - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - if ( outStr != NULL ) fclose ( outStr ); - setExit(1); - return; - }; - break; - - default: - panic ( "compress: bad srcMode" ); - break; - } - - if (verbosity >= 1) { - fprintf ( stderr, " %s: ", inName ); - pad ( inName ); - fflush ( stderr ); - } - - /*--- Now the input and output handles are sane. Do the Biz. ---*/ - outputHandleJustInCase = outStr; - deleteOutputOnInterrupt = True; - compressStream ( inStr, outStr ); - outputHandleJustInCase = NULL; - - /*--- If there was an I/O error, we won't get here. ---*/ - if ( srcMode == SM_F2F ) { - applySavedTimeInfoToOutputFile ( outName ); - deleteOutputOnInterrupt = False; - if ( !keepInputFiles ) { - IntNative retVal = remove ( inName ); - ERROR_IF_NOT_ZERO ( retVal ); - } - } - - deleteOutputOnInterrupt = False; -} - - -/*---------------------------------------------*/ -static -void uncompress ( Char *name ) -{ - FILE *inStr; - FILE *outStr; - Int32 n, i; - Bool magicNumberOK; - Bool cantGuess; - struct MY_STAT statBuf; - - deleteOutputOnInterrupt = False; - - if (name == NULL && srcMode != SM_I2O) - panic ( "uncompress: bad modes\n" ); - - cantGuess = False; - switch (srcMode) { - case SM_I2O: - copyFileName ( inName, (Char*)"(stdin)" ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - case SM_F2F: - copyFileName ( inName, name ); - copyFileName ( outName, name ); - for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) - if (mapSuffix(outName,zSuffix[i],unzSuffix[i])) - goto zzz; - cantGuess = True; - strcat ( outName, ".out" ); - break; - case SM_F2O: - copyFileName ( inName, name ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - } - - zzz: - if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { - if (noisy) - fprintf ( stderr, "%s: There are no files matching `%s'.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode != SM_I2O && !fileExists ( inName ) ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - } - if ( srcMode == SM_F2F || srcMode == SM_F2O ) { - MY_STAT(inName, &statBuf); - if ( MY_S_ISDIR(statBuf.st_mode) ) { - fprintf( stderr, - "%s: Input file %s is a directory.\n", - progName,inName); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) { - if (noisy) - fprintf ( stderr, "%s: Input file %s is not a normal file.\n", - progName, inName ); - setExit(1); - return; - } - if ( /* srcMode == SM_F2F implied && */ cantGuess ) { - if (noisy) - fprintf ( stderr, - "%s: Can't guess original name for %s -- using %s\n", - progName, inName, outName ); - /* just a warning, no return */ - } - if ( srcMode == SM_F2F && fileExists ( outName ) ) { - if (forceOverwrite) { - remove(outName); - } else { - fprintf ( stderr, "%s: Output file %s already exists.\n", - progName, outName ); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && - (n=countHardLinks ( inName ) ) > 0) { - fprintf ( stderr, "%s: Input file %s has %d other link%s.\n", - progName, inName, n, n > 1 ? "s" : "" ); - setExit(1); - return; - } - - if ( srcMode == SM_F2F ) { - /* Save the file's meta-info before we open it. Doing it later - means we mess up the access times. */ - saveInputFileMetaInfo ( inName ); - } - - switch ( srcMode ) { - - case SM_I2O: - inStr = stdin; - outStr = stdout; - if ( isatty ( fileno ( stdin ) ) ) { - fprintf ( stderr, - "%s: I won't read compressed data from a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - setExit(1); - return; - }; - break; - - case SM_F2O: - inStr = fopen ( inName, "rb" ); - outStr = stdout; - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s:%s.\n", - progName, inName, strerror(errno) ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - }; - break; - - case SM_F2F: - inStr = fopen ( inName, "rb" ); - outStr = fopen_output_safely ( outName, "wb" ); - if ( outStr == NULL) { - fprintf ( stderr, "%s: Can't create output file %s: %s.\n", - progName, outName, strerror(errno) ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - } - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - if ( outStr != NULL ) fclose ( outStr ); - setExit(1); - return; - }; - break; - - default: - panic ( "uncompress: bad srcMode" ); - break; - } - - if (verbosity >= 1) { - fprintf ( stderr, " %s: ", inName ); - pad ( inName ); - fflush ( stderr ); - } - - /*--- Now the input and output handles are sane. Do the Biz. ---*/ - outputHandleJustInCase = outStr; - deleteOutputOnInterrupt = True; - magicNumberOK = uncompressStream ( inStr, outStr ); - outputHandleJustInCase = NULL; - - /*--- If there was an I/O error, we won't get here. ---*/ - if ( magicNumberOK ) { - if ( srcMode == SM_F2F ) { - applySavedTimeInfoToOutputFile ( outName ); - deleteOutputOnInterrupt = False; - if ( !keepInputFiles ) { - IntNative retVal = remove ( inName ); - ERROR_IF_NOT_ZERO ( retVal ); - } - } - } else { - unzFailsExist = True; - deleteOutputOnInterrupt = False; - if ( srcMode == SM_F2F ) { - IntNative retVal = remove ( outName ); - ERROR_IF_NOT_ZERO ( retVal ); - } - } - deleteOutputOnInterrupt = False; - - if ( magicNumberOK ) { - if (verbosity >= 1) - fprintf ( stderr, "done\n" ); - } else { - setExit(2); - if (verbosity >= 1) - fprintf ( stderr, "not a bzip2 file.\n" ); else - fprintf ( stderr, - "%s: %s is not a bzip2 file.\n", - progName, inName ); - } - -} - - -/*---------------------------------------------*/ -static -void testf ( Char *name ) -{ - FILE *inStr; - Bool allOK; - struct MY_STAT statBuf; - - deleteOutputOnInterrupt = False; - - if (name == NULL && srcMode != SM_I2O) - panic ( "testf: bad modes\n" ); - - copyFileName ( outName, (Char*)"(none)" ); - switch (srcMode) { - case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break; - case SM_F2F: copyFileName ( inName, name ); break; - case SM_F2O: copyFileName ( inName, name ); break; - } - - if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { - if (noisy) - fprintf ( stderr, "%s: There are no files matching `%s'.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode != SM_I2O && !fileExists ( inName ) ) { - fprintf ( stderr, "%s: Can't open input %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - } - if ( srcMode != SM_I2O ) { - MY_STAT(inName, &statBuf); - if ( MY_S_ISDIR(statBuf.st_mode) ) { - fprintf( stderr, - "%s: Input file %s is a directory.\n", - progName,inName); - setExit(1); - return; - } - } - - switch ( srcMode ) { - - case SM_I2O: - if ( isatty ( fileno ( stdin ) ) ) { - fprintf ( stderr, - "%s: I won't read compressed data from a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - setExit(1); - return; - }; - inStr = stdin; - break; - - case SM_F2O: case SM_F2F: - inStr = fopen ( inName, "rb" ); - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s:%s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - }; - break; - - default: - panic ( "testf: bad srcMode" ); - break; - } - - if (verbosity >= 1) { - fprintf ( stderr, " %s: ", inName ); - pad ( inName ); - fflush ( stderr ); - } - - /*--- Now the input handle is sane. Do the Biz. ---*/ - outputHandleJustInCase = NULL; - allOK = testStream ( inStr ); - - if (allOK && verbosity >= 1) fprintf ( stderr, "ok\n" ); - if (!allOK) testFailsExist = True; -} - - -/*---------------------------------------------*/ -static -void license ( void ) -{ - fprintf ( stderr, - - "bzip2, a block-sorting file compressor. " - "Version %s.\n" - " \n" - " Copyright (C) 1996-2007 by Julian Seward.\n" - " \n" - " This program is free software; you can redistribute it and/or modify\n" - " it under the terms set out in the LICENSE file, which is included\n" - " in the bzip2-1.0.5 source distribution.\n" - " \n" - " This program is distributed in the hope that it will be useful,\n" - " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - " LICENSE file for more details.\n" - " \n", - BZ2_bzlibVersion() - ); -} - - -/*---------------------------------------------*/ -static -void usage ( Char *fullProgName ) -{ - fprintf ( - stderr, - "bzip2, a block-sorting file compressor. " - "Version %s.\n" - "\n usage: %s [flags and input files in any order]\n" - "\n" - " -h --help print this message\n" - " -d --decompress force decompression\n" - " -z --compress force compression\n" - " -k --keep keep (don't delete) input files\n" - " -f --force overwrite existing output files\n" - " -t --test test compressed file integrity\n" - " -c --stdout output to standard out\n" - " -q --quiet suppress noncritical error messages\n" - " -v --verbose be verbose (a 2nd -v gives more)\n" - " -L --license display software version & license\n" - " -V --version display software version & license\n" - " -s --small use less memory (at most 2500k)\n" - " -1 .. -9 set block size to 100k .. 900k\n" - " --fast alias for -1\n" - " --best alias for -9\n" - "\n" - " If invoked as `bzip2', default action is to compress.\n" - " as `bunzip2', default action is to decompress.\n" - " as `bzcat', default action is to decompress to stdout.\n" - "\n" - " If no file names are given, bzip2 compresses or decompresses\n" - " from standard input to standard output. You can combine\n" - " short flags, so `-v -4' means the same as -v4 or -4v, &c.\n" -# if BZ_UNIX - "\n" -# endif - , - - BZ2_bzlibVersion(), - fullProgName - ); -} - - -/*---------------------------------------------*/ -static -void redundant ( Char* flag ) -{ - fprintf ( - stderr, - "%s: %s is redundant in versions 0.9.5 and above\n", - progName, flag ); -} - - -/*---------------------------------------------*/ -/*-- - All the garbage from here to main() is purely to - implement a linked list of command-line arguments, - into which main() copies argv[1 .. argc-1]. - - The purpose of this exercise is to facilitate - the expansion of wildcard characters * and ? in - filenames for OSs which don't know how to do it - themselves, like MSDOS, Windows 95 and NT. - - The actual Dirty Work is done by the platform- - specific macro APPEND_FILESPEC. ---*/ - -typedef - struct zzzz { - Char *name; - struct zzzz *link; - } - Cell; - - -/*---------------------------------------------*/ -static -void *myMalloc ( Int32 n ) -{ - void* p; - - p = malloc ( (size_t)n ); - if (p == NULL) outOfMemory (); - return p; -} - - -/*---------------------------------------------*/ -static -Cell *mkCell ( void ) -{ - Cell *c; - - c = (Cell*) myMalloc ( sizeof ( Cell ) ); - c->name = NULL; - c->link = NULL; - return c; -} - - -/*---------------------------------------------*/ -static -Cell *snocString ( Cell *root, Char *name ) -{ - if (root == NULL) { - Cell *tmp = mkCell(); - tmp->name = (Char*) myMalloc ( 5 + strlen(name) ); - strcpy ( tmp->name, name ); - return tmp; - } else { - Cell *tmp = root; - while (tmp->link != NULL) tmp = tmp->link; - tmp->link = snocString ( tmp->link, name ); - return root; - } -} - - -/*---------------------------------------------*/ -static -void addFlagsFromEnvVar ( Cell** argList, Char* varName ) -{ - Int32 i, j, k; - Char *envbase, *p; - - envbase = getenv(varName); - if (envbase != NULL) { - p = envbase; - i = 0; - while (True) { - if (p[i] == 0) break; - p += i; - i = 0; - while (isspace((Int32)(p[0]))) p++; - while (p[i] != 0 && !isspace((Int32)(p[i]))) i++; - if (i > 0) { - k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10; - for (j = 0; j < k; j++) tmpName[j] = p[j]; - tmpName[k] = 0; - APPEND_FLAG(*argList, tmpName); - } - } - } -} - - -/*---------------------------------------------*/ -#define ISFLAG(s) (strcmp(aa->name, (s))==0) - -IntNative main ( IntNative argc, Char *argv[] ) -{ - Int32 i, j; - Char *tmp; - Cell *argList; - Cell *aa; - Bool decode; - - /*-- Be really really really paranoid :-) --*/ - if (sizeof(Int32) != 4 || sizeof(UInt32) != 4 || - sizeof(Int16) != 2 || sizeof(UInt16) != 2 || - sizeof(Char) != 1 || sizeof(UChar) != 1) - configError(); - - /*-- Initialise --*/ - outputHandleJustInCase = NULL; - smallMode = False; - keepInputFiles = False; - forceOverwrite = False; - noisy = True; - verbosity = 0; - blockSize100k = 9; - testFailsExist = False; - unzFailsExist = False; - numFileNames = 0; - numFilesProcessed = 0; - workFactor = 30; - deleteOutputOnInterrupt = False; - exitValue = 0; - i = j = 0; /* avoid bogus warning from egcs-1.1.X */ - - /*-- Set up signal handlers for mem access errors --*/ - signal (SIGSEGV, mySIGSEGVorSIGBUScatcher); -# if BZ_UNIX -# ifndef __DJGPP__ - signal (SIGBUS, mySIGSEGVorSIGBUScatcher); -# endif -# endif - - copyFileName ( inName, (Char*)"(none)" ); - copyFileName ( outName, (Char*)"(none)" ); - - copyFileName ( progNameReally, argv[0] ); - progName = &progNameReally[0]; - for (tmp = &progNameReally[0]; *tmp != '\0'; tmp++) - if (*tmp == PATH_SEP) progName = tmp + 1; - - - /*-- Copy flags from env var BZIP2, and - expand filename wildcards in arg list. - --*/ - argList = NULL; - addFlagsFromEnvVar ( &argList, (Char*)"BZIP2" ); - addFlagsFromEnvVar ( &argList, (Char*)"BZIP" ); - for (i = 1; i <= argc-1; i++) - APPEND_FILESPEC(argList, argv[i]); - - - /*-- Find the length of the longest filename --*/ - longestFileName = 7; - numFileNames = 0; - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFileNames++; - if (longestFileName < (Int32)strlen(aa->name) ) - longestFileName = (Int32)strlen(aa->name); - } - - - /*-- Determine source modes; flag handling may change this too. --*/ - if (numFileNames == 0) - srcMode = SM_I2O; else srcMode = SM_F2F; - - - /*-- Determine what to do (compress/uncompress/test/cat). --*/ - /*-- Note that subsequent flag handling may change this. --*/ - opMode = OM_Z; - - if ( (strstr ( progName, "unzip" ) != 0) || - (strstr ( progName, "UNZIP" ) != 0) ) - opMode = OM_UNZ; - - if ( (strstr ( progName, "z2cat" ) != 0) || - (strstr ( progName, "Z2CAT" ) != 0) || - (strstr ( progName, "zcat" ) != 0) || - (strstr ( progName, "ZCAT" ) != 0) ) { - opMode = OM_UNZ; - srcMode = (numFileNames == 0) ? SM_I2O : SM_F2O; - } - - - /*-- Look at the flags. --*/ - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) break; - if (aa->name[0] == '-' && aa->name[1] != '-') { - for (j = 1; aa->name[j] != '\0'; j++) { - switch (aa->name[j]) { - case 'c': srcMode = SM_F2O; break; - case 'd': opMode = OM_UNZ; break; - case 'z': opMode = OM_Z; break; - case 'f': forceOverwrite = True; break; - case 't': opMode = OM_TEST; break; - case 'k': keepInputFiles = True; break; - case 's': smallMode = True; break; - case 'q': noisy = False; break; - case '1': blockSize100k = 1; break; - case '2': blockSize100k = 2; break; - case '3': blockSize100k = 3; break; - case '4': blockSize100k = 4; break; - case '5': blockSize100k = 5; break; - case '6': blockSize100k = 6; break; - case '7': blockSize100k = 7; break; - case '8': blockSize100k = 8; break; - case '9': blockSize100k = 9; break; - case 'V': - case 'L': license(); break; - case 'v': verbosity++; break; - case 'h': usage ( progName ); - exit ( 0 ); - break; - default: fprintf ( stderr, "%s: Bad flag `%s'\n", - progName, aa->name ); - usage ( progName ); - exit ( 1 ); - break; - } - } - } - } - - /*-- And again ... --*/ - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) break; - if (ISFLAG("--stdout")) srcMode = SM_F2O; else - if (ISFLAG("--decompress")) opMode = OM_UNZ; else - if (ISFLAG("--compress")) opMode = OM_Z; else - if (ISFLAG("--force")) forceOverwrite = True; else - if (ISFLAG("--test")) opMode = OM_TEST; else - if (ISFLAG("--keep")) keepInputFiles = True; else - if (ISFLAG("--small")) smallMode = True; else - if (ISFLAG("--quiet")) noisy = False; else - if (ISFLAG("--version")) license(); else - if (ISFLAG("--license")) license(); else - if (ISFLAG("--exponential")) workFactor = 1; else - if (ISFLAG("--repetitive-best")) redundant(aa->name); else - if (ISFLAG("--repetitive-fast")) redundant(aa->name); else - if (ISFLAG("--fast")) blockSize100k = 1; else - if (ISFLAG("--best")) blockSize100k = 9; else - if (ISFLAG("--verbose")) verbosity++; else - if (ISFLAG("--help")) { usage ( progName ); exit ( 0 ); } - else - if (strncmp ( aa->name, "--", 2) == 0) { - fprintf ( stderr, "%s: Bad flag `%s'\n", progName, aa->name ); - usage ( progName ); - exit ( 1 ); - } - } - - if (verbosity > 4) verbosity = 4; - if (opMode == OM_Z && smallMode && blockSize100k > 2) - blockSize100k = 2; - - if (opMode == OM_TEST && srcMode == SM_F2O) { - fprintf ( stderr, "%s: -c and -t cannot be used together.\n", - progName ); - exit ( 1 ); - } - - if (srcMode == SM_F2O && numFileNames == 0) - srcMode = SM_I2O; - - if (opMode != OM_Z) blockSize100k = 0; - - if (srcMode == SM_F2F) { - signal (SIGINT, mySignalCatcher); - signal (SIGTERM, mySignalCatcher); -# if BZ_UNIX - signal (SIGHUP, mySignalCatcher); -# endif - } - - if (opMode == OM_Z) { - if (srcMode == SM_I2O) { - compress ( NULL ); - } else { - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFilesProcessed++; - compress ( aa->name ); - } - } - } - else - - if (opMode == OM_UNZ) { - unzFailsExist = False; - if (srcMode == SM_I2O) { - uncompress ( NULL ); - } else { - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFilesProcessed++; - uncompress ( aa->name ); - } - } - if (unzFailsExist) { - setExit(2); - exit(exitValue); - } - } - - else { - testFailsExist = False; - if (srcMode == SM_I2O) { - testf ( NULL ); - } else { - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFilesProcessed++; - testf ( aa->name ); - } - } - if (testFailsExist && noisy) { - fprintf ( stderr, - "\n" - "You can use the `bzip2recover' program to attempt to recover\n" - "data from undamaged sections of corrupted files.\n\n" - ); - setExit(2); - exit(exitValue); - } - } - - /* Free the argument list memory to mollify leak detectors - (eg) Purify, Checker. Serves no other useful purpose. - */ - aa = argList; - while (aa != NULL) { - Cell* aa2 = aa->link; - if (aa->name != NULL) free(aa->name); - free(aa); - aa = aa2; - } - - return exitValue; -} - - -/*-----------------------------------------------------------*/ -/*--- end bzip2.c ---*/ -/*-----------------------------------------------------------*/ diff --git a/cpan/Compress-Raw-Bzip2/bzip2-src/bzip2recover.c b/cpan/Compress-Raw-Bzip2/bzip2-src/bzip2recover.c deleted file mode 100644 index bdbcd8b..0000000 --- a/cpan/Compress-Raw-Bzip2/bzip2-src/bzip2recover.c +++ /dev/null @@ -1,514 +0,0 @@ -/*-----------------------------------------------------------*/ -/*--- Block recoverer program for bzip2 ---*/ -/*--- bzip2recover.c ---*/ -/*-----------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - -/* This program is a complete hack and should be rewritten properly. - It isn't very complicated. */ - -#include -#include -#include -#include - - -/* This program records bit locations in the file to be recovered. - That means that if 64-bit ints are not supported, we will not - be able to recover .bz2 files over 512MB (2^32 bits) long. - On GNU supported platforms, we take advantage of the 64-bit - int support to circumvent this problem. Ditto MSVC. - - This change occurred in version 1.0.2; all prior versions have - the 512MB limitation. -*/ -#ifdef __GNUC__ - typedef unsigned long long int MaybeUInt64; -# define MaybeUInt64_FMT "%Lu" -#else -#ifdef _MSC_VER - typedef unsigned __int64 MaybeUInt64; -# define MaybeUInt64_FMT "%I64u" -#else - typedef unsigned int MaybeUInt64; -# define MaybeUInt64_FMT "%u" -#endif -#endif - -typedef unsigned int UInt32; -typedef int Int32; -typedef unsigned char UChar; -typedef char Char; -typedef unsigned char Bool; -#define True ((Bool)1) -#define False ((Bool)0) - - -#define BZ_MAX_FILENAME 2000 - -Char inFileName[BZ_MAX_FILENAME]; -Char outFileName[BZ_MAX_FILENAME]; -Char progName[BZ_MAX_FILENAME]; - -MaybeUInt64 bytesOut = 0; -MaybeUInt64 bytesIn = 0; - - -/*---------------------------------------------------*/ -/*--- Header bytes ---*/ -/*---------------------------------------------------*/ - -#define BZ_HDR_B 0x42 /* 'B' */ -#define BZ_HDR_Z 0x5a /* 'Z' */ -#define BZ_HDR_h 0x68 /* 'h' */ -#define BZ_HDR_0 0x30 /* '0' */ - - -/*---------------------------------------------------*/ -/*--- I/O errors ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------*/ -static void readError ( void ) -{ - fprintf ( stderr, - "%s: I/O error reading `%s', possible reason follows.\n", - progName, inFileName ); - perror ( progName ); - fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", - progName ); - exit ( 1 ); -} - - -/*---------------------------------------------*/ -static void writeError ( void ) -{ - fprintf ( stderr, - "%s: I/O error reading `%s', possible reason follows.\n", - progName, inFileName ); - perror ( progName ); - fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", - progName ); - exit ( 1 ); -} - - -/*---------------------------------------------*/ -static void mallocFail ( Int32 n ) -{ - fprintf ( stderr, - "%s: malloc failed on request for %d bytes.\n", - progName, n ); - fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", - progName ); - exit ( 1 ); -} - - -/*---------------------------------------------*/ -static void tooManyBlocks ( Int32 max_handled_blocks ) -{ - fprintf ( stderr, - "%s: `%s' appears to contain more than %d blocks\n", - progName, inFileName, max_handled_blocks ); - fprintf ( stderr, - "%s: and cannot be handled. To fix, increase\n", - progName ); - fprintf ( stderr, - "%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n", - progName ); - exit ( 1 ); -} - - - -/*---------------------------------------------------*/ -/*--- Bit stream I/O ---*/ -/*---------------------------------------------------*/ - -typedef - struct { - FILE* handle; - Int32 buffer; - Int32 buffLive; - Char mode; - } - BitStream; - - -/*---------------------------------------------*/ -static BitStream* bsOpenReadStream ( FILE* stream ) -{ - BitStream *bs = (BitStream*) malloc ( sizeof(BitStream) ); - if (bs == NULL) mallocFail ( sizeof(BitStream) ); - bs->handle = stream; - bs->buffer = 0; - bs->buffLive = 0; - bs->mode = 'r'; - return bs; -} - - -/*---------------------------------------------*/ -static BitStream* bsOpenWriteStream ( FILE* stream ) -{ - BitStream *bs = (BitStream*) malloc ( sizeof(BitStream) ); - if (bs == NULL) mallocFail ( sizeof(BitStream) ); - bs->handle = stream; - bs->buffer = 0; - bs->buffLive = 0; - bs->mode = 'w'; - return bs; -} - - -/*---------------------------------------------*/ -static void bsPutBit ( BitStream* bs, Int32 bit ) -{ - if (bs->buffLive == 8) { - Int32 retVal = putc ( (UChar) bs->buffer, bs->handle ); - if (retVal == EOF) writeError(); - bytesOut++; - bs->buffLive = 1; - bs->buffer = bit & 0x1; - } else { - bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) ); - bs->buffLive++; - }; -} - - -/*---------------------------------------------*/ -/*-- - Returns 0 or 1, or 2 to indicate EOF. ---*/ -static Int32 bsGetBit ( BitStream* bs ) -{ - if (bs->buffLive > 0) { - bs->buffLive --; - return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 ); - } else { - Int32 retVal = getc ( bs->handle ); - if ( retVal == EOF ) { - if (errno != 0) readError(); - return 2; - } - bs->buffLive = 7; - bs->buffer = retVal; - return ( ((bs->buffer) >> 7) & 0x1 ); - } -} - - -/*---------------------------------------------*/ -static void bsClose ( BitStream* bs ) -{ - Int32 retVal; - - if ( bs->mode == 'w' ) { - while ( bs->buffLive < 8 ) { - bs->buffLive++; - bs->buffer <<= 1; - }; - retVal = putc ( (UChar) (bs->buffer), bs->handle ); - if (retVal == EOF) writeError(); - bytesOut++; - retVal = fflush ( bs->handle ); - if (retVal == EOF) writeError(); - } - retVal = fclose ( bs->handle ); - if (retVal == EOF) { - if (bs->mode == 'w') writeError(); else readError(); - } - free ( bs ); -} - - -/*---------------------------------------------*/ -static void bsPutUChar ( BitStream* bs, UChar c ) -{ - Int32 i; - for (i = 7; i >= 0; i--) - bsPutBit ( bs, (((UInt32) c) >> i) & 0x1 ); -} - - -/*---------------------------------------------*/ -static void bsPutUInt32 ( BitStream* bs, UInt32 c ) -{ - Int32 i; - - for (i = 31; i >= 0; i--) - bsPutBit ( bs, (c >> i) & 0x1 ); -} - - -/*---------------------------------------------*/ -static Bool endsInBz2 ( Char* name ) -{ - Int32 n = strlen ( name ); - if (n <= 4) return False; - return - (name[n-4] == '.' && - name[n-3] == 'b' && - name[n-2] == 'z' && - name[n-1] == '2'); -} - - -/*---------------------------------------------------*/ -/*--- ---*/ -/*---------------------------------------------------*/ - -/* This logic isn't really right when it comes to Cygwin. */ -#ifdef _WIN32 -# define BZ_SPLIT_SYM '\\' /* path splitter on Windows platform */ -#else -# define BZ_SPLIT_SYM '/' /* path splitter on Unix platform */ -#endif - -#define BLOCK_HEADER_HI 0x00003141UL -#define BLOCK_HEADER_LO 0x59265359UL - -#define BLOCK_ENDMARK_HI 0x00001772UL -#define BLOCK_ENDMARK_LO 0x45385090UL - -/* Increase if necessary. However, a .bz2 file with > 50000 blocks - would have an uncompressed size of at least 40GB, so the chances - are low you'll need to up this. -*/ -#define BZ_MAX_HANDLED_BLOCKS 50000 - -MaybeUInt64 bStart [BZ_MAX_HANDLED_BLOCKS]; -MaybeUInt64 bEnd [BZ_MAX_HANDLED_BLOCKS]; -MaybeUInt64 rbStart[BZ_MAX_HANDLED_BLOCKS]; -MaybeUInt64 rbEnd [BZ_MAX_HANDLED_BLOCKS]; - -Int32 main ( Int32 argc, Char** argv ) -{ - FILE* inFile; - FILE* outFile; - BitStream* bsIn, *bsWr; - Int32 b, wrBlock, currBlock, rbCtr; - MaybeUInt64 bitsRead; - - UInt32 buffHi, buffLo, blockCRC; - Char* p; - - strcpy ( progName, argv[0] ); - inFileName[0] = outFileName[0] = 0; - - fprintf ( stderr, - "bzip2recover 1.0.5: extracts blocks from damaged .bz2 files.\n" ); - - if (argc != 2) { - fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", - progName, progName ); - switch (sizeof(MaybeUInt64)) { - case 8: - fprintf(stderr, - "\trestrictions on size of recovered file: None\n"); - break; - case 4: - fprintf(stderr, - "\trestrictions on size of recovered file: 512 MB\n"); - fprintf(stderr, - "\tto circumvent, recompile with MaybeUInt64 as an\n" - "\tunsigned 64-bit int.\n"); - break; - default: - fprintf(stderr, - "\tsizeof(MaybeUInt64) is not 4 or 8 -- " - "configuration error.\n"); - break; - } - exit(1); - } - - if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) { - fprintf ( stderr, - "%s: supplied filename is suspiciously (>= %d chars) long. Bye!\n", - progName, (int)strlen(argv[1]) ); - exit(1); - } - - strcpy ( inFileName, argv[1] ); - - inFile = fopen ( inFileName, "rb" ); - if (inFile == NULL) { - fprintf ( stderr, "%s: can't read `%s'\n", progName, inFileName ); - exit(1); - } - - bsIn = bsOpenReadStream ( inFile ); - fprintf ( stderr, "%s: searching for block boundaries ...\n", progName ); - - bitsRead = 0; - buffHi = buffLo = 0; - currBlock = 0; - bStart[currBlock] = 0; - - rbCtr = 0; - - while (True) { - b = bsGetBit ( bsIn ); - bitsRead++; - if (b == 2) { - if (bitsRead >= bStart[currBlock] && - (bitsRead - bStart[currBlock]) >= 40) { - bEnd[currBlock] = bitsRead-1; - if (currBlock > 0) - fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT - " to " MaybeUInt64_FMT " (incomplete)\n", - currBlock, bStart[currBlock], bEnd[currBlock] ); - } else - currBlock--; - break; - } - buffHi = (buffHi << 1) | (buffLo >> 31); - buffLo = (buffLo << 1) | (b & 1); - if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI - && buffLo == BLOCK_HEADER_LO) - || - ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI - && buffLo == BLOCK_ENDMARK_LO) - ) { - if (bitsRead > 49) { - bEnd[currBlock] = bitsRead-49; - } else { - bEnd[currBlock] = 0; - } - if (currBlock > 0 && - (bEnd[currBlock] - bStart[currBlock]) >= 130) { - fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT - " to " MaybeUInt64_FMT "\n", - rbCtr+1, bStart[currBlock], bEnd[currBlock] ); - rbStart[rbCtr] = bStart[currBlock]; - rbEnd[rbCtr] = bEnd[currBlock]; - rbCtr++; - } - if (currBlock >= BZ_MAX_HANDLED_BLOCKS) - tooManyBlocks(BZ_MAX_HANDLED_BLOCKS); - currBlock++; - - bStart[currBlock] = bitsRead; - } - } - - bsClose ( bsIn ); - - /*-- identified blocks run from 1 to rbCtr inclusive. --*/ - - if (rbCtr < 1) { - fprintf ( stderr, - "%s: sorry, I couldn't find any block boundaries.\n", - progName ); - exit(1); - }; - - fprintf ( stderr, "%s: splitting into blocks\n", progName ); - - inFile = fopen ( inFileName, "rb" ); - if (inFile == NULL) { - fprintf ( stderr, "%s: can't open `%s'\n", progName, inFileName ); - exit(1); - } - bsIn = bsOpenReadStream ( inFile ); - - /*-- placate gcc's dataflow analyser --*/ - blockCRC = 0; bsWr = 0; - - bitsRead = 0; - outFile = NULL; - wrBlock = 0; - while (True) { - b = bsGetBit(bsIn); - if (b == 2) break; - buffHi = (buffHi << 1) | (buffLo >> 31); - buffLo = (buffLo << 1) | (b & 1); - if (bitsRead == 47+rbStart[wrBlock]) - blockCRC = (buffHi << 16) | (buffLo >> 16); - - if (outFile != NULL && bitsRead >= rbStart[wrBlock] - && bitsRead <= rbEnd[wrBlock]) { - bsPutBit ( bsWr, b ); - } - - bitsRead++; - - if (bitsRead == rbEnd[wrBlock]+1) { - if (outFile != NULL) { - bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 ); - bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 ); - bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); - bsPutUInt32 ( bsWr, blockCRC ); - bsClose ( bsWr ); - } - if (wrBlock >= rbCtr) break; - wrBlock++; - } else - if (bitsRead == rbStart[wrBlock]) { - /* Create the output file name, correctly handling leading paths. - (31.10.2001 by Sergey E. Kusikov) */ - Char* split; - Int32 ofs, k; - for (k = 0; k < BZ_MAX_FILENAME; k++) - outFileName[k] = 0; - strcpy (outFileName, inFileName); - split = strrchr (outFileName, BZ_SPLIT_SYM); - if (split == NULL) { - split = outFileName; - } else { - ++split; - } - /* Now split points to the start of the basename. */ - ofs = split - outFileName; - sprintf (split, "rec%5d", wrBlock+1); - for (p = split; *p != 0; p++) if (*p == ' ') *p = '0'; - strcat (outFileName, inFileName + ofs); - - if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" ); - - fprintf ( stderr, " writing block %d to `%s' ...\n", - wrBlock+1, outFileName ); - - outFile = fopen ( outFileName, "wb" ); - if (outFile == NULL) { - fprintf ( stderr, "%s: can't write `%s'\n", - progName, outFileName ); - exit(1); - } - bsWr = bsOpenWriteStream ( outFile ); - bsPutUChar ( bsWr, BZ_HDR_B ); - bsPutUChar ( bsWr, BZ_HDR_Z ); - bsPutUChar ( bsWr, BZ_HDR_h ); - bsPutUChar ( bsWr, BZ_HDR_0 + 9 ); - bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 ); - bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 ); - bsPutUChar ( bsWr, 0x53 ); bsPutUChar ( bsWr, 0x59 ); - } - } - - fprintf ( stderr, "%s: finished\n", progName ); - return 0; -} - - - -/*-----------------------------------------------------------*/ -/*--- end bzip2recover.c ---*/ -/*-----------------------------------------------------------*/ diff --git a/cpan/Compress-Raw-Bzip2/bzip2-src/dlltest.c b/cpan/Compress-Raw-Bzip2/bzip2-src/dlltest.c deleted file mode 100644 index 03fa146..0000000 --- a/cpan/Compress-Raw-Bzip2/bzip2-src/dlltest.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - minibz2 - libbz2.dll test program. - by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) - This file is Public Domain. Welcome any email to me. - - usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename] -*/ - -#define BZ_IMPORT -#include -#include -#include "bzlib.h" -#ifdef _WIN32 -#include -#endif - - -#ifdef _WIN32 - -#define BZ2_LIBNAME "libbz2-1.0.2.DLL" - -#include -static int BZ2DLLLoaded = 0; -static HINSTANCE BZ2DLLhLib; -int BZ2DLLLoadLibrary(void) -{ - HINSTANCE hLib; - - if(BZ2DLLLoaded==1){return 0;} - hLib=LoadLibrary(BZ2_LIBNAME); - if(hLib == NULL){ - fprintf(stderr,"Can't load %s\n",BZ2_LIBNAME); - return -1; - } - BZ2_bzlibVersion=GetProcAddress(hLib,"BZ2_bzlibVersion"); - BZ2_bzopen=GetProcAddress(hLib,"BZ2_bzopen"); - BZ2_bzdopen=GetProcAddress(hLib,"BZ2_bzdopen"); - BZ2_bzread=GetProcAddress(hLib,"BZ2_bzread"); - BZ2_bzwrite=GetProcAddress(hLib,"BZ2_bzwrite"); - BZ2_bzflush=GetProcAddress(hLib,"BZ2_bzflush"); - BZ2_bzclose=GetProcAddress(hLib,"BZ2_bzclose"); - BZ2_bzerror=GetProcAddress(hLib,"BZ2_bzerror"); - - if (!BZ2_bzlibVersion || !BZ2_bzopen || !BZ2_bzdopen - || !BZ2_bzread || !BZ2_bzwrite || !BZ2_bzflush - || !BZ2_bzclose || !BZ2_bzerror) { - fprintf(stderr,"GetProcAddress failed.\n"); - return -1; - } - BZ2DLLLoaded=1; - BZ2DLLhLib=hLib; - return 0; - -} -int BZ2DLLFreeLibrary(void) -{ - if(BZ2DLLLoaded==0){return 0;} - FreeLibrary(BZ2DLLhLib); - BZ2DLLLoaded=0; -} -#endif /* WIN32 */ - -void usage(void) -{ - puts("usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]"); -} - -int main(int argc,char *argv[]) -{ - int decompress = 0; - int level = 9; - char *fn_r = NULL; - char *fn_w = NULL; - -#ifdef _WIN32 - if(BZ2DLLLoadLibrary()<0){ - fprintf(stderr,"Loading of %s failed. Giving up.\n", BZ2_LIBNAME); - exit(1); - } - printf("Loading of %s succeeded. Library version is %s.\n", - BZ2_LIBNAME, BZ2_bzlibVersion() ); -#endif - while(++argv,--argc){ - if(**argv =='-' || **argv=='/'){ - char *p; - - for(p=*argv+1;*p;p++){ - if(*p=='d'){ - decompress = 1; - }else if('1'<=*p && *p<='9'){ - level = *p - '0'; - }else{ - usage(); - exit(1); - } - } - }else{ - break; - } - } - if(argc>=1){ - fn_r = *argv; - argc--;argv++; - }else{ - fn_r = NULL; - } - if(argc>=1){ - fn_w = *argv; - argc--;argv++; - }else{ - fn_w = NULL; - } - { - int len; - char buff[0x1000]; - char mode[10]; - - if(decompress){ - BZFILE *BZ2fp_r = NULL; - FILE *fp_w = NULL; - - if(fn_w){ - if((fp_w = fopen(fn_w,"wb"))==NULL){ - printf("can't open [%s]\n",fn_w); - perror("reason:"); - exit(1); - } - }else{ - fp_w = stdout; - } - if((fn_r == NULL && (BZ2fp_r = BZ2_bzdopen(fileno(stdin),"rb"))==NULL) - || (fn_r != NULL && (BZ2fp_r = BZ2_bzopen(fn_r,"rb"))==NULL)){ - printf("can't bz2openstream\n"); - exit(1); - } - while((len=BZ2_bzread(BZ2fp_r,buff,0x1000))>0){ - fwrite(buff,1,len,fp_w); - } - BZ2_bzclose(BZ2fp_r); - if(fp_w != stdout) fclose(fp_w); - }else{ - BZFILE *BZ2fp_w = NULL; - FILE *fp_r = NULL; - - if(fn_r){ - if((fp_r = fopen(fn_r,"rb"))==NULL){ - printf("can't open [%s]\n",fn_r); - perror("reason:"); - exit(1); - } - }else{ - fp_r = stdin; - } - mode[0]='w'; - mode[1] = '0' + level; - mode[2] = '\0'; - - if((fn_w == NULL && (BZ2fp_w = BZ2_bzdopen(fileno(stdout),mode))==NULL) - || (fn_w !=NULL && (BZ2fp_w = BZ2_bzopen(fn_w,mode))==NULL)){ - printf("can't bz2openstream\n"); - exit(1); - } - while((len=fread(buff,1,0x1000,fp_r))>0){ - BZ2_bzwrite(BZ2fp_w,buff,len); - } - BZ2_bzclose(BZ2fp_w); - if(fp_r!=stdin)fclose(fp_r); - } - } -#ifdef _WIN32 - BZ2DLLFreeLibrary(); -#endif - return 0; -} diff --git a/cpan/Compress-Raw-Bzip2/bzip2-src/mk251.c b/cpan/Compress-Raw-Bzip2/bzip2-src/mk251.c deleted file mode 100644 index 39e94c0..0000000 --- a/cpan/Compress-Raw-Bzip2/bzip2-src/mk251.c +++ /dev/null @@ -1,31 +0,0 @@ - -/* Spew out a long sequence of the byte 251. When fed to bzip2 - versions 1.0.0 or 1.0.1, causes it to die with internal error - 1007 in blocksort.c. This assertion misses an extremely rare - case, which is fixed in this version (1.0.2) and above. -*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include - -int main () -{ - int i; - for (i = 0; i < 48500000 ; i++) - putchar(251); - return 0; -} diff --git a/cpan/Compress-Raw-Bzip2/bzip2-src/spewG.c b/cpan/Compress-Raw-Bzip2/bzip2-src/spewG.c deleted file mode 100644 index 5892b92..0000000 --- a/cpan/Compress-Raw-Bzip2/bzip2-src/spewG.c +++ /dev/null @@ -1,54 +0,0 @@ - -/* spew out a thoroughly gigantic file designed so that bzip2 - can compress it reasonably rapidly. This is to help test - support for large files (> 2GB) in a reasonable amount of time. - I suggest you use the undocumented --exponential option to - bzip2 when compressing the resulting file; this saves a bit of - time. Note: *don't* bother with --exponential when compressing - Real Files; it'll just waste a lot of CPU time :-) - (but is otherwise harmless). -*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#define _FILE_OFFSET_BITS 64 - -#include -#include - -/* The number of megabytes of junk to spew out (roughly) */ -#define MEGABYTES 5000 - -#define N_BUF 1000000 -char buf[N_BUF]; - -int main ( int argc, char** argv ) -{ - int ii, kk, p; - srandom(1); - setbuffer ( stdout, buf, N_BUF ); - for (kk = 0; kk < MEGABYTES * 515; kk+=3) { - p = 25+random()%50; - for (ii = 0; ii < p; ii++) - printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ); - for (ii = 0; ii < p-1; ii++) - printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ); - for (ii = 0; ii < p+1; ii++) - printf ( "ccccccccccccccccccccccccccccccccccccc" ); - } - fflush(stdout); - return 0; -} diff --git a/cpan/Compress-Raw-Bzip2/bzip2-src/unzcrash.c b/cpan/Compress-Raw-Bzip2/bzip2-src/unzcrash.c deleted file mode 100644 index a1b7546..0000000 --- a/cpan/Compress-Raw-Bzip2/bzip2-src/unzcrash.c +++ /dev/null @@ -1,141 +0,0 @@ - -/* A test program written to test robustness to decompression of - corrupted data. Usage is - unzcrash filename - and the program will read the specified file, compress it (in memory), - and then repeatedly decompress it, each time with a different bit of - the compressed data inverted, so as to test all possible one-bit errors. - This should not cause any invalid memory accesses. If it does, - I want to know about it! - - PS. As you can see from the above description, the process is - incredibly slow. A file of size eg 5KB will cause it to run for - many hours. -*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include -#include -#include "bzlib.h" - -#define M_BLOCK 1000000 - -typedef unsigned char uchar; - -#define M_BLOCK_OUT (M_BLOCK + 1000000) -uchar inbuf[M_BLOCK]; -uchar outbuf[M_BLOCK_OUT]; -uchar zbuf[M_BLOCK + 600 + (M_BLOCK / 100)]; - -int nIn, nOut, nZ; - -static char *bzerrorstrings[] = { - "OK" - ,"SEQUENCE_ERROR" - ,"PARAM_ERROR" - ,"MEM_ERROR" - ,"DATA_ERROR" - ,"DATA_ERROR_MAGIC" - ,"IO_ERROR" - ,"UNEXPECTED_EOF" - ,"OUTBUFF_FULL" - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ -}; - -void flip_bit ( int bit ) -{ - int byteno = bit / 8; - int bitno = bit % 8; - uchar mask = 1 << bitno; - //fprintf ( stderr, "(byte %d bit %d mask %d)", - // byteno, bitno, (int)mask ); - zbuf[byteno] ^= mask; -} - -int main ( int argc, char** argv ) -{ - FILE* f; - int r; - int bit; - int i; - - if (argc != 2) { - fprintf ( stderr, "usage: unzcrash filename\n" ); - return 1; - } - - f = fopen ( argv[1], "r" ); - if (!f) { - fprintf ( stderr, "unzcrash: can't open %s\n", argv[1] ); - return 1; - } - - nIn = fread ( inbuf, 1, M_BLOCK, f ); - fprintf ( stderr, "%d bytes read\n", nIn ); - - nZ = M_BLOCK; - r = BZ2_bzBuffToBuffCompress ( - zbuf, &nZ, inbuf, nIn, 9, 0, 30 ); - - assert (r == BZ_OK); - fprintf ( stderr, "%d after compression\n", nZ ); - - for (bit = 0; bit < nZ*8; bit++) { - fprintf ( stderr, "bit %d ", bit ); - flip_bit ( bit ); - nOut = M_BLOCK_OUT; - r = BZ2_bzBuffToBuffDecompress ( - outbuf, &nOut, zbuf, nZ, 0, 0 ); - fprintf ( stderr, " %d %s ", r, bzerrorstrings[-r] ); - - if (r != BZ_OK) { - fprintf ( stderr, "\n" ); - } else { - if (nOut != nIn) { - fprintf(stderr, "nIn/nOut mismatch %d %d\n", nIn, nOut ); - return 1; - } else { - for (i = 0; i < nOut; i++) - if (inbuf[i] != outbuf[i]) { - fprintf(stderr, "mismatch at %d\n", i ); - return 1; - } - if (i == nOut) fprintf(stderr, "really ok!\n" ); - } - } - - flip_bit ( bit ); - } - -#if 0 - assert (nOut == nIn); - for (i = 0; i < nOut; i++) { - if (inbuf[i] != outbuf[i]) { - fprintf ( stderr, "difference at %d !\n", i ); - return 1; - } - } -#endif - - fprintf ( stderr, "all ok\n" ); - return 0; -} diff --git a/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm b/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm index c80eae3..48f8207 100644 --- a/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm +++ b/cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm @@ -12,7 +12,7 @@ use Carp ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.021'; +$VERSION = '2.024'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -326,7 +326,7 @@ The following bzip2 constants are exported by this module =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -348,7 +348,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/pod/FAQ.pod b/cpan/Compress-Raw-Bzip2/pod/FAQ.pod index 41921a5..0051908 100644 --- a/cpan/Compress-Raw-Bzip2/pod/FAQ.pod +++ b/cpan/Compress-Raw-Bzip2/pod/FAQ.pod @@ -94,7 +94,7 @@ can find it on CPAN at =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -112,7 +112,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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 6f3872b..becd09a 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.021'; + my $VERSION = '2.024'; my @NAMES = qw( ); diff --git a/cpan/Compress-Raw-Bzip2/t/01bzip2.t b/cpan/Compress-Raw-Bzip2/t/01bzip2.t index 008c0b3..4325428 100644 --- a/cpan/Compress-Raw-Bzip2/t/01bzip2.t +++ b/cpan/Compress-Raw-Bzip2/t/01bzip2.t @@ -28,10 +28,10 @@ BEGIN $count = 103 ; } elsif ($] >= 5.006) { - $count = 157 ; + $count = 173 ; } else { - $count = 115 ; + $count = 131 ; } plan tests => $count + $extra; @@ -352,7 +352,7 @@ for my $consume ( 0 .. 1) foreach (1 .. 2) { - next if $[ < 5.005 ; + next if $] < 5.005 ; title 'test bzinflate/bzdeflate with a substr'; @@ -365,12 +365,12 @@ foreach (1 .. 2) my $status = $x->bzdeflate(substr($contents,0), $X); cmp_ok $status, '==', BZ_RUN_OK ; - cmp_ok $x->bzflush($X), '==', BZ_RUN_OK ; + cmp_ok $x->bzclose($X), '==', BZ_STREAM_END ; my $append = "Appended" ; $X .= $append ; - ok my $k = new Compress::Raw::Bunzip2(1, 0) ; + ok my $k = new Compress::Raw::Bunzip2(1, 1) ; my $Z; my $keep = $X ; diff --git a/cpan/Compress-Raw-Bzip2/t/compress/CompTestUtils.pm b/cpan/Compress-Raw-Bzip2/t/compress/CompTestUtils.pm index cb63d62..f21045d 100644 --- a/cpan/Compress-Raw-Bzip2/t/compress/CompTestUtils.pm +++ b/cpan/Compress-Raw-Bzip2/t/compress/CompTestUtils.pm @@ -16,7 +16,7 @@ use Carp ; sub title { #diag "" ; - ok 1, $_[0] ; + ok(1, $_[0]) ; #diag "" ; } @@ -476,6 +476,7 @@ sub anyUncompress Append => 1, Transparent => 0, RawInflate => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; @@ -537,6 +538,7 @@ sub getHeaders Append => 1, Transparent => 0, RawInflate => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; @@ -647,7 +649,7 @@ sub getMultiValues { my $class = shift ; - return (0,0) if $class =~ /lzf/i; + return (0,0) if $class =~ /lzf|lzma/i; return (1,0); } diff --git a/cpan/Compress-Raw-Zlib/Changes b/cpan/Compress-Raw-Zlib/Changes index 891a693..24fb8c3 100644 --- a/cpan/Compress-Raw-Zlib/Changes +++ b/cpan/Compress-Raw-Zlib/Changes @@ -1,6 +1,12 @@ CHANGES ------- + 2.023 9 November 2009 + + * fixed instance where $[ should have been $] in t/02zlib.t + Thanks to Robin Barker and zefram [RT #50765] for independantly + spotting the issue. + 2.021 30 August 2009 * Changed test harness so that it can cope with PERL5OPT=-MCarp=verbose diff --git a/cpan/Compress-Raw-Zlib/README b/cpan/Compress-Raw-Zlib/README index f1387f3..10b3961 100644 --- a/cpan/Compress-Raw-Zlib/README +++ b/cpan/Compress-Raw-Zlib/README @@ -1,11 +1,11 @@ Compress-Raw-Zlib - Version 2.021 + Version 2.024 - 30th August 2009 + 7th January 2010 - Copyright (c) 2005-2009 Paul Marquess. All rights reserved. + Copyright (c) 2005-2010 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. @@ -355,7 +355,7 @@ To help me help you, I need all of the following information: If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm for a line like this: - $VERSION = "2.021" ; + $VERSION = "2.024" ; c. The version of zlib you have used. If you have successfully installed Compress-Raw-Zlib, this one-liner diff --git a/cpan/Compress-Raw-Zlib/Zlib.xs b/cpan/Compress-Raw-Zlib/Zlib.xs index 251f998..24ad61d 100644 --- a/cpan/Compress-Raw-Zlib/Zlib.xs +++ b/cpan/Compress-Raw-Zlib/Zlib.xs @@ -3,7 +3,7 @@ * Created : 22nd January 1996 * Version : 2.000 * - * Copyright (c) 1995-2009 Paul Marquess. All rights reserved. + * Copyright (c) 1995-2010 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-Zlib/lib/Compress/Raw/Zlib.pm b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm index 04bfb2e..79c96b7 100644 --- a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm +++ b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm @@ -13,7 +13,7 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.021'; +$VERSION = '2.024'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -1381,7 +1381,7 @@ of I. =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1412,7 +1412,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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-Zlib/pod/FAQ.pod b/cpan/Compress-Raw-Zlib/pod/FAQ.pod index 56d08f5..6951877 100644 --- a/cpan/Compress-Raw-Zlib/pod/FAQ.pod +++ b/cpan/Compress-Raw-Zlib/pod/FAQ.pod @@ -117,7 +117,7 @@ C. =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -135,7 +135,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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-Zlib/t/02zlib.t b/cpan/Compress-Raw-Zlib/t/02zlib.t index 7d37924..f0548c9 100644 --- a/cpan/Compress-Raw-Zlib/t/02zlib.t +++ b/cpan/Compress-Raw-Zlib/t/02zlib.t @@ -27,10 +27,10 @@ BEGIN $count = 230 ; } elsif ($] >= 5.006) { - $count = 284 ; + $count = 300 ; } else { - $count = 242 ; + $count = 258 ; } plan tests => $count + $extra; @@ -603,7 +603,7 @@ for my $consume ( 0 .. 1) foreach (1 .. 2) { - next if $[ < 5.005 ; + next if $] < 5.005 ; title 'test inflate/deflate with a substr'; diff --git a/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm b/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm index cb63d62..f21045d 100644 --- a/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm +++ b/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm @@ -16,7 +16,7 @@ use Carp ; sub title { #diag "" ; - ok 1, $_[0] ; + ok(1, $_[0]) ; #diag "" ; } @@ -476,6 +476,7 @@ sub anyUncompress Append => 1, Transparent => 0, RawInflate => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; @@ -537,6 +538,7 @@ sub getHeaders Append => 1, Transparent => 0, RawInflate => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; @@ -647,7 +649,7 @@ sub getMultiValues { my $class = shift ; - return (0,0) if $class =~ /lzf/i; + return (0,0) if $class =~ /lzf|lzma/i; return (1,0); } diff --git a/cpan/IO-Compress/Changes b/cpan/IO-Compress/Changes index ef30644..c98bef1 100644 --- a/cpan/IO-Compress/Changes +++ b/cpan/IO-Compress/Changes @@ -1,6 +1,25 @@ CHANGES ------- + 2.024 7 January 2010 + + * Compress::Zlib + Get memGunzip & memGzip to set $gzerrno + [RT# 47283] + + * Compress::Zlib + Export memGunzip, memGzip and zlib_version on demand + [RT# 52992] + + * examples/io/anycat + This sample was using IO::Uncompress::AnyInflate. Much better to + use IO::Uncompress::AnyUncompress. + + 2.023 9 November 2009 + + * IO::Compress::AnyUncompress + Added support for lzma_alone & xz. + 2.022 9 October 2009 * IO::Compress - Makefile.PL diff --git a/cpan/IO-Compress/Makefile.PL b/cpan/IO-Compress/Makefile.PL index 018e27b..00902f6 100644 --- a/cpan/IO-Compress/Makefile.PL +++ b/cpan/IO-Compress/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.021' ; +$::VERSION = '2.024' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/cpan/IO-Compress/README b/cpan/IO-Compress/README index 8da9fbf..3974cd4 100644 --- a/cpan/IO-Compress/README +++ b/cpan/IO-Compress/README @@ -1,11 +1,11 @@ - IO-Compress + IO-Compress - Version 2.022 + Version 2.024 - 9th October 2009 + 7th January 2010 - Copyright (c) 1995-2009 Paul Marquess. All rights reserved. + Copyright (c) 1995-2010 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. @@ -89,7 +89,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress then search IO::Compress::Gzip.pm for a line like this: - $VERSION = "2.021" ; + $VERSION = "2.024" ; 2. If you are having problems building IO-Compress, send me a complete log of what happened. Start by unpacking the IO-Compress diff --git a/cpan/IO-Compress/examples/io/anycat b/cpan/IO-Compress/examples/io/anycat index 9db9c41..b7f7001 100755 --- a/cpan/IO-Compress/examples/io/anycat +++ b/cpan/IO-Compress/examples/io/anycat @@ -3,15 +3,15 @@ use strict ; use warnings ; -use IO::Uncompress::AnyInflate qw( anyinflate $AnyInflateError ); +use IO::Uncompress::AnyUncompress qw( anyuncompress $AnyUncompressError ); @ARGV = '-' unless @ARGV ; foreach my $file (@ARGV) { - anyinflate $file => '-', + anyuncompress $file => '-', Transparent => 1, Strict => 0, - or die "Cannot uncompress '$file': $AnyInflateError\n" ; + or die "Cannot uncompress '$file': $AnyUncompressError\n" ; } diff --git a/cpan/IO-Compress/lib/Compress/Zlib.pm b/cpan/IO-Compress/lib/Compress/Zlib.pm index 604227c..9424df6 100644 --- a/cpan/IO-Compress/lib/Compress/Zlib.pm +++ b/cpan/IO-Compress/lib/Compress/Zlib.pm @@ -8,17 +8,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.021 ; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Gzip 2.021 ; -use IO::Uncompress::Gunzip 2.021 ; +use IO::Compress::Base::Common 2.024 ; +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Gzip 2.024 ; +use IO::Uncompress::Gunzip 2.024 ; use strict ; use warnings ; use bytes ; -our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); +our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $AUTOLOAD); -$VERSION = '2.022'; +$VERSION = '2.024'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -36,6 +36,11 @@ $VERSION = eval $VERSION; push @EXPORT, @Compress::Raw::Zlib::EXPORT ; +@EXPORT_OK = qw(memGunzip memGzip zlib_version); +%EXPORT_TAGS = ( + ALL => \@EXPORT +); + BEGIN { *zlib_version = \&Compress::Raw::Zlib::zlib_version; @@ -88,6 +93,11 @@ sub _set_gzerr return $value ; } +sub _set_gzerr_undef +{ + _set_gzerr(@_); + return undef; +} sub _save_gzerr { my $gz = shift ; @@ -452,7 +462,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.021 ; +use IO::Compress::Gzip::Constants 2.024 ; sub memGzip($) { @@ -464,13 +474,16 @@ sub memGzip($) $] >= 5.008 and (utf8::downgrade($$string, 1) or croak "Wide character in memGzip"); - IO::Compress::Gzip::gzip($string, \$out, Minimal => 1) - or return undef ; + _set_gzerr(0); + if ( ! IO::Compress::Gzip::gzip($string, \$out, Minimal => 1) ) + { + $Compress::Zlib::gzerrno = $IO::Compress::Gzip::GzipError; + return undef ; + } return $out; } - sub _removeGzipHeader($) { my $string = shift ; @@ -529,6 +542,12 @@ sub _removeGzipHeader($) return Z_OK(); } +sub _ret_gun_error +{ + $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError; + return undef; +} + sub memGunzip($) { @@ -538,25 +557,35 @@ sub memGunzip($) $] >= 5.008 and (utf8::downgrade($$string, 1) or croak "Wide character in memGunzip"); - _removeGzipHeader($string) == Z_OK() - or return undef; + _set_gzerr(0); + + my $status = _removeGzipHeader($string) ; + $status == Z_OK() + or return _set_gzerr_undef($status); my $bufsize = length $$string > 4096 ? length $$string : 4096 ; my $x = new Compress::Raw::Zlib::Inflate({-WindowBits => - MAX_WBITS(), -Bufsize => $bufsize}) - or return undef; + or return _ret_gun_error(); my $output = "" ; - my $status = $x->inflate($string, $output); - return undef - unless $status == Z_STREAM_END(); + $status = $x->inflate($string, $output); + + if ( $status == Z_OK() ) + { + _set_gzerr(Z_DATA_ERROR()); + return undef; + } + + return _ret_gun_error() + if ($status != Z_STREAM_END()); if (length $$string >= 8) { my ($crc, $len) = unpack ("VV", substr($$string, 0, 8)); substr($$string, 0, 8) = ''; - return undef + return _set_gzerr_undef(Z_DATA_ERROR()) unless $len == length($output) and $crc == crc32($output); } @@ -564,6 +593,7 @@ sub memGunzip($) { $$string = ''; } + return $output; } @@ -972,10 +1002,11 @@ standard output. This function is used to create an in-memory gzip file with the minimum possible gzip header (exactly 10 bytes). - $dest = Compress::Zlib::memGzip($buffer) ; + $dest = Compress::Zlib::memGzip($buffer) + or die "Cannot compress: $gzerrno\n"; -If successful, it returns the in-memory gzip file, otherwise it returns -undef. +If successful, it returns the in-memory gzip file. Otherwise it returns +C and the C<$gzerrno> variable will store the zlib error code. The C<$buffer> parameter can either be a scalar or a scalar reference. @@ -986,10 +1017,12 @@ carry out in-memory gzip compression. This function is used to uncompress an in-memory gzip file. - $dest = Compress::Zlib::memGunzip($buffer) ; + $dest = Compress::Zlib::memGunzip($buffer) + or die "Cannot uncomprss: $gzerrno\n"; -If successful, it returns the uncompressed gzip file, otherwise it -returns undef. +If successful, it returns the uncompressed gzip file. Otherwise it +returns C and the C<$gzerrno> variable will store the zlib error +code. The C<$buffer> parameter can either be a scalar or a scalar reference. The contents of the C<$buffer> parameter are destroyed after calling this function. @@ -1423,7 +1456,7 @@ of I. =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1454,7 +1487,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 1995-2009 Paul Marquess. All rights reserved. +Copyright (c) 1995-2010 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/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm index 103a045..3e2e89f 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm @@ -4,13 +4,13 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); #use Compress::Bzip2 ; -use Compress::Raw::Bzip2 2.021 ; +use Compress::Raw::Bzip2 2.024 ; our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm index ac8f036..f23a981 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); -use Compress::Raw::Zlib 2.021 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.024 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm index e83542f..16f14d8 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base.pm b/cpan/IO-Compress/lib/IO/Compress/Base.pm index bdd8d79..5a20f60 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.021 ; +use IO::Compress::Base::Common 2.024 ; use IO::File ; use Scalar::Util qw(blessed readonly); @@ -20,7 +20,7 @@ use bytes; our (@ISA, $VERSION); @ISA = qw(Exporter IO::File); -$VERSION = '2.022'; +$VERSION = '2.024'; #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. @@ -956,7 +956,7 @@ purpose if to to be sub-classed by IO::Compress modules. =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -974,7 +974,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Compress/Base/Common.pm b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm index 26af4f8..4f8b4da 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm @@ -11,7 +11,7 @@ use File::GlobMapper; require Exporter; our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); @ISA = qw(Exporter); -$VERSION = '2.022'; +$VERSION = '2.024'; @EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput isaFileGlobString cleanFileGlobString oneTarget diff --git a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm index 28725c6..2a85ef5 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm @@ -5,16 +5,16 @@ use warnings; use bytes; require Exporter ; -use IO::Compress::Base 2.021 ; +use IO::Compress::Base 2.024 ; -use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject); -use IO::Compress::Adapter::Bzip2 2.021 ; +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); +use IO::Compress::Adapter::Bzip2 2.024 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.022'; +$VERSION = '2.024'; $Bzip2Error = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'BlockSize100K' => [0, 1, Parse_unsigned, 1], diff --git a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm index 2e1a19f..0f46e59 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm @@ -6,16 +6,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.021 ; +use IO::Compress::RawDeflate 2.024 ; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Zlib::Constants 2.021 ; -use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Zlib::Constants 2.024 ; +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -364,7 +364,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -493,7 +534,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -851,7 +892,7 @@ See L =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -882,7 +923,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Compress/Gzip.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm index f2e60f6..1978b91 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use warnings; use bytes; -use IO::Compress::RawDeflate 2.021 ; +use IO::Compress::RawDeflate 2.024 ; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.022'; +$VERSION = '2.024'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -482,7 +482,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -611,7 +652,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -1163,7 +1204,7 @@ See L =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1194,7 +1235,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Compress/Gzip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm index 095668e..8504330 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names); our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE); -$VERSION = '2.022'; +$VERSION = '2.024'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm index 02a8cda..b97b51c 100644 --- a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm @@ -7,16 +7,16 @@ use warnings; use bytes; -use IO::Compress::Base 2.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.021 ; +use IO::Compress::Base 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -142,8 +142,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); - use Compress::Raw::Zlib 2.021 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.024 qw(:Parse); + use Compress::Raw::Zlib 2.024 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( @@ -451,7 +451,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -580,7 +621,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -938,7 +979,7 @@ See L =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -969,7 +1010,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Compress/Zip.pm b/cpan/IO-Compress/lib/IO/Compress/Zip.pm index d6e6167..5e37d78 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip.pm @@ -4,27 +4,27 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.021 ; -use IO::Compress::Adapter::Deflate 2.021 ; -use IO::Compress::Adapter::Identity 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; -use IO::Compress::Zip::Constants 2.021 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.024 ; +use IO::Compress::Adapter::Deflate 2.024 ; +use IO::Compress::Adapter::Identity 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; +use IO::Compress::Zip::Constants 2.024 ; -use Compress::Raw::Zlib 2.021 qw(crc32) ; +use Compress::Raw::Zlib 2.024 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.021 ; + import IO::Compress::Adapter::Bzip2 2.024 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.021 ; - } ; - eval { require IO::Compress::Adapter::Lzma ; - import IO::Compress::Adapter::Lzma 2.020 ; - require IO::Compress::Lzma ; - import IO::Compress::Lzma 2.020 ; + import IO::Compress::Bzip2 2.024 ; } ; +# eval { require IO::Compress::Adapter::Lzma ; +# import IO::Compress::Adapter::Lzma 2.020 ; +# require IO::Compress::Lzma ; +# import IO::Compress::Lzma 2.024 ; +# } ; } @@ -32,7 +32,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.022'; +$VERSION = '2.024'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -89,10 +89,10 @@ sub mkComp ); *$self->{ZipData}{CRC32} = crc32(undef); } - elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) { - ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject(); - *$self->{ZipData}{CRC32} = crc32(undef); - } +# elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) { +# ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject(); +# *$self->{ZipData}{CRC32} = crc32(undef); +# } return $self->saveErrorString(undef, $errstr, $errno) if ! defined $obj; @@ -475,8 +475,9 @@ sub ckParams ! defined $IO::Compress::Adapter::Bzip2::VERSION; return $self->saveErrorString(undef, "Lzma not available") - if $method == ZIP_CM_LZMA and - ! defined $IO::Compress::Adapter::Lzma::VERSION; + if $method == ZIP_CM_LZMA ; + #and + #! defined $IO::Compress::Adapter::Lzma::VERSION; *$self->{ZipData}{Method} = $method; @@ -512,8 +513,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); - use Compress::Raw::Zlib 2.021 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.024 qw(:Parse); + use Compress::Raw::Zlib 2.024 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); @@ -859,7 +860,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -988,7 +1030,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -1532,7 +1574,7 @@ See L =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1563,7 +1605,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Compress/Zip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm index a554d49..c8cb953 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm @@ -7,7 +7,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS); -$VERSION = '2.022'; +$VERSION = '2.024'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm index 6b935ff..10fcf34 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT); -$VERSION = '2.022'; +$VERSION = '2.024'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm b/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm index 0c88017..6812bb4 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm @@ -8,9 +8,9 @@ use bytes; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.022'; +$VERSION = '2.024'; -use IO::Compress::Gzip::Constants 2.021 ; +use IO::Compress::Gzip::Constants 2.024 ; sub ExtraFieldError { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm index 796aadb..98677e3 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); -use Compress::Raw::Bzip2 2.021 ; +use Compress::Raw::Bzip2 2.024 ; our ($VERSION, @ISA); -$VERSION = '2.022'; +$VERSION = '2.024'; sub mkUncompObject { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm index 834eb5d..27de6e0 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,13 +4,13 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; -use Compress::Raw::Zlib 2.021 (); +use Compress::Raw::Zlib 2.024 (); sub mkUncompObject { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm index 5c67c1b..aac1e41 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm @@ -4,11 +4,11 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status); -use Compress::Raw::Zlib 2.021 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.024 qw(:Status); +use Compress::Raw::Zlib 2.024 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; diff --git a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm index 900feda..68038f5 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm @@ -6,22 +6,22 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.021 (); +use IO::Uncompress::Adapter::Inflate 2.024 (); -use IO::Uncompress::Base 2.021 ; -use IO::Uncompress::Gunzip 2.021 ; -use IO::Uncompress::Inflate 2.021 ; -use IO::Uncompress::RawInflate 2.021 ; -use IO::Uncompress::Unzip 2.021 ; +use IO::Uncompress::Base 2.024 ; +use IO::Uncompress::Gunzip 2.024 ; +use IO::Uncompress::Inflate 2.024 ; +use IO::Uncompress::RawInflate 2.024 ; +use IO::Uncompress::Unzip 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -341,7 +341,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -908,7 +949,7 @@ See L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -939,7 +980,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm index c4406e5..5984921 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.021 ; +use IO::Uncompress::Base 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.022'; +$VERSION = '2.024'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,22 +27,22 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.021 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.021 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.021 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.021 ;'; - #eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;'; - #eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.021 ;'; - eval ' use IO::Uncompress::UnLzop 2.021 ;'; - eval ' use IO::Uncompress::Gunzip 2.021 ;'; - eval ' use IO::Uncompress::Inflate 2.021 ;'; - eval ' use IO::Uncompress::RawInflate 2.021 ;'; - eval ' use IO::Uncompress::Unzip 2.021 ;'; - eval ' use IO::Uncompress::UnLzf 2.021 ;'; - #eval ' use IO::Uncompress::UnLzma 2.018 ;'; - #eval ' use IO::Uncompress::UnXz 2.018 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.024 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.024 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.024 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.024 ;'; + eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;'; + eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.024 ;'; + eval ' use IO::Uncompress::UnLzop 2.024 ;'; + eval ' use IO::Uncompress::Gunzip 2.024 ;'; + eval ' use IO::Uncompress::Inflate 2.024 ;'; + eval ' use IO::Uncompress::RawInflate 2.024 ;'; + eval ' use IO::Uncompress::Unzip 2.024 ;'; + eval ' use IO::Uncompress::UnLzf 2.024 ;'; + eval ' use IO::Uncompress::UnLzma 2.024 ;'; + eval ' use IO::Uncompress::UnXz 2.024 ;'; } sub new @@ -60,7 +60,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] , 'UnLzma' => [1, 1, Parse_boolean, 0] ) ; } @@ -108,39 +108,40 @@ sub mkUncomp } } -# if (defined $IO::Uncompress::UnLzma::VERSION && $got->value('UnLzma')) -# { -# my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject(); -# -# return $self->saveErrorString(undef, $errstr, $errno) -# if ! defined $obj; -# -# *$self->{Uncomp} = $obj; -# -# my @possible = qw( UnLzma ); -# #unshift @possible, 'RawInflate' -# # if $got->value('RawInflate'); -# -# if ( *$self->{Info} = $self->ckMagic( @possible )) -# { -# return 1; -# } -# } -# -# if (defined $IO::Uncompress::UnXz::VERSION and -# $magic = $self->ckMagic('UnXz')) { -# *$self->{Info} = $self->readHeader($magic) -# or return undef ; -# -# my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnXz::mkUncompObject(); -# -# return $self->saveErrorString(undef, $errstr, $errno) -# if ! defined $obj; -# -# *$self->{Uncomp} = $obj; -# -# return 1; -# } + if (defined $IO::Uncompress::UnLzma::VERSION && $got->value('UnLzma')) + { + my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject(); + + return $self->saveErrorString(undef, $errstr, $errno) + if ! defined $obj; + + *$self->{Uncomp} = $obj; + + my @possible = qw( UnLzma ); + #unshift @possible, 'RawInflate' + # if $got->value('RawInflate'); + + if ( *$self->{Info} = $self->ckMagic( @possible )) + { + return 1; + } + } + + if (defined $IO::Uncompress::UnXz::VERSION and + $magic = $self->ckMagic('UnXz')) { + *$self->{Info} = $self->readHeader($magic) + or return undef ; + + my ($obj, $errstr, $errno) = + IO::Uncompress::Adapter::UnXz::mkUncompObject(); + + return $self->saveErrorString(undef, $errstr, $errno) + if ! defined $obj; + + *$self->{Uncomp} = $obj; + + return 1; + } if (defined $IO::Uncompress::Bunzip2::VERSION and $magic = $self->ckMagic('Bunzip2')) { @@ -295,6 +296,10 @@ The formats supported are: =item lzf +=item lzma + +=item xz + =back The module will auto-detect which, if any, of the supported @@ -445,7 +450,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -681,6 +727,17 @@ prone and can result is false positives. Defaults to 0. +=item C<< UnLzma => 0|1 >> + +When auto-detecting the compressed format, try to test for lzma_alone +content using the C module. + +The reason this is not default behaviour is because lzma_alone content can +only be detected by attempting to uncompress it. This process is error +prone and can result is false positives. + +Defaults to 0. + =back =head2 Examples @@ -936,7 +993,7 @@ Same as doing this =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -954,7 +1011,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Uncompress/Base.pm b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm index eccff87..33f2ac2 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm @@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.022'; +$VERSION = '2.024'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.021 ; +use IO::Compress::Base::Common 2.024 ; #use Parse::Parameters ; use IO::File ; @@ -1449,7 +1449,7 @@ purpose if to to be sub-classed by IO::Unompress modules. =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1467,7 +1467,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Uncompress/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm index 22cf65d..b3988c4 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm @@ -4,15 +4,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.021 ; -use IO::Uncompress::Adapter::Bunzip2 2.021 ; +use IO::Uncompress::Base 2.024 ; +use IO::Uncompress::Adapter::Bunzip2 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); -$VERSION = '2.022'; +$VERSION = '2.024'; $Bunzip2Error = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -40,7 +40,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'Verbosity' => [1, 1, Parse_boolean, 0], diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm index 41b6d3d..f3e4e65 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm @@ -9,12 +9,12 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.021 ; +use IO::Uncompress::RawInflate 2.024 ; -use Compress::Raw::Zlib 2.021 qw( crc32 ) ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; +use Compress::Raw::Zlib 2.024 qw( crc32 ) ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.022'; +$VERSION = '2.024'; sub new { @@ -47,7 +47,7 @@ sub gunzip sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; } @@ -477,7 +477,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -1032,7 +1073,7 @@ See L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1063,7 +1104,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Uncompress/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm index 1a22263..956f62e 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm @@ -5,15 +5,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.021 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.024 ; -use IO::Uncompress::RawInflate 2.021 ; +use IO::Uncompress::RawInflate 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); @@ -398,7 +398,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -903,7 +944,7 @@ See L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -934,7 +975,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Uncompress/RawInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm index 3a45fcd..f017fa0 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm @@ -5,16 +5,16 @@ use strict ; use warnings; use bytes; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.021 ; -use IO::Uncompress::Adapter::Inflate 2.021 ; +use IO::Uncompress::Base 2.024 ; +use IO::Uncompress::Adapter::Inflate 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -546,7 +546,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -1031,7 +1072,7 @@ See L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1062,7 +1103,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/lib/IO/Uncompress/Unzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm index c9f638a..e7d6849 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm @@ -8,21 +8,21 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.021 ; -use IO::Uncompress::Adapter::Identity 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; -use IO::Compress::Zip::Constants 2.021 ; +use IO::Uncompress::RawInflate 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Uncompress::Adapter::Inflate 2.024 ; +use IO::Uncompress::Adapter::Identity 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; +use IO::Compress::Zip::Constants 2.024 ; -use Compress::Raw::Zlib 2.021 qw(crc32) ; +use Compress::Raw::Zlib 2.024 qw(crc32) ; BEGIN { eval { require IO::Uncompress::Adapter::Bunzip2 ; import IO::Uncompress::Adapter::Bunzip2 } ; - eval { require IO::Uncompress::Adapter::UnLzma ; - import IO::Uncompress::Adapter::UnLzma } ; +# eval { require IO::Uncompress::Adapter::UnLzma ; +# import IO::Uncompress::Adapter::UnLzma } ; } @@ -30,7 +30,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.022'; +$VERSION = '2.024'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -63,7 +63,7 @@ sub unzip sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( @@ -650,34 +650,34 @@ sub _readZipHeader($) *$self->{Uncomp} = $obj; } - elsif ($compressedMethod == ZIP_CM_LZMA) - { - return $self->HeaderError("Unsupported Compression format $compressedMethod") - if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ; - - *$self->{Type} = 'zip-lzma'; - my $LzmaHeader; - $self->smartReadExact(\$LzmaHeader, 4) - or return $self->saveErrorString(undef, "Truncated file"); - my ($verHi, $verLo) = unpack ("CC", substr($LzmaHeader, 0, 2)); - my $LzmaPropertiesSize = unpack ("v", substr($LzmaHeader, 2, 2)); - - - my $LzmaPropertyData; - $self->smartReadExact(\$LzmaPropertyData, $LzmaPropertiesSize) - or return $self->saveErrorString(undef, "Truncated file"); - #my $LzmaInfo = unpack ("C", substr($LzmaPropertyData, 0, 1)); - #my $LzmaDictSize = unpack ("V", substr($LzmaPropertyData, 1, 4)); - - # Create an LZMA_Alone header - $self->pushBack($LzmaPropertyData . - $uncompressedLength->getPacked_V64()); - - my $obj = - IO::Uncompress::Adapter::UnLzma::mkUncompObject(); - - *$self->{Uncomp} = $obj; - } +# elsif ($compressedMethod == ZIP_CM_LZMA) +# { +# return $self->HeaderError("Unsupported Compression format $compressedMethod") +# if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ; +# +# *$self->{Type} = 'zip-lzma'; +# my $LzmaHeader; +# $self->smartReadExact(\$LzmaHeader, 4) +# or return $self->saveErrorString(undef, "Truncated file"); +# my ($verHi, $verLo) = unpack ("CC", substr($LzmaHeader, 0, 2)); +# my $LzmaPropertiesSize = unpack ("v", substr($LzmaHeader, 2, 2)); +# +# +# my $LzmaPropertyData; +# $self->smartReadExact(\$LzmaPropertyData, $LzmaPropertiesSize) +# or return $self->saveErrorString(undef, "Truncated file"); +# #my $LzmaInfo = unpack ("C", substr($LzmaPropertyData, 0, 1)); +# #my $LzmaDictSize = unpack ("V", substr($LzmaPropertyData, 1, 4)); +# +# # Create an LZMA_Alone header +# $self->pushBack($LzmaPropertyData . +# $uncompressedLength->getPacked_V64()); +# +# my $obj = +# IO::Uncompress::Adapter::UnLzma::mkUncompObject(); +# +# *$self->{Uncomp} = $obj; +# } elsif ($compressedMethod == ZIP_CM_STORE) { # TODO -- add support for reading uncompressed @@ -979,7 +979,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C is enabled, the filehandle will be positioned to the end of +the file via a call to C before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C is specified, and set to true, it will I all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -1470,7 +1511,7 @@ See L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -1501,7 +1542,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/pod/FAQ.pod b/cpan/IO-Compress/pod/FAQ.pod index 0fee2a9..b2df94f 100644 --- a/cpan/IO-Compress/pod/FAQ.pod +++ b/cpan/IO-Compress/pod/FAQ.pod @@ -487,7 +487,7 @@ file. =head1 SEE ALSO -L, L, L, L, L, L, L, L, L, L, L, L, L, L, L +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L L @@ -505,7 +505,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/IO-Compress/t/000prereq.t b/cpan/IO-Compress/t/000prereq.t index 11b84fd..5ee058d 100644 --- a/cpan/IO-Compress/t/000prereq.t +++ b/cpan/IO-Compress/t/000prereq.t @@ -25,7 +25,7 @@ BEGIN if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - my $VERSION = '2.021'; + my $VERSION = '2.024'; my @NAMES = qw( Compress::Raw::Bzip2 Compress::Raw::Zlib diff --git a/cpan/IO-Compress/t/compress/CompTestUtils.pm b/cpan/IO-Compress/t/compress/CompTestUtils.pm index c5452b6..f21045d 100644 --- a/cpan/IO-Compress/t/compress/CompTestUtils.pm +++ b/cpan/IO-Compress/t/compress/CompTestUtils.pm @@ -476,7 +476,7 @@ sub anyUncompress Append => 1, Transparent => 0, RawInflate => 1, - #UnLzma => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; @@ -538,7 +538,7 @@ sub getHeaders Append => 1, Transparent => 0, RawInflate => 1, - #UnLzma => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; diff --git a/cpan/IO-Compress/t/compress/any.pl b/cpan/IO-Compress/t/compress/any.pl index 23a2329..c0da133 100644 --- a/cpan/IO-Compress/t/compress/any.pl +++ b/cpan/IO-Compress/t/compress/any.pl @@ -26,6 +26,9 @@ sub run my $Error = getErrorRef($CompressClass); my $UnError = getErrorRef($UncompressClass); + my @anyUnLz = (); + @anyUnLz = (UnLzma => 1 ) if $CompressClass =~ /lzma/i ; + my $AnyConstruct = "IO::Uncompress::${AnyClass}" ; no strict 'refs'; my $AnyError = \${ "IO::Uncompress::${AnyClass}::${AnyClass}Error" }; @@ -57,7 +60,7 @@ sub run { my $unc = new $AnyConstruct $input, Transparent => $trans, RawInflate => 1, - #UnLzma => 1, + @anyUnLz, Append => 1 ; ok $unc, " Created $AnyClass object" @@ -77,7 +80,7 @@ sub run { my $unc = new $AnyConstruct $input, Transparent => $trans, RawInflate => 1, - #UnLzma => 1, + @anyUnLz, Append => 1 ; ok $unc, " Created $AnyClass object" diff --git a/cpan/IO-Compress/t/cz-03zlib-v1.t b/cpan/IO-Compress/t/cz-03zlib-v1.t index 7358f4a..acb69a0 100644 --- a/cpan/IO-Compress/t/cz-03zlib-v1.t +++ b/cpan/IO-Compress/t/cz-03zlib-v1.t @@ -23,16 +23,16 @@ BEGIN my $count = 0 ; if ($] < 5.005) { - $count = 390 ; + $count = 445 ; } else { - $count = 401 ; + $count = 456 ; } plan tests => $count + $extra ; - use_ok('Compress::Zlib', 2) ; + use_ok('Compress::Zlib', qw(:ALL memGunzip memGzip zlib_version)); use_ok('IO::Compress::Gzip::Constants') ; use_ok('IO::Compress::Gzip', qw($GzipError)) ; @@ -47,8 +47,8 @@ EOM my $len = length $hello ; # Check zlib_version and ZLIB_VERSION are the same. -is Compress::Zlib::zlib_version, ZLIB_VERSION, - "ZLIB_VERSION matches Compress::Zlib::zlib_version" ; +is zlib_version, ZLIB_VERSION, + "ZLIB_VERSION matches zlib_version" ; # generate a long random string my $contents = '' ; @@ -344,8 +344,9 @@ EOM # create an in-memory gzip file - my $dest = Compress::Zlib::memGzip($buffer) ; + my $dest = memGzip($buffer) ; ok length $dest ; + is $gzerrno, 0; # write it to disk ok open(FH, ">$name") ; @@ -366,14 +367,16 @@ EOM 1 while unlink $name ; # now check that memGunzip can deal with it. - my $ungzip = Compress::Zlib::memGunzip($dest) ; + my $ungzip = memGunzip($dest) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; # now do the same but use a reference - $dest = Compress::Zlib::memGzip(\$buffer) ; + $dest = memGzip(\$buffer) ; ok length $dest ; + is $gzerrno, 0; # write it to disk ok open(FH, ">$name") ; @@ -392,103 +395,121 @@ EOM # now check that memGunzip can deal with it. my $keep = $dest; - $ungzip = Compress::Zlib::memGunzip(\$dest) ; + $ungzip = memGunzip(\$dest) ; + is $gzerrno, 0; ok defined $ungzip ; ok $buffer eq $ungzip ; # check memGunzip can cope with missing gzip trailer my $minimal = substr($keep, 0, -1) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -2) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -3) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -4) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -5) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -6) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -7) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -8) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -9) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; 1 while unlink $name ; # check corrupt header -- too short $dest = "x" ; - my $result = Compress::Zlib::memGunzip($dest) ; + my $result = memGunzip($dest) ; ok !defined $result ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # check corrupt header -- full of junk $dest = "x" x 200 ; - $result = Compress::Zlib::memGunzip($dest) ; + $result = memGunzip($dest) ; ok !defined $result ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - 1st byte wrong my $bad = $keep ; substr($bad, 0, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - 2st byte wrong $bad = $keep ; substr($bad, 1, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - method not deflated $bad = $keep ; substr($bad, 2, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - reserverd bits used $bad = $keep ; substr($bad, 3, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt trailer - length wrong $bad = $keep ; substr($bad, -8, 4) = "\xFF" x 4 ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt trailer - CRC wrong $bad = $keep ; substr($bad, -4, 4) = "\xFF" x 4 ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -535,7 +556,8 @@ EOM my $compr = readFile($name); ok length $compr ; - my $unc = Compress::Zlib::memGunzip($compr) ; + my $unc = memGunzip($compr) ; + is $gzerrno, 0; ok defined $unc ; ok $buffer eq $unc ; 1 while unlink $name ; @@ -897,10 +919,12 @@ if ($] >= 5.005) foreach (1 .. 20000) { $contents .= chr int rand 256 } - ok my $compressed = Compress::Zlib::memGzip(\$contents) ; + ok my $compressed = memGzip(\$contents) ; + is $gzerrno, 0; ok length $compressed > 4096 ; - ok my $out = Compress::Zlib::memGunzip(\$compressed) ; + ok my $out = memGunzip(\$compressed) ; + is $gzerrno, 0; ok $contents eq $out ; is length $out, length $contents ; @@ -926,7 +950,8 @@ EOM my $buffer = $good ; substr($buffer, 0, 1) = 'x' ; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -934,7 +959,8 @@ EOM my $buffer = $good ; substr($buffer, 1, 1) = "\xFF" ; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -942,7 +968,8 @@ EOM my $buffer = $good ; substr($buffer, 2, 1) = 'x' ; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -950,7 +977,8 @@ EOM my $buffer = $good ; substr($buffer, 3, 1) = "\xff"; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } } @@ -970,7 +998,8 @@ EOM substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } @@ -990,7 +1019,8 @@ EOM substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } my $Comment = "comment" ; @@ -1007,7 +1037,8 @@ EOM ok $x->close ; substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } for my $index ( GZIP_MIN_HEADER_SIZE .. GZIP_MIN_HEADER_SIZE + GZIP_FHCRC_SIZE -1) @@ -1024,7 +1055,8 @@ EOM substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -1046,9 +1078,10 @@ EOM ok defined $buffer ; - ok my $got = Compress::Zlib::memGunzip($buffer) + ok my $got = memGunzip($buffer) or diag "gzerrno is $gzerrno" ; is $got, $string ; + is $gzerrno, 0; } @@ -1072,7 +1105,8 @@ EOM substr($buffer, $trim) = ''; - ok my $u = Compress::Zlib::memGunzip(\$buffer) ; + ok my $u = memGunzip(\$buffer) ; + is $gzerrno, 0; ok $u eq $string; } @@ -1082,7 +1116,8 @@ EOM my $buffer = $good ; substr($buffer, -4, 4) = pack('V', 1234); - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -1091,7 +1126,8 @@ EOM substr($buffer, -4, 4) = pack('V', 1234); substr($buffer, -8, 4) = pack('V', 1234); - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } } diff --git a/cpan/IO-Compress/t/cz-08encoding.t b/cpan/IO-Compress/t/cz-08encoding.t index f377609..ba833a4 100644 --- a/cpan/IO-Compress/t/cz-08encoding.t +++ b/cpan/IO-Compress/t/cz-08encoding.t @@ -30,15 +30,15 @@ BEGIN plan tests => 29 + $extra ; - use_ok('Compress::Zlib', 2); + use_ok('Compress::Zlib', qw(:ALL zlib_version memGunzip memGzip)); } # Check zlib_version and ZLIB_VERSION are the same. -is Compress::Zlib::zlib_version, ZLIB_VERSION, - "ZLIB_VERSION matches Compress::Zlib::zlib_version" ; +is zlib_version, ZLIB_VERSION, + "ZLIB_VERSION matches zlib_version" ; { @@ -46,7 +46,7 @@ is Compress::Zlib::zlib_version, ZLIB_VERSION, # length of this string is 2 characters my $s = "\x{df}\x{100}"; - my $cs = Compress::Zlib::memGzip(Encode::encode_utf8($s)); + my $cs = memGzip(Encode::encode_utf8($s)); # length stored at end of gzip file should be 4 my ($crc, $len) = unpack ("VV", substr($cs, -8, 8)); @@ -58,12 +58,12 @@ is Compress::Zlib::zlib_version, ZLIB_VERSION, title "memGunzip when compressed gzip has been encoded" ; my $s = "hello world" ; - my $co = Compress::Zlib::memGzip($s); - is Compress::Zlib::memGunzip(my $x = $co), $s, " match uncompressed"; + my $co = memGzip($s); + is memGunzip(my $x = $co), $s, " match uncompressed"; utf8::upgrade($co); - my $un = Compress::Zlib::memGunzip($co); + my $un = memGunzip($co); ok $un, " got uncompressed"; is $un, $s, " uncompressed matched original"; @@ -116,16 +116,16 @@ is Compress::Zlib::zlib_version, ZLIB_VERSION, title "Catch wide characters"; my $a = "a\xFF\x{100}"; - eval { Compress::Zlib::memGzip($a) }; + eval { memGzip($a) }; like($@, qr/Wide character in memGzip/, " wide characters in memGzip"); - eval { Compress::Zlib::memGunzip($a) }; + eval { memGunzip($a) }; like($@, qr/Wide character in memGunzip/, " wide characters in memGunzip"); - eval { Compress::Zlib::compress($a) }; + eval { compress($a) }; like($@, qr/Wide character in compress/, " wide characters in compress"); - eval { Compress::Zlib::uncompress($a) }; + eval { uncompress($a) }; like($@, qr/Wide character in uncompress/, " wide characters in uncompress"); my $lex = new LexFile my $name ;