From 175cf3e13def1d266a9d7058868a6e547c00586c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= Date: Wed, 16 Oct 2019 08:07:15 +0300 Subject: [PATCH] add decompressors using IO::Uncompress --- getpaste | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/getpaste b/getpaste index b8ec500..db972a4 100755 --- a/getpaste +++ b/getpaste @@ -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 {{{