#!perl
-#
use warnings;
use strict;
use 5.014;
-use bytes;
+use bytes ();
use File::Slurp;
use Getopt::Long;
my $ofh;
if( $OUTPUT ) {
- die "Output file exists"
+ die "Output file exists\n"
if( -e $OUTPUT && $REPEAT == 1 && !$FORCE );
open $ofh, ">", $OUTPUT
or die "Cannot open output file $OUTPUT.\n";
$bro->window( $WINDOW );
while( read $ifh, (my $buf), $STREAM ) {
$encoded = $bro->compress($buf);
- $total_size += bytes::length( $encoded );
+ $total_size += bytes::length( $buf );
print $ofh $encoded;
}
$encoded = $bro->finish();
- $total_size += bytes::length( $encoded );
print $ofh $encoded;
}
else {
my $decoded = read_file( $ifh );
my $encoded = bro( $decoded, $QUALITY, $WINDOW );
- $total_size += bytes::length( $encoded );
+ $total_size += bytes::length( $decoded );
write_file( $ofh, $encoded );
}
}