Subject: | sync flush appending extra empty uncompressed block |
Date: | Thu, 3 Aug 2017 01:48:09 +0200 |
To: | bug-Compress-Raw-Zlib [...] rt.cpan.org |
From: | Felipe Gasper <felipe [...] felipegasper.com> |
#!/usr/bin/env perl
use strict;
use warnings;
use Compress::Raw::Zlib;
my $deflate = Compress::Raw::Zlib::Deflate->new(
-WindowBits => -15,
-AppendOutput => 1
);
my $str = 'Hello';
for ( 1 .. 2 ) {
$deflate->deflate( $str, my $out );
$deflate->flush( $out, Compress::Raw::Zlib::Z_SYNC_FLUSH() );
printf "sync: %v.02x\n", $out;
$out = q<>;
$deflate->deflate( $str, $out );
$deflate->flush( $out, Compress::Raw::Zlib::Z_FULL_FLUSH() );
printf "full: %v.02x\n", $out;
}
===================
sync: f2.48.cd.c9.c9.07.00.00.00.ff.ff.00.00.00.ff.ff
full: f2.00.11.00.00.00.00.ff.ff
sync: f2.48.cd.c9.c9.07.00.00.00.ff.ff
full: f2.00.11.00.00.00.00.ff.ff
===================
That first sync doesn’t seem like it should be appending the extra 5 bytes?
-FG