View | Details | Raw Unified | Return to bug 224004
Collapse All | Expand All

(-)b/graphics/gdal/Makefile (-3 / +19 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	gdal
4
PORTNAME=	gdal
5
PORTVERSION=	2.4.1
5
PORTVERSION=	2.4.1
6
PORTREVISION=	2
6
CATEGORIES=	graphics geography
7
CATEGORIES=	graphics geography
7
MASTER_SITES=	https://download.osgeo.org/gdal/${PORTVERSION}/ \
8
MASTER_SITES=	https://download.osgeo.org/gdal/${PORTVERSION}/ \
8
		LOCAL/sunpoet
9
		LOCAL/sunpoet
Lines 20-36 LIB_DEPENDS= libgeotiff.so:graphics/libgeotiff \ Link Here
20
		libproj.so:graphics/proj \
21
		libproj.so:graphics/proj \
21
		libtiff.so:graphics/tiff
22
		libtiff.so:graphics/tiff
22
23
24
FLAVORS=	default lite full
25
FLAVOR?=	${FLAVORS:[1]}
26
lite_PKGNAMESUFFIX=	-lite
27
full_PKGNAMESUFFIX=	-full
28
.if ${FLAVOR} == lite
29
OPTIONS_DEFAULT=	JASPER
30
.elif ${FLAVOR} == full
31
OPTIONS_DEFAULT=	ARMADILLO CFITSIO CURL ECW EXPAT FREEXL GEOS GTA HDF5 JASPER \
32
			KML LIBXML2 MYSQL NETCDF ODBC OPENJPEG PCRE PGSQL POPPLER \
33
			SFCGAL SPATIALITE SQLITE WEBP XERCES ZSTD
34
.else
35
OPTIONS_DEFAULT=CURL ECW EXPAT FREEXL GEOS HDF5 JASPER KML LIBXML2 \
36
			NETCDF OPENJPEG PCRE PGSQL POPPLER SPATIALITE SQLITE \
37
			WEBP XERCES
38
.endif
39
40
USES=		compiler:c++11-lang gmake iconv jpeg localbase pkgconfig ssl tar:xz
41
23
OPTIONS_DEFINE=	ARMADILLO CFITSIO CURL ECW EXPAT FREEXL GEOS GTA HDF5 JASPER \
42
OPTIONS_DEFINE=	ARMADILLO CFITSIO CURL ECW EXPAT FREEXL GEOS GTA HDF5 JASPER \
24
		KML LIBXML2 MYSQL NETCDF ODBC OPENJPEG PCRE PGSQL SFCGAL \
43
		KML LIBXML2 MYSQL NETCDF ODBC OPENJPEG PCRE PGSQL SFCGAL \
25
		SPATIALITE SQLITE WEBP XERCES ZSTD
44
		SPATIALITE SQLITE WEBP XERCES ZSTD
26
OPTIONS_DEFAULT=JASPER
27
OPTIONS_RADIO=	PDF
45
OPTIONS_RADIO=	PDF
28
OPTIONS_RADIO_PDF=	PODOFO POPPLER
46
OPTIONS_RADIO_PDF=	PODOFO POPPLER
29
OPTIONS_SUB=	yes
47
OPTIONS_SUB=	yes
30
PCRE_DESC=	Regular expression support for SQLite
48
PCRE_DESC=	Regular expression support for SQLite
31
49
32
USES=		compiler:c++11-lang gmake iconv jpeg localbase pkgconfig ssl tar:xz
33
34
CFLAGS+=	-fPIC
50
CFLAGS+=	-fPIC
35
CONFIGURE_ARGS=	--datadir=${DATADIR} \
51
CONFIGURE_ARGS=	--datadir=${DATADIR} \
36
		--enable-static=yes \
52
		--enable-static=yes \
(-)b/graphics/gdal/files/patch-frmts_pdf_pdfobject.cpp (+130 lines)
Added Link Here
1
--- frmts/pdf/pdfobject.cpp.orig	2019-05-08 16:11:48 UTC
2
+++ frmts/pdf/pdfobject.cpp
3
@@ -38,7 +38,7 @@
4
 #include <vector>
5
 #include "pdfobject.h"
6
 
7
-CPL_CVSID("$Id: pdfobject.cpp d295d0ebc3b41092ad072790c704c772098da210 2019-01-17 22:52:36 +0100 Even Rouault $")
8
+CPL_CVSID("$Id$")
9
 
10
 /************************************************************************/
11
 /*                        ROUND_TO_INT_IF_CLOSE()                       */
12
@@ -1195,7 +1195,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const cha
13
         return oIter->second;
14
 
15
 #if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 58
16
-    Object o = m_poDict->lookupNF(((char*)pszKey));
17
+    auto&& o(m_poDict->lookupNF(((char*)pszKey)));
18
     if (!o.isNull())
19
     {
20
         int nRefNum = 0;
21
@@ -1204,7 +1204,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const cha
22
         {
23
             nRefNum = o.getRefNum();
24
             nRefGen = o.getRefGen();
25
-            Object o2 = m_poDict->lookup((char*)pszKey);
26
+            Object o2(m_poDict->lookup((char*)pszKey));
27
             if( !o2.isNull() )
28
             {
29
                 GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE);
30
@@ -1215,7 +1215,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const cha
31
         }
32
         else
33
         {
34
-            GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE);
35
+            GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o.copy())), TRUE);
36
             poObj->SetRefNumAndGen(nRefNum, nRefGen);
37
             m_map[pszKey] = poObj;
38
             return poObj;
39
@@ -1329,7 +1329,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex)
40
         return m_v[nIndex];
41
 
42
 #if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 58
43
-    Object o = m_poArray->getNF(nIndex);
44
+    auto&& o(m_poArray->getNF(nIndex));
45
     if( !o.isNull() )
46
     {
47
         int nRefNum = 0;
48
@@ -1338,7 +1338,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex)
49
         {
50
             nRefNum = o.getRefNum();
51
             nRefGen = o.getRefGen();
52
-            Object o2 = m_poArray->get(nIndex);
53
+            Object o2(m_poArray->get(nIndex));
54
             if( !o2.isNull() )
55
             {
56
                 GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE);
57
@@ -1349,7 +1349,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex)
58
         }
59
         else
60
         {
61
-            GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE);
62
+            GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o.copy())), TRUE);
63
             poObj->SetRefNumAndGen(nRefNum, nRefGen);
64
             m_v[nIndex] = poObj;
65
             return poObj;
66
@@ -1416,8 +1416,6 @@ int GDALPDFStreamPoppler::GetLength()
67
 
68
 char* GDALPDFStreamPoppler::GetBytes()
69
 {
70
-    /* fillGooString() available in poppler >= 0.16.0 */
71
-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
72
     GooString* gstr = new GooString();
73
     m_poStream->fillGooString(gstr);
74
 
75
@@ -1427,7 +1425,12 @@ char* GDALPDFStreamPoppler::GetBytes()
76
         char* pszContent = (char*) VSIMalloc(m_nLength + 1);
77
         if (pszContent)
78
         {
79
-            memcpy(pszContent, gstr->getCString(), m_nLength);
80
+#if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72)
81
+            const char* srcStr = gstr->c_str();
82
+#else
83
+            const char* srcStr = gstr->getCString();
84
+#endif
85
+            memcpy(pszContent, srcStr, m_nLength);
86
             pszContent[m_nLength] = '\0';
87
         }
88
         delete gstr;
89
@@ -1438,41 +1441,6 @@ char* GDALPDFStreamPoppler::GetBytes()
90
         delete gstr;
91
         return nullptr;
92
     }
93
-#else
94
-    int i;
95
-    int nLengthAlloc = 0;
96
-    char* pszContent = nullptr;
97
-    if( m_nLength >= 0 )
98
-    {
99
-        pszContent = (char*) VSIMalloc(m_nLength + 1);
100
-        if (!pszContent)
101
-            return nullptr;
102
-        nLengthAlloc = m_nLength;
103
-    }
104
-    m_poStream->reset();
105
-    for(i = 0; ; ++i )
106
-    {
107
-        int nVal = m_poStream->getChar();
108
-        if (nVal == EOF)
109
-            break;
110
-        if( i >= nLengthAlloc )
111
-        {
112
-            nLengthAlloc = 32 + nLengthAlloc + nLengthAlloc / 3;
113
-            char* pszContentNew = (char*) VSIRealloc(pszContent, nLengthAlloc + 1);
114
-            if( pszContentNew == nullptr )
115
-            {
116
-                CPLFree(pszContent);
117
-                m_nLength = 0;
118
-                return nullptr;
119
-            }
120
-            pszContent = pszContentNew;
121
-        }
122
-        pszContent[i] = (GByte)nVal;
123
-    }
124
-    m_nLength = i;
125
-    pszContent[i] = '\0';
126
-    return pszContent;
127
-#endif
128
 }
129
 
130
 #endif // HAVE_POPPLER

Return to bug 224004