[poppler] Branch 'poppler-0.24' - 5 commits - poppler/Annot.cc poppler/Catalog.cc poppler/Catalog.h poppler/Dict.cc splash/Splash.cc utils/HtmlOutputDev.cc utils/pdfinfo.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Fri Aug 16 16:13:05 PDT 2013
poppler/Annot.cc | 2 +-
poppler/Catalog.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++
poppler/Catalog.h | 10 ++++++++++
poppler/Dict.cc | 2 +-
splash/Splash.cc | 4 +++-
utils/HtmlOutputDev.cc | 4 +++-
utils/pdfinfo.cc | 8 ++++++--
7 files changed, 69 insertions(+), 6 deletions(-)
New commits:
commit ef6420656c7b88eb22a63ec2cb3e504e0bda0384
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Aug 17 01:11:37 2013 +0200
Fix jpeg image export
Use same logic than the one used in ImageOutputDev
Bug #48270
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 23d8b6e..7926674 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -36,6 +36,7 @@
// Copyright (C) 2012 Pino Toscano <pino at kde.org>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2013 Julien Nabet <serval2412 at yahoo.fr>
+// Copyright (C) 2013 Johannes Brandstätter <jbrandstaetter at gmail.com>
//
// 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
@@ -1502,7 +1503,8 @@ void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
/*if( !globalParams->getErrQuiet() )
printf("image stream of kind %d\n", str->getKind());*/
// dump JPEG file
- if (dumpJPEG && str->getKind() == strDCT) {
+ if (dumpJPEG && str->getKind() == strDCT && (colorMap->getNumPixelComps() == 1 ||
+ colorMap->getNumPixelComps() == 3) && !inlineImg) {
drawJpegImage(state, str);
}
else {
commit 681f52a572b08c068cb376e5b2dc8a31676aad07
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Aug 16 23:58:44 2013 +0200
Fix exit(1) in 1026.asan.0.42.pdf
The main crash in discussion with Thomas
diff --git a/splash/Splash.cc b/splash/Splash.cc
index bc7d79f..ccfe1ed 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -4504,7 +4504,9 @@ void Splash::scaleImageYuXd(SplashImageSource src, void *srcData,
xq = srcWidth % scaledWidth;
// allocate buffers
- lineBuf = (Guchar *)gmallocn(srcWidth, nComps);
+ lineBuf = (Guchar *)gmallocn_checkoverflow(srcWidth, nComps);
+ if (unlikely(!lineBuf))
+ return;
if (srcAlpha) {
alphaLineBuf = (Guchar *)gmalloc(srcWidth);
} else {
commit 9f4d7796589e4c9c1645fbbcf0cfabd79a71bde9
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Thu Aug 8 20:33:54 2013 +0200
use copyString where memory is freed with gfree
Bug #67666
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index f0cce6d..00291f8 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -4990,7 +4990,7 @@ void AnnotWidget::generateFieldAppearance() {
}
// build the appearance stream
- appearStream = new MemStream(strdup(appearBuf->getCString()), 0,
+ appearStream = new MemStream(copyString(appearBuf->getCString()), 0,
appearBuf->getLength(), &appearDict);
appearance.free();
appearance.initStream(appearStream);
diff --git a/poppler/Dict.cc b/poppler/Dict.cc
index 3f3c022..4cf42dc 100644
--- a/poppler/Dict.cc
+++ b/poppler/Dict.cc
@@ -96,7 +96,7 @@ Dict::Dict(Dict* dictA) {
sorted = dictA->sorted;
entries = (DictEntry *)gmallocn(size, sizeof(DictEntry));
for (int i=0; i<length; i++) {
- entries[i].key = strdup(dictA->entries[i].key);
+ entries[i].key = copyString(dictA->entries[i].key);
dictA->entries[i].val.copy(&entries[i].val);
}
}
commit 73cca518c479594e26605196d54b429fbf42dcdc
Author: Adrian Perez de Castro <aperez at igalia.com>
Date: Thu Apr 25 09:52:56 2013 +0300
pdfinfo: Use Catalog::getMarkInfo() to show mark info properties
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 14e4f6c..f297614 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -225,8 +225,12 @@ int main(int argc, char *argv[]) {
info.free();
// print tagging info
- printf("Tagged: %s\n",
- doc->getStructTreeRoot()->isDict() ? "yes" : "no");
+ printf("Tagged: %s\n",
+ (doc->getCatalog()->getMarkInfo() & Catalog::markInfoMarked) ? "yes" : "no");
+ printf("UserProperties: %s\n",
+ (doc->getCatalog()->getMarkInfo() & Catalog::markInfoUserProperties) ? "yes" : "no");
+ printf("Suspects: %s\n",
+ (doc->getCatalog()->getMarkInfo() & Catalog::markInfoSuspects) ? "yes" : "no");
// print form info
switch (doc->getCatalog()->getFormType())
commit 402ee8b4e31630a42a0a38db1d39164cc5789f3c
Author: Adrian Perez de Castro <aperez at igalia.com>
Date: Thu Apr 25 09:52:56 2013 +0300
Tagged-PDF: Accessors in Catalog for the MarkInfo dictionary
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 6bd511a..25a8997 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -97,6 +97,7 @@ Catalog::Catalog(PDFDoc *docA) {
attrsList = NULL;
kidsIdxList = NULL;
lastCachedPage = 0;
+ markInfo = markInfoNull;
xref->getCatalog(&catDict);
if (!catDict.isDict()) {
@@ -857,6 +858,50 @@ Object *Catalog::getStructTreeRoot()
return &structTreeRoot;
}
+Guint Catalog::getMarkInfo()
+{
+ if (markInfo == markInfoNull) {
+ markInfo = 0;
+
+ Object catDict;
+ catalogLocker();
+ xref->getCatalog(&catDict);
+
+ if (catDict.isDict()) {
+ Object markInfoDict;
+ catDict.dictLookup("MarkInfo", &markInfoDict);
+ if (markInfoDict.isDict()) {
+ Object value;
+
+ if (markInfoDict.dictLookup("Marked", &value)->isBool() && value.getBool())
+ markInfo |= markInfoMarked;
+ else if (!value.isNull())
+ error(errSyntaxError, -1, "Marked object is wrong type ({0:s})", value.getTypeName());
+ value.free();
+
+ if (markInfoDict.dictLookup("Suspects", &value)->isBool() && value.getBool())
+ markInfo |= markInfoSuspects;
+ else if (!value.isNull())
+ error(errSyntaxError, -1, "Suspects object is wrong type ({0:s})", value.getTypeName());
+ value.free();
+
+ if (markInfoDict.dictLookup("UserProperties", &value)->isBool() && value.getBool())
+ markInfo |= markInfoUserProperties;
+ else if (!value.isNull())
+ error(errSyntaxError, -1, "UserProperties object is wrong type ({0:s})", value.getTypeName());
+ value.free();
+ } else if (!markInfoDict.isNull()) {
+ error(errSyntaxError, -1, "MarkInfo object is wrong type ({0:s})", markInfoDict.getTypeName());
+ }
+ markInfoDict.free();
+ } else {
+ error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
+ }
+ catDict.free();
+ }
+ return markInfo;
+}
+
Object *Catalog::getOutline()
{
catalogLocker();
diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 24a3dcf..a89d9aa 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -125,6 +125,15 @@ public:
// Return the structure tree root object.
Object *getStructTreeRoot();
+ // Return values from the MarkInfo dictionary as flags in a bitfield.
+ enum MarkInfoFlags {
+ markInfoNull = 1 << 0,
+ markInfoMarked = 1 << 1,
+ markInfoUserProperties = 1 << 2,
+ markInfoSuspects = 1 << 3,
+ };
+ Guint getMarkInfo();
+
// Find a page, given its object ID. Returns page number, or 0 if
// not found.
int findPage(int num, int gen);
@@ -219,6 +228,7 @@ private:
GooString *baseURI; // base URI for URI-type links
Object metadata; // metadata stream
Object structTreeRoot; // structure tree root dictionary
+ Guint markInfo; // Flags from MarkInfo dictionary
Object outline; // outline dictionary
Object acroForm; // AcroForm dictionary
Object viewerPreferences; // ViewerPreference dictionary
More information about the poppler
mailing list