Uncompress/Adapter/LZO.pm

filter: Statementstmt 86.6% 13 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 90.0% 18 / 20 CC 1 SCAR 0.6
CC
1
Cov
87%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Compress/Adapter/LZO.pm ↑ Summary Compress/Lzop.pm »
1 package IO::Uncompress::Adapter::LZO;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use IO::Compress::Base::Common 2.217 qw(:Status);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Compress::LZO ;
Subroutine BEGIN: called CC=1 SCAR=2.6
9  
10 our ($VERSION, @ISA);
11 $VERSION = '2.217';
12  
13  
14 sub mkUncompObject
15 {
16 return bless {
17 'CompBytes' => 0,
18 'UnCompBytes' => 0,
19 'Error' => '',
20 'ConsumesInput' => 0,
21 } ;
22 }
23  
24 sub uncompr
25 {
26 my $self = shift ;
27 my $from = shift ;
28 my $to = shift ;
29 my $eof = shift ;
30 my $outSize = shift ;
31  
32 return STATUS_OK
33 unless length $$from;
34  
35 $self->{CompBytes} += length $$from;
36  
37 if (length $$from == $outSize) {
38 $self->{UnCompBytes} += length $$from;
39 $$to .= $$from;
40 return STATUS_OK;
41 }
42  
43  
44 #$$to .= Compress::LZO::my_decompress($from, $outSize);
45  
46 $$to .= Compress::LZO::decompress("\xf0" . pack("N", $outSize) . $$from);
47  
48 $self->{ErrorNo} = 0;
49  
50 if (! defined $to) {
51 $self->{Error} = "error uncompressing";
52 $self->{ErrorNo} = 1;
53 return STATUS_ERROR;
54 }
55  
56 $self->{UnCompBytes} += length $$to;
57  
58 return STATUS_OK ;
59 }
60  
61  
62  
63 sub reset
64 {
65 return STATUS_OK ;
66 }
67  
68 #sub count
69 #{
70 # my $self = shift ;
71 # $self->{UnCompBytes};
72 #}
73  
74 sub compressedBytes
75 {
76 my $self = shift ;
77 $self->{CompBytes};
78 }
79  
80 sub uncompressedBytes
81 {
82 my $self = shift ;
83 $self->{UnCompBytes};
84 }
85  
86 sub crc32
87 {
88 my $self = shift ;
89 #$self->{Inf}->crc32();
90 }
91  
92 sub adler32
93 {
94 my $self = shift ;
95 #$self->{Inf}->adler32();
96 }
97  
98 sub sync
99 {
100 my $self = shift ;
101 #( $self->{Inf}->inflateSync(@_) == BZ_OK)
102 # ? STATUS_OK
103 # : STATUS_ERROR ;
104 }
105  
106 1;
107  
108 __END__
« Compress/Adapter/LZO.pm ↑ Summary Compress/Lzop.pm »