]> www.fi.muni.cz Git - evince.git/blobdiff - pdf/xpdf/XRef.cc
Reused eog HIG dialog in GPdf.
[evince.git] / pdf / xpdf / XRef.cc
index 0e1bbc9c6c620a4162cc2e7609fcad89bc1122e1..56cb131c00251cd0fd5bf16379f7a2d8de4464ba 100644 (file)
@@ -2,15 +2,16 @@
 //
 // XRef.cc
 //
-// Copyright 1996-2002 Glyph & Cog, LLC
+// Copyright 1996-2003 Glyph & Cog, LLC
 //
 //========================================================================
 
-#ifdef __GNUC__
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
 #pragma implementation
 #endif
 
-#include <aconf.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
@@ -324,6 +325,11 @@ GBool XRef::readXRef(Guint *pos) {
   if (obj2.isInt()) {
     *pos = (Guint)obj2.getInt();
     more = gTrue;
+  } else if (obj2.isRef()) {
+    // certain buggy PDF generators generate "/Prev NNN 0 R" instead
+    // of "/Prev NNN"
+    *pos = (Guint)obj2.getRefNum();
+    more = gTrue;
   } else {
     more = gFalse;
   }
@@ -454,6 +460,7 @@ GBool XRef::checkEncrypted(GString *ownerPassword, GString *userPassword) {
   ret = gFalse;
 
   permFlags = defPermFlags;
+  ownerPasswordOk = gFalse;
   trailerDict.dictLookup("Encrypt", &encrypt);
   if ((encrypted1 = encrypt.isDict())) {
     ret = gTrue;