[poppler] 2 commits - fofi/FoFiType1C.cc glib/poppler-document.cc poppler/PDFDoc.cc poppler/PDFDoc.h qt4/src qt/poppler-document.cc utils/parseargs.c utils/pdfinfo.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Aug 16 15:25:15 PDT 2009


 fofi/FoFiType1C.cc          |   14 ++++++++++++++
 glib/poppler-document.cc    |    2 +-
 poppler/PDFDoc.cc           |    9 +++++----
 poppler/PDFDoc.h            |    8 +++++---
 qt/poppler-document.cc      |    4 ++--
 qt4/src/poppler-document.cc |    4 ++--
 utils/parseargs.c           |    2 +-
 utils/pdfinfo.cc            |    4 ++--
 8 files changed, 32 insertions(+), 15 deletions(-)

New commits:
commit 5491d16dfbd73f0256c62e49d02622dc3185012e
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Aug 17 00:24:41 2009 +0200

    Move poppler core away from using a double as PDF file version
    
    Frontends are yet to come

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index dfdfb80..6b46fc0 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -646,7 +646,7 @@ poppler_document_get_property (GObject    *object,
     case PROP_FORMAT:
       str = g_strndup("PDF-", 15); /* allocates 16 chars, pads with \0s */
       g_ascii_formatd (str + 4, 15 + 1 - 4,
-		       "%.2g", document->doc->getPDFVersion ());
+		       "%.2g", document->doc->getPDFMajorVersion () + document->doc->getPDFMinorVersion() / 10.0);
       g_value_take_string (value, str);
       break;
     case PROP_AUTHOR:
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 463488f..435ad10 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -304,7 +304,8 @@ void PDFDoc::checkHeader() {
   char *p;
   int i;
 
-  pdfVersion = 0;
+  pdfMajorVersion = 0;
+  pdfMinorVersion = 0;
   for (i = 0; i < headerSearchSize; ++i) {
     hdrBuf[i] = str->getChar();
   }
@@ -323,7 +324,7 @@ void PDFDoc::checkHeader() {
     error(-1, "May not be a PDF file (continuing anyway)");
     return;
   }
-  pdfVersion = gatof(p);
+  sscanf(p, "%d.%d", &pdfMajorVersion, &pdfMinorVersion);
   // We don't do the version check. Don't add it back in.
 }
 
@@ -578,7 +579,7 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr)
 
 void PDFDoc::saveCompleteRewrite (OutStream* outStr)
 {
-  outStr->printf("%%PDF-%.1f\r\n",pdfVersion);
+  outStr->printf("%%PDF-%d.%d\r\n",pdfMajorVersion,pdfMinorVersion);
   XRef *uxref = new XRef();
   uxref->add(0, 65535, 0, gFalse);
   for(int i=0; i<xref->getNumObjects(); i++) {
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 94229b7..7527316 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2005 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2008 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -199,7 +199,8 @@ public:
   Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); }
 
   // Return the PDF version specified by the file.
-  double getPDFVersion() { return pdfVersion; }
+  int getPDFMajorVersion() { return pdfMajorVersion; }
+  int getPDFMinorVersion() { return pdfMinorVersion; }
 
   // Save this file with another name.
   int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
@@ -234,7 +235,8 @@ private:
   FILE *file;
   BaseStream *str;
   void *guiData;
-  double pdfVersion;
+  int pdfMajorVersion;
+  int pdfMinorVersion;
   XRef *xref;
   Catalog *catalog;
 #ifndef DISABLE_OUTLINE
diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc
index 4c47e62..fe74676 100644
--- a/qt/poppler-document.cc
+++ b/qt/poppler-document.cc
@@ -1,6 +1,6 @@
 /* poppler-document.cc: qt interface to poppler
  * Copyright (C) 2005, Net Integration Technologies, Inc.
- * Copyright (C) 2005-2008, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005-2009, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2006, Stefan Kebekus <stefan.kebekus at math.uni-koeln.de>
  * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss at gmx.at>
  *
@@ -270,7 +270,7 @@ bool Document::okToAddNotes() const
 
 double Document::getPDFVersion() const
 {
-  return data->doc.getPDFVersion();
+  return data->doc.getPDFMajorVersion () + data->doc.getPDFMinorVersion() / 10.0;
 }
 
 QDomDocument *Document::toc() const
diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 4eb1aba..3e4b086 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -1,7 +1,7 @@
 /* poppler-document.cc: qt interface to poppler
  * Copyright (C) 2005, Net Integration Technologies, Inc.
  * Copyright (C) 2005, 2008, Brad Hards <bradh at frogmouth.net>
- * Copyright (C) 2005-2008, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005-2009, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2006-2009, Pino Toscano <pino at kde.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -379,7 +379,7 @@ namespace Poppler {
 
     double Document::pdfVersion() const
     {
-	return m_doc->doc->getPDFVersion();
+	return m_doc->doc->getPDFMajorVersion () + m_doc->doc->getPDFMinorVersion() / 10.0;
     }
 
     Page *Document::page(const QString &label) const
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 9063f87..bfbe0b3 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2006 Dom Lachowicz <cinamod at hotmail.com>
-// Copyright (C) 2007-2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2009 Albert Astals Cid <aacid at kde.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -303,7 +303,7 @@ int main(int argc, char *argv[]) {
   printf("Optimized:      %s\n", doc->isLinearized() ? "yes" : "no");
 
   // print PDF version
-  printf("PDF version:    %.1f\n", doc->getPDFVersion());
+  printf("PDF version:    %d.%d\n", doc->getPDFMajorVersion(), doc->getPDFMinorVersion());
 
   // print the metadata
   if (printMetadata && (metadata = doc->readMetadata())) {
commit efd5dd63a5b08249529d9a9f5906aefe806fb3aa
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Aug 17 00:21:22 2009 +0200

    Forgot to update copyright info

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 8921dfb..43deb19 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -6,6 +6,20 @@
 //
 //========================================================================
 
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
 #include <config.h>
 
 #ifdef USE_GCC_PRAGMAS
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 57a3ed8..463488f 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2005, 2007, 2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007-2009 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2008 Carlos Garcia Campos <carlosgc at gnome.org>
diff --git a/utils/parseargs.c b/utils/parseargs.c
index 973af1c..8e84a9b 100644
--- a/utils/parseargs.c
+++ b/utils/parseargs.c
@@ -15,7 +15,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2009 Albert Astals Cid <aacid at kde.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git


More information about the poppler mailing list