| 1 | package IO::Compress::Adapter::Bzip2 ; | ||||||||||
| 2 | |||||||||||
| 3 | 59 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 59 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 59 | ▶ | use bytes; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 59 | ▶ | use IO::Compress::Base::Common 2.225 qw(:Status); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 59 | ▶ | use Compress::Raw::Bzip2 2.225 ; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 59 | our ($VERSION); | |||||||||
| 12 | 59 | $VERSION = '2.225'; | |||||||||
| 13 | |||||||||||
| 14 | sub mkCompObject | ||||||||||
| 15 | 548 | ▶ | { | ||||||||
|
Subroutine
mkCompObject: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||
| 16 | 548 | my $BlockSize100K = shift ; | |||||||||
| 17 | 548 | my $WorkFactor = shift ; | |||||||||
| 18 | 548 | my $Verbosity = shift ; | |||||||||
| 19 | |||||||||||
| 20 | 548 | ▶ | $BlockSize100K = 1 if ! defined $BlockSize100K ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 548 | ▶ | $WorkFactor = 0 if ! defined $WorkFactor ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 548 | ▶ | $Verbosity = 0 if ! defined $Verbosity ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 548 | my ($def, $status) = Compress::Raw::Bzip2->new(1, $BlockSize100K, | |||||||||
| 25 | $WorkFactor, $Verbosity); | ||||||||||
| 26 | |||||||||||
| 27 | 548 | ▶ | return (undef, "Could not create Deflate object: $status", $status) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | if $status != BZ_OK ; | ||||||||||
| 29 | |||||||||||
| 30 | 548 | return bless {'Def' => $def, | |||||||||
| 31 | 'Error' => '', | ||||||||||
| 32 | 'ErrorNo' => 0, | ||||||||||
| 33 | } ; | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub compr | ||||||||||
| 37 | 535 | ▶ | { | ||||||||
|
Subroutine
compr: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||
| 38 | 535 | my $self = shift ; | |||||||||
| 39 | |||||||||||
| 40 | 535 | my $def = $self->{Def}; | |||||||||
| 41 | |||||||||||
| 42 | 535 | my $status = $def->bzdeflate($_[0], $_[1]) ; | |||||||||
| 43 | 535 | $self->{ErrorNo} = $status; | |||||||||
| 44 | |||||||||||
| 45 | 535 | ▶ | if ($status != BZ_RUN_OK) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | { | ||||||||||
| 47 | 0 | $self->{Error} = "Deflate Error: $status"; | |||||||||
| 48 | 0 | return STATUS_ERROR; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 535 | return STATUS_OK; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | sub flush | ||||||||||
| 55 | 4 | ▶ | { | ||||||||
|
Subroutine
flush: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||
| 56 | 4 | my $self = shift ; | |||||||||
| 57 | |||||||||||
| 58 | 4 | my $def = $self->{Def}; | |||||||||
| 59 | |||||||||||
| 60 | 4 | my $status = $def->bzflush($_[0]); | |||||||||
| 61 | 4 | $self->{ErrorNo} = $status; | |||||||||
| 62 | |||||||||||
| 63 | 4 | ▶ | if ($status != BZ_RUN_OK) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | { | ||||||||||
| 65 | 0 | $self->{Error} = "Deflate Error: $status"; | |||||||||
| 66 | 0 | return STATUS_ERROR; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 4 | return STATUS_OK; | |||||||||
| 70 | |||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | sub close | ||||||||||
| 74 | 547 | ▶ | { | ||||||||
|
Subroutine
close: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||
| 75 | 547 | my $self = shift ; | |||||||||
| 76 | |||||||||||
| 77 | 547 | my $def = $self->{Def}; | |||||||||
| 78 | |||||||||||
| 79 | 547 | my $status = $def->bzclose($_[0]); | |||||||||
| 80 | 547 | $self->{ErrorNo} = $status; | |||||||||
| 81 | |||||||||||
| 82 | 547 | ▶ | if ($status != BZ_STREAM_END) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 83 | { | ||||||||||
| 84 | 0 | $self->{Error} = "Deflate Error: $status"; | |||||||||
| 85 | 0 | return STATUS_ERROR; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 547 | return STATUS_OK; | |||||||||
| 89 | |||||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | sub reset | ||||||||||
| 94 | 0 | ▶ | { | ||||||||
|
Subroutine
reset: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 95 | 0 | my $self = shift ; | |||||||||
| 96 | |||||||||||
| 97 | 0 | my $outer = $self->{Outer}; | |||||||||
| 98 | |||||||||||
| 99 | 0 | my ($def, $status) = Compress::Raw::Bzip2->new(); | |||||||||
| 100 | 0 | ▶ | $self->{ErrorNo} = ($status == BZ_OK) ? 0 : $status ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 101 | |||||||||||
| 102 | 0 | ▶ | if ($status != BZ_OK) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 103 | { | ||||||||||
| 104 | 0 | $self->{Error} = "Cannot create Deflate object: $status"; | |||||||||
| 105 | 0 | return STATUS_ERROR; | |||||||||
| 106 | } | ||||||||||
| 107 | |||||||||||
| 108 | 0 | $self->{Def} = $def; | |||||||||
| 109 | |||||||||||
| 110 | 0 | return STATUS_OK; | |||||||||
| 111 | } | ||||||||||
| 112 | |||||||||||
| 113 | sub compressedBytes | ||||||||||
| 114 | 0 | ▶ | { | ||||||||
|
Subroutine
compressedBytes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 115 | 0 | my $self = shift ; | |||||||||
| 116 | 0 | $self->{Def}->compressedBytes(); | |||||||||
| 117 | } | ||||||||||
| 118 | |||||||||||
| 119 | sub uncompressedBytes | ||||||||||
| 120 | 0 | ▶ | { | ||||||||
|
Subroutine
uncompressedBytes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 121 | 0 | my $self = shift ; | |||||||||
| 122 | 0 | $self->{Def}->uncompressedBytes(); | |||||||||
| 123 | } | ||||||||||
| 124 | |||||||||||
| 125 | #sub total_out | ||||||||||
| 126 | #{ | ||||||||||
| 127 | # my $self = shift ; | ||||||||||
| 128 | # 0; | ||||||||||
| 129 | #} | ||||||||||
| 130 | # | ||||||||||
| 131 | |||||||||||
| 132 | #sub total_in | ||||||||||
| 133 | #{ | ||||||||||
| 134 | # my $self = shift ; | ||||||||||
| 135 | # $self->{Def}->total_in(); | ||||||||||
| 136 | #} | ||||||||||
| 137 | # | ||||||||||
| 138 | #sub crc32 | ||||||||||
| 139 | #{ | ||||||||||
| 140 | # my $self = shift ; | ||||||||||
| 141 | # $self->{Def}->crc32(); | ||||||||||
| 142 | #} | ||||||||||
| 143 | # | ||||||||||
| 144 | #sub adler32 | ||||||||||
| 145 | #{ | ||||||||||
| 146 | # my $self = shift ; | ||||||||||
| 147 | # $self->{Def}->adler32(); | ||||||||||
| 148 | #} | ||||||||||
| 149 | |||||||||||
| 150 | |||||||||||
| 151 | 59 | 1; | |||||||||
| 152 | |||||||||||
| 153 | __END__ | ||||||||||