File Coverage

blib/lib/IO/Uncompress/Adapter/LZO.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package IO::Uncompress::Adapter::LZO;
2              
3 1     1   33060 use strict;
  1         2  
  1         23  
4 1     1   3 use warnings;
  1         1  
  1         17  
5 1     1   3 use bytes;
  1         1  
  1         3  
6              
7 1     1   20 use IO::Compress::Base::Common 2.073 qw(:Status);
  1         13  
  1         82  
8 1     1   157 use Compress::LZO ;
  0            
  0            
9              
10             our ($VERSION, @ISA);
11             $VERSION = '2.073';
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__