Skip to content

Commit

Permalink
add decompressors using IO::Uncompress
Browse files Browse the repository at this point in the history
  • Loading branch information
grawity committed Oct 16, 2019
1 parent fe3f8e3 commit 175cf3e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions getpaste
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,32 @@ sub decompress_lzw {
return Compress::LZW->decompress($buf);
}

sub decompress_inflate {
my ($buf) = @_;

require IO::Uncompress::Inflate;
my $outbuf;
my $stream = IO::Uncompress::Inflate->new(\$buf);
my $status = $stream->read($outbuf);
if ($status <= 0) {
_die("inflate failed: $IO::Uncompress::Inflate::InflateError");
}
return $outbuf;
}

sub decompress_rawinflate {
my ($buf) = @_;

require IO::Uncompress::RawInflate;
my $outbuf;
my $stream = IO::Uncompress::RawInflate->new(\$buf);
my $status = $stream->read($outbuf);
if ($status <= 0) {
_die("inflate failed: $IO::Uncompress::RawInflate::RawInflateError");
}
return $outbuf;
}

# }}}
# extra KDFs {{{

Expand Down

0 comments on commit 175cf3e

Please sign in to comment.