[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 55/205: mkhelp: simplified the gzip code
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 55/205: mkhelp: simplified the gzip code |
Date: |
Thu, 20 Apr 2017 16:19:55 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.0
in repository gnurl.
commit 9f3bc40f7f0c5a9b809bd8870c5d63c98cc45777
Author: Dan Fandrich <address@hidden>
AuthorDate: Thu Mar 9 22:15:54 2017 +0100
mkhelp: simplified the gzip code
This eliminates the need for an external gzip program, which wasn't
working with Busybox's gzip, anyway. It now compresses using perl's
IO::Compress::Gzip
---
src/mkhelp.pl | 59 ++++++++++++++++-------------------------------------------
1 file changed, 16 insertions(+), 43 deletions(-)
diff --git a/src/mkhelp.pl b/src/mkhelp.pl
index 74a4b82e2..8b7f72157 100644
--- a/src/mkhelp.pl
+++ b/src/mkhelp.pl
@@ -102,39 +102,6 @@ while(<READ>) {
}
close(READ);
-# if compressed
-if($c) {
- my @test = `gzip --version 2>&1`;
- if($test[0] =~ /gzip/) {
- open(GZIP, ">dumpit") ||
- die "can't create the dumpit file, try without -c";
- binmode GZIP;
- for(@out) {
- print GZIP $_;
- $gzip += length($_);
- }
- close(GZIP);
-
- system("gzip --best --no-name dumpit");
-
- open(GZIP, "<dumpit.gz") ||
- die "can't read the dumpit.gz file, try without -c";
- binmode GZIP;
- while(<GZIP>) {
- push @gzip, $_;
- $gzipped += length($_);
- }
- close(GZIP);
-
- unlink("dumpit.gz");
- }
- else {
- # no gzip, no compression!
- undef $c;
- print STDERR "MEEEP: Couldn't find gzip, disable compression\n";
- }
-}
-
$now = localtime;
print <<HEAD
/*
@@ -146,27 +113,33 @@ print <<HEAD
HEAD
;
if($c) {
+ # if compressed
+ use IO::Compress::Gzip;
+ my $content = join("", @out);
+ my $gzippedContent;
+ IO::Compress::Gzip::gzip(
+ \$content, \$gzippedContent, Level => 9, TextFlag => 1) or die "gzip
failed:";
+ $gzip = length($content);
+ $gzipped = length($gzippedContent);
+
print <<HEAD
#include <zlib.h>
#include "memdebug.h" /* keep this as LAST include */
static const unsigned char hugehelpgz[] = {
/* This mumbo-jumbo is the huge help text compressed with gzip.
- Thanks to this operation, the size of this data shrunk from $gzip
+ Thanks to this operation, the size of this data shrank from $gzip
to $gzipped bytes. You can disable the use of compressed help
texts by NOT passing -c to the mkhelp.pl tool. */
HEAD
;
+
my $c=0;
print " ";
- for(@gzip) {
- my @all=split(//, $_);
- for(@all) {
- my $num=ord($_);
- printf(" 0x%02x,", 0+$num);
- if(++$c>11) {
- print "\n ";
- $c=0;
- }
+ for(split(//, $gzippedContent)) {
+ my $num=ord($_);
+ printf(" 0x%02x,", 0+$num);
+ if(!(++$c % 12)) {
+ print "\n ";
}
}
print "\n};\n";
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 182/205: openssl: fix this statement may fall through [-Wimplicit-fallthrough=], (continued)
- [GNUnet-SVN] [gnurl] 182/205: openssl: fix this statement may fall through [-Wimplicit-fallthrough=], gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 48/205: insecure.d: clarify that this is for server connections, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 147/205: multi: make curl_multi_wait avoid malloc in the typical case, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 196/205: extern-scan.pl: strip trailing CR, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 174/205: vtls: fix unreferenced variable warnings, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 191/205: http2: fix handle leak in error path, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 24/205: fix some typos in the doc (#1306), gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 64/205: authneg: clear auth.multi flag at http_done, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 104/205: tests/README: mention nroff for --manual tests, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 73/205: tests: clear the SSL_CERT_FILE variable on --libcurl tests, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 55/205: mkhelp: simplified the gzip code,
gnunet <=
- [GNUnet-SVN] [gnurl] 102/205: travis: run tests-nonflaky instead of tests-full, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 77/205: winbuild: add basic support for OpenSSL 1.1.x, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 41/205: http2: Fix assertion error on redirect with CL=0, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 46/205: maketgz: Run updatemanpages.pl to update man pages, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 124/205: RELEASE-NOTES: synced with 556c51a2df, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 127/205: docs/Makefile.am: include CMakeLists.txt in the dist tarball, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 90/205: runtests.pl: fixed display of the Gopher IPv6 port number, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 125/205: curl: fix callback argument inconsistency, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 131/205: connect: fix unreferenced parameter warning, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 105/205: mkhelp: disable compression if the perl gzip module is unavailable, gnunet, 2017/04/20