[poppler] 4 commits - CMakeLists.txt glib/poppler-private.h glib/poppler-structure-element.cc poppler/Form.cc poppler/Form.h poppler/Gfx.h poppler/GfxState.h poppler/GlobalParams.cc poppler/GlobalParams.h poppler/PDFDoc.cc poppler/PDFDoc.h poppler/poppler-config.h.cmake poppler/SecurityHandler.cc poppler/SecurityHandler.h poppler/XpdfPluginAPI.cc poppler/XpdfPluginAPI.h utils/HtmlOutputDev.cc utils/HtmlOutputDev.h utils/pdfinfo.cc utils/pdftohtml.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Sep 23 17:22:46 UTC 2018
CMakeLists.txt | 2
glib/poppler-private.h | 2
glib/poppler-structure-element.cc | 27 +--
poppler/Form.cc | 20 --
poppler/Form.h | 21 --
poppler/Gfx.h | 2
poppler/GfxState.h | 8
poppler/GlobalParams.cc | 219 ------------------------
poppler/GlobalParams.h | 14 -
poppler/PDFDoc.cc | 22 --
poppler/PDFDoc.h | 41 ++--
poppler/SecurityHandler.cc | 104 -----------
poppler/SecurityHandler.h | 52 -----
poppler/XpdfPluginAPI.cc | 243 ---------------------------
poppler/XpdfPluginAPI.h | 342 --------------------------------------
poppler/poppler-config.h.cmake | 4
utils/HtmlOutputDev.cc | 12 -
utils/HtmlOutputDev.h | 2
utils/pdfinfo.cc | 2
utils/pdftohtml.cc | 4
20 files changed, 63 insertions(+), 1080 deletions(-)
New commits:
commit 2aa679bf2551874561190caff4ea18b34c9b388f
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Sep 23 19:17:53 2018 +0200
Remove the DEBUG_FORMS define
Just define the functions, but not call them
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 98d1e0ff..68d3b602 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -107,11 +107,9 @@ FormWidget::~FormWidget()
widget->decRefCnt();
}
-#ifdef DEBUG_FORMS
void FormWidget::print(int indent) {
printf ("%*s+ (%d %d): [widget]\n", indent, "", ref.num, ref.gen);
}
-#endif
void FormWidget::createWidgetAnnotation() {
if (widget)
@@ -768,7 +766,6 @@ FormField::~FormField()
delete fullyQualifiedName;
}
-#ifdef DEBUG_FORMS
void FormField::print(int indent)
{
printf ("%*s- (%d %d): [container] terminal: %s children: %d\n", indent, "", ref.num, ref.gen,
@@ -786,7 +783,6 @@ void FormField::printTree(int indent)
children[i]->printTree(indent + 4);
}
}
-#endif
void FormField::fillChildrenSiblingsID()
{
@@ -1008,8 +1004,7 @@ FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref& ref, For
}
}
-#ifdef DEBUG_FORMS
-static char *_getButtonType(FormButtonType type)
+static const char *_getButtonType(FormButtonType type)
{
switch (type) {
case formButtonPush:
@@ -1029,7 +1024,6 @@ void FormFieldButton::print(int indent)
printf ("%*s- (%d %d): [%s] terminal: %s children: %d\n", indent, "", ref.num, ref.gen,
_getButtonType(btype), terminal ? "Yes" : "No", numChildren);
}
-#endif
void FormFieldButton::setNumSiblings (int num)
{
@@ -1190,13 +1184,11 @@ FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref& ref, FormFie
}
}
-#ifdef DEBUG_FORMS
void FormFieldText::print(int indent)
{
printf ("%*s- (%d %d): [text] terminal: %s children: %d\n", indent, "", ref.num, ref.gen,
terminal ? "Yes" : "No", numChildren);
}
-#endif
void FormFieldText::setContentCopy (const GooString* new_content)
{
@@ -1449,13 +1441,11 @@ FormFieldChoice::~FormFieldChoice()
delete editedChoice;
}
-#ifdef DEBUG_FORMS
void FormFieldChoice::print(int indent)
{
printf ("%*s- (%d %d): [choice] terminal: %s children: %d\n", indent, "", ref.num, ref.gen,
terminal ? "Yes" : "No", numChildren);
}
-#endif
void FormFieldChoice::updateSelection() {
Object objV;
@@ -1779,13 +1769,11 @@ SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool for
return signature_info;
}
-#ifdef DEBUG_FORMS
void FormFieldSignature::print(int indent)
{
printf ("%*s- (%d %d): [signature] terminal: %s children: %d\n", indent, "", ref.num, ref.gen,
terminal ? "Yes" : "No", numChildren);
}
-#endif
//------------------------------------------------------------------------
// Form
@@ -1871,10 +1859,8 @@ Form::Form(PDFDoc *docA, Object* acroFormA)
}
}
-#ifdef DEBUG_FORMS
- for (int i = 0; i < numFields; i++)
- rootFields[i]->printTree();
-#endif
+// for (int i = 0; i < numFields; i++)
+// rootFields[i]->printTree();
}
Form::~Form() {
diff --git a/poppler/Form.h b/poppler/Form.h
index 0dd86dfc..5cc62266 100644
--- a/poppler/Form.h
+++ b/poppler/Form.h
@@ -134,9 +134,7 @@ public:
virtual void updateWidgetAppearance() = 0;
-#ifdef DEBUG_FORMS
void print(int indent = 0);
-#endif
protected:
FormWidget(PDFDoc *docA, Object *aobj, unsigned num, Ref aref, FormField *fieldA);
@@ -324,11 +322,8 @@ public:
void createWidgetAnnotations();
-#ifdef DEBUG_FORMS
void printTree(int indent = 0);
virtual void print(int indent = 0);
-#endif
-
protected:
void _createWidget (Object *obj, Ref aref);
@@ -389,9 +384,7 @@ public:
FormFieldButton* getSibling (int i) const { return siblings[i]; }
int getNumSiblings () const { return numSiblings; }
-#ifdef DEBUG_FORMS
- void print(int indent = 0);
-#endif
+ void print(int indent) override;
~FormFieldButton();
protected:
@@ -435,9 +428,7 @@ public:
//set the font size of the field's text (currently only integer values)
void setTextFontSize(int fontSize);
-#ifdef DEBUG_FORMS
- void print(int indent = 0);
-#endif
+ void print(int indent) override;
static int tokenizeDA(const GooString* daString, GooList* daToks, const char* searchTok);
@@ -498,9 +489,7 @@ public:
int getTopIndex() const { return topIdx; }
-#ifdef DEBUG_FORMS
- void print(int indent = 0);
-#endif
+ void print(int indent) override;
protected:
void unselectAll();
@@ -549,9 +538,7 @@ private:
GooString *signature;
SignatureInfo *signature_info;
-#ifdef DEBUG_FORMS
- void print(int indent = 0);
-#endif
+ void print(int indent) override;
};
//------------------------------------------------------------------------
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index 6060ffdc..69404451 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -115,9 +115,6 @@
#cmakedefine USE_CMS 1
#endif
-// Also, there are preprocessor symbols in the header files
-// that are used but never defined when building poppler: DEBUG_FORMS
-
//------------------------------------------------------------------------
// version
//------------------------------------------------------------------------
commit 87fcbb6a73cfeac5d21a8ce8e8d10f2f52ae0e00
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Sep 23 19:15:19 2018 +0200
Remove the DISABLE_OUTLINE define
It makes no sense
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 5a89e1d4..777880d2 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -84,9 +84,7 @@
#include "Parser.h"
#include "SecurityHandler.h"
#include "Decrypt.h"
-#ifndef DISABLE_OUTLINE
#include "Outline.h"
-#endif
#include "PDFDoc.h"
#include "Hints.h"
#include "UTF.h"
@@ -121,9 +119,7 @@ void PDFDoc::init()
linearization = nullptr;
catalog = nullptr;
hints = nullptr;
-#ifndef DISABLE_OUTLINE
outline = nullptr;
-#endif
startXRefPos = -1;
secHdlr = nullptr;
pageCache = nullptr;
@@ -330,11 +326,9 @@ PDFDoc::~PDFDoc() {
gfree(pageCache);
}
delete secHdlr;
-#ifndef DISABLE_OUTLINE
if (outline) {
delete outline;
}
-#endif
if (catalog) {
delete catalog;
}
@@ -1956,7 +1950,6 @@ Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, G
return objectsCount;
}
-#ifndef DISABLE_OUTLINE
Outline *PDFDoc::getOutline()
{
if (!outline) {
@@ -1967,7 +1960,6 @@ Outline *PDFDoc::getOutline()
return outline;
}
-#endif
PDFDoc *PDFDoc::ErrorPDFDoc(int errorCode, const GooString *fileNameA)
{
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 2fe982d3..08b012b5 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -236,11 +236,8 @@ public:
// Process the links for a page.
void processLinks(OutputDev *out, int page);
-
-#ifndef DISABLE_OUTLINE
// Return the outline object.
Outline *getOutline();
-#endif
// Is the file encrypted?
GBool isEncrypted() { return xref->isEncrypted(); }
@@ -421,9 +418,7 @@ private:
SecurityHandler *secHdlr;
Catalog *catalog;
Hints *hints;
-#ifndef DISABLE_OUTLINE
Outline *outline;
-#endif
Page **pageCache;
GBool ok;
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index ec69d456..6060ffdc 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -116,7 +116,7 @@
#endif
// Also, there are preprocessor symbols in the header files
-// that are used but never defined when building poppler: DISABLE_OUTLINE, DEBUG_FORMS
+// that are used but never defined when building poppler: DEBUG_FORMS
//------------------------------------------------------------------------
// version
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index f695ee44..076a15fe 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1705,9 +1705,6 @@ void HtmlOutputDev::dumpMetaVars(FILE *file)
GBool HtmlOutputDev::dumpDocOutline(PDFDoc* doc)
{
-#ifdef DISABLE_OUTLINE
- return gFalse;
-#else
FILE * output = nullptr;
GBool bClose = gFalse;
@@ -1773,14 +1770,10 @@ GBool HtmlOutputDev::dumpDocOutline(PDFDoc* doc)
newXmlOutlineLevel(output, outlines);
return gTrue;
-#endif
}
GBool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const GooList *outlines, int level)
{
-#ifdef DISABLE_OUTLINE
- return gFalse;
-#else
GBool atLeastOne = gFalse;
if (level == 1)
@@ -1845,12 +1838,10 @@ GBool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const GooList *outlines,
fputs("</ul>\n",output);
return atLeastOne;
-#endif
}
void HtmlOutputDev::newXmlOutlineLevel(FILE *output, const GooList *outlines)
{
-#ifndef DISABLE_OUTLINE
fputs("<outline>\n", output);
for (int i = 0; i < outlines->getLength(); i++)
@@ -1879,10 +1870,8 @@ void HtmlOutputDev::newXmlOutlineLevel(FILE *output, const GooList *outlines)
}
fputs("</outline>\n", output);
-#endif
}
-#ifndef DISABLE_OUTLINE
int HtmlOutputDev::getOutlinePageNum(OutlineItem *item)
{
const LinkAction *action = item->getAction();
@@ -1916,4 +1905,3 @@ int HtmlOutputDev::getOutlinePageNum(OutlineItem *item)
delete linkdest;
return pagenum;
}
-#endif
diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index 0c6b1c55..7ce6225a 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -333,9 +333,7 @@ private:
void doFrame(int firstPage);
GBool newHtmlOutlineLevel(FILE *output, const GooList *outlines, int level = 1);
void newXmlOutlineLevel(FILE *output, const GooList *outlines);
-#ifndef DISABLE_OUTLINE
int getOutlinePageNum(OutlineItem *item);
-#endif
void drawJpegImage(GfxState *state, Stream *str);
void drawPngImage(GfxState *state, Stream *str, int width, int height,
GfxImageColorMap *colorMap, GBool isMask = gFalse);
diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index 1881e2be..a8ede422 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -358,11 +358,7 @@ int main(int argc, char *argv[]) {
else
rawOrder = singleHtml;
-#ifdef DISABLE_OUTLINE
- doOutline = gFalse;
-#else
doOutline = doc->getOutline()->getItems() != nullptr;
-#endif
// write text file
htmlOut = new HtmlOutputDev(doc->getCatalog(), htmlFileName->getCString(),
docTitle->getCString(),
commit cd53c552e75d47a1c1d60953989192271a452c0b
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Sep 23 19:11:12 2018 +0200
Remove ENABLE_PLUGINS
We're never defining it, so just stop carrying it
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56036307..f2870d8b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -391,7 +391,6 @@ set(poppler_SRCS
poppler/StdinPDFDocBuilder.cc
poppler/Sound.cc
poppler/ViewerPreferences.cc
- poppler/XpdfPluginAPI.cc
poppler/Movie.cc
poppler/Rendition.cc
)
@@ -567,7 +566,6 @@ if(ENABLE_XPDF_HEADERS)
poppler/StdinCachedFile.h
poppler/StdinPDFDocBuilder.h
poppler/UTF.h
- poppler/XpdfPluginAPI.h
poppler/Sound.h
${CMAKE_CURRENT_BINARY_DIR}/poppler/poppler-config.h
DESTINATION include/poppler)
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 0544a9ee..097386c1 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -54,11 +54,6 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
-#ifdef ENABLE_PLUGINS
-# ifndef _WIN32
-# include <dlfcn.h>
-# endif
-#endif
#ifdef _WIN32
# include <shlobj.h>
# include <mbstring.h>
@@ -76,9 +71,6 @@
#include "CMap.h"
#include "BuiltinFontTables.h"
#include "FontEncodingTables.h"
-#ifdef ENABLE_PLUGINS
-# include "XpdfPluginAPI.h"
-#endif
#include "GlobalParams.h"
#include "GfxFont.h"
@@ -100,12 +92,6 @@
#include "UnicodeMapTables.h"
#include "UnicodeMapFuncs.h"
-#ifdef ENABLE_PLUGINS
-# ifdef _WIN32
-extern XpdfPluginVecTable xpdfPluginVecTable;
-# endif
-#endif
-
//------------------------------------------------------------------------
#define cidToUnicodeCacheSize 4
@@ -387,146 +373,6 @@ SysFontInfo *SysFontList::find(const GooString *name, GBool fixedWidth, GBool ex
}
-#ifdef ENABLE_PLUGINS
-//------------------------------------------------------------------------
-// Plugin
-//------------------------------------------------------------------------
-
-class Plugin {
-public:
-
- static Plugin *load(char *type, char *name);
- ~Plugin();
-
-private:
-
-#ifdef _WIN32
- Plugin(HMODULE libA);
- HMODULE lib;
-#else
- Plugin(void *dlA);
- void *dl;
-#endif
-};
-
-Plugin *Plugin::load(char *type, char *name) {
- GooString *path;
- Plugin *plugin;
- XpdfPluginVecTable *vt;
- XpdfBool (*xpdfInitPlugin)(void);
-#ifdef _WIN32
- HMODULE libA;
-#else
- void *dlA;
-#endif
-
- path = new GooString(POPPLER_DATADIR);
- appendToPath(path, "plugins");
- appendToPath(path, type);
- appendToPath(path, name);
-
-#ifdef _WIN32
- path->append(".dll");
- if (!(libA = LoadLibrary(path->getCString()))) {
- error(errIO, -1, "Failed to load plugin '{0:t}'", path);
- goto err1;
- }
- if (!(vt = (XpdfPluginVecTable *)
- GetProcAddress(libA, "xpdfPluginVecTable"))) {
- error(errIO, -1, "Failed to find xpdfPluginVecTable in plugin '{0:t}'",
- path);
- goto err2;
- }
-#else
- //~ need to deal with other extensions here
- path->append(".so");
- if (!(dlA = dlopen(path->getCString(), RTLD_NOW))) {
- error(errIO, -1, "Failed to load plugin '{0:t}': {1:s}",
- path, dlerror());
- goto err1;
- }
- if (!(vt = (XpdfPluginVecTable *)dlsym(dlA, "xpdfPluginVecTable"))) {
- error(errIO, -1, "Failed to find xpdfPluginVecTable in plugin '{0:t}'",
- path);
- goto err2;
- }
-#endif
-
- if (vt->version != xpdfPluginVecTable.version) {
- error(errIO, -1, "Plugin '{0:t}' is wrong version", path);
- goto err2;
- }
- memcpy(vt, &xpdfPluginVecTable, sizeof(xpdfPluginVecTable));
-
-#ifdef _WIN32
- if (!(xpdfInitPlugin = (XpdfBool (*)(void))
- GetProcAddress(libA, "xpdfInitPlugin"))) {
- error(errIO, -1, "Failed to find xpdfInitPlugin in plugin '{0:t}'",
- path);
- goto err2;
- }
-#else
- if (!(xpdfInitPlugin = (XpdfBool (*)(void))dlsym(dlA, "xpdfInitPlugin"))) {
- error(errIO, -1, "Failed to find xpdfInitPlugin in plugin '{0:t}'",
- path);
- goto err2;
- }
-#endif
-
- if (!(*xpdfInitPlugin)()) {
- error(errIO, -1, "Initialization of plugin '{0:t}' failed", path);
- goto err2;
- }
-
-#ifdef _WIN32
- plugin = new Plugin(libA);
-#else
- plugin = new Plugin(dlA);
-#endif
-
- delete path;
- return plugin;
-
- err2:
-#ifdef _WIN32
- FreeLibrary(libA);
-#else
- dlclose(dlA);
-#endif
- err1:
- delete path;
- return NULL;
-}
-
-#ifdef _WIN32
-Plugin::Plugin(HMODULE libA) {
- lib = libA;
-}
-#else
-Plugin::Plugin(void *dlA) {
- dl = dlA;
-}
-#endif
-
-Plugin::~Plugin() {
- void (*xpdfFreePlugin)(void);
-
-#ifdef _WIN32
- if ((xpdfFreePlugin = (void (*)(void))
- GetProcAddress(lib, "xpdfFreePlugin"))) {
- (*xpdfFreePlugin)();
- }
- FreeLibrary(lib);
-#else
- if ((xpdfFreePlugin = (void (*)(void))dlsym(dl, "xpdfFreePlugin"))) {
- (*xpdfFreePlugin)();
- }
- dlclose(dl);
-#endif
-}
-
-#endif // ENABLE_PLUGINS
-
#define globalParamsLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
#define unicodeMapCacheLocker() std::unique_lock<std::recursive_mutex> locker(unicodeMapCacheMutex)
#define cMapCacheLocker() std::unique_lock<std::recursive_mutex> locker(cMapCacheMutex)
@@ -578,10 +424,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
cMapCache = new CMapCache();
baseFontsInitialized = gFalse;
-#ifdef ENABLE_PLUGINS
- plugins = new GooList();
- securityHandlers = new GooList();
-#endif
// set up the initial nameToUnicode tables
for (int i = 0; nameToUnicodeZapfDingbatsTab[i].name; ++i) {
@@ -724,11 +566,6 @@ GlobalParams::~GlobalParams() {
delete unicodeToUnicodeCache;
delete unicodeMapCache;
delete cMapCache;
-
-#ifdef ENABLE_PLUGINS
- delete securityHandlers;
- deleteGooList(plugins, Plugin);
-#endif
}
//------------------------------------------------------------------------
@@ -1461,59 +1298,3 @@ void GlobalParams::setErrQuiet(GBool errQuietA) {
globalParamsLocker();
errQuiet = errQuietA;
}
-
-void GlobalParams::addSecurityHandler(XpdfSecurityHandler *handler) {
-#ifdef ENABLE_PLUGINS
- globalParamsLocker();
- securityHandlers->append(handler);
-#endif
-}
-
-XpdfSecurityHandler *GlobalParams::getSecurityHandler(char *name) {
-#ifdef ENABLE_PLUGINS
- XpdfSecurityHandler *hdlr;
- int i;
-
- globalParamsLocker();
- for (i = 0; i < securityHandlers->getLength(); ++i) {
- hdlr = (XpdfSecurityHandler *)securityHandlers->get(i);
- if (!strcasecmp(hdlr->name, name)) {
- return hdlr;
- }
- }
-
- if (!loadPlugin("security", name)) {
- return NULL;
- }
-
- globalParamsLocker();
- for (i = 0; i < securityHandlers->getLength(); ++i) {
- hdlr = (XpdfSecurityHandler *)securityHandlers->get(i);
- if (!strcmp(hdlr->name, name)) {
- return hdlr;
- }
- }
-#else
- (void)name;
-#endif
-
- return nullptr;
-}
-
-#ifdef ENABLE_PLUGINS
-//------------------------------------------------------------------------
-// plugins
-//------------------------------------------------------------------------
-
-GBool GlobalParams::loadPlugin(char *type, char *name) {
- Plugin *plugin;
-
- if (!(plugin = Plugin::load(type, name))) {
- return gFalse;
- }
- globalParamsLocker();
- plugins->append(plugin);
- return gTrue;
-}
-
-#endif // ENABLE_PLUGINS
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 8850b246..500a6191 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -149,9 +149,6 @@ public:
UnicodeMap *getUnicodeMap(GooString *encodingName);
CMap *getCMap(const GooString *collection, GooString *cMapName, Stream *stream = NULL);
UnicodeMap *getTextEncoding();
-#ifdef ENABLE_PLUGINS
- GBool loadPlugin(char *type, char *name);
-#endif
GooList *getEncodingNames();
@@ -171,11 +168,6 @@ public:
static GBool parseYesNo2(const char *token, GBool *flag);
- //----- security handlers
-
- void addSecurityHandler(XpdfSecurityHandler *handler);
- XpdfSecurityHandler *getSecurityHandler(char *name);
-
private:
void parseNameToUnicode(const GooString *name);
@@ -236,12 +228,6 @@ private:
UnicodeMapCache *unicodeMapCache;
CMapCache *cMapCache;
-#ifdef ENABLE_PLUGINS
- GooList *plugins; // list of plugins [Plugin]
- GooList *securityHandlers; // list of loaded security handlers
- // [XpdfSecurityHandler]
-#endif
-
mutable std::recursive_mutex mutex;
mutable std::recursive_mutex unicodeMapCacheMutex;
mutable std::recursive_mutex cMapCacheMutex;
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index 3a1eb82b..d11b2016 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -34,9 +34,6 @@
#include "Decrypt.h"
#include "Error.h"
#include "GlobalParams.h"
-#ifdef ENABLE_PLUGINS
-# include "XpdfPluginAPI.h"
-#endif
#include "SecurityHandler.h"
#include <limits.h>
@@ -47,25 +44,13 @@
SecurityHandler *SecurityHandler::make(PDFDoc *docA, Object *encryptDictA) {
SecurityHandler *secHdlr;
-#ifdef ENABLE_PLUGINS
- XpdfSecurityHandler *xsh;
-#endif
Object filterObj = encryptDictA->dictLookup("Filter");
if (filterObj.isName("Standard")) {
secHdlr = new StandardSecurityHandler(docA, encryptDictA);
} else if (filterObj.isName()) {
-#ifdef ENABLE_PLUGINS
- if ((xsh = globalParams->getSecurityHandler(filterObj.getName()))) {
- secHdlr = new ExternalSecurityHandler(docA, encryptDictA, xsh);
- } else {
-#endif
- error(errSyntaxError, -1, "Couldn't find the '{0:s}' security handler",
- filterObj.getName());
- secHdlr = nullptr;
-#ifdef ENABLE_PLUGINS
- }
-#endif
+ error(errSyntaxError, -1, "Couldn't find the '{0:s}' security handler", filterObj.getName());
+ secHdlr = nullptr;
} else {
error(errSyntaxError, -1,
"Missing or invalid 'Filter' entry in encryption dictionary");
@@ -360,80 +345,3 @@ GBool StandardSecurityHandler::authorize(void *authData) {
return gTrue;
}
-#ifdef ENABLE_PLUGINS
-
-//------------------------------------------------------------------------
-// ExternalSecurityHandler
-//------------------------------------------------------------------------
-
-ExternalSecurityHandler::ExternalSecurityHandler(PDFDoc *docA,
- Object *encryptDictA,
- XpdfSecurityHandler *xshA):
- SecurityHandler(docA)
-{
- encryptDictA->copy(&encryptDict);
- xsh = xshA;
- encAlgorithm = cryptRC4; //~ this should be obtained via getKey
- ok = gFalse;
-
- if (!(*xsh->newDoc)(xsh->handlerData, (XpdfDoc)docA,
- (XpdfObject)encryptDictA, &docData)) {
- return;
- }
-
- ok = gTrue;
-}
-
-ExternalSecurityHandler::~ExternalSecurityHandler() {
- (*xsh->freeDoc)(xsh->handlerData, docData);
-}
-
-void *ExternalSecurityHandler::makeAuthData(GooString *ownerPassword,
- GooString *userPassword) {
- char *opw, *upw;
- void *authData;
-
- opw = ownerPassword ? ownerPassword->getCString() : (char *)NULL;
- upw = userPassword ? userPassword->getCString() : (char *)NULL;
- if (!(*xsh->makeAuthData)(xsh->handlerData, docData, opw, upw, &authData)) {
- return NULL;
- }
- return authData;
-}
-
-void *ExternalSecurityHandler::getAuthData() {
- void *authData;
-
- if (!(*xsh->getAuthData)(xsh->handlerData, docData, &authData)) {
- return NULL;
- }
- return authData;
-}
-
-void ExternalSecurityHandler::freeAuthData(void *authData) {
- (*xsh->freeAuthData)(xsh->handlerData, docData, authData);
-}
-
-GBool ExternalSecurityHandler::authorize(void *authData) {
- char *key;
- int length;
-
- if (!ok) {
- return gFalse;
- }
- permFlags = (*xsh->authorize)(xsh->handlerData, docData, authData);
- if (!(permFlags & xpdfPermissionOpen)) {
- return gFalse;
- }
- if (!(*xsh->getKey)(xsh->handlerData, docData, &key, &length, &encVersion, &encRevision)) {
- return gFalse;
- }
- if ((fileKeyLength = length) > 16) {
- fileKeyLength = 16;
- }
- memcpy(fileKey, key, fileKeyLength);
- (*xsh->freeKey)(xsh->handlerData, docData, key, length);
- return gTrue;
-}
-
-#endif // ENABLE_PLUGINS
diff --git a/poppler/SecurityHandler.h b/poppler/SecurityHandler.h
index ed871b7f..1b72ae41 100644
--- a/poppler/SecurityHandler.h
+++ b/poppler/SecurityHandler.h
@@ -143,44 +143,4 @@ private:
GBool ok;
};
-#ifdef ENABLE_PLUGINS
-//------------------------------------------------------------------------
-// ExternalSecurityHandler
-//------------------------------------------------------------------------
-
-class ExternalSecurityHandler: public SecurityHandler {
-public:
-
- ExternalSecurityHandler(PDFDoc *docA, Object *encryptDictA,
- XpdfSecurityHandler *xshA);
- virtual ~ExternalSecurityHandler();
-
- virtual void *makeAuthData(GooString *ownerPassword,
- GooString *userPassword);
- virtual void *getAuthData();
- virtual void freeAuthData(void *authData);
- virtual GBool authorize(void *authData);
- virtual int getPermissionFlags() { return permFlags; }
- virtual GBool getOwnerPasswordOk() { return gFalse; }
- virtual Guchar *getFileKey() { return fileKey; }
- virtual int getFileKeyLength() { return fileKeyLength; }
- virtual int getEncVersion() { return encVersion; }
- virtual int getEncRevision() { return encRevision; }
- virtual CryptAlgorithm getEncAlgorithm() { return encAlgorithm; }
-
-private:
-
- Object encryptDict;
- XpdfSecurityHandler *xsh;
- void *docData;
- int permFlags;
- Guchar fileKey[16];
- int fileKeyLength;
- int encVersion;
- int encRevision;
- CryptAlgorithm encAlgorithm;
- GBool ok;
-};
-#endif // ENABLE_PLUGINS
-
#endif
diff --git a/poppler/XpdfPluginAPI.cc b/poppler/XpdfPluginAPI.cc
deleted file mode 100644
index 834c681d..00000000
--- a/poppler/XpdfPluginAPI.cc
+++ /dev/null
@@ -1,243 +0,0 @@
-//========================================================================
-//
-// XpdfPluginAPI.cc
-//
-// Copyright 2004 Glyph & Cog, LLC
-//
-//========================================================================
-
-//========================================================================
-//
-// 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 Kovid Goyal <kovid at kovidgoyal.net>
-// Copyright (C) 2012 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 ENABLE_PLUGINS
-
-#include "gmem.h"
-#include "GlobalParams.h"
-#include "Object.h"
-#include "PDFDoc.h"
-#include "XpdfPluginAPI.h"
-
-//------------------------------------------------------------------------
-
-//~ This should use a pool of Objects; change xpdfFreeObj to match.
-static Object *allocObj() {
- return (Object *)gmalloc(sizeof(Object));
-}
-
-//------------------------------------------------------------------------
-// Document access functions
-//------------------------------------------------------------------------
-
-XpdfObject _xpdfGetInfoDict(XpdfDoc doc) {
- Object *obj;
-
- obj = allocObj();
- return (XpdfObject)((PDFDoc *)doc)->getDocInfo(obj);
-}
-
-XpdfObject _xpdfGetCatalog(XpdfDoc doc) {
- Object *obj;
-
- obj = allocObj();
- return (XpdfObject)((PDFDoc *)doc)->getXRef()->getCatalog(obj);
-}
-
-//------------------------------------------------------------------------
-// Object access functions.
-//------------------------------------------------------------------------
-
-XpdfBool _xpdfObjIsBool(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isBool();
-}
-
-XpdfBool _xpdfObjIsInt(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isInt();
-}
-
-XpdfBool _xpdfObjIsReal(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isReal();
-}
-
-XpdfBool _xpdfObjIsNumber(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isNum();
-}
-
-XpdfBool _xpdfObjIsString(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isString();
-}
-
-XpdfBool _xpdfObjIsName(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isName();
-}
-
-XpdfBool _xpdfObjIsNull(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isNull();
-}
-
-XpdfBool _xpdfObjIsArray(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isArray();
-}
-
-XpdfBool _xpdfObjIsDict(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isDict();
-}
-
-XpdfBool _xpdfObjIsStream(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isStream();
-}
-
-XpdfBool _xpdfObjIsRef(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->isRef();
-}
-
-XpdfBool _xpdfBoolValue(XpdfObject obj) {
- return (XpdfBool)((Object *)obj)->getBool();
-}
-
-int _xpdfIntValue(XpdfObject obj) {
- if (!((Object *)obj)->isInt()) {
- return 0;
- }
- return ((Object *)obj)->getInt();
-}
-
-double _xpdfRealValue(XpdfObject obj) {
- if (!((Object *)obj)->isReal()) {
- return 0;
- }
- return ((Object *)obj)->getReal();
-}
-
-double _xpdfNumberValue(XpdfObject obj) {
- if (!((Object *)obj)->isNum()) {
- return 0;
- }
- return ((Object *)obj)->getNum();
-}
-
-int _xpdfStringLength(XpdfObject obj) {
- if (!((Object *)obj)->isString()) {
- return 0;
- }
- return ((Object *)obj)->getString()->getLength();
-}
-
-char *_xpdfStringValue(XpdfObject obj) {
- if (!((Object *)obj)->isString()) {
- return 0;
- }
- return ((Object *)obj)->getString()->getCString();
-}
-
-char *_xpdfNameValue(XpdfObject obj) {
- if (!((Object *)obj)->isName()) {
- return NULL;
- }
- return ((Object *)obj)->getName();
-}
-
-int _xpdfArrayLength(XpdfObject obj) {
- if (!((Object *)obj)->isArray()) {
- return 0;
- }
- return ((Object *)obj)->arrayGetLength();
-}
-
-XpdfObject _xpdfArrayGet(XpdfObject obj, int idx) {
- Object *elem;
-
- elem = allocObj();
- if (!((Object *)obj)->isArray()) {
- return (XpdfObject)elem->initNull();
- }
- return (XpdfObject)((Object *)obj)->arrayGet(idx, elem);
-}
-
-XpdfObject _xpdfDictGet(XpdfObject obj, char *key) {
- Object *elem;
-
- elem = allocObj();
- if (!((Object *)obj)->isDict()) {
- return (XpdfObject)elem->initNull();
- }
- return (XpdfObject)((Object *)obj)->dictLookup(key, elem);
-}
-
-void _xpdfFreeObj(XpdfObject obj) {
- ((Object *)obj)->free();
- gfree(obj);
-}
-
-//------------------------------------------------------------------------
-// Memory allocation functions
-//------------------------------------------------------------------------
-
-void *_xpdfMalloc(int size) {
- return gmalloc(size);
-}
-
-void *_xpdfRealloc(void *p, int size) {
- return grealloc(p, size);
-}
-
-void _xpdfFree(void *p) {
- gfree(p);
-}
-
-//------------------------------------------------------------------------
-// Security handlers
-//------------------------------------------------------------------------
-
-void _xpdfRegisterSecurityHandler(XpdfSecurityHandler *handler) {
- if (handler->version <= xpdfPluginAPIVersion) {
- globalParams->addSecurityHandler(handler);
- }
-}
-
-//------------------------------------------------------------------------
-
-XpdfPluginVecTable xpdfPluginVecTable = {
- xpdfPluginAPIVersion,
- &_xpdfGetInfoDict,
- &_xpdfGetCatalog,
- &_xpdfObjIsBool,
- &_xpdfObjIsInt,
- &_xpdfObjIsReal,
- &_xpdfObjIsString,
- &_xpdfObjIsName,
- &_xpdfObjIsNull,
- &_xpdfObjIsArray,
- &_xpdfObjIsDict,
- &_xpdfObjIsStream,
- &_xpdfObjIsRef,
- &_xpdfBoolValue,
- &_xpdfIntValue,
- &_xpdfRealValue,
- &_xpdfStringLength,
- &_xpdfStringValue,
- &_xpdfNameValue,
- &_xpdfArrayLength,
- &_xpdfArrayGet,
- &_xpdfDictGet,
- &_xpdfFreeObj,
- &_xpdfMalloc,
- &_xpdfRealloc,
- &_xpdfFree,
- &_xpdfRegisterSecurityHandler,
-};
-
-#endif // ENABLE_PLUGINS
diff --git a/poppler/XpdfPluginAPI.h b/poppler/XpdfPluginAPI.h
deleted file mode 100644
index 6ed890a8..00000000
--- a/poppler/XpdfPluginAPI.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * XpdfPluginAPI.h
- *
- * Copyright 2004 Glyph & Cog, LLC
- */
-
-//========================================================================
-//
-// 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) 2012 Albert Astals Cid <aacid at kde.org>
-// Copyright (C) 2014 Bogdan Cristea <cristeab at gmail.com>
-// Copyright (C) 2014 Peter Breitenlohner <peb at mppmu.mpg.de>
-//
-// 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
-//
-//========================================================================
-
-#ifndef XPDFPLUGINAPI_H
-#define XPDFPLUGINAPI_H
-
-#ifdef _WIN32
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#include <windows.h>
-#else
-#define Object XtObject
-#include <X11/Intrinsic.h>
-#undef Object
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*------------------------------------------------------------------------
- * Macros
- *------------------------------------------------------------------------*/
-
-/*
- * The current API version.
- */
-#define xpdfPluginAPIVersion 1
-
-#ifdef _WIN32
-# ifdef __cplusplus
-# define PLUGINFUNC(retType) extern "C" __declspec(dllexport) retType
-# else
-# define PLUGINFUNC(retType) extern __declspec(dllexport) retType
-# endif
-#else
-# ifdef __cplusplus
-# define PLUGINFUNC(retType) extern "C" retType
-# else
-# define PLUGINFUNC(retType) extern retType
-# endif
-#endif
-
-/*------------------------------------------------------------------------
- * Plugin setup/cleanup
- *------------------------------------------------------------------------*/
-
-/*
- * All plugins are required to implement two functions:
- *
- * -- Initialize the plugin. Returns non-zero if successful.
- * PLUGINFUNC(XpdfBool) xpdfInitPlugin(void);
- *
- * -- Free the plugin.
- * PLUGINFUNC(void) xpdfFreePlugin(void);
- */
-
-/*------------------------------------------------------------------------
- * Types
- *------------------------------------------------------------------------*/
-
-/*
- * Standard C boolean -- zero = false, non-zero = true.
- */
-typedef int XpdfBool;
-#define xpdfTrue 1
-#define xpdfFalse 0
-
-/*
- * PDF document handle.
- */
-typedef struct _XpdfDoc *XpdfDoc;
-
-/*
- * PDF object handle.
- */
-typedef struct _XpdfObject *XpdfObject;
-
-/*
- * Document access permissions. Any of these can be bitwise 'or'ed
- * together. If xpdfPermissionOpen is not included, the document
- * cannot be opened at all, and the other bits are ignored.
- */
-typedef unsigned int XpdfPermission;
-#define xpdfPermissionOpen (1 << 0)
-#define xpdfPermissionPrint (1 << 2)
-#define xpdfPermissionChange (1 << 3)
-#define xpdfPermissionCopy (1 << 4)
-#define xpdfPermissionNotes (1 << 5)
-
-/*------------------------------------------------------------------------
- * Security handler
- *------------------------------------------------------------------------*/
-
-/*
- * XpdfSecurityHandler - a security handler plugin should create one
- * of these and pass it to xpdfRegisterSecurityHandler.
- */
-#ifdef __cplusplus
-struct XpdfSecurityHandler {
-#else
-typedef struct {
-#endif
-
- /*
- * Version of the security handler spec (this document) -- use
- * xpdfPluginAPIVersion.
- */
- int version;
-
- /*
- * Security handler name.
- */
- char *name;
-
- /*
- * Any global data the security handler needs. XpdfViewer will pass
- * this pointer to all handler functions as the <handlerData>
- * argument.
- */
- void *handlerData;
-
- /*
- * Allocate and initialize data for a new document. XpdfViewer will
- * pass the returned pointer to all other handler functions as the
- * <docData> argument. Returns non-zero if successful.
- */
- XpdfBool (*newDoc)(void *handlerData, XpdfDoc doc,
- XpdfObject encryptDict, void **docData);
-
- /*
- * Free the data allocated by newDoc.
- */
- void (*freeDoc)(void *handlerData, void *docData);
-
- /*
- * Construct authorization data based on the supplied owner and user
- * passwords (either or both of which may be NULL). This function
- * is called in "batch" mode, i.e., if the password was supplied on
- * the command line or via an Xpdf library API. It should not
- * generate any user interaction (e.g., a password dialog). It is
- * not required to support this function: the makeAuthData function
- * pointer can be set to NULL. Returns non-zero if successful.
- */
- XpdfBool (*makeAuthData)(void *handlerData, void *docData,
- char *ownerPassword, char *userPassword,
- void **authData);
-
- /*
- * Request any needed information (e.g., a password) from the user,
- * and construct an authorization data object. Returns non-zero if
- * successful.
- */
- XpdfBool (*getAuthData)(void *handlerData, void *docData,
- void **authData);
-
- /*
- * Free the data allocated by getAuthData.
- */
- void (*freeAuthData)(void *handlerData, void *docData,
- void *authData);
-
- /*
- * Request permission to access the document. This returns all
- * permissions granted by authData.
- */
- XpdfPermission (*authorize)(void *handlerData, void *docData,
- void *authData);
-
- /*
- * Get the decryption key and algorithm version associated with the
- * document. Returns non-zero if successful.
- */
- XpdfBool (*getKey)(void *handlerData, void *docData,
- char **key, int *keyLen, int *cryptVersion, int *cryptRevision);
-
- /*
- * Free the data allocated by getKey.
- */
- void (*freeKey)(void *handlerData, void *docData,
- char *key, int keyLen);
-
-#ifdef __cplusplus
-};
-#else
-} XpdfSecurityHandler;
-#endif
-
-/*------------------------------------------------------------------------*/
-
-typedef struct {
- int version;
-
-/*------------------------------------------------------------------------
- * Document access functions
- *------------------------------------------------------------------------*/
-
-/*
- * Get a document's info dictionary. (The returned object must be
- * freed with xpdfFreeObj.)
- */
-XpdfObject (*_xpdfGetInfoDict)(XpdfDoc doc);
-
-/*
- * Get a document's catalog ("root") dictionary. (The returned object
- * must be freed with xpdfFreeObj.)
- */
-XpdfObject (*_xpdfGetCatalog)(XpdfDoc doc);
-
-/*------------------------------------------------------------------------
- * Object access functions
- *------------------------------------------------------------------------*/
-
-/*
- * Check an object's type.
- */
-XpdfBool (*_xpdfObjIsBool)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsInt)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsReal)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsString)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsName)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsNull)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsArray)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsDict)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsStream)(XpdfObject obj);
-XpdfBool (*_xpdfObjIsRef)(XpdfObject obj);
-
-/*
- * Value access.
- * (Objects returned by xpdfArrayGet and xpdfDictGet must be freed
- * with xpdfFreeObj.)
- */
-XpdfBool (*_xpdfBoolValue)(XpdfObject obj);
-int (*_xpdfIntValue)(XpdfObject obj);
-double (*_xpdfRealValue)(XpdfObject obj);
-int (*_xpdfStringLength)(XpdfObject obj);
-char *(*_xpdfStringValue)(XpdfObject obj);
-char *(*_xpdfNameValue)(XpdfObject obj);
-int (*_xpdfArrayLength)(XpdfObject obj);
-XpdfObject (*_xpdfArrayGet)(XpdfObject obj, int idx);
-XpdfObject (*_xpdfDictGet)(XpdfObject obj, char *key);
-
-/*
- * Object destruction. NB: *all* objects must be freed after use.
- */
-void (*_xpdfFreeObj)(XpdfObject obj);
-
-/*------------------------------------------------------------------------
- * Memory allocation functions
- *------------------------------------------------------------------------*/
-
-void *(*_xpdfMalloc)(int size);
-void *(*_xpdfRealloc)(void *p, int size);
-void (*_xpdfFree)(void *p);
-
-/*------------------------------------------------------------------------
- * Security handler functions
- *------------------------------------------------------------------------*/
-
-/*
- * Register a new security handler.
- */
-void (*_xpdfRegisterSecurityHandler)(XpdfSecurityHandler *handler);
-
-/*------------------------------------------------------------------------*/
-
-} XpdfPluginVecTable;
-
-#ifdef _WIN32
-
-extern __declspec(dllexport) XpdfPluginVecTable xpdfPluginVecTable;
-
-#define xpdfPluginSetup \
- extern __declspec(dllexport) \
- XpdfPluginVecTable xpdfPluginVecTable = {xpdfPluginAPIVersion};
-
-#else
-
-extern XpdfPluginVecTable xpdfPluginVecTable;
-
-#define xpdfPluginSetup \
- XpdfPluginVecTable xpdfPluginVecTable = {xpdfPluginAPIVersion};
-
-#endif
-
-#define xpdfGetInfoDict (*xpdfPluginVecTable._xpdfGetInfoDict)
-#define xpdfGetCatalog (*xpdfPluginVecTable._xpdfGetCatalog)
-#ifdef _WIN32
-#define xpdfWin32GetWindow (*xpdfPluginVecTable._xpdfWin32GetWindow)
-#else
-#define xpdfXGetWindow (*xpdfPluginVecTable._xpdfXGetWindow)
-#endif
-#define xpdfObjIsBool (*xpdfPluginVecTable._xpdfObjIsBool)
-#define xpdfObjIsInt (*xpdfPluginVecTable._xpdfObjIsInt)
-#define xpdfObjIsReal (*xpdfPluginVecTable._xpdfObjIsReal)
-#define xpdfObjIsString (*xpdfPluginVecTable._xpdfObjIsString)
-#define xpdfObjIsName (*xpdfPluginVecTable._xpdfObjIsName)
-#define xpdfObjIsNull (*xpdfPluginVecTable._xpdfObjIsNull)
-#define xpdfObjIsArray (*xpdfPluginVecTable._xpdfObjIsArray)
-#define xpdfObjIsDict (*xpdfPluginVecTable._xpdfObjIsDict)
-#define xpdfObjIsStream (*xpdfPluginVecTable._xpdfObjIsStream)
-#define xpdfObjIsRef (*xpdfPluginVecTable._xpdfObjIsRef)
-#define xpdfBoolValue (*xpdfPluginVecTable._xpdfBoolValue)
-#define xpdfIntValue (*xpdfPluginVecTable._xpdfIntValue)
-#define xpdfRealValue (*xpdfPluginVecTable._xpdfRealValue)
-#define xpdfStringLength (*xpdfPluginVecTable._xpdfStringLength)
-#define xpdfStringValue (*xpdfPluginVecTable._xpdfStringValue)
-#define xpdfNameValue (*xpdfPluginVecTable._xpdfNameValue)
-#define xpdfArrayLength (*xpdfPluginVecTable._xpdfArrayLength)
-#define xpdfArrayGet (*xpdfPluginVecTable._xpdfArrayGet)
-#define xpdfDictGet (*xpdfPluginVecTable._xpdfDictGet)
-#define xpdfFreeObj (*xpdfPluginVecTable._xpdfFreeObj)
-#define xpdfMalloc (*xpdfPluginVecTable._xpdfMalloc)
-#define xpdfRealloc (*xpdfPluginVecTable._xpdfRealloc)
-#define xpdfFree (*xpdfPluginVecTable._xpdfFree)
-#define xpdfRegisterSecurityHandler (*xpdfPluginVecTable._xpdfRegisterSecurityHandler)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index bd93f282..ec69d456 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -116,8 +116,7 @@
#endif
// Also, there are preprocessor symbols in the header files
-// that are used but never defined when building poppler using configure
-// or cmake: DISABLE_OUTLINE, ENABLE_PLUGINS, DEBUG_FORMS
+// that are used but never defined when building poppler: DISABLE_OUTLINE, DEBUG_FORMS
//------------------------------------------------------------------------
// version
commit e84b9e58e0e644f30e104850969a8255d59b9971
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Sep 23 19:07:00 2018 +0200
More const
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
index f2080472..5a4d131a 100644
--- a/glib/poppler-private.h
+++ b/glib/poppler-private.h
@@ -102,7 +102,7 @@ struct _PopplerStructureElement
/*< private >*/
GObject parent_instance;
PopplerDocument *document;
- StructElement *elem;
+ const StructElement *elem;
};
GList *_poppler_document_get_layers (PopplerDocument *document);
diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc
index 38a6f62f..6ee8bc65 100644
--- a/glib/poppler-structure-element.cc
+++ b/glib/poppler-structure-element.cc
@@ -53,7 +53,7 @@ typedef struct _PopplerStructureElementClass
G_DEFINE_TYPE (PopplerStructureElement, poppler_structure_element, G_TYPE_OBJECT)
static PopplerStructureElement *
-_poppler_structure_element_new (PopplerDocument *document, StructElement *element)
+_poppler_structure_element_new (PopplerDocument *document, const StructElement *element)
{
PopplerStructureElement *poppler_structure_element;
@@ -537,7 +537,7 @@ poppler_structure_element_get_id (PopplerStructureElement *poppler_structure_ele
g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), NULL);
g_return_val_if_fail (poppler_structure_element->elem != nullptr, NULL);
- GooString *string = poppler_structure_element->elem->getID ();
+ const GooString *string = poppler_structure_element->elem->getID ();
return string ? _poppler_goo_string_to_utf8 (string) : nullptr;
}
@@ -557,7 +557,7 @@ poppler_structure_element_get_title (PopplerStructureElement *poppler_structure_
g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), NULL);
g_return_val_if_fail (poppler_structure_element->elem != nullptr, NULL);
- GooString *string = poppler_structure_element->elem->getTitle ();
+ const GooString *string = poppler_structure_element->elem->getTitle ();
return string ? _poppler_goo_string_to_utf8 (string) : nullptr;
}
@@ -583,7 +583,7 @@ poppler_structure_element_get_abbreviation (PopplerStructureElement *poppler_str
if (poppler_structure_element->elem->getType () != StructElement::Span)
return nullptr;
- GooString *string = poppler_structure_element->elem->getExpandedAbbr ();
+ const GooString *string = poppler_structure_element->elem->getExpandedAbbr ();
return string ? _poppler_goo_string_to_utf8 (string) : nullptr;
}
@@ -605,7 +605,7 @@ poppler_structure_element_get_language (PopplerStructureElement *poppler_structu
g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), NULL);
g_return_val_if_fail (poppler_structure_element->elem != nullptr, NULL);
- GooString *string = poppler_structure_element->elem->getLanguage ();
+ const GooString *string = poppler_structure_element->elem->getLanguage ();
return string ? _poppler_goo_string_to_utf8 (string) : nullptr;
}
@@ -631,7 +631,7 @@ poppler_structure_element_get_alt_text (PopplerStructureElement *poppler_structu
g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), NULL);
g_return_val_if_fail (poppler_structure_element->elem != nullptr, NULL);
- GooString *string = poppler_structure_element->elem->getAltText ();
+ const GooString *string = poppler_structure_element->elem->getAltText ();
return string ? _poppler_goo_string_to_utf8 (string) : nullptr;
}
@@ -659,7 +659,7 @@ poppler_structure_element_get_actual_text (PopplerStructureElement *poppler_stru
g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), NULL);
g_return_val_if_fail (poppler_structure_element->elem != nullptr, NULL);
- GooString *string = poppler_structure_element->elem->getActualText ();
+ const GooString *string = poppler_structure_element->elem->getActualText ();
return string ? _poppler_goo_string_to_utf8 (string) : nullptr;
}
@@ -695,8 +695,8 @@ struct _PopplerStructureElementIter
{
PopplerDocument *document;
union {
- StructElement *elem;
- StructTreeRoot *root;
+ const StructElement *elem;
+ const StructTreeRoot *root;
};
gboolean is_root;
unsigned index;
@@ -792,11 +792,10 @@ PopplerStructureElementIter *
poppler_structure_element_iter_new (PopplerDocument *poppler_document)
{
PopplerStructureElementIter *iter;
- StructTreeRoot *root;
g_return_val_if_fail (POPPLER_IS_DOCUMENT (poppler_document), NULL);
- root = poppler_document->doc->getStructTreeRoot ();
+ const StructTreeRoot *root = poppler_document->doc->getStructTreeRoot ();
if (root == nullptr)
return nullptr;
@@ -850,11 +849,9 @@ poppler_structure_element_iter_next (PopplerStructureElementIter *iter)
PopplerStructureElement *
poppler_structure_element_iter_get_element (PopplerStructureElementIter *iter)
{
- StructElement *elem;
-
g_return_val_if_fail (iter != nullptr, NULL);
- elem = iter->is_root
+ const StructElement *elem = iter->is_root
? iter->root->getChild (iter->index)
: iter->elem->getChild (iter->index);
@@ -876,7 +873,7 @@ poppler_structure_element_iter_get_element (PopplerStructureElementIter *iter)
PopplerStructureElementIter *
poppler_structure_element_iter_get_child (PopplerStructureElementIter *parent)
{
- StructElement *elem;
+ const StructElement *elem;
g_return_val_if_fail (parent != nullptr, NULL);
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index ae83e8f4..75efab1b 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -127,7 +127,7 @@ public:
Object lookupGState(const char *name);
Object lookupGStateNF(const char *name);
- GfxResources *getNext() { return next; }
+ GfxResources *getNext() const { return next; }
private:
GfxFont *doLookupFont(const char *name) const;
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index cd109045..a401ff09 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -198,9 +198,9 @@ public:
~GfxColorTransform();
GfxColorTransform(const GfxColorTransform &) = delete;
GfxColorTransform& operator=(const GfxColorTransform &) = delete;
- int getIntent() { return cmsIntent; }
- int getInputPixelType() { return inputPixelType; }
- int getTransformPixelType() { return transformPixelType; }
+ int getIntent() const { return cmsIntent; }
+ int getInputPixelType() const { return inputPixelType; }
+ int getTransformPixelType() const { return transformPixelType; }
void ref();
unsigned int unref();
private:
@@ -267,7 +267,7 @@ public:
virtual GBool isNonMarking() { return gFalse; }
// Return the color space's overprint mask.
- Guint getOverprintMask() { return overprintMask; }
+ Guint getOverprintMask() const { return overprintMask; }
// Return the number of color space modes
static int getNumColorSpaceModes();
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index aded0dad..5a89e1d4 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -134,8 +134,8 @@ PDFDoc::PDFDoc()
init();
}
-PDFDoc::PDFDoc(GooString *fileNameA, GooString *ownerPassword,
- GooString *userPassword, void *guiDataA) {
+PDFDoc::PDFDoc(const GooString *fileNameA, const GooString *ownerPassword,
+ const GooString *userPassword, void *guiDataA) {
#ifdef _WIN32
int n, i;
#endif
@@ -218,8 +218,8 @@ PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword,
}
#endif
-PDFDoc::PDFDoc(BaseStream *strA, GooString *ownerPassword,
- GooString *userPassword, void *guiDataA) {
+PDFDoc::PDFDoc(BaseStream *strA, const GooString *ownerPassword,
+ const GooString *userPassword, void *guiDataA) {
#ifdef _WIN32
int n, i;
#endif
@@ -246,7 +246,7 @@ PDFDoc::PDFDoc(BaseStream *strA, GooString *ownerPassword,
ok = setup(ownerPassword, userPassword);
}
-GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) {
+GBool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPassword) {
pdfdocLocker();
if (str->getLength() <= 0)
@@ -442,7 +442,7 @@ void PDFDoc::checkHeader() {
// We don't do the version check. Don't add it back in.
}
-GBool PDFDoc::checkEncryption(GooString *ownerPassword, GooString *userPassword) {
+GBool PDFDoc::checkEncryption(const GooString *ownerPassword, const GooString *userPassword) {
GBool encrypted;
GBool ret;
@@ -1969,7 +1969,7 @@ Outline *PDFDoc::getOutline()
}
#endif
-PDFDoc *PDFDoc::ErrorPDFDoc(int errorCode, GooString *fileNameA)
+PDFDoc *PDFDoc::ErrorPDFDoc(int errorCode, const GooString *fileNameA)
{
PDFDoc *doc = new PDFDoc();
doc->errCode = errorCode;
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index e57d96db..2fe982d3 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -118,35 +118,35 @@ enum PDFSubtypeConformance {
class PDFDoc {
public:
- PDFDoc(GooString *fileNameA, GooString *ownerPassword = NULL,
- GooString *userPassword = NULL, void *guiDataA = NULL);
+ PDFDoc(const GooString *fileNameA, const GooString *ownerPassword = NULL,
+ const GooString *userPassword = NULL, void *guiDataA = NULL);
#ifdef _WIN32
PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword = NULL,
GooString *userPassword = NULL, void *guiDataA = NULL);
#endif
- PDFDoc(BaseStream *strA, GooString *ownerPassword = NULL,
- GooString *userPassword = NULL, void *guiDataA = NULL);
+ PDFDoc(BaseStream *strA, const GooString *ownerPassword = NULL,
+ const GooString *userPassword = NULL, void *guiDataA = NULL);
~PDFDoc();
PDFDoc(const PDFDoc &) = delete;
PDFDoc& operator=(const PDFDoc &) = delete;
- static PDFDoc *ErrorPDFDoc(int errorCode, GooString *fileNameA = NULL);
+ static PDFDoc *ErrorPDFDoc(int errorCode, const GooString *fileNameA = NULL);
// Was PDF document successfully opened?
- GBool isOk() { return ok; }
+ GBool isOk() const { return ok; }
// Get the error code (if isOk() returns false).
- int getErrorCode() { return errCode; }
+ int getErrorCode() const { return errCode; }
// Get the error code returned by fopen() (if getErrorCode() ==
// errOpenFile).
- int getFopenErrno() { return fopenErrno; }
+ int getFopenErrno() const { return fopenErrno; }
// Get file name.
- GooString *getFileName() { return fileName; }
+ const GooString *getFileName() const { return fileName; }
#ifdef _WIN32
wchar_t *getFileNameU() { return fileNameU; }
#endif
@@ -156,16 +156,16 @@ public:
GBool checkLinearization();
// Get the xref table.
- XRef *getXRef() { return xref; }
+ XRef *getXRef() const { return xref; }
// Get catalog.
- Catalog *getCatalog() { return catalog; }
+ Catalog *getCatalog() const { return catalog; }
// Get optional content configuration
- OCGs *getOptContentConfig() { return catalog->getOptContentConfig(); }
+ OCGs *getOptContentConfig() const { return catalog->getOptContentConfig(); }
// Get base stream.
- BaseStream *getBaseStream() { return str; }
+ BaseStream *getBaseStream() const { return str; }
// Get page parameters.
double getPageMediaWidth(int page)
@@ -184,10 +184,10 @@ public:
// Return the contents of the metadata stream, or NULL if there is
// no metadata.
- GooString *readMetadata() { return catalog->readMetadata(); }
+ const GooString *readMetadata() const { return catalog->readMetadata(); }
// Return the structure tree root object.
- StructTreeRoot *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
+ const StructTreeRoot *getStructTreeRoot() const { return catalog->getStructTreeRoot(); }
// Get page.
Page *getPage(int page);
@@ -384,10 +384,10 @@ private:
PDFDoc();
void init();
- GBool setup(GooString *ownerPassword, GooString *userPassword);
+ GBool setup(const GooString *ownerPassword, const GooString *userPassword);
GBool checkFooter();
void checkHeader();
- GBool checkEncryption(GooString *ownerPassword, GooString *userPassword);
+ GBool checkEncryption(const GooString *ownerPassword, const GooString *userPassword);
void extractPDFSubtype();
// Get the offset of the start xref table.
@@ -400,7 +400,7 @@ private:
// Mark the document's Info dictionary as modified.
void setDocInfoModified(Object *infoObj);
- GooString *fileName;
+ const GooString *fileName;
#ifdef _WIN32
wchar_t *fileNameU;
#endif
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index 58012595..3a1eb82b 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -81,8 +81,8 @@ SecurityHandler::SecurityHandler(PDFDoc *docA) {
SecurityHandler::~SecurityHandler() {
}
-GBool SecurityHandler::checkEncryption(GooString *ownerPassword,
- GooString *userPassword) {
+GBool SecurityHandler::checkEncryption(const GooString *ownerPassword,
+ const GooString *userPassword) {
void *authData;
GBool ok;
int i;
@@ -321,8 +321,8 @@ GBool StandardSecurityHandler::isUnencrypted() {
return encVersion == -1 && encRevision == -1;
}
-void *StandardSecurityHandler::makeAuthData(GooString *ownerPassword,
- GooString *userPassword) {
+void *StandardSecurityHandler::makeAuthData(const GooString *ownerPassword,
+ const GooString *userPassword) {
return new StandardAuthData(ownerPassword ? ownerPassword->copy()
: nullptr,
userPassword ? userPassword->copy()
diff --git a/poppler/SecurityHandler.h b/poppler/SecurityHandler.h
index cc21b2ca..ed871b7f 100644
--- a/poppler/SecurityHandler.h
+++ b/poppler/SecurityHandler.h
@@ -63,14 +63,14 @@ public:
// document can be opened (if it's unencrypted, or if a correct
// password is obtained); false otherwise (encrypted and no correct
// password).
- GBool checkEncryption(GooString *ownerPassword,
- GooString *userPassword);
+ GBool checkEncryption(const GooString *ownerPassword,
+ const GooString *userPassword);
// Create authorization data for the specified owner and user
// passwords. If the security handler doesn't support "batch" mode,
// this function should return NULL.
- virtual void *makeAuthData(GooString *ownerPassword,
- GooString *userPassword) = 0;
+ virtual void *makeAuthData(const GooString *ownerPassword,
+ const GooString *userPassword) = 0;
// Construct authorization data, typically by prompting the user for
// a password. Returns an authorization data object, or NULL to
@@ -113,8 +113,8 @@ public:
~StandardSecurityHandler();
GBool isUnencrypted() override;
- void *makeAuthData(GooString *ownerPassword,
- GooString *userPassword) override;
+ void *makeAuthData(const GooString *ownerPassword,
+ const GooString *userPassword) override;
void *getAuthData() override;
void freeAuthData(void *authData) override;
GBool authorize(void *authData) override;
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 41708bd7..913a6c05 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -940,7 +940,7 @@ int main(int argc, char *argv[]) {
if (printMetadata) {
// print the metadata
- GooString *metadata = doc->readMetadata();
+ const GooString *metadata = doc->readMetadata();
if (metadata) {
fputs(metadata->getCString(), stdout);
fputc('\n', stdout);
More information about the poppler
mailing list