groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: Fix Savannah bug #44891.


From: Deri James
Subject: [groff] 01/01: Fix Savannah bug #44891.
Date: Wed, 22 Apr 2015 14:29:55 +0000

deri pushed a commit to branch master
in repository groff.

commit cc4e05054c93177b0574154cc78af06a1b4cc7a6
Author: Deri James <address@hidden>
Date:   Wed Apr 22 15:13:06 2015 +0100

    Fix Savannah bug #44891.
    
    * src/devices/gropdf/gropdf.pl: If module Compress::Zlib is not
    available fallback to producing uncompressed PDF and output a
    warning.
---
 ChangeLog                    |    8 ++++++++
 src/devices/gropdf/gropdf.pl |   27 ++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf2e4b7..f720cfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-04-22  Deri James  <address@hidden>
+
+       Fix Savannah bug #44891.
+
+       * src/devices/gropdf/gropdf.pl: If module Compress::Zlib is not
+       available fallback to producing uncompressed PDF and output a
+       warning.
+       
 2015-04-22  Bjarni Ingi Gislason  <address@hidden>
 
        Fix Savannah bug #44894.
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 8103914..89767fc 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2,8 +2,8 @@
 #
 #      gropdf          : PDF post processor for groff
 #
-# Copyright (C) 2011-2014  Free Software Foundation, Inc.
-#      Written by Deri James <address@hidden>
+# Copyright (C) 2011-2015 Free Software Foundation, Inc.
+#      Written by Deri James <address@hidden>
 #
 # This file is part of groff.
 #
@@ -22,7 +22,24 @@
 
 use strict;
 use Getopt::Long qw(:config bundling);
-use Compress::Zlib;
+
+my $gotzlib=0;
+
+my $rc = eval
+{
+  require Compress::Zlib;
+  Compress::Zlib->import();
+  1;
+};
+
+if($rc)
+{
+  $gotzlib=1;
+}
+else
+{
+    Msg(0,"Perl module Compress::Zlib not available - cannot compress this 
pdf");
+}
 
 my %cfg;
 
@@ -1407,7 +1424,7 @@ sub LoadPDF
            sysseek(PD,$o->{STREAMPOS}->[0],0);
            Msg(0,'Failed to read all the stream') if $l != 
sysread(PD,$o->{STREAM},$l);
 
-           if (exists($o->{OBJ}->{'Filter'}) and $o->{OBJ}->{'Filter'} eq 
'/FlateDecode')
+           if ($gotzlib and exists($o->{OBJ}->{'Filter'}) and 
$o->{OBJ}->{'Filter'} eq '/FlateDecode')
            {
                $o->{STREAM}=Compress::Zlib::uncompress($o->{STREAM});
                delete($o->{OBJ }->{'Filter'});
@@ -1892,7 +1909,7 @@ sub PutObj
     $obj[$ono]->{XREF}=$fct;
     if (exists($obj[$ono]->{STREAM}))
     {
-       if (!$debug && !exists($obj[$ono]->{DATA}->{'Filter'}))
+       if ($gotzlib && !$debug && !exists($obj[$ono]->{DATA}->{'Filter'}))
        {
            $obj[$ono]->{STREAM}=Compress::Zlib::compress($obj[$ono]->{STREAM});
            $obj[$ono]->{DATA}->{'Filter'}=['/FlateDecode'];



reply via email to

[Prev in Thread] Current Thread [Next in Thread]