[poppler] Branch 'xpdf303merge' - 9 commits - poppler/Gfx.cc poppler/GfxState.cc poppler/PSOutputDev.cc poppler/SplashOutputDev.cc utils/pdftoppm.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Sep 11 15:35:12 PDT 2011


 poppler/Gfx.cc             |    2 +-
 poppler/GfxState.cc        |   10 +++++++++-
 poppler/PSOutputDev.cc     |   13 ++++++++-----
 poppler/SplashOutputDev.cc |    6 ++++--
 utils/pdftoppm.cc          |   13 ++++++-------
 5 files changed, 28 insertions(+), 16 deletions(-)

New commits:
commit 61c06d2efad20880e1e0b399cf797dd55f6c8dab
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Sep 12 00:32:38 2011 +0200

    xpdf303: Useless NULL assignments

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index fe89afd..11d8036 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1474,10 +1474,12 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state) {
   }
   if (splash) {
     delete splash;
+    splash = NULL;
   }
   if (!bitmap || w != bitmap->getWidth() || h != bitmap->getHeight()) {
     if (bitmap) {
       delete bitmap;
+      bitmap = NULL;
     }
     bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode,
 			      colorMode != splashModeMono1, bitmapTopDown);
commit 4fbcbf1ffb8a98fe8c12643fdab2cbd90b4e60f9
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Sep 12 00:30:52 2011 +0200

    xpdf303: Set size to 64 instead of 100

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 93c9499..fe89afd 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1384,7 +1384,7 @@ void SplashOutputDev::setupScreenParams(double hDPI, double vDPI) {
   case screenStochasticClustered:
     screenParams.type = splashScreenStochasticClustered;
     if (screenParams.size < 0) {
-      screenParams.size = 100;
+      screenParams.size = 64;
     }
     if (screenParams.dotRadius < 0) {
       screenParams.dotRadius = 2;
@@ -1397,7 +1397,7 @@ void SplashOutputDev::setupScreenParams(double hDPI, double vDPI) {
     if (hDPI > 299.9 && vDPI > 299.9) {
       screenParams.type = splashScreenStochasticClustered;
       if (screenParams.size < 0) {
-	screenParams.size = 100;
+	screenParams.size = 64;
       }
       if (screenParams.dotRadius < 0) {
 	screenParams.dotRadius = 2;
commit 1c7203e57e9c7c264f5cada6362a6b449dd8689c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Sep 12 00:21:03 2011 +0200

    xpdf303: Avoid calling a "slow" function

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 05354f8..2a2388a 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1513,13 +1513,16 @@ void PSOutputDev::writeTrailer() {
       writePS("\n");
       writePS("%%DocumentCustomColors:");
       for (cc = customColors; cc; cc = cc->next) {
-	writePSFmt(" ({0:s})", cc->name->getCString());
+	writePS(" ");
+	writePSString(cc->name);
       }
       writePS("\n");
       writePS("%%CMYKCustomColor:\n");
       for (cc = customColors; cc; cc = cc->next) {
-	writePSFmt("%%+ {0:.4g} {1:.4g} {2:.4g} {3:.4g} ({4:t})\n",
-		   cc->c, cc->m, cc->y, cc->k, cc->name);
+	writePSFmt("%%+ {0:.4g} {1:.4g} {2:.4g} {3:.4g} ",
+		   cc->c, cc->m, cc->y, cc->k);
+	writePSString(cc->name);
+	writePS("\n");
       }
     }
   }
commit db4c5789bf95af9f45a7911153acc20a26a447f1
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Sep 12 00:19:49 2011 +0200

    xpdf303: fix spacing

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index c826426..05354f8 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1500,7 +1500,7 @@ void PSOutputDev::writeTrailer() {
       writePS("%%DocumentProcessColors:");
       if (processColors & psProcessCyan) {
 	writePS(" Cyan");
-	 }
+      }
       if (processColors & psProcessMagenta) {
 	writePS(" Magenta");
       }
commit 10c3d15f841865929d2f66353cb01d0d321e8b82
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Sep 12 00:03:13 2011 +0200

    xpdf303: make limit smaller

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 9c9c109..c826426 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3935,7 +3935,7 @@ void PSOutputDev::updateFont(GfxState *state) {
   if (state->getFont()) {
     writePSFmt("/F{0:d}_{1:d} {2:.6g} Tf\n",
 	       state->getFont()->getID()->num, state->getFont()->getID()->gen,
-	       fabs(state->getFontSize()) < 0.00001 ? 0.00001
+	       fabs(state->getFontSize()) < 0.0001 ? 0.0001
 	                                            : state->getFontSize());
   }
 }
commit 1d4e6e739701ba817576752ced169b24c5e95156
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 11 23:57:22 2011 +0200

    xpdf303: Remove 512 limit in pdftoppm

diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index d48c3ee..fba9b93 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -49,8 +49,6 @@
 #include "splash/Splash.h"
 #include "SplashOutputDev.h"
 
-#define PPM_FILE_SZ 512
-
 static int firstPage = 1;
 static int lastPage = 0;
 static GBool printOnlyOdd = gFalse;
@@ -244,7 +242,7 @@ int main(int argc, char *argv[]) {
   PDFDoc *doc;
   GooString *fileName = NULL;
   char *ppmRoot = NULL;
-  char ppmFile[PPM_FILE_SZ];
+  char *ppmFile;
   GooString *ownerPW, *userPW;
   SplashColor paperColor;
   SplashOutputDev *splashOut;
@@ -407,13 +405,14 @@ int main(int argc, char *argv[]) {
     if (ppmRoot != NULL) {
       const char *ext = png ? "png" : (jpeg || jpegcmyk) ? "jpg" : tiff ? "tif" : mono ? "pbm" : gray ? "pgm" : "ppm";
       if (singleFile) {
-        snprintf(ppmFile, PPM_FILE_SZ, "%.*s.%s",
-              PPM_FILE_SZ - 32, ppmRoot, ext);
+        ppmFile = new char[strlen(ppmRoot) + 1 + strlen(ext) + 1];
+        sprintf(ppmFile, "%s.%s", ppmRoot, ext);
       } else {
-        snprintf(ppmFile, PPM_FILE_SZ, "%.*s-%0*d.%s",
-              PPM_FILE_SZ - 32, ppmRoot, pg_num_len, pg, ext);
+        ppmFile = new char[strlen(ppmRoot) + 1 + pg_num_len + 1 + strlen(ext) + 1];
+        sprintf(ppmFile, "%s-%0*d.%s", ppmRoot, pg_num_len, pg, ext);
       }
       savePageSlice(doc, splashOut, pg, x, y, w, h, pg_w, pg_h, ppmFile);
+      delete[] ppmFile;
     } else {
       savePageSlice(doc, splashOut, pg, x, y, w, h, pg_w, pg_h, NULL);
     }
commit e4e843f1115d95c54967f0386bfb28f685d6c88d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 11 22:49:34 2011 +0200

    xpdf303: Rework nComps != colorSpace->getNComps() handling

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 1bb240b..d16f686 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -4734,9 +4734,13 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
     colorSpace->getDefaultRanges(decodeLow, decodeRange, maxPixel);
   } else if (decode->isArray()) {
     nComps = decode->arrayGetLength() / 2;
-    if (nComps != colorSpace->getNComps()) {
+    if (nComps < colorSpace->getNComps()) {
       goto err1;
     }
+    if (nComps > colorSpace->getNComps()) {
+      error(errSyntaxWarning, -1, "Too many elements in Decode array");
+      nComps = colorSpace->getNComps();
+    }
     for (i = 0; i < nComps; ++i) {
       decode->arrayGet(2*i, &obj);
       if (!obj.isNum()) {
commit dda45b6a67f3f97705e5d806eaf7d37171789e66
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 11 22:46:51 2011 +0200

    xpdf303: NULL GfxICCBasedColorSpace if array does not have 2 elements

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 3e37bdc..1bb240b 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -1517,6 +1517,10 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, Gfx *gfx) {
   Object obj1, obj2, obj3;
   int i;
 
+  if (arr->getLength() < 2) {
+    error(errSyntaxError, -1, "Bad ICCBased color space");
+    return NULL;
+  }
   arr->getNF(1, &obj1);
   if (obj1.isRef()) {
     iccProfileStreamA = obj1.getRef();
commit 760e814a6d26db8eba567520aad771002e11357a
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 11 22:21:40 2011 +0200

    xpdf303: increase formDepth limit

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index eb5dac4..ded78c6 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4458,7 +4458,7 @@ void Gfx::doForm(Object *str) {
   int i;
 
   // check for excessive recursion
-  if (formDepth > 20) {
+  if (formDepth > 100) {
     return;
   }
 


More information about the poppler mailing list