From owner-svn-ports-all@freebsd.org Sun May 12 16:34:45 2019 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE776159B185; Sun, 12 May 2019 16:34:44 +0000 (UTC) (envelope-from sunpoet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7250D75545; Sun, 12 May 2019 16:34:44 +0000 (UTC) (envelope-from sunpoet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9552E2D25D; Sun, 12 May 2019 16:34:41 +0000 (UTC) (envelope-from sunpoet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4CGYfE0009785; Sun, 12 May 2019 16:34:41 GMT (envelope-from sunpoet@FreeBSD.org) Received: (from sunpoet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4CGYfUf009784; Sun, 12 May 2019 16:34:41 GMT (envelope-from sunpoet@FreeBSD.org) Message-Id: <201905121634.x4CGYfUf009784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sunpoet set sender to sunpoet@FreeBSD.org using -f From: Sunpoet Po-Chuan Hsieh Date: Sun, 12 May 2019 16:34:41 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r501395 - head/graphics/gdal/files X-SVN-Group: ports-head X-SVN-Commit-Author: sunpoet X-SVN-Commit-Paths: head/graphics/gdal/files X-SVN-Commit-Revision: 501395 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7250D75545 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 16:34:45 -0000 Author: sunpoet Date: Sun May 12 16:34:40 2019 New Revision: 501395 URL: https://svnweb.freebsd.org/changeset/ports/501395 Log: Fix build with poppler 0.75.0 Obtained from: https://github.com/OSGeo/gdal/commit/783addc36d7da7a3f0c15fd46dde117e0ec0bb87 Added: head/graphics/gdal/files/patch-frmts-pdf-pdfio.h (contents, props changed) head/graphics/gdal/files/patch-frmts-pdf-pdfobject.cpp (contents, props changed) Added: head/graphics/gdal/files/patch-frmts-pdf-pdfio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/graphics/gdal/files/patch-frmts-pdf-pdfio.h Sun May 12 16:34:40 2019 (r501395) @@ -0,0 +1,16 @@ +Obtained from: https://github.com/OSGeo/gdal/commit/783addc36d7da7a3f0c15fd46dde117e0ec0bb87 + +--- frmts/pdf/pdfio.h.orig 2019-03-15 12:33:01 UTC ++++ frmts/pdf/pdfio.h +@@ -93,11 +93,6 @@ class VSIPDFFileStream final: public Bas + virtual void close() override; + + private: +- /* getChars/hasGetChars added in poppler 0.15.0 +- * POPPLER_BASE_STREAM_HAS_TWO_ARGS true from poppler 0.16, +- * This test will be wrong for poppler 0.15 or 0.16, +- * but will still compile correctly. +- */ + virtual GBool hasGetChars() override; + virtual int getChars(int nChars, Guchar *buffer) override; + Added: head/graphics/gdal/files/patch-frmts-pdf-pdfobject.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/graphics/gdal/files/patch-frmts-pdf-pdfobject.cpp Sun May 12 16:34:40 2019 (r501395) @@ -0,0 +1,123 @@ +Obtained from: https://github.com/OSGeo/gdal/commit/783addc36d7da7a3f0c15fd46dde117e0ec0bb87 + +--- frmts/pdf/pdfobject.cpp.orig 2019-03-15 12:33:01 UTC ++++ frmts/pdf/pdfobject.cpp +@@ -1195,7 +1195,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler: + return oIter->second; + + #if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 58 +- Object o = m_poDict->lookupNF(((char*)pszKey)); ++ auto&& o(m_poDict->lookupNF(((char*)pszKey))); + if (!o.isNull()) + { + int nRefNum = 0; +@@ -1204,7 +1204,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler: + { + nRefNum = o.getRefNum(); + nRefGen = o.getRefGen(); +- Object o2 = m_poDict->lookup((char*)pszKey); ++ Object o2(m_poDict->lookup((char*)pszKey)); + if( !o2.isNull() ) + { + GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE); +@@ -1215,7 +1215,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler: + } + else + { +- GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE); ++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o.copy())), TRUE); + poObj->SetRefNumAndGen(nRefNum, nRefGen); + m_map[pszKey] = poObj; + return poObj; +@@ -1329,7 +1329,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get( + return m_v[nIndex]; + + #if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 58 +- Object o = m_poArray->getNF(nIndex); ++ auto&& o(m_poArray->getNF(nIndex)); + if( !o.isNull() ) + { + int nRefNum = 0; +@@ -1338,7 +1338,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get( + { + nRefNum = o.getRefNum(); + nRefGen = o.getRefGen(); +- Object o2 = m_poArray->get(nIndex); ++ Object o2(m_poArray->get(nIndex)); + if( !o2.isNull() ) + { + GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE); +@@ -1349,7 +1349,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get( + } + else + { +- GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE); ++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o.copy())), TRUE); + poObj->SetRefNumAndGen(nRefNum, nRefGen); + m_v[nIndex] = poObj; + return poObj; +@@ -1416,8 +1416,6 @@ int GDALPDFStreamPoppler::GetLength() + + char* GDALPDFStreamPoppler::GetBytes() + { +- /* fillGooString() available in poppler >= 0.16.0 */ +-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS + GooString* gstr = new GooString(); + m_poStream->fillGooString(gstr); + +@@ -1427,7 +1425,12 @@ char* GDALPDFStreamPoppler::GetBytes() + char* pszContent = (char*) VSIMalloc(m_nLength + 1); + if (pszContent) + { +- memcpy(pszContent, gstr->getCString(), m_nLength); ++#if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72) ++ const char* srcStr = gstr->c_str(); ++#else ++ const char* srcStr = gstr->getCString(); ++#endif ++ memcpy(pszContent, srcStr, m_nLength); + pszContent[m_nLength] = '\0'; + } + delete gstr; +@@ -1438,41 +1441,6 @@ char* GDALPDFStreamPoppler::GetBytes() + delete gstr; + return nullptr; + } +-#else +- int i; +- int nLengthAlloc = 0; +- char* pszContent = nullptr; +- if( m_nLength >= 0 ) +- { +- pszContent = (char*) VSIMalloc(m_nLength + 1); +- if (!pszContent) +- return nullptr; +- nLengthAlloc = m_nLength; +- } +- m_poStream->reset(); +- for(i = 0; ; ++i ) +- { +- int nVal = m_poStream->getChar(); +- if (nVal == EOF) +- break; +- if( i >= nLengthAlloc ) +- { +- nLengthAlloc = 32 + nLengthAlloc + nLengthAlloc / 3; +- char* pszContentNew = (char*) VSIRealloc(pszContent, nLengthAlloc + 1); +- if( pszContentNew == nullptr ) +- { +- CPLFree(pszContent); +- m_nLength = 0; +- return nullptr; +- } +- pszContent = pszContentNew; +- } +- pszContent[i] = (GByte)nVal; +- } +- m_nLength = i; +- pszContent[i] = '\0'; +- return pszContent; +-#endif + } + + #endif // HAVE_POPPLER