| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Gzip::Libdeflate; |
|
2
|
2
|
|
|
2
|
|
146437
|
use warnings; |
|
|
2
|
|
|
|
|
13
|
|
|
|
2
|
|
|
|
|
68
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
123
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
|
5
|
|
|
|
|
|
|
require XSLoader; |
|
6
|
|
|
|
|
|
|
XSLoader::load ('Gzip::Libdeflate', $VERSION); |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
990
|
use File::Slurper qw!read_binary write_binary!; |
|
|
2
|
|
|
|
|
29497
|
|
|
|
2
|
|
|
|
|
113
|
|
|
9
|
2
|
|
|
2
|
|
14
|
use Carp; |
|
|
2
|
|
|
|
|
13
|
|
|
|
2
|
|
|
|
|
737
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_from |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
4
|
|
|
4
|
0
|
10
|
my (%options) = @_; |
|
14
|
4
|
|
|
|
|
6
|
my $from; |
|
15
|
4
|
50
|
|
|
|
10
|
if ($options{in}) { |
|
|
|
0
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
12
|
$from = read_binary ($options{in}); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
elsif ($options{from}) { |
|
19
|
0
|
|
|
|
|
0
|
$from = $options{from}; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
4
|
50
|
|
|
|
409
|
if (! $from) { |
|
22
|
0
|
|
|
|
|
0
|
carp "Specify one of from => scalar or in => file"; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
4
|
|
|
|
|
12
|
return $from; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub make_out |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
4
|
|
|
4
|
0
|
25
|
my ($out, %options) = @_; |
|
30
|
4
|
|
|
|
|
14
|
my $outfile = $options{out}; |
|
31
|
4
|
100
|
|
|
|
10
|
if ($outfile) { |
|
32
|
2
|
|
|
|
|
10
|
write_binary ($outfile, $out); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
4
|
|
|
|
|
393
|
return $out; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub compress_file |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
1
|
|
|
1
|
1
|
339
|
my ($o, %options) = @_; |
|
40
|
1
|
|
|
|
|
4
|
my $from = get_from (%options); |
|
41
|
1
|
50
|
|
|
|
5
|
if (! $from) { |
|
42
|
0
|
|
|
|
|
0
|
return undef; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
1
|
|
|
|
|
2145
|
my $out = $o->compress ($from); |
|
45
|
1
|
|
|
|
|
7
|
return make_out ($out, %options); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub decompress_file |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
3
|
|
|
3
|
1
|
1937
|
my ($o, %options) = @_; |
|
51
|
3
|
|
|
|
|
11
|
my $from = get_from (%options); |
|
52
|
3
|
50
|
|
|
|
7
|
if (! $from) { |
|
53
|
0
|
|
|
|
|
0
|
return undef; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
3
|
|
|
|
|
17
|
my $type = $o->get_type (); |
|
56
|
3
|
50
|
|
|
|
8
|
if ($type ne 'gzip') { |
|
57
|
0
|
0
|
|
|
|
0
|
if (! $options{size}) { |
|
58
|
0
|
|
|
|
|
0
|
warn "A non-zero numerical size is required to decompress deflate/zlib inputs"; |
|
59
|
0
|
|
|
|
|
0
|
return undef; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
3
|
|
|
|
|
5
|
my $size = $options{size}; |
|
63
|
3
|
50
|
|
|
|
7
|
if (! $size) { |
|
64
|
3
|
|
|
|
|
6
|
$size = 0; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
3
|
|
|
|
|
900
|
my $out = $o->decompress ($from, $size); |
|
67
|
3
|
|
|
|
|
17
|
return make_out ($out, %options); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |