[poppler] 2 commits - utils/pdfsig.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 4 22:27:47 UTC 2019


 utils/pdfsig.cc |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 6f81aa23e8745df604a60e334fe13ccec96d7c3c
Author: Nelson Efrain A. Cruz <neac03 at gmail.com>
Date:   Wed Dec 4 09:18:48 2019 -0300

    Changes value of exit code on dumping signatures error

diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc
index aadccc06..d79710d0 100644
--- a/utils/pdfsig.cc
+++ b/utils/pdfsig.cc
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
 
   Win32Console win32Console(&argc, &argv);
   int exitCode = 99;
-  bool ok, dumpingOk;
+  bool ok;
 
   ok = parseArgs(argDesc, &argc, argv);
 
@@ -194,9 +194,9 @@ int main(int argc, char *argv[])
       exitCode = 0;
       printf("Dumping Signatures: %u\n", sigCount);
       for (unsigned int i = 0; i < sigCount; i++) {
-        dumpingOk = dumpSignature(i, sigCount, sig_widgets.at(i), fileName->c_str());
+        const bool dumpingOk = dumpSignature(i, sigCount, sig_widgets.at(i), fileName->c_str());
         if (!dumpingOk) {
-          exitCode = 99;
+          exitCode = 3;
         }
       }
       goto end;
commit ed8159b0ba705062b6bd8e5c624648642e696662
Author: Nelson Efrain A. Cruz <neac03 at gmail.com>
Date:   Tue Dec 3 13:24:48 2019 -0300

    Fixes pdfsig exit code when dumping signatures

diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc
index 505d72a3..aadccc06 100644
--- a/utils/pdfsig.cc
+++ b/utils/pdfsig.cc
@@ -96,12 +96,12 @@ static char *getReadableTime(time_t unix_time)
   return time_str;
 }
 
-static void dumpSignature(int sig_num, int sigCount, FormWidgetSignature *sig_widget, const char *filename)
+static bool dumpSignature(int sig_num, int sigCount, FormWidgetSignature *sig_widget, const char *filename)
 {
     const GooString *signature = sig_widget->getSignature();
     if (!signature) {
         printf("Cannot dump signature #%d\n", sig_num);
-        return;
+        return false;
     }
 
     const int sigCountLength = numberOfCharacters(sigCount);
@@ -116,6 +116,8 @@ static void dumpSignature(int sig_num, int sigCount, FormWidgetSignature *sig_wi
     outfile.close();
     delete format;
     delete path;
+
+    return true;
 }
 
 static GooString nssDir;
@@ -156,7 +158,7 @@ int main(int argc, char *argv[])
 
   Win32Console win32Console(&argc, &argv);
   int exitCode = 99;
-  bool ok;
+  bool ok, dumpingOk;
 
   ok = parseArgs(argDesc, &argc, argv);
 
@@ -189,9 +191,13 @@ int main(int argc, char *argv[])
 
   if (sigCount >= 1) {
     if (dumpSignatures) {
+      exitCode = 0;
       printf("Dumping Signatures: %u\n", sigCount);
       for (unsigned int i = 0; i < sigCount; i++) {
-        dumpSignature(i, sigCount, sig_widgets.at(i), fileName->c_str());
+        dumpingOk = dumpSignature(i, sigCount, sig_widgets.at(i), fileName->c_str());
+        if (!dumpingOk) {
+          exitCode = 99;
+        }
       }
       goto end;
     } else {


More information about the poppler mailing list