[poppler] 2 commits - glib/poppler-input-stream.h goo/gtypes.h poppler/PDFDoc.cc poppler/PDFDoc.h poppler/Stream.cc poppler/Stream.h

Adrian Johnson ajohnson at kemper.freedesktop.org
Sun Jan 27 15:14:16 PST 2013


 glib/poppler-input-stream.h |    2 +-
 goo/gtypes.h                |    5 ++++-
 poppler/PDFDoc.cc           |   16 ++++++++--------
 poppler/PDFDoc.h            |    6 +++---
 poppler/Stream.cc           |    4 ++--
 poppler/Stream.h            |    4 ++--
 6 files changed, 20 insertions(+), 17 deletions(-)

New commits:
commit c60ad119363c65d097dff56a68c1ab3fb2933f0b
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Jan 27 15:50:26 2013 +1030

    A few more missing Goffsets

diff --git a/glib/poppler-input-stream.h b/glib/poppler-input-stream.h
index 251a61b..74c198f 100644
--- a/glib/poppler-input-stream.h
+++ b/glib/poppler-input-stream.h
@@ -65,7 +65,7 @@ private:
   char buf[inputStreamBufSize];
   char *bufPtr;
   char *bufEnd;
-  Guint bufPos;
+  Goffset bufPos;
   int savePos;
   GBool saved;
 };
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 4f2ac57..c184348 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -891,7 +891,7 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr)
       if (xref->getEntry(i)->type != xrefEntryFree) {
         Object obj1;
         xref->fetch(ref.num, ref.gen, &obj1, 1);
-        Guint offset = writeObjectHeader(&ref, outStr);
+        Goffset offset = writeObjectHeader(&ref, outStr);
         writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen);
         writeObjectFooter(outStr);
         uxref->add(ref.num, ref.gen, offset, gTrue);
@@ -970,7 +970,7 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr)
       ref.num = i;
       ref.gen = xref->getEntry(i)->gen;
       xref->fetch(ref.num, ref.gen, &obj1, 1);
-      Guint offset = writeObjectHeader(&ref, outStr);
+      Goffset offset = writeObjectHeader(&ref, outStr);
       // Write unencrypted objects in unencrypted form
       if (xref->getEntry(i)->getFlag(XRefEntry::Unencrypted)) {
         writeObject(&obj1, outStr, NULL, cryptRC4, 0, 0, 0);
@@ -984,7 +984,7 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr)
       ref.num = i;
       ref.gen = 0; //compressed entries have gen == 0
       xref->fetch(ref.num, ref.gen, &obj1, 1);
-      Guint offset = writeObjectHeader(&ref, outStr);
+      Goffset offset = writeObjectHeader(&ref, outStr);
       writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen);
       writeObjectFooter(outStr);
       uxref->add(ref.num, ref.gen, offset, gTrue);
@@ -1106,7 +1106,7 @@ void PDFDoc::writeString (GooString* s, OutStream* outStr, Guchar *fileKey,
   delete sEnc;
 }
 
-Guint PDFDoc::writeObjectHeader (Ref *ref, OutStream* outStr)
+Goffset PDFDoc::writeObjectHeader (Ref *ref, OutStream* outStr)
 {
   Goffset offset = outStr->getPos();
   outStr->printf("%i %i obj ", ref->num, ref->gen);
@@ -1241,7 +1241,7 @@ void PDFDoc::writeObjectFooter (OutStream* outStr)
   outStr->printf("endobj\r\n");
 }
 
-Dict *PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Guint startxRef,
+Dict *PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Goffset startxRef,
                                 Ref *root, XRef *xRef, const char *fileName, Goffset fileSize)
 {
   Dict *trailerDict = new Dict(xRef);
@@ -1327,7 +1327,7 @@ Dict *PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Guint startxRef
   trailerDict->set("Root", &obj1);
 
   if (incrUpdate) { 
-    obj1.initInt(startxRef);
+    obj1.initInt64(startxRef);
     trailerDict->set("Prev", &obj1);
   }
   
@@ -1372,7 +1372,7 @@ void PDFDoc::writeXRefStreamTrailer (Dict *trailerDict, XRef *uxref, Ref *uxrefS
   outStr->printf( "%%%%EOF\r\n");
 }
 
-void PDFDoc::writeXRefTableTrailer(Guint uxrefOffset, XRef *uxref, GBool writeAllEntries,
+void PDFDoc::writeXRefTableTrailer(Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries,
                                    int uxrefSize, OutStream* outStr, GBool incrUpdate)
 {
   const char *fileNameA = fileName ? fileName->getCString() : NULL;
@@ -1575,7 +1575,7 @@ Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, G
       ref.gen = xRef->getEntry(n)->gen;
       objectsCount++;
       getXRef()->fetch(ref.num - numOffset, ref.gen, &obj);
-      Guint offset = writeObjectHeader(&ref, outStr);
+      Goffset offset = writeObjectHeader(&ref, outStr);
       if (combine) {
         writeObject(&obj, outStr, getXRef(), numOffset, NULL, cryptRC4, 0, 0, 0);
       } else if (xRef->getEntry(n)->getFlag(XRefEntry::Unencrypted)) {
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 8eab095..cc9d2db 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -252,7 +252,7 @@ public:
   static void writeHeader(OutStream *outStr, int major, int minor);
 
   // Ownership goes to the caller
-  static Dict *createTrailerDict (int uxrefSize, GBool incrUpdate, Guint startxRef,
+  static Dict *createTrailerDict (int uxrefSize, GBool incrUpdate, Goffset startxRef,
                                   Ref *root, XRef *xRef, const char *fileName, Goffset fileSize);
   static void writeXRefTableTrailer (Dict *trailerDict, XRef *uxref, GBool writeAllEntries,
                                      Goffset uxrefOffset, OutStream* outStr, XRef *xRef);
@@ -267,7 +267,7 @@ private:
                                 CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen);
 
   // Write object header to current file stream and return its offset
-  static Guint writeObjectHeader (Ref *ref, OutStream* outStr);
+  static Goffset writeObjectHeader (Ref *ref, OutStream* outStr);
   static void writeObjectFooter (OutStream* outStr);
 
   void writeObject (Object *obj, OutStream* outStr, Guchar *fileKey, CryptAlgorithm encAlgorithm,
@@ -278,7 +278,7 @@ private:
   { writeDictionnary(dict, outStr, getXRef(), 0, fileKey, encAlgorithm, keyLength, objNum, objGen); }
   static void writeStream (Stream* str, OutStream* outStr);
   static void writeRawStream (Stream* str, OutStream* outStr);
-  void writeXRefTableTrailer (Guint uxrefOffset, XRef *uxref, GBool writeAllEntries,
+  void writeXRefTableTrailer (Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries,
                               int uxrefSize, OutStream* outStr, GBool incrUpdate);
   static void writeString (GooString* s, OutStream* outStr, Guchar *fileKey,
                            CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen);
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 3f89ddc..91a1af2 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -757,8 +757,8 @@ GBool StreamPredictor::getNextLine() {
 // UniqueFileStream
 //------------------------------------------------------------------------
 
-UniqueFileStream::UniqueFileStream(FILE *fA, char *fileNameA, Guint startA, GBool limitedA,
-		       Guint lengthA, Object *dictA):
+UniqueFileStream::UniqueFileStream(FILE *fA, char *fileNameA, Goffset startA, GBool limitedA,
+		       Goffset lengthA, Object *dictA):
     FileStream(fA, fileNameA, startA, limitedA, lengthA, dictA) {
   f = fopen(fileName, "rb");
 }
diff --git a/poppler/Stream.h b/poppler/Stream.h
index c871ba7..3d48f92 100644
--- a/poppler/Stream.h
+++ b/poppler/Stream.h
@@ -507,8 +507,8 @@ private:
 class UniqueFileStream: public FileStream {
 public:
 
-  UniqueFileStream(FILE *fA, char *fileNameA, Guint startA, GBool limitedA,
-	     Guint lengthA, Object *dictA);
+  UniqueFileStream(FILE *fA, char *fileNameA, Goffset startA, GBool limitedA,
+	     Goffset lengthA, Object *dictA);
   virtual ~UniqueFileStream();
 };
 
commit 9b113dc86a27085693ac4bcad061780c881ea7f9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Jan 27 11:32:34 2013 +1030

    Use sys/types.h instead of stdio.h for the off_t type
    
    Bug 44085

diff --git a/goo/gtypes.h b/goo/gtypes.h
index 53d8cbe..84245b7 100644
--- a/goo/gtypes.h
+++ b/goo/gtypes.h
@@ -26,7 +26,10 @@
 #define GTYPES_H
 
 #include "poppler-config.h"
-#include <stdio.h> // for off_t
+
+#ifndef _WIN32
+#include <sys/types.h> // for off_t
+#endif
 
 /*
  * These have stupid names to avoid conflicts with some (but not all)


More information about the poppler mailing list