use upstream patch
This commit is contained in:
parent
f17cd7bb3f
commit
6cfed6b7dd
|
@ -1,297 +0,0 @@
|
|||
From 97ffea9503c57fc8aa222ca9f2f428d47467771e Mon Sep 17 00:00:00 2001
|
||||
From: David Tardon <dtardon@redhat.com>
|
||||
Date: Fri, 8 Sep 2017 09:23:29 +0200
|
||||
Subject: [PATCH] adapt to poppler 0.58
|
||||
|
||||
---
|
||||
configure.in | 17 +++++++++++++++++
|
||||
frmts/pdf/GNUmakefile | 4 ++++
|
||||
frmts/pdf/pdfdataset.cpp | 16 ++++++++++++++++
|
||||
frmts/pdf/pdfio.cpp | 18 ++++++++++++++++--
|
||||
frmts/pdf/pdfio.h | 13 ++++++++++++-
|
||||
frmts/pdf/pdfobject.cpp | 26 ++++++++++++++++++++++++--
|
||||
6 files changed, 89 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 3fb74b0..84194be 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -3921,6 +3921,7 @@ HAVE_POPPLER=no
|
||||
POPPLER_HAS_OPTCONTENT=no
|
||||
POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
|
||||
POPPLER_0_20_OR_LATER=no
|
||||
+POPPLER_NEW_OBJECT_API=no
|
||||
|
||||
AC_MSG_CHECKING([for poppler])
|
||||
|
||||
@@ -4023,6 +4024,21 @@ if test "$with_poppler" != "no" -a "$with_poppler" != ""; then
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.58.0
|
||||
+ AC_MSG_CHECKING([if Object does have new API (>= 0.58.0)])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_NEW_OBJECT_API=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@@ -4037,6 +4053,7 @@ AC_SUBST(POPPLER_HAS_OPTCONTENT, $POPPLER_HAS_OPTCONTENT)
|
||||
AC_SUBST(POPPLER_BASE_STREAM_HAS_TWO_ARGS, $POPPLER_BASE_STREAM_HAS_TWO_ARGS)
|
||||
AC_SUBST(POPPLER_0_20_OR_LATER, $POPPLER_0_20_OR_LATER)
|
||||
AC_SUBST(POPPLER_0_23_OR_LATER, $POPPLER_0_23_OR_LATER)
|
||||
+AC_SUBST(POPPLER_NEW_OBJECT_API, $POPPLER_NEW_OBJECT_API)
|
||||
AC_SUBST(POPPLER_INC, $POPPLER_INC)
|
||||
AC_SUBST(POPPLER_PLUGIN_LIB, $POPPLER_PLUGIN_LIB)
|
||||
|
||||
diff --git a/frmts/pdf/GNUmakefile b/frmts/pdf/GNUmakefile
|
||||
index f5b7f41..eb7dc1b 100644
|
||||
--- a/frmts/pdf/GNUmakefile
|
||||
+++ b/frmts/pdf/GNUmakefile
|
||||
@@ -31,6 +31,10 @@ ifeq ($(POPPLER_0_23_OR_LATER),yes)
|
||||
CPPFLAGS += -DPOPPLER_0_23_OR_LATER
|
||||
endif
|
||||
|
||||
+ifeq ($(POPPLER_NEW_OBJECT_API),yes)
|
||||
+CPPFLAGS += -DPOPPLER_NEW_OBJECT_API
|
||||
+endif
|
||||
+
|
||||
ifeq ($(HAVE_PODOFO),yes)
|
||||
CPPFLAGS += -DHAVE_PODOFO
|
||||
endif
|
||||
diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
|
||||
index 4bee2d8..5b00d3d 100644
|
||||
--- a/frmts/pdf/pdfdataset.cpp
|
||||
+++ b/frmts/pdf/pdfdataset.cpp
|
||||
@@ -128,7 +128,9 @@ class ObjectAutoFree : public Object
|
||||
|
||||
public:
|
||||
ObjectAutoFree() {}
|
||||
+#if !defined(POPPLER_NEW_OBJECT_API)
|
||||
~ObjectAutoFree() { obj.free(); }
|
||||
+#endif
|
||||
|
||||
Object* getObj() { return &obj; }
|
||||
};
|
||||
@@ -2283,7 +2285,11 @@ GDALPDFObject* PDFDataset::GetCatalog()
|
||||
if (bUseLib.test(PDFLIB_POPPLER))
|
||||
{
|
||||
poCatalogObjectPoppler = new ObjectAutoFree;
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ *poCatalogObjectPoppler->getObj() = poDocPoppler->getXRef()->getCatalog();
|
||||
+#else
|
||||
poDocPoppler->getXRef()->getCatalog(poCatalogObjectPoppler->getObj());
|
||||
+#endif
|
||||
if (!poCatalogObjectPoppler->getObj()->isNull())
|
||||
poCatalogObject = new GDALPDFObjectPoppler(poCatalogObjectPoppler->getObj(), FALSE);
|
||||
}
|
||||
@@ -4074,7 +4080,11 @@ GDALDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
|
||||
if (pszUserPwd)
|
||||
poUserPwd = new GooString(pszUserPwd);
|
||||
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ *oObj.getObj() = Object(objNull);
|
||||
+#else
|
||||
oObj.getObj()->initNull();
|
||||
+#endif
|
||||
poDocPoppler = new PDFDoc(new VSIPDFFileStream(fp, pszFilename, oObj.getObj()), NULL, poUserPwd);
|
||||
delete poUserPwd;
|
||||
|
||||
@@ -4764,10 +4774,16 @@ GDALDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
|
||||
if( poDocPoppler->getXRef()->isOk() )
|
||||
{
|
||||
Object oInfo;
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ oInfo = poDocPoppler->getDocInfo();
|
||||
+#else
|
||||
poDocPoppler->getDocInfo(&oInfo);
|
||||
+#endif
|
||||
GDALPDFObjectPoppler oInfoObjPoppler(&oInfo, FALSE);
|
||||
poDS->ParseInfo(&oInfoObjPoppler);
|
||||
+#if !defined(POPPLER_NEW_OBJECT_API)
|
||||
oInfo.free();
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Find layers */
|
||||
diff --git a/frmts/pdf/pdfio.cpp b/frmts/pdf/pdfio.cpp
|
||||
index 3baeac0..8d3060b 100644
|
||||
--- a/frmts/pdf/pdfio.cpp
|
||||
+++ b/frmts/pdf/pdfio.cpp
|
||||
@@ -54,11 +54,15 @@ static vsi_l_offset VSIPDFFileStreamGetSize(VSILFILE* f)
|
||||
/************************************************************************/
|
||||
|
||||
VSIPDFFileStream::VSIPDFFileStream(VSILFILE* fIn, const char* pszFilename, Object *dictA):
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ BaseStream(dictA->copy(), (setPos_offset_type)VSIPDFFileStreamGetSize(fIn))
|
||||
+#else
|
||||
#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
|
||||
BaseStream(dictA, (setPos_offset_type)VSIPDFFileStreamGetSize(fIn))
|
||||
#else
|
||||
BaseStream(dictA)
|
||||
#endif
|
||||
+#endif
|
||||
{
|
||||
poParent = NULL;
|
||||
poFilename = new GooString(pszFilename);
|
||||
@@ -79,11 +83,15 @@ VSIPDFFileStream::VSIPDFFileStream(VSILFILE* fIn, const char* pszFilename, Objec
|
||||
VSIPDFFileStream::VSIPDFFileStream(VSIPDFFileStream* poParentIn,
|
||||
vsi_l_offset startA, GBool limitedA,
|
||||
vsi_l_offset lengthA, Object *dictA):
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ BaseStream(dictA->copy(), (makeSubStream_offset_type)lengthA)
|
||||
+#else
|
||||
#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
|
||||
BaseStream(dictA, (makeSubStream_offset_type)lengthA)
|
||||
#else
|
||||
BaseStream(dictA)
|
||||
#endif
|
||||
+#endif
|
||||
{
|
||||
this->poParent = poParentIn;
|
||||
poFilename = poParent->poFilename;
|
||||
@@ -129,11 +137,17 @@ BaseStream* VSIPDFFileStream::copy()
|
||||
/************************************************************************/
|
||||
|
||||
Stream *VSIPDFFileStream::makeSubStream(makeSubStream_offset_type startA, GBool limitedA,
|
||||
- makeSubStream_offset_type lengthA, Object *dictA)
|
||||
+ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA)
|
||||
{
|
||||
return new VSIPDFFileStream(this,
|
||||
startA, limitedA,
|
||||
- lengthA, dictA);
|
||||
+ lengthA,
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ &dictA
|
||||
+#else
|
||||
+ dictA
|
||||
+#endif
|
||||
+ );
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
diff --git a/frmts/pdf/pdfio.h b/frmts/pdf/pdfio.h
|
||||
index 13b36a0..81345db 100644
|
||||
--- a/frmts/pdf/pdfio.h
|
||||
+++ b/frmts/pdf/pdfio.h
|
||||
@@ -39,19 +39,30 @@
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
|
||||
+#ifdef POPPLER_NEW_OBJECT_API
|
||||
+#define getPos_ret_type Goffset
|
||||
+#define getStart_ret_type Goffset
|
||||
+#define makeSubStream_offset_type Goffset
|
||||
+#define makeSubStream_object_type Object &&
|
||||
+#define setPos_offset_type Goffset
|
||||
+#define moveStart_delta_type Goffset
|
||||
+#else
|
||||
#ifdef POPPLER_0_23_OR_LATER
|
||||
#define getPos_ret_type Goffset
|
||||
#define getStart_ret_type Goffset
|
||||
#define makeSubStream_offset_type Goffset
|
||||
+#define makeSubStream_object_type Object *
|
||||
#define setPos_offset_type Goffset
|
||||
#define moveStart_delta_type Goffset
|
||||
#else
|
||||
#define getPos_ret_type int
|
||||
#define getStart_ret_type Guint
|
||||
#define makeSubStream_offset_type Guint
|
||||
+#define makeSubStream_object_type Object *
|
||||
#define setPos_offset_type Guint
|
||||
#define moveStart_delta_type int
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
|
||||
class VSIPDFFileStream: public BaseStream
|
||||
@@ -68,7 +79,7 @@ class VSIPDFFileStream: public BaseStream
|
||||
#endif
|
||||
|
||||
virtual Stream * makeSubStream(makeSubStream_offset_type startA, GBool limitedA,
|
||||
- makeSubStream_offset_type lengthA, Object *dictA);
|
||||
+ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA);
|
||||
virtual getPos_ret_type getPos();
|
||||
virtual getStart_ret_type getStart();
|
||||
|
||||
diff --git a/frmts/pdf/pdfobject.cpp b/frmts/pdf/pdfobject.cpp
|
||||
index e1f11a9..9b1ab9a 100644
|
||||
--- a/frmts/pdf/pdfobject.cpp
|
||||
+++ b/frmts/pdf/pdfobject.cpp
|
||||
@@ -975,7 +975,9 @@ class GDALPDFStreamPoppler : public GDALPDFStream
|
||||
|
||||
GDALPDFObjectPoppler::~GDALPDFObjectPoppler()
|
||||
{
|
||||
+#if !defined(POPPLER_NEW_OBJECT_API)
|
||||
m_po->free();
|
||||
+#endif
|
||||
if (m_bDestroy)
|
||||
delete m_po;
|
||||
delete m_poDict;
|
||||
@@ -1187,7 +1189,11 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const char* pszKey)
|
||||
return oIter->second;
|
||||
|
||||
Object* po = new Object;
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ if (!(*po = m_poDict->lookupNF((char*)pszKey)).isNull())
|
||||
+#else
|
||||
if (m_poDict->lookupNF((char*)pszKey, po) && !po->isNull())
|
||||
+#endif
|
||||
{
|
||||
int nRefNum = 0, nRefGen = 0;
|
||||
if( po->isRef())
|
||||
@@ -1195,7 +1201,13 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const char* pszKey)
|
||||
nRefNum = po->getRefNum();
|
||||
nRefGen = po->getRefGen();
|
||||
}
|
||||
- if( !po->isRef() || (m_poDict->lookup((char*)pszKey, po) && !po->isNull()) )
|
||||
+ if( !po->isRef()
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ || (!(*po = m_poDict->lookupNF((char*)pszKey)).isNull())
|
||||
+#else
|
||||
+ || (m_poDict->lookup((char*)pszKey, po) && !po->isNull())
|
||||
+#endif
|
||||
+ )
|
||||
{
|
||||
GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(po, TRUE);
|
||||
poObj->SetRefNumAndGen(nRefNum, nRefGen);
|
||||
@@ -1290,7 +1302,11 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex)
|
||||
return m_v[nIndex];
|
||||
|
||||
Object* po = new Object;
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ if (!(*po = m_poArray->getNF(nIndex)).isNull())
|
||||
+#else
|
||||
if (m_poArray->getNF(nIndex, po))
|
||||
+#endif
|
||||
{
|
||||
int nRefNum = 0, nRefGen = 0;
|
||||
if( po->isRef())
|
||||
@@ -1298,7 +1314,13 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex)
|
||||
nRefNum = po->getRefNum();
|
||||
nRefGen = po->getRefGen();
|
||||
}
|
||||
- if( !po->isRef() || (m_poArray->get(nIndex, po)) )
|
||||
+ if( !po->isRef()
|
||||
+#if defined(POPPLER_NEW_OBJECT_API)
|
||||
+ || !((*po = m_poArray->get(nIndex)).isNull())
|
||||
+#else
|
||||
+ || (m_poArray->get(nIndex, po))
|
||||
+#endif
|
||||
+ )
|
||||
{
|
||||
GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(po, TRUE);
|
||||
poObj->SetRefNumAndGen(nRefNum, nRefGen);
|
||||
--
|
||||
2.13.5
|
||||
|
|
@ -0,0 +1,625 @@
|
|||
Index: /branches/2.2/gdal/GDALmake.opt.in
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/GDALmake.opt.in (revision 40035)
|
||||
+++ /branches/2.2/gdal/GDALmake.opt.in (revision 40036)
|
||||
@@ -473,4 +473,5 @@
|
||||
POPPLER_0_20_OR_LATER = @POPPLER_0_20_OR_LATER@
|
||||
POPPLER_0_23_OR_LATER = @POPPLER_0_23_OR_LATER@
|
||||
+POPPLER_0_58_OR_LATER = @POPPLER_0_58_OR_LATER@
|
||||
POPPLER_INC = @POPPLER_INC@
|
||||
POPPLER_PLUGIN_LIB = @POPPLER_PLUGIN_LIB@
|
||||
Index: /branches/2.2/gdal/configure
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/configure (revision 40035)
|
||||
+++ /branches/2.2/gdal/configure (revision 40036)
|
||||
@@ -663,4 +663,5 @@
|
||||
POPPLER_PLUGIN_LIB
|
||||
POPPLER_INC
|
||||
+POPPLER_0_58_OR_LATER
|
||||
POPPLER_0_23_OR_LATER
|
||||
POPPLER_0_20_OR_LATER
|
||||
@@ -32272,4 +32273,6 @@
|
||||
POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
|
||||
POPPLER_0_20_OR_LATER=no
|
||||
+POPPLER_0_23_OR_LATER=no
|
||||
+POPPLER_0_58_OR_LATER=no
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for poppler" >&5
|
||||
@@ -32312,15 +32315,19 @@
|
||||
POPPLER_PLUGIN_LIB="${TEST_POPPLER_LIB}"
|
||||
|
||||
- # And now try another dirty thing, but this one is
|
||||
- # optional.
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Catalog::optContent exists" >&5
|
||||
-$as_echo_n "checking if Catalog::optContent exists... " >&6; }
|
||||
+ CHECK_OTHER_POPPLER_VERSION=yes
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.58.0
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Object does have new API (>= 0.58.0)" >&5
|
||||
+$as_echo_n "checking if Object does have new API (>= 0.58.0)... " >&6; }
|
||||
rm -f testpoppler.*
|
||||
- echo '#define private public' > testpoppler.cpp
|
||||
- echo '#include <poppler/Object.h>' >> testpoppler.cpp
|
||||
- echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
|
||||
if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_58_OR_LATER=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
POPPLER_HAS_OPTCONTENT=yes
|
||||
+ CHECK_OTHER_POPPLER_VERSION=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
@@ -32330,48 +32337,73 @@
|
||||
fi
|
||||
|
||||
- # And now we check if we have Poppler >= 0.16.0
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if BaseStream constructor needs 2 arguments" >&5
|
||||
-$as_echo_n "checking if BaseStream constructor needs 2 arguments... " >&6; }
|
||||
- rm -f testpoppler.*
|
||||
- echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
- echo 'public:' >> testpoppler.cpp
|
||||
- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
- echo '};' >> testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
- if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
-$as_echo "yes" >&6; }
|
||||
-
|
||||
- # And now we check if we have Poppler >= 0.20.0
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.20.0" >&5
|
||||
-$as_echo_n "checking if we have Poppler >= 0.20.0... " >&6; }
|
||||
+ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
+
|
||||
+ # And now try another dirty thing, but this one is
|
||||
+ # optional.
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Catalog::optContent exists" >&5
|
||||
+$as_echo_n "checking if Catalog::optContent exists... " >&6; }
|
||||
rm -f testpoppler.*
|
||||
- echo '#include <poppler/Error.h>' > testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
|
||||
+ echo '#define private public' > testpoppler.cpp
|
||||
+ echo '#include <poppler/Object.h>' >> testpoppler.cpp
|
||||
+ echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
|
||||
if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_HAS_OPTCONTENT=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
-
|
||||
- # And now we check if we have Poppler >= 0.23.0
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.23.0" >&5
|
||||
-$as_echo_n "checking if we have Poppler >= 0.23.0... " >&6; }
|
||||
+ else
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+ fi
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.16.0
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if BaseStream constructor needs 2 arguments" >&5
|
||||
+$as_echo_n "checking if BaseStream constructor needs 2 arguments... " >&6; }
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
+ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
+ echo 'public:' >> testpoppler.cpp
|
||||
+ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
+ echo '};' >> testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
+$as_echo "yes" >&6; }
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.20.0
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.20.0" >&5
|
||||
+$as_echo_n "checking if we have Poppler >= 0.20.0... " >&6; }
|
||||
rm -f testpoppler.*
|
||||
- echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
- echo 'public:' >> testpoppler.cpp
|
||||
- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
- echo ' ~TestStream() {}' >> testpoppler.cpp
|
||||
- echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
|
||||
- echo '};' >> testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
+ echo '#include <poppler/Error.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
|
||||
if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.23.0
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.23.0" >&5
|
||||
+$as_echo_n "checking if we have Poppler >= 0.23.0... " >&6; }
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
+ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
+ echo 'public:' >> testpoppler.cpp
|
||||
+ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
+ echo ' ~TestStream() {}' >> testpoppler.cpp
|
||||
+ echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
|
||||
+ echo '};' >> testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
+$as_echo "yes" >&6; }
|
||||
+ else
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+ fi
|
||||
+
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
@@ -32383,8 +32415,4 @@
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
-
|
||||
- else
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
-$as_echo "no" >&6; }
|
||||
fi
|
||||
else
|
||||
@@ -32408,4 +32436,6 @@
|
||||
|
||||
POPPLER_0_23_OR_LATER=$POPPLER_0_23_OR_LATER
|
||||
+
|
||||
+POPPLER_0_58_OR_LATER=$POPPLER_0_58_OR_LATER
|
||||
|
||||
POPPLER_INC=$POPPLER_INC
|
||||
Index: /branches/2.2/gdal/configure.in
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/configure.in (revision 40035)
|
||||
+++ /branches/2.2/gdal/configure.in (revision 40036)
|
||||
@@ -4284,4 +4284,6 @@
|
||||
POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
|
||||
POPPLER_0_20_OR_LATER=no
|
||||
+POPPLER_0_23_OR_LATER=no
|
||||
+POPPLER_0_58_OR_LATER=no
|
||||
|
||||
AC_MSG_CHECKING([for poppler])
|
||||
@@ -4322,14 +4324,18 @@
|
||||
POPPLER_PLUGIN_LIB="${TEST_POPPLER_LIB}"
|
||||
|
||||
- # And now try another dirty thing, but this one is
|
||||
- # optional.
|
||||
- AC_MSG_CHECKING([if Catalog::optContent exists])
|
||||
+ CHECK_OTHER_POPPLER_VERSION=yes
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.58.0
|
||||
+ AC_MSG_CHECKING([if Object does have new API (>= 0.58.0)])
|
||||
rm -f testpoppler.*
|
||||
- echo '#define private public' > testpoppler.cpp
|
||||
- echo '#include <poppler/Object.h>' >> testpoppler.cpp
|
||||
- echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
|
||||
if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_58_OR_LATER=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
POPPLER_HAS_OPTCONTENT=yes
|
||||
+ CHECK_OTHER_POPPLER_VERSION=no
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
@@ -4337,42 +4343,63 @@
|
||||
fi
|
||||
|
||||
- # And now we check if we have Poppler >= 0.16.0
|
||||
- AC_MSG_CHECKING([if BaseStream constructor needs 2 arguments])
|
||||
- rm -f testpoppler.*
|
||||
- echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
- echo 'public:' >> testpoppler.cpp
|
||||
- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
- echo '};' >> testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
- if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
- AC_MSG_RESULT([yes])
|
||||
-
|
||||
- # And now we check if we have Poppler >= 0.20.0
|
||||
- AC_MSG_CHECKING([if we have Poppler >= 0.20.0])
|
||||
+ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
+
|
||||
+ # And now try another dirty thing, but this one is
|
||||
+ # optional.
|
||||
+ AC_MSG_CHECKING([if Catalog::optContent exists])
|
||||
rm -f testpoppler.*
|
||||
- echo '#include <poppler/Error.h>' > testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
|
||||
+ echo '#define private public' > testpoppler.cpp
|
||||
+ echo '#include <poppler/Object.h>' >> testpoppler.cpp
|
||||
+ echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
|
||||
if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_HAS_OPTCONTENT=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
-
|
||||
- # And now we check if we have Poppler >= 0.23.0
|
||||
- AC_MSG_CHECKING([if we have Poppler >= 0.23.0])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.16.0
|
||||
+ AC_MSG_CHECKING([if BaseStream constructor needs 2 arguments])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
+ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
+ echo 'public:' >> testpoppler.cpp
|
||||
+ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
+ echo '};' >> testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.20.0
|
||||
+ AC_MSG_CHECKING([if we have Poppler >= 0.20.0])
|
||||
rm -f testpoppler.*
|
||||
- echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
- echo 'public:' >> testpoppler.cpp
|
||||
- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
- echo ' ~TestStream() {}' >> testpoppler.cpp
|
||||
- echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
|
||||
- echo '};' >> testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
+ echo '#include <poppler/Error.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
|
||||
if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
+
|
||||
+ # And now we check if we have Poppler >= 0.23.0
|
||||
+ AC_MSG_CHECKING([if we have Poppler >= 0.23.0])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
|
||||
+ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
|
||||
+ echo 'public:' >> testpoppler.cpp
|
||||
+ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
|
||||
+ echo ' ~TestStream() {}' >> testpoppler.cpp
|
||||
+ echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
|
||||
+ echo '};' >> testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
+
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -4382,7 +4409,4 @@
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
-
|
||||
- else
|
||||
- AC_MSG_RESULT([no])
|
||||
fi
|
||||
else
|
||||
@@ -4400,4 +4424,5 @@
|
||||
AC_SUBST(POPPLER_0_20_OR_LATER, $POPPLER_0_20_OR_LATER)
|
||||
AC_SUBST(POPPLER_0_23_OR_LATER, $POPPLER_0_23_OR_LATER)
|
||||
+AC_SUBST(POPPLER_0_58_OR_LATER, $POPPLER_0_58_OR_LATER)
|
||||
AC_SUBST(POPPLER_INC, $POPPLER_INC)
|
||||
AC_SUBST(POPPLER_PLUGIN_LIB, $POPPLER_PLUGIN_LIB)
|
||||
Index: /branches/2.2/gdal/frmts/pdf/GNUmakefile
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/frmts/pdf/GNUmakefile (revision 40035)
|
||||
+++ /branches/2.2/gdal/frmts/pdf/GNUmakefile (revision 40036)
|
||||
@@ -32,4 +32,8 @@
|
||||
endif
|
||||
|
||||
+ifeq ($(POPPLER_0_58_OR_LATER),yes)
|
||||
+CPPFLAGS += -DPOPPLER_0_58_OR_LATER
|
||||
+endif
|
||||
+
|
||||
ifeq ($(HAVE_PODOFO),yes)
|
||||
CPPFLAGS += -DHAVE_PODOFO
|
||||
Index: /branches/2.2/gdal/frmts/pdf/makefile.vc
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/frmts/pdf/makefile.vc (revision 40035)
|
||||
+++ /branches/2.2/gdal/frmts/pdf/makefile.vc (revision 40036)
|
||||
@@ -15,5 +15,5 @@
|
||||
|
||||
!IFDEF POPPLER_ENABLED
|
||||
-POPPLER_EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) $(POPPLER_0_23_OR_LATER_FLAGS) -DHAVE_POPPLER
|
||||
+POPPLER_EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) $(POPPLER_0_23_OR_LATER_FLAGS) $(POPPLER_0_58_OR_LATER_FLAGS) -DHAVE_POPPLER
|
||||
|
||||
!IFDEF POPPLER_HAS_OPTCONTENT
|
||||
@@ -31,4 +31,8 @@
|
||||
!IFDEF POPPLER_0_23_OR_LATER
|
||||
POPPLER_0_23_OR_LATER_FLAGS = -DPOPPLER_0_23_OR_LATER
|
||||
+!ENDIF
|
||||
+
|
||||
+!IFDEF POPPLER_0_58_OR_LATER
|
||||
+POPPLER_0_58_OR_LATER_FLAGS = -DPOPPLER_0_58_OR_LATER
|
||||
!ENDIF
|
||||
|
||||
Index: /branches/2.2/gdal/frmts/pdf/pdfdataset.cpp
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/frmts/pdf/pdfdataset.cpp (revision 40035)
|
||||
+++ /branches/2.2/gdal/frmts/pdf/pdfdataset.cpp (revision 40036)
|
||||
@@ -130,5 +130,9 @@
|
||||
public:
|
||||
ObjectAutoFree() {}
|
||||
- ~ObjectAutoFree() { obj.free(); }
|
||||
+ ~ObjectAutoFree() {
|
||||
+#ifndef POPPLER_0_58_OR_LATER
|
||||
+ obj.free();
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
Object* getObj() { return &obj; }
|
||||
@@ -2286,5 +2290,9 @@
|
||||
{
|
||||
poCatalogObjectPoppler = new ObjectAutoFree;
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ *poCatalogObjectPoppler->getObj() = poDocPoppler->getXRef()->getCatalog();
|
||||
+#else
|
||||
poDocPoppler->getXRef()->getCatalog(poCatalogObjectPoppler->getObj());
|
||||
+#endif
|
||||
if (!poCatalogObjectPoppler->getObj()->isNull())
|
||||
poCatalogObject = new GDALPDFObjectPoppler(poCatalogObjectPoppler->getObj(), FALSE);
|
||||
@@ -4027,5 +4035,9 @@
|
||||
#ifdef HAVE_POPPLER
|
||||
PDFDoc* poDocPoppler = NULL;
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ Object oObj;
|
||||
+#else
|
||||
ObjectAutoFree oObj;
|
||||
+#endif
|
||||
Page* poPagePoppler = NULL;
|
||||
Catalog* poCatalogPoppler = NULL;
|
||||
@@ -4074,6 +4086,10 @@
|
||||
poUserPwd = new GooString(pszUserPwd);
|
||||
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ poDocPoppler = new PDFDoc(new VSIPDFFileStream(fp, pszFilename, std::move(oObj)), NULL, poUserPwd);
|
||||
+#else
|
||||
oObj.getObj()->initNull();
|
||||
poDocPoppler = new PDFDoc(new VSIPDFFileStream(fp, pszFilename, oObj.getObj()), NULL, poUserPwd);
|
||||
+#endif
|
||||
delete poUserPwd;
|
||||
|
||||
@@ -4766,8 +4782,14 @@
|
||||
{
|
||||
Object oInfo;
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ oInfo = poDocPoppler->getDocInfo();
|
||||
+#else
|
||||
poDocPoppler->getDocInfo(&oInfo);
|
||||
+#endif
|
||||
GDALPDFObjectPoppler oInfoObjPoppler(&oInfo, FALSE);
|
||||
poDS->ParseInfo(&oInfoObjPoppler);
|
||||
+#ifndef POPPLER_0_58_OR_LATER
|
||||
oInfo.free();
|
||||
+#endif
|
||||
}
|
||||
|
||||
Index: /branches/2.2/gdal/frmts/pdf/pdfio.cpp
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/frmts/pdf/pdfio.cpp (revision 40035)
|
||||
+++ /branches/2.2/gdal/frmts/pdf/pdfio.cpp (revision 40036)
|
||||
@@ -53,6 +53,10 @@
|
||||
/************************************************************************/
|
||||
|
||||
-VSIPDFFileStream::VSIPDFFileStream(VSILFILE* fIn, const char* pszFilename, Object *dictA):
|
||||
-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
|
||||
+VSIPDFFileStream::VSIPDFFileStream(VSILFILE* fIn, const char* pszFilename,
|
||||
+ makeSubStream_object_type dictA
|
||||
+) :
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ BaseStream(std::move(dictA), (Goffset)VSIPDFFileStreamGetSize(fIn)),
|
||||
+#elif defined(POPPLER_BASE_STREAM_HAS_TWO_ARGS)
|
||||
BaseStream(dictA, (setPos_offset_type)VSIPDFFileStreamGetSize(fIn))
|
||||
#else
|
||||
@@ -78,6 +82,9 @@
|
||||
VSIPDFFileStream::VSIPDFFileStream(VSIPDFFileStream* poParentIn,
|
||||
vsi_l_offset startA, GBool limitedA,
|
||||
- vsi_l_offset lengthA, Object *dictA):
|
||||
-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
|
||||
+ vsi_l_offset lengthA,
|
||||
+ makeSubStream_object_type dictA) :
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ BaseStream(std::move(dictA), (Goffset)lengthA),
|
||||
+#elif defined(POPPLER_BASE_STREAM_HAS_TWO_ARGS)
|
||||
BaseStream(dictA, (makeSubStream_offset_type)lengthA)
|
||||
#else
|
||||
@@ -116,5 +123,11 @@
|
||||
/************************************************************************/
|
||||
|
||||
-#ifdef POPPLER_0_23_OR_LATER
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+BaseStream* VSIPDFFileStream::copy()
|
||||
+{
|
||||
+ return new VSIPDFFileStream(poParent, nStart, bLimited,
|
||||
+ nLength, dict.copy());
|
||||
+}
|
||||
+#elif defined(POPPLER_0_23_OR_LATER)
|
||||
BaseStream* VSIPDFFileStream::copy()
|
||||
{
|
||||
@@ -127,11 +140,16 @@
|
||||
/* makeSubStream() */
|
||||
/************************************************************************/
|
||||
-
|
||||
Stream *VSIPDFFileStream::makeSubStream(makeSubStream_offset_type startA, GBool limitedA,
|
||||
- makeSubStream_offset_type lengthA, Object *dictA)
|
||||
-{
|
||||
+ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA)
|
||||
+{
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ return new VSIPDFFileStream(this,
|
||||
+ startA, limitedA,
|
||||
+ lengthA, std::move(dictA));
|
||||
+#else
|
||||
return new VSIPDFFileStream(this,
|
||||
startA, limitedA,
|
||||
lengthA, dictA);
|
||||
+#endif
|
||||
}
|
||||
|
||||
Index: /branches/2.2/gdal/frmts/pdf/pdfio.h
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/frmts/pdf/pdfio.h (revision 40035)
|
||||
+++ /branches/2.2/gdal/frmts/pdf/pdfio.h (revision 40036)
|
||||
@@ -53,11 +53,19 @@
|
||||
|
||||
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+#define makeSubStream_object_type Object&&
|
||||
+#else
|
||||
+#define makeSubStream_object_type Object*
|
||||
+#endif
|
||||
+
|
||||
class VSIPDFFileStream: public BaseStream
|
||||
{
|
||||
public:
|
||||
- VSIPDFFileStream(VSILFILE* f, const char* pszFilename, Object *dictA);
|
||||
+ VSIPDFFileStream(VSILFILE* f, const char* pszFilename,
|
||||
+ makeSubStream_object_type dictA);
|
||||
VSIPDFFileStream(VSIPDFFileStream* poParent,
|
||||
vsi_l_offset startA, GBool limitedA,
|
||||
- vsi_l_offset lengthA, Object *dictA);
|
||||
+ vsi_l_offset lengthA,
|
||||
+ makeSubStream_object_type dictA);
|
||||
virtual ~VSIPDFFileStream();
|
||||
|
||||
@@ -67,5 +75,5 @@
|
||||
|
||||
virtual Stream * makeSubStream(makeSubStream_offset_type startA, GBool limitedA,
|
||||
- makeSubStream_offset_type lengthA, Object *dictA);
|
||||
+ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA) override;
|
||||
virtual getPos_ret_type getPos();
|
||||
virtual getStart_ret_type getStart();
|
||||
Index: /branches/2.2/gdal/frmts/pdf/pdfobject.cpp
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/frmts/pdf/pdfobject.cpp (revision 40035)
|
||||
+++ /branches/2.2/gdal/frmts/pdf/pdfobject.cpp (revision 40036)
|
||||
@@ -972,5 +972,7 @@
|
||||
GDALPDFObjectPoppler::~GDALPDFObjectPoppler()
|
||||
{
|
||||
+#ifndef POPPLER_0_58_OR_LATER
|
||||
m_po->free();
|
||||
+#endif
|
||||
if (m_bDestroy)
|
||||
delete m_po;
|
||||
@@ -1183,4 +1185,33 @@
|
||||
return oIter->second;
|
||||
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ Object o = m_poDict->lookupNF(((char*)pszKey));
|
||||
+ if (!o.isNull())
|
||||
+ {
|
||||
+ int nRefNum = 0;
|
||||
+ int nRefGen = 0;
|
||||
+ if( o.isRef())
|
||||
+ {
|
||||
+ nRefNum = o.getRefNum();
|
||||
+ nRefGen = o.getRefGen();
|
||||
+ Object o2 = m_poDict->lookup((char*)pszKey);
|
||||
+ if( !o2.isNull() )
|
||||
+ {
|
||||
+ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE);
|
||||
+ poObj->SetRefNumAndGen(nRefNum, nRefGen);
|
||||
+ m_map[pszKey] = poObj;
|
||||
+ return poObj;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE);
|
||||
+ poObj->SetRefNumAndGen(nRefNum, nRefGen);
|
||||
+ m_map[pszKey] = poObj;
|
||||
+ return poObj;
|
||||
+ }
|
||||
+ }
|
||||
+ return NULL;
|
||||
+#else
|
||||
Object* po = new Object;
|
||||
if (m_poDict->lookupNF((char*)pszKey, po) && !po->isNull())
|
||||
@@ -1211,4 +1242,5 @@
|
||||
return NULL;
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
@@ -1287,4 +1319,33 @@
|
||||
return m_v[nIndex];
|
||||
|
||||
+#ifdef POPPLER_0_58_OR_LATER
|
||||
+ Object o = m_poArray->getNF(nIndex);
|
||||
+ if( !o.isNull() )
|
||||
+ {
|
||||
+ int nRefNum = 0;
|
||||
+ int nRefGen = 0;
|
||||
+ if( o.isRef())
|
||||
+ {
|
||||
+ nRefNum = o.getRefNum();
|
||||
+ nRefGen = o.getRefGen();
|
||||
+ Object o2 = m_poArray->get(nIndex);
|
||||
+ if( !o2.isNull() )
|
||||
+ {
|
||||
+ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE);
|
||||
+ poObj->SetRefNumAndGen(nRefNum, nRefGen);
|
||||
+ m_v[nIndex] = poObj;
|
||||
+ return poObj;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE);
|
||||
+ poObj->SetRefNumAndGen(nRefNum, nRefGen);
|
||||
+ m_v[nIndex] = poObj;
|
||||
+ return poObj;
|
||||
+ }
|
||||
+ }
|
||||
+ return NULL;
|
||||
+#else
|
||||
Object* po = new Object;
|
||||
if (m_poArray->getNF(nIndex, po))
|
||||
@@ -1315,4 +1376,5 @@
|
||||
return NULL;
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
Index: /branches/2.2/gdal/nmake.opt
|
||||
===================================================================
|
||||
--- /branches/2.2/gdal/nmake.opt (revision 40035)
|
||||
+++ /branches/2.2/gdal/nmake.opt (revision 40036)
|
||||
@@ -622,4 +622,5 @@
|
||||
# Uncomment POPPLER_0_20_OR_LATER = YES for Poppler >= 0.20.0
|
||||
# Uncomment POPPLER_0_23_OR_LATER = YES for Poppler >= 0.23.0
|
||||
+# Uncomment POPPLER_0_58_OR_LATER = YES for Poppler >= 0.58.0
|
||||
#POPPLER_ENABLED = YES
|
||||
#POPPLER_CFLAGS = -Ie:/kde/include -Ie:/kde/include/poppler
|
||||
@@ -628,4 +629,5 @@
|
||||
#POPPLER_0_20_OR_LATER = YES
|
||||
#POPPLER_0_23_OR_LATER = YES
|
||||
+#POPPLER_0_58_OR_LATER = YES
|
||||
#POPPLER_LIBS = e:/kde/lib/poppler.lib e:/kde/lib/freetype.lib e:/kde/lib/liblcms-1.lib advapi32.lib gdi32.lib
|
||||
|
|
@ -74,7 +74,7 @@ Patch4: %{name}-uchar.patch
|
|||
Patch8: %{name}-1.9.0-java.patch
|
||||
Patch9: %{name}-2.1.0-zlib.patch
|
||||
|
||||
Patch10: 0001-adapt-to-poppler-0.58.patch
|
||||
Patch10: %{name}-2.1.4-poppler-0.58.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
|
@ -310,7 +310,7 @@ rm -r frmts/grib/degrib18/g2clib-1.0.4
|
|||
%patch4 -p1 -b .uchar~
|
||||
%patch8 -p1 -b .java~
|
||||
%patch9 -p1 -b .zlib~
|
||||
%patch10 -p1 -b .poppler~
|
||||
%patch10 -p4 -b .poppler~
|
||||
|
||||
# Copy in PROVENANCE.TXT-fedora
|
||||
cp -p %SOURCE4 .
|
||||
|
@ -456,7 +456,7 @@ export CPPFLAGS="$CPPFLAGS -I%{_includedir}/libgeotiff"
|
|||
# NOTE: running autoconf seems to break build:
|
||||
# fitsdataset.cpp:37:10: fatal error: fitsio.h: No such file or directory
|
||||
# #include <fitsio.h>
|
||||
make %{?_smp_mflags} POPPLER_0_20_OR_LATER=yes POPPLER_0_23_OR_LATER=yes POPPLER_BASE_STREAM_HAS_TWO_ARGS=YES POPPLER_NEW_OBJECT_API=yes
|
||||
make %{?_smp_mflags} POPPLER_0_20_OR_LATER=yes POPPLER_0_23_OR_LATER=yes POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes POPPLER_0_58_OR_LATER=yes
|
||||
make man
|
||||
make docs
|
||||
|
||||
|
|
Loading…
Reference in New Issue