| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package IO::Uncompress::AnyInflate ; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # for RFC1950, RFC1951 or RFC1952 | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 6 |  |  | 6 |  | 12374 | use strict; | 
|  | 6 |  |  |  |  | 35 |  | 
|  | 6 |  |  |  |  | 165 |  | 
| 6 | 6 |  |  | 6 |  | 30 | use warnings; | 
|  | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 126 |  | 
| 7 | 6 |  |  | 6 |  | 2407 | use bytes; | 
|  | 6 |  |  |  |  | 61 |  | 
|  | 6 |  |  |  |  | 28 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 6 |  |  | 6 |  | 2155 | use IO::Compress::Base::Common  2.204 qw(:Parse); | 
|  | 6 |  |  |  |  | 121 |  | 
|  | 6 |  |  |  |  | 896 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 6 |  |  | 6 |  | 1974 | use IO::Uncompress::Adapter::Inflate  2.204 (); | 
|  | 6 |  |  |  |  | 122 |  | 
|  | 6 |  |  |  |  | 187 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 6 |  |  | 6 |  | 2264 | use IO::Uncompress::Base  2.204 ; | 
|  | 6 |  |  |  |  | 104 |  | 
|  | 6 |  |  |  |  | 308 |  | 
| 15 | 6 |  |  | 6 |  | 2204 | use IO::Uncompress::Gunzip  2.204 ; | 
|  | 6 |  |  |  |  | 123 |  | 
|  | 6 |  |  |  |  | 266 |  | 
| 16 | 6 |  |  | 6 |  | 2491 | use IO::Uncompress::Inflate  2.204 ; | 
|  | 6 |  |  |  |  | 116 |  | 
|  | 6 |  |  |  |  | 279 |  | 
| 17 | 6 |  |  | 6 |  | 40 | use IO::Uncompress::RawInflate  2.204 ; | 
|  | 6 |  |  |  |  | 66 |  | 
|  | 6 |  |  |  |  | 196 |  | 
| 18 | 6 |  |  | 6 |  | 2978 | use IO::Uncompress::Unzip  2.204 ; | 
|  | 6 |  |  |  |  | 122 |  | 
|  | 6 |  |  |  |  | 3433 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | require Exporter ; | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | $VERSION = '2.204'; | 
| 25 |  |  |  |  |  |  | $AnyInflateError = ''; | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | @ISA = qw(IO::Uncompress::Base Exporter); | 
| 28 |  |  |  |  |  |  | @EXPORT_OK = qw( $AnyInflateError anyinflate ) ; | 
| 29 |  |  |  |  |  |  | %EXPORT_TAGS = %IO::Uncompress::Base::DEFLATE_CONSTANTS if keys %IO::Uncompress::Base::DEFLATE_CONSTANTS; | 
| 30 |  |  |  |  |  |  | push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; | 
| 31 |  |  |  |  |  |  | Exporter::export_ok_tags('all'); | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | # TODO - allow the user to pick a set of the three formats to allow | 
| 34 |  |  |  |  |  |  | #        or just assume want to auto-detect any of the three formats. | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | sub new | 
| 37 |  |  |  |  |  |  | { | 
| 38 | 36 |  |  | 36 | 1 | 5089 | my $class = shift ; | 
| 39 | 36 |  |  |  |  | 121 | my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$AnyInflateError); | 
| 40 | 36 |  |  |  |  | 143 | $obj->_create(undef, 0, @_); | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub anyinflate | 
| 44 |  |  |  |  |  |  | { | 
| 45 | 0 |  |  | 0 | 1 | 0 | my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$AnyInflateError); | 
| 46 | 0 |  |  |  |  | 0 | return $obj->_inf(@_) ; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub getExtraParams | 
| 50 |  |  |  |  |  |  | { | 
| 51 | 36 |  |  | 36 | 0 | 273 | return ( 'rawinflate' => [Parse_boolean,  0] ) ; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | sub ckParams | 
| 55 |  |  |  |  |  |  | { | 
| 56 | 36 |  |  | 36 | 0 | 61 | my $self = shift ; | 
| 57 | 36 |  |  |  |  | 56 | my $got = shift ; | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | # any always needs both crc32 and adler32 | 
| 60 | 36 |  |  |  |  | 112 | $got->setValue('crc32' => 1); | 
| 61 | 36 |  |  |  |  | 98 | $got->setValue('adler32' => 1); | 
| 62 |  |  |  |  |  |  |  | 
| 63 | 36 |  |  |  |  | 102 | return 1; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub mkUncomp | 
| 67 |  |  |  |  |  |  | { | 
| 68 | 36 |  |  | 36 | 0 | 68 | my $self = shift ; | 
| 69 | 36 |  |  |  |  | 49 | my $got = shift ; | 
| 70 |  |  |  |  |  |  |  | 
| 71 | 36 |  |  |  |  | 116 | my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject(); | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 36 | 50 |  |  |  | 106 | return $self->saveErrorString(undef, $errstr, $errno) | 
| 74 |  |  |  |  |  |  | if ! defined $obj; | 
| 75 |  |  |  |  |  |  |  | 
| 76 | 36 |  |  |  |  | 86 | *$self->{Uncomp} = $obj; | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 36 |  |  |  |  | 100 | my @possible = qw( Inflate Gunzip Unzip ); | 
| 79 | 36 |  |  |  |  | 90 | unshift @possible, 'RawInflate' | 
| 80 |  |  |  |  |  |  | if 1 || $got->getValue('rawinflate'); | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 36 |  |  |  |  | 87 | my $magic = $self->ckMagic( @possible ); | 
| 83 |  |  |  |  |  |  |  | 
| 84 | 36 | 100 |  |  |  | 82 | if ($magic) { | 
| 85 | 32 | 50 |  |  |  | 93 | *$self->{Info} = $self->readHeader($magic) | 
| 86 |  |  |  |  |  |  | or return undef ; | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 32 |  |  |  |  | 153 | return 1; | 
| 89 |  |  |  |  |  |  | } | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 4 |  |  |  |  | 10 | return 0 ; | 
| 92 |  |  |  |  |  |  | } | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | sub ckMagic | 
| 97 |  |  |  |  |  |  | { | 
| 98 | 36 |  |  | 36 | 0 | 80 | my $self = shift; | 
| 99 | 36 |  |  |  |  | 84 | my @names = @_ ; | 
| 100 |  |  |  |  |  |  |  | 
| 101 | 36 |  |  |  |  | 69 | my $keep = ref $self ; | 
| 102 | 36 |  |  |  |  | 81 | for my $class ( map { "IO::Uncompress::$_" } @names) | 
|  | 144 |  |  |  |  | 346 |  | 
| 103 |  |  |  |  |  |  | { | 
| 104 | 96 |  |  |  |  | 315 | bless $self => $class; | 
| 105 | 96 |  |  |  |  | 282 | my $magic = $self->ckMagic(); | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 96 | 100 |  |  |  | 206 | if ($magic) | 
| 108 |  |  |  |  |  |  | { | 
| 109 |  |  |  |  |  |  | #bless $self => $class; | 
| 110 | 32 |  |  |  |  | 102 | return $magic ; | 
| 111 |  |  |  |  |  |  | } | 
| 112 |  |  |  |  |  |  |  | 
| 113 | 64 |  |  |  |  | 184 | $self->pushBack(*$self->{HeaderPending})  ; | 
| 114 | 64 |  |  |  |  | 130 | *$self->{HeaderPending} = ''  ; | 
| 115 |  |  |  |  |  |  | } | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 4 |  |  |  |  | 14 | bless $self => $keep; | 
| 118 | 4 |  |  |  |  | 12 | return undef; | 
| 119 |  |  |  |  |  |  | } | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | 1 ; | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | __END__ |