r2156 - in trunk: . epdfview

ag at linuxfromscratch.org ag at linuxfromscratch.org
Mon Jan 25 06:07:48 PST 2010


Author: ag
Date: 2010-01-25 07:07:48 -0700 (Mon, 25 Jan 2010)
New Revision: 2156

Added:
   trunk/epdfview/
   trunk/epdfview/epdfview-1.7-fix_nonexisting-1.patch
Log:
Fixed a bug when opening a non-existing file

Added: trunk/epdfview/epdfview-1.7-fix_nonexisting-1.patch
===================================================================
--- trunk/epdfview/epdfview-1.7-fix_nonexisting-1.patch	                        (rev 0)
+++ trunk/epdfview/epdfview-1.7-fix_nonexisting-1.patch	2010-01-25 14:07:48 UTC (rev 2156)
@@ -0,0 +1,51 @@
+Submitted By:            Agathoklis Hatzimanikas <ag at linuxfromscratch dot org>
+Date:                    2010-01-25
+Initial Package Version: 0.1.7
+Upstream Status:         Applied
+Origin:                  Upstream
+Description:             http://trac.emma-soft.com/epdfview/ticket/116
+
+diff -Naur epdfview-0.1.7.orig/src/PDFDocument.cxx epdfview-0.1.7/src/PDFDocument.cxx
+--- epdfview-0.1.7.orig/src/PDFDocument.cxx	2009-02-28 23:00:35.000000000 +0200
++++ epdfview-0.1.7/src/PDFDocument.cxx	2010-01-25 12:46:59.133636329 +0200
+@@ -246,23 +246,25 @@
+     // Check if the document couldn't be opened successfully and why.
+     if ( NULL == newDocument )
+     {
+-        // Poppler's glib wrapper passes the Poppler error code unless the
+-        // error is that the file is encrypted. We want to set our own
+-        // error code in this case.
+         DocumentError errorCode = DocumentErrorNone;
+-        if ( POPPLER_ERROR == loadError->domain )
++        switch ( loadError->code )
+         {
+-            errorCode = DocumentErrorEncrypted;
+-        }
+-        else
+-        {
+-            // OK, the glib's wrapper don't pass the error code directly
+-            // from Poppler. Instead returns G_FILE_ERROR_FAILED and a
+-            // non translated string.
+-            // Maybe I'm wrong (very probable) but that's a wrong way.
+-            // So I'm reading the error code from the error string...
+-            sscanf (loadError->message, "Failed to load document (error %d)",
+-                    (gint *)&errorCode);
++            case POPPLER_ERROR_OPEN_FILE:
++            case POPPLER_ERROR_INVALID:
++                errorCode = DocumentErrorOpenFile;
++                break;
++
++            case POPPLER_ERROR_BAD_CATALOG:
++                errorCode = DocumentErrorBadCatalog;
++                break;
++
++            case POPPLER_ERROR_DAMAGED:
++                errorCode = DocumentErrorDamaged;
++                break;
++
++            case POPPLER_ERROR_ENCRYPTED:
++                errorCode = DocumentErrorEncrypted;
++                break;
+         }
+         g_error_free (loadError);
+         // Get our error message.




More information about the patches mailing list