]> iEval git - io-compress-brotli.git/commitdiff
Fix bin/bro-perl
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 23 Sep 2017 18:34:19 +0000 (21:34 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 23 Sep 2017 18:34:19 +0000 (21:34 +0300)
bin/bro-perl

index 45eed8e3dff125d2ea7463335b0e738904195bc2..ad35af8b20a7c6307c879b4e57cdedc7a18dc452 100755 (executable)
@@ -14,7 +14,6 @@ use IO::Compress::Brotli;
 use IO::Uncompress::Brotli;
 
 GetOptions(
-    'c|custom-dictionary=s' => \(my $DICTIONARY),
     'd|decompress'          => \(my $DECOMPRESS),
     'f|force'               => \(my $FORCE),
     'h|help'                => \(my $HELP),
@@ -29,7 +28,7 @@ GetOptions(
 
 if( $HELP ) {
     say "Usage: $0 [--force] [--quality n] [--decompress] [--input filename] [--output filename]".
-        " [--repeat iters] [--verbose] [--window n] [--custom-dictionary filename] [--stream size]";
+        " [--repeat iters] [--verbose] [--window n] [--stream size]";
     exit 1;
 }
 
@@ -62,19 +61,12 @@ for ( 1..$REPEAT ) {
     binmode $ofh;
 
     if( $DECOMPRESS ) {
-        if( $STREAM ) {
-            my $bro = IO::Uncompress::Brotli->create();
-            while( read $ifh, (my $buf), $STREAM ) {
-                $decoded = $bro->decompress($buf);
-                $total_size += bytes::length( $decoded );
-                print $ofh $decoded;
-            }
-        }
-        else {
-            $encoded = read_file( $ifh );
-            $decoded = unbro( $encoded );
+        $STREAM //= 4 * 1024 * 1024;
+        my $bro = IO::Uncompress::Brotli->create();
+        while( read $ifh, (my $buf), $STREAM ) {
+            $decoded = $bro->decompress($buf);
             $total_size += bytes::length( $decoded );
-            write_file( $ofh, $decoded );
+            print $ofh $decoded;
         }
     }
     else {
This page took 0.026614 seconds and 4 git commands to generate.