blib/lib/SWF/ForcibleConverter.pm

filter: Statementstmt 20.2% 53 / 262 Branchbran 11.3% 10 / 88 Conditioncond 19.3% 6 / 31 MC/DCmcdc 15.7% 3 / 19 Subroutinesub 40.5% 15 / 37 Podpod 64.2% 9 / 14 totaltotal 21.2% 96 / 451 CC 57 SCAR 45.0
CC
57
Cov
18%
_drain
342.0
_read_first_chunk
90.0
convert9
90.0
CRAP 89.9
↑ Summary
1 package SWF::ForcibleConverter;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use vars qw($VERSION $DEBUG);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 $VERSION = '0.02';
7 3 $DEBUG = $ENV{SWF_FORCIBLECONVERTER_DEBUG};
8  
9 3 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use constant HEADER_SIZE => 8;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use constant MIN_BUFFER_SIZE => 4096;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶use vars qw($COMPRESSION_LEVEL);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 $COMPRESSION_LEVEL = 6;
16  
17 1 ▶sub create_io_file {
Subroutine create_io_file: called CC=1 SCAR=0.0
Pod undocumented
18 1 require IO::File; IO::File->new(@_);
19 }
20  
21 1 ▶sub create_io_handle {
Subroutine create_io_handle: called CC=1 SCAR=0.0
Pod undocumented
22 1 require IO::Handle; IO::Handle->new(@_);
23 }
24  
25 1 ▶sub create_io_uncompress {
Subroutine create_io_uncompress: called CC=2 SCAR=7.2
Pod undocumented
26 1 require IO::Uncompress::Inflate;
27 1 ▶ IO::Uncompress::Inflate->new(@_)
Branch: 1 branch
BranchTrueFalseTotal
"IO::Uncompress::Inflate"->new(@_) or die "Cannot create IO::Uncompress::Inflate: $IO::Uncompress::Inflate::InflateError" 1 0 1
28 or die "Cannot create IO::Uncompress::Inflate: $IO::Uncompress::Inflate::InflateError";
29 }
30  
31 1 ▶sub create_io_compress {
Subroutine create_io_compress: called CC=2 SCAR=7.2
Pod undocumented
32 1 require IO::Compress::Deflate;
33 1 ▶ IO::Compress::Deflate->new(@_)
Branch: 1 branch
BranchTrueFalseTotal
"IO::Compress::Deflate"->new(@_) or die "Cannot create IO::Compress::Deflate: $IO::Compress::Deflate::DeflateError" 1 0 1
34 or die "Cannot create IO::Compress::Deflate: $IO::Compress::Deflate::DeflateError";
35 }
36  
37 6 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
38 6 my $class = shift;
39 6 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
060
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
40
41 6 ▶ my $args = shift || {};
Condition100%2/2
shift() || {}
l!l
33
MC/DC100%1/1
shift() || {}
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
42 6 my $self = {};
43 6 bless $self, $class;
44  
45 # set with validation
46 $self->set_buffer_size( $args->{buffer_size} )
47 6 ▶ if( exists $args->{buffer_size} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"buffer_size"} 3 3 6
48  
49 # stash
50 4 $self->{_r_io} = undef; # handle for reading
51 4 $self->{_w_io} = undef; # handle for writing
52 4 $self->{_header} = undef; # original header HEADER_SIZE bytes
53  
54 # you have to customize and set these chunks before drain()
55 4 $self->{_header_v9} = undef; # header for output editing on
56 4 $self->{_first_chunk} = undef; # the first chunk just behind header
57  
58 4 return $self;
59 }
60  
61 10 ▶sub buffer_size {
Subroutine buffer_size: called CC=2 SCAR=6.9
Pod documented
62 10 my $self = shift;
63 10 ▶ return @_ ? $self->{buffer_size} = shift : $self->{buffer_size};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 5 5 10
64 }
65  
66 8 ▶sub set_buffer_size {
Subroutine set_buffer_size: called CC=3 SCAR=11.0
Pod documented
67 8 my $self = shift;
68 8 my $size = shift;
69 8 ▶ croak "size of buffer is @{[ MIN_BUFFER_SIZE ]} necessity at least"
Branch: 1 branch
BranchTrueFalseTotal
if not $size or $size < 4096 5 3 8
Condition100%3/3
not $size or $size < 4096
l!l&&r!l&&!r
233
MC/DC100%2/2
not $size or $size < 4096
not $size $size < 4096
Truth table100%3/3
not(A) or B
A= not $sizeB= $size < 4096
ABresult
1X1
011
000
70 if( ! $size or $size < MIN_BUFFER_SIZE );
71 3 $self->buffer_size( $size );
72 }
73  
74 4 ▶sub get_buffer_size {
Subroutine get_buffer_size: called CC=2 SCAR=6.9
Pod documented
75 4 ▶ shift->buffer_size || MIN_BUFFER_SIZE;
Branch: 1 branch
BranchTrueFalseTotal
(shift())->buffer_size or 4096 2 2 4
76 }
77  
78 #-----------------------------------------------------------
79 #
80 #
81  
82 0 ▶sub _open_r {
Subroutine _open_r: not called CC=6 SCAR=37.4
83 0 my $self = shift;
84 0 my $file = shift; # or STDIN
85 0 ▶ unless( $self->{_r_io} ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_r_io"}) 0 0 0
86 0 my $io;
87 0 ▶ if( defined $file ){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $file) { } 0 0 0
88 0 ▶ if( ref($file) ){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $file) { } 0 0 0
89 0 $io = $file; # it sets opend file handle that is a "IO"
90 }else{
91 0 $io = create_io_file;
92 0 ▶ $io->open($file,"r") or die "Cannot open $file for reading: $!";
Branch: 1 branch
BranchTrueFalseTotal
$io->open($file, "r") or die "Cannot open $file for reading: $!" 0 0 0
93 }
94 }else{
95 0 $io = create_io_handle;
96 0 ▶ $io->fdopen(fileno(STDIN),"r") or die "Cannot open STDIN: $!";
Branch: 1 branch
BranchTrueFalseTotal
$io->fdopen(fileno STDIN, "r") or die "Cannot open STDIN: $!" 0 0 0
97 }
98 0 $self->{_r_io} = $io;
99  
100 # clear keeping header because input is reopend,
101 # it may be the other resource
102 0 $self->{_header} = undef;
103 0 $self->{_header_v9} = undef;
104 0 $self->{_first_chunk} = undef;
105 }
106 0 return $self->{_r_io};
107 }
108  
109 0 ▶sub _open_w {
Subroutine _open_w: not called CC=5 SCAR=34.0
110 0 my $self = shift;
111 0 my $file = shift; # or STDOUT
112 0 ▶ unless( $self->{_w_io} ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_w_io"}) 0 0 0
113 0 my $io;
114 0 ▶ if( defined $file ){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $file) { } 0 0 0
115 0 $io = create_io_file;
116 0 ▶ $io->open($file,"w") or die "Cannot open $file for writing: $!";
Branch: 1 branch
BranchTrueFalseTotal
$io->open($file, "w") or die "Cannot open $file for writing: $!" 0 0 0
117 }else{
118 0 $io = create_io_handle;
119 0 ▶ $io->fdopen(fileno(STDOUT),"w") or die "Cannot open STDOUT: $!";
Branch: 1 branch
BranchTrueFalseTotal
$io->fdopen(fileno STDOUT, "w") or die "Cannot open STDOUT: $!" 0 0 0
120 }
121 0 $self->{_w_io} = $io;
122 }
123 0 return $self->{_w_io};
124 }
125  
126 0 ▶sub _close_r {
Subroutine _close_r: not called CC=2 SCAR=17.9
127 0 my $self = shift;
128 0 ▶ if( $self->{_r_io} ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_r_io"}) 0 0 0
129 0 $self->{_r_io}->close;
130 0 $self->{_r_io} = undef;
131 }
132 }
133  
134 0 ▶sub _close_w {
Subroutine _close_w: not called CC=2 SCAR=17.9
135 0 my $self = shift;
136 0 ▶ if( $self->{_w_io} ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_w_io"}) 0 0 0
137 0 $self->{_w_io}->close;
138 0 $self->{_w_io} = undef;
139 }
140 }
141  
142 0 ▶sub _switch_input_handle_to_uncompress {
Subroutine _switch_input_handle_to_uncompress: not called CC=1 SCAR=6.9
143 0 my $self = shift;
144 0 my $input = shift;
145 0 $self->{_r_io} = create_io_uncompress($input);
146 }
147  
148 0 ▶sub _switch_output_handle_to_compress {
Subroutine _switch_output_handle_to_compress: not called CC=1 SCAR=6.9
149 0 my $self = shift;
150 0 my $output = shift;
151 0 $self->{_w_io} = create_io_compress($output, Append => 1, -Level => $COMPRESSION_LEVEL );
152 }
153  
154 0 ▶sub _version {
Subroutine _version: not called CC=1 SCAR=6.9
155 0 my $self = shift;
156 0 my $header = shift;
157 0 ord(substr($header, 3, 1));
158 }
159  
160 0 ▶sub _is_compressed {
Subroutine _is_compressed: not called CC=1 SCAR=6.9
161 0 my $self = shift;
162 0 my $header = shift;
163 0 substr($header, 0, 1) eq "\x43";
164 }
165  
166 0 ▶sub _modify_custom_header_to_version_9 {
Subroutine _modify_custom_header_to_version_9: not called CC=1 SCAR=6.9
167 0 my $self = shift;
168 0 my $h = $self->{_header_v9};
169 0 substr($h, 3, 1, "\x09");
170 0 $self->{_header_v9} = $h;
171 }
172  
173 0 ▶sub _modify_custom_header_to_uncompressed {
Subroutine _modify_custom_header_to_uncompressed: not called CC=1 SCAR=6.9
174 0 my $self = shift;
175 0 my $h = $self->{_header_v9};
176 0 substr($h, 0, 1, "\x46"); # "F"WS
177 0 $self->{_header_v9} = $h;
178 }
179  
180 0 ▶sub _modify_custom_header_to_compressed {
Subroutine _modify_custom_header_to_compressed: not called CC=1 SCAR=6.9
181 0 my $self = shift;
182 0 my $h = $self->{_header_v9};
183 0 substr($h, 0, 1, "\x43"); # "C"WS
184 0 $self->{_header_v9} = $h;
185 }
186  
187 #-----------------------------------------------------------
188 # io methods
189 #
190  
191 0 ▶sub _read_header {
Subroutine _read_header: not called CC=4 SCAR=30.0
192 0 my $self = shift;
193 0 my $input = shift;
194 0 my $r = $self->_open_r($input);
195  
196 # skip if it already read header
197 0 ▶ unless( $self->{_header} ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_header"}) 0 0 0
198
199 # read header, 8 bytes from othe rigin
200 0 my $header;
201 0 my $size = $r->read($header, HEADER_SIZE);
202 0 ▶ die "Failed to read the header" if( ! defined $size or $size != HEADER_SIZE );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $size or $size != 8 0 0 0
Condition0%0/3
not defined $size or $size != 8
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $size or $size != 8
not defined $size $size != 8
Truth table0%0/3
not(A) or B
A= not defined $sizeB= $size != 8
ABresult
1X1
011
000
203  
204 0 $self->{_header} = $header; # keep for reuse
205 0 $self->{_header_v9} = $header;
206 }
207
208 0 return $self->{_header};
209 }
210  
211 0 ▶sub _read_first_chunk {
Subroutine _read_first_chunk: not called CC=9 SCAR=45.0
212 0 my $self = shift;
213 0 my $input = shift;
214 0 my $r = $self->_open_r($input);
215 0 my $readsize= $self->get_buffer_size;
216  
217 0 ▶ if( ! $self->{_header} and $self->{_first_chunk} ){
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{"_header"} and $self->{"_first_chunk"}) 0 0 0
Condition0%0/3
not $self->{"_header"} and $self->{"_first_chunk"}
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->{"_header"} and $self->{"_first_chunk"}
not $self->{"_header"} $self->{"_first_chunk"}
Truth table0%0/3
not(A) and B
A= not $self->{"_header"}B= $self->{"_first_chunk"}
ABresult
0X0
100
111
218 0 croak "It tried to read the first chunk although the header was not read";
219 }
220  
221 0 ▶ if( $self->_is_compressed($self->_read_header($input)) ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_compressed($self->_read_header($input))) 0 0 0
222 0 $r = $self->_switch_input_handle_to_uncompress($r);
223 0 $self->_modify_custom_header_to_uncompressed;
224 }
225  
226 0 ▶ unless( $self->{_first_chunk} ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_first_chunk"}) 0 0 0
227  
228 0 my $chunk = undef;
229 0 my $size = $r->read($chunk, $readsize);
230 0 ▶ if( ! defined $size or ( $size != $readsize and ! $r->eof ) ){
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $size or $size != $readsize and not $r->eof) 0 0 0
Condition0%0/6
not defined $size or $size != $readsize and not $r->eof
l!l&&r!l&&!r
000
$size != $readsize and not $r->eof
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $size or $size != $readsize and not $r->eof
not defined $size $size != $readsize not $r->eof
Truth table0%0/4
not(A) or B and not(C)
A= not defined $sizeB= $size != $readsizeC= not $r->eof
ABCresult
1XX1
0111
00X0
0100
231 0 ▶ die "Failed to read the first chunk (@{[ defined $size ? $size : 'undef' ]})";
Branch: 1 branch
BranchTrueFalseTotal
defined $size ? : 0 0 0
232 }
233 0 $self->{_first_chunk} = $chunk;
234 }
235
236 0 return $self->{_first_chunk};
237 }
238  
239 0 ▶sub _drain {
Subroutine _drain: not called CC=18 SCAR=58.3
240 0 my $self = shift;
241 0 my $input = shift;
242 0 my $output = shift;
243 0 ▶ my $options = shift || {};
Condition0%0/2
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
244
245 0 ▶ my $force_cws = ($options->{cws} || $options->{cws} ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$options->{'cws'} || $options->{'cws'} ? : 0 0 0
Condition0%0/3
$options->{"cws"} or $options->{"cws"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$options->{"cws"} or $options->{"cws"}
$options->{"cws"} $options->{"cws"}
Truth table0%0/3
A or B
A= $options->{"cws"}B= $options->{"cws"}
ABresult
1X1
011
000
246 0 ▶ my $force_fws = ($options->{fws} || $options->{fws} ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fws'} || $options->{'fws'} ? : 0 0 0
Condition0%0/3
$options->{"fws"} or $options->{"fws"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$options->{"fws"} or $options->{"fws"}
$options->{"fws"} $options->{"fws"}
Truth table0%0/3
A or B
A= $options->{"fws"}B= $options->{"fws"}
ABresult
1X1
011
000
247  
248 # ready to output
249 0 my $w;
250 my $writer;
251 0 ▶ if( ref($output) eq 'CODE' ){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $output eq 'CODE') { } 0 0 0
252 0 $writer = $output;
253 }else{
254 0 $w = $self->_open_w($output);
255 0 ▶ $writer = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
256 0 $w->print($_[0]);
257 0 };
258 }
259 0 my $total = 0;
260  
261 # choose format of output as cws or fws
262 0 ▶ my $to_compress = $self->_is_compressed($self->{_header}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->_is_compressed($self->{'_header'}) ? : 0 0 0
263 0 ▶ if( $force_cws != $force_fws ){
Branch: 1 branch
BranchTrueFalseTotal
if ($force_cws != $force_fws) 0 0 0
264 0 ▶ $to_compress = 1 if( $force_cws );
Branch: 1 branch
BranchTrueFalseTotal
if $force_cws 0 0 0
265 0 ▶ $to_compress = 0 if( $force_fws );
Branch: 1 branch
BranchTrueFalseTotal
if $force_fws 0 0 0
266 }
267  
268 # print the header that is always uncompressed 8 bytes
269 0 ▶ if( $to_compress ){
Branch: 1 branch
BranchTrueFalseTotal
if ($to_compress) { } 0 0 0
270 0 $self->_modify_custom_header_to_compressed;
271 0 $writer->($self->{_header_v9});
272 0 $total += length $self->{_header_v9};
273 0 $w = $self->_switch_output_handle_to_compress( $w );
274 }else{
275 0 $writer->($self->{_header_v9});
276 0 $total += length $self->{_header_v9};
277 }
278  
279 # print out buffered data
280 0 for my $chunk ( @{$self->{_first_chunk}} ){
281 0 ▶ if( ref $chunk eq 'SCALAR' ){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $chunk eq 'SCALAR') { } 0 0 0
282 0 $writer->($$chunk); $total += length $$chunk;
283 }else{
284 0 $writer->( $chunk); $total += length $chunk;
285 }
286 }
287
288 # print out unread data
289 0 my $r = $self->_open_r($input);
290 0 my $readsize = $self->get_buffer_size;
291 0 ▶ while( ! $r->eof ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($r->eof) 0 0 0
292 0 my $buf;
293 0 my $size = $r->read($buf, $readsize);
294 0 ▶ if( ! defined $size or $size != $readsize ){
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $size or $size != $readsize) 0 0 0
Condition0%0/3
not defined $size or $size != $readsize
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $size or $size != $readsize
not defined $size $size != $readsize
Truth table0%0/3
not(A) or B
A= not defined $sizeB= $size != $readsize
ABresult
1X1
011
000
295 0 ▶ if( ! $r->eof ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($r->eof) 0 0 0
296 0 die "Failed to read a chunk";
297 }
298 }
299 0 $writer->($buf);
300 0 $total += length $buf;
301 }
302  
303 # drain() can be called once
304 0 $self->_close_w;
305 0 $self->_close_r;
306  
307 0 return $total;
308 }
309  
310 #-----------------------------------------------------------
311 # main public utilities
312 #
313  
314 0 ▶sub version {
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
315 0 my $self = shift;
316 0 my $input = shift;
317 0 $self->_version($self->_read_header($input));
318 }
319  
320 0 ▶sub is_compressed {
Subroutine is_compressed: not called CC=1 SCAR=6.9
Pod documented
321 0 my $self = shift;
322 0 my $input = shift;
323 0 $self->_is_compressed($self->_read_header($input));
324 }
325  
326 #-----------------------------------------------------------
327 # main jobs with drain will close handles
328 #
329  
330 0 ▶sub uncompress {
Subroutine uncompress: not called CC=1 SCAR=6.9
Pod documented
331 0 my $self = shift;
332 0 my $input = shift;
333 0 my $output = shift;
334  
335 0 my $first = $self->_read_first_chunk($input);
336 0 $self->{_first_chunk} = [\$first];
337 0 $self->_drain($input, $output, { fws => 1 });
338 }
339  
340 0 ▶sub _get_body_position { # function for ->covert9()
Subroutine _get_body_position: not called CC=1 SCAR=6.9
341 0 my $the_9th = shift; # 9th char
342  
343 0 my $result = 0;
344 0 $result += 3; # "FWS" or "CWS"
345 0 $result += 1; # version
346 0 $result += 4; # length
347  
348 0 my $rectNBits = int( ord($the_9th) >> 3 ); # unsigned right shift
349 0 $result += int( (5 + $rectNBits * 4) / 8 ); # stage(rect)
350 0 $result += 2; # ?
351 0 $result += 1; # frame rate
352 0 $result += 2; # total frames
353
354 0 return $result;
355 }
356  
357 0 ▶sub convert9 {
Subroutine convert9: not called CC=9 SCAR=45.0
Pod documented
358 0 my $self = shift;
359 0 my $input = shift;
360 0 my $output = shift;
361 0 my $options;
362 0 ▶ if( scalar @_ == 1 ){
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 1) { } 0 0 0
363 0 $options = shift @_;
364 }else{
365 0 my %opts = @_;
366 0 $options = \%opts;
367 }
368  
369 # prepare
370 0 my $header = $self->_read_header($input);
371 0 my $buf_size = $self->get_buffer_size;
372  
373 # read first chunk that includes info for body position
374 0 my $first = $self->_read_first_chunk($input);
375 0 my $pos = _get_body_position(substr($first, 0, 1));
376  
377 # read and write header with updating the version to 9
378 0 my $version = $self->_version($header);
379  
380 0 ▶ if( $version < 9 ){
Branch: 1 branch
BranchTrueFalseTotal
if ($version < 9) 0 0 0
381 0 $self->_modify_custom_header_to_version_9;
382 }
383  
384 0 my $total = 0;
385 0 ▶ if( 9 <= $version ){
Branch: 1 branch
BranchTrueFalseTotal
if (9 <= $version) { } 0 0 0
386 # simply, copy (but uncompressed)
387 0 $self->{_first_chunk} = [\$first];
388 0 $total += $self->_drain($input, $output, $options);
389  
390 }else{
391
392 0 my $result = undef;
393 0 my $offset = $pos - HEADER_SIZE;
394 0 ▶ if( 8 == $version ){
Branch: 1 branch
BranchTrueFalseTotal
if (8 == $version) 0 0 0
395 # find file attributes position
396  
397 # require Config;
398 0 my $shortsize = 2; # $Config::Config{shortsize};
399 0 my $intsize = 4; # $Config::Config{intsize};
400  
401 0 my $currentp = $offset;
402 0 while( 1 ){
403 0 ▶ last if( length $first < $currentp - HEADER_SIZE );
Branch: 1 branch
BranchTrueFalseTotal
if length $first < $currentp - 8 0 0 0
404 0 my $short = unpack "x${currentp}s", $first;
405 0 my $tag = $short >> 6;
406 0 ▶ if( $tag == 69 ){
Branch: 1 branch
BranchTrueFalseTotal
if ($tag == 69) 0 0 0
407 0 $result = $currentp;
408 0 last;
409 }
410 0 $currentp += 2;
411
412 0 my $len = $short & 0x3f;
413 0 ▶ if( $len == 0x3f ){
Branch: 1 branch
BranchTrueFalseTotal
if ($len == 63) 0 0 0
414 0 $len = unpack "x${currentp}i", $first;
415 0 $currentp += $intsize;
416 }
417 0 $currentp += $len;
418 }
419 }
420  
421 0 ▶ if( defined $result ){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $result) { } 0 0 0
422
423 0 my $attr_pos = $result + 2 - HEADER_SIZE;
424
425 0 my $target = unpack('C', substr($first, $attr_pos, 1));
426 0 $target |= 0x08;
427 0 substr($first, $attr_pos, 1, pack('C',$target));
428  
429 0 $self->{_first_chunk} = [\$first];
430 0 $total += $self->_drain($input, $output, $options);
431  
432 }else{
433  
434 $self->{_first_chunk} = [
435 0 substr($first, 0, $offset),
436 "\x44\x11\x08\x00\x00\x00",
437 substr($first, $offset),
438 ];
439 0 $total += $self->_drain($input, $output, $options);
440 }
441 }
442
443 0 return $total;
444 }
445  
446 0 ▶sub convert9_compress {
Subroutine convert9_compress: not called CC=1 SCAR=6.9
Pod documented
447 0 my $self = shift;
448 0 my $input = shift;
449 0 my $output = shift;
450 0 $self->convert9($input, $output, { cws => 1 });
451 }
452  
453 0 ▶sub convert9_uncompress {
Subroutine convert9_uncompress: not called CC=1 SCAR=6.9
Pod documented
454 0 my $self = shift;
455 0 my $input = shift;
456 0 my $output = shift;
457 0 $self->convert9($input, $output, { fws => 1 });
458 }
459  
460 3 1;
461 __END__
↑ Summary