]> www.fi.muni.cz Git - evince.git/commitdiff
Check for incorrect dvi files. Fix parsing dvi on AMD64 platform. Thanks
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 18 Jun 2005 21:43:31 +0000 (21:43 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 18 Jun 2005 21:43:31 +0000 (21:43 +0000)
        * dvi/dvi-document.c: (dvi_document_load):
        * dvi/mdvi-lib/dviread.c: (mdvi_init_context):
        * po/POTFILES.in:

        Check for incorrect dvi files. Fix parsing dvi on AMD64
        platform. Thanks to tester@tester.ca (Olivier Crete).

ChangeLog
dvi/dvi-document.c
dvi/mdvi-lib/dviread.c
po/POTFILES.in

index 57cb4cf251aeca2a3f5218b57304346b54c31529..f77e17c4870e592aebc50299522fa990fb7e895b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-06-19  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * dvi/dvi-document.c: (dvi_document_load):
+       * dvi/mdvi-lib/dviread.c: (mdvi_init_context):
+       * po/POTFILES.in:
+       
+       Check for incorrect dvi files. Fix parsing dvi on AMD64
+       platform. Thanks to tester@tester.ca (Olivier Crete).
+
 2005-06-18  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-page-action.c: (match_selected_cb),
index 4285f6888e7ec6b1628229d5e7ea4c592465cac8..d0307e3a2661226be08b50adc65ab56f3e47d5f8 100644 (file)
@@ -28,6 +28,7 @@
 #include "pixbuf-device.h"
 
 #include <gtk/gtk.h>
+#include <glib/gi18n.h>
 
 GMutex *dvi_context_mutex = NULL;
 
@@ -81,14 +82,27 @@ dvi_document_load (EvDocument  *document,
     
     filename = g_filename_from_uri (uri, NULL, error);
     
-    if (!filename)
-       return FALSE;
+    if (!filename) {
+               g_set_error (error,
+                            EV_DOCUMENT_ERROR,
+                            EV_DOCUMENT_ERROR_INVALID,
+                            _("File not available"));
+               return FALSE;
+    }
        
     if (dvi_document->context)
        mdvi_destroy_context (dvi_document->context);
 
     dvi_document->context = mdvi_init_context(dvi_document->params, dvi_document->spec, filename);
 
+    if (!dvi_document->context) {
+               g_set_error (error,
+                            EV_DOCUMENT_ERROR,
+                            EV_DOCUMENT_ERROR_INVALID,
+                            _("DVI document has incorrect format"));
+               return FALSE;
+    }
+
     mdvi_pixbuf_device_init (&dvi_document->context->device);
 
     dvi_document->base_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv 
index 2f9b5cd4016805383552069ca8adf4f86ac2cf89..d4eddcc2eb2aade76e873cf63c9cfda506e3ac0e 100644 (file)
@@ -853,7 +853,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
                for(i = 1; i <= 10; i++)
                        page[i] = fsget4(p);
                page[0] = offset;
-               offset = (long)fuget4(p);
+               offset = fsget4(p);
                /* check if the page is selected */
                if(spec && mdvi_page_selected(spec, page, n) == 0) {
                        DEBUG((DBG_DVI, "Page %d (%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld) ignored by request\n",
index 80fff690e18085e0a6025c3941de0279304003f5..e9da774d7adc548e641b450f81d8e7f9cfe8b6c3 100644 (file)
@@ -11,6 +11,7 @@ data/evince.schemas.in
 pdf/ev-poppler.cc
 ps/gsdefaults.c
 ps/ps-document.c
+dvi/dvi-document.c
 shell/eggfindbar.c
 shell/ev-application.c
 shell/ev-document-types.c