PKGBUILDs/community/gdal/gdal-2.2-poppler-0.58.patch
2017-09-22 23:15:29 +00:00

625 lines
27 KiB
Diff

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.ac
===================================================================
--- /branches/2.2/gdal/configure.ac (revision 40035)
+++ /branches/2.2/gdal/configure.ac (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
+ 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 @@
#endif
+#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) override;
+ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA) override;
virtual getPos_ret_type getPos() override;
virtual getStart_ret_type getStart() override;
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