File | /opt/wise/lib/perl5/5.10.0/x86_64-linux-thread-multi/IO/Uncompress/Adapter/Inflate.pm | Statements Executed | 18 | Total Time | 0.00084 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | BEGIN |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | adler32 |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | compressedBytes |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | crc32 |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | createDeflateStream |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | getEndOffset |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | getLastBlockOffset |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | mkUncompObject |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | reset |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | resetLastBlockByte |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | sync |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | uncompr |
0 | 0 | 0 | 0 | 0 | IO::Uncompress::Adapter::Inflate:: | uncompressedBytes |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package IO::Uncompress::Adapter::Inflate; | |||
2 | ||||
3 | 3 | 2.8e-5 | 9.3e-6 | use strict; # spent 10µs making 1 call to strict::import |
4 | 3 | 3.3e-5 | 1.1e-5 | use warnings; # spent 25µs making 1 call to warnings::import |
5 | 3 | 3.2e-5 | 1.1e-5 | use bytes; # spent 7µs making 1 call to bytes::import |
6 | ||||
7 | 3 | 6.7e-5 | 2.2e-5 | use IO::Compress::Base::Common 2.008 qw(:Status); # spent 177µs making 1 call to Exporter::import
# spent 26µs making 1 call to UNIVERSAL::VERSION |
8 | 3 | 0.00067 | 0.00022 | use Compress::Raw::Zlib 2.008 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); # spent 59µs making 1 call to Exporter::import
# spent 21µs making 1 call to UNIVERSAL::VERSION |
9 | ||||
10 | 1 | 0 | 0 | our ($VERSION); |
11 | 1 | 2.0e-6 | 2.0e-6 | $VERSION = '2.008'; |
12 | ||||
13 | ||||
14 | ||||
15 | sub mkUncompObject | |||
16 | { | |||
17 | my $crc32 = shift || 1; | |||
18 | my $adler32 = shift || 1; | |||
19 | my $scan = shift || 0; | |||
20 | ||||
21 | my $inflate ; | |||
22 | my $status ; | |||
23 | ||||
24 | if ($scan) | |||
25 | { | |||
26 | ($inflate, $status) = new Compress::Raw::Zlib::InflateScan | |||
27 | CRC32 => $crc32, | |||
28 | ADLER32 => $adler32, | |||
29 | WindowBits => - MAX_WBITS ; | |||
30 | } | |||
31 | else | |||
32 | { | |||
33 | ($inflate, $status) = new Compress::Raw::Zlib::Inflate | |||
34 | AppendOutput => 1, | |||
35 | CRC32 => $crc32, | |||
36 | ADLER32 => $adler32, | |||
37 | WindowBits => - MAX_WBITS ; | |||
38 | } | |||
39 | ||||
40 | return (undef, "Could not create Inflation object: $status", $status) | |||
41 | if $status != Z_OK ; | |||
42 | ||||
43 | return bless {'Inf' => $inflate, | |||
44 | 'CompSize' => 0, | |||
45 | 'UnCompSize' => 0, | |||
46 | 'Error' => '', | |||
47 | } ; | |||
48 | ||||
49 | } | |||
50 | ||||
51 | sub uncompr | |||
52 | { | |||
53 | my $self = shift ; | |||
54 | my $from = shift ; | |||
55 | my $to = shift ; | |||
56 | my $eof = shift ; | |||
57 | ||||
58 | my $inf = $self->{Inf}; | |||
59 | ||||
60 | my $status = $inf->inflate($from, $to, $eof); | |||
61 | $self->{ErrorNo} = $status; | |||
62 | ||||
63 | if ($status != Z_STREAM_END && $eof) | |||
64 | { | |||
65 | $self->{Error} = "unexpected end of file"; | |||
66 | return STATUS_ERROR; | |||
67 | } | |||
68 | ||||
69 | if ($status != Z_OK && $status != Z_STREAM_END ) | |||
70 | { | |||
71 | $self->{Error} = "Inflation Error: $status"; | |||
72 | return STATUS_ERROR; | |||
73 | } | |||
74 | ||||
75 | ||||
76 | return STATUS_OK if $status == Z_OK ; | |||
77 | return STATUS_ENDSTREAM if $status == Z_STREAM_END ; | |||
78 | return STATUS_ERROR ; | |||
79 | } | |||
80 | ||||
81 | sub reset | |||
82 | { | |||
83 | my $self = shift ; | |||
84 | $self->{Inf}->inflateReset(); | |||
85 | ||||
86 | return STATUS_OK ; | |||
87 | } | |||
88 | ||||
89 | #sub count | |||
90 | #{ | |||
91 | # my $self = shift ; | |||
92 | # $self->{Inf}->inflateCount(); | |||
93 | #} | |||
94 | ||||
95 | sub crc32 | |||
96 | { | |||
97 | my $self = shift ; | |||
98 | $self->{Inf}->crc32(); | |||
99 | } | |||
100 | ||||
101 | sub compressedBytes | |||
102 | { | |||
103 | my $self = shift ; | |||
104 | $self->{Inf}->compressedBytes(); | |||
105 | } | |||
106 | ||||
107 | sub uncompressedBytes | |||
108 | { | |||
109 | my $self = shift ; | |||
110 | $self->{Inf}->uncompressedBytes(); | |||
111 | } | |||
112 | ||||
113 | sub adler32 | |||
114 | { | |||
115 | my $self = shift ; | |||
116 | $self->{Inf}->adler32(); | |||
117 | } | |||
118 | ||||
119 | sub sync | |||
120 | { | |||
121 | my $self = shift ; | |||
122 | ( $self->{Inf}->inflateSync(@_) == Z_OK) | |||
123 | ? STATUS_OK | |||
124 | : STATUS_ERROR ; | |||
125 | } | |||
126 | ||||
127 | ||||
128 | sub getLastBlockOffset | |||
129 | { | |||
130 | my $self = shift ; | |||
131 | $self->{Inf}->getLastBlockOffset(); | |||
132 | } | |||
133 | ||||
134 | sub getEndOffset | |||
135 | { | |||
136 | my $self = shift ; | |||
137 | $self->{Inf}->getEndOffset(); | |||
138 | } | |||
139 | ||||
140 | sub resetLastBlockByte | |||
141 | { | |||
142 | my $self = shift ; | |||
143 | $self->{Inf}->resetLastBlockByte(@_); | |||
144 | } | |||
145 | ||||
146 | sub createDeflateStream | |||
147 | { | |||
148 | my $self = shift ; | |||
149 | my $deflate = $self->{Inf}->createDeflateStream(@_); | |||
150 | return bless {'Def' => $deflate, | |||
151 | 'CompSize' => 0, | |||
152 | 'UnCompSize' => 0, | |||
153 | 'Error' => '', | |||
154 | }, 'IO::Compress::Adapter::Deflate'; | |||
155 | } | |||
156 | ||||
157 | 1 | 4.0e-6 | 4.0e-6 | 1; |
158 | ||||
159 | ||||
160 | __END__ | |||
161 |