From 181da5e258d275ab974d2adbc3e92460443a27d9ace5f81863ae74302f3f0028 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Fri, 27 Mar 2015 16:48:14 +0000 Subject: [PATCH] Accepting request 293424 from home:dimstar:Factory - Add gdal-poppler-0.31.patch: Fix build with poppler 0.31+. OBS-URL: https://build.opensuse.org/request/show/293424 OBS-URL: https://build.opensuse.org/package/show/Application:Geo/gdal?expand=0&rev=8 --- gdal-poppler-0.31.patch | 122 ++++++++++++++++++++++++++++++++++++++++ gdal.changes | 5 ++ gdal.spec | 3 + 3 files changed, 130 insertions(+) create mode 100644 gdal-poppler-0.31.patch diff --git a/gdal-poppler-0.31.patch b/gdal-poppler-0.31.patch new file mode 100644 index 0000000..999fa82 --- /dev/null +++ b/gdal-poppler-0.31.patch @@ -0,0 +1,122 @@ +Index: frmts/pdf/pdfdataset.cpp +=================================================================== +--- frmts/pdf/pdfdataset.cpp.orig ++++ frmts/pdf/pdfdataset.cpp +@@ -108,12 +108,9 @@ class GDALPDFOutputDev : public SplashOu + + public: + GDALPDFOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, +- GBool reverseVideoA, SplashColorPtr paperColorA, +- GBool bitmapTopDownA = gTrue, +- GBool allowAntialiasA = gTrue) : ++ GBool reverseVideoA, SplashColorPtr paperColorA) : + SplashOutputDev(colorModeA, bitmapRowPadA, +- reverseVideoA, paperColorA, +- bitmapTopDownA, allowAntialiasA), ++ reverseVideoA, paperColorA), + bEnableVector(TRUE), + bEnableText(TRUE), + bEnableBitmap(TRUE) {} +Index: frmts/pdf/pdfio.cpp +=================================================================== +--- frmts/pdf/pdfio.cpp.orig ++++ frmts/pdf/pdfio.cpp +@@ -39,13 +39,25 @@ + + CPL_CVSID("$Id: pdfio.cpp 27044 2014-03-16 23:41:27Z rouault $"); + ++ ++#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS ++/* Poppler 0.31.0 is the first one that needs to know the file size */ ++static vsi_l_offset VSIPDFFileStreamGetSize(VSILFILE* f) ++{ ++ VSIFSeekL(f, 0, SEEK_END); ++ vsi_l_offset nSize = VSIFTellL(f); ++ VSIFSeekL(f, 0, SEEK_SET); ++ return nSize; ++} ++#endif ++ + /************************************************************************/ + /* VSIPDFFileStream() */ + /************************************************************************/ + + VSIPDFFileStream::VSIPDFFileStream(VSILFILE* f, const char* pszFilename, Object *dictA): + #ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS +- BaseStream(dictA, 0) ++ BaseStream(dictA, (setPos_offset_type)VSIPDFFileStreamGetSize(f)) + #else + BaseStream(dictA) + #endif +@@ -195,7 +207,7 @@ int VSIPDFFileStream::FillBuffer() + /* getChar() */ + /************************************************************************/ + +-/* The unoptimized version performs a bit well since we must go through */ ++/* The unoptimized version performs a bit less since we must go through */ + /* the whole virtual I/O chain for each character reading. We save a few */ + /* percent with this extra internal caching */ + +@@ -326,4 +338,47 @@ void VSIPDFFileStream::moveStart(moveSta + nPosInBuffer = nBufferLength = -1; + } + ++/************************************************************************/ ++/* hasGetChars() */ ++/************************************************************************/ ++ ++GBool VSIPDFFileStream::hasGetChars() ++{ ++ return true; ++} ++ ++/************************************************************************/ ++/* getChars() */ ++/************************************************************************/ ++ ++int VSIPDFFileStream::getChars(int nChars, Guchar *buffer) ++{ ++ int nRead = 0; ++ while (nRead < nChars) ++ { ++ int nToRead = nChars - nRead; ++ if (nPosInBuffer == nBufferLength) ++ { ++ if (!bLimited && nToRead > BUFFER_SIZE) ++ { ++ int nJustRead = (int) VSIFReadL(buffer + nRead, 1, nToRead, f); ++ nPosInBuffer = nBufferLength = -1; ++ nCurrentPos += nJustRead; ++ nRead += nJustRead; ++ break; ++ } ++ else if (!FillBuffer() || nPosInBuffer >= nBufferLength) ++ break; ++ } ++ if( nToRead > nBufferLength - nPosInBuffer ) ++ nToRead = nBufferLength - nPosInBuffer; ++ ++ memcpy( buffer + nRead, abyBuffer + nPosInBuffer, nToRead ); ++ nPosInBuffer += nToRead; ++ nCurrentPos += nToRead; ++ nRead += nToRead; ++ } ++ return nRead; ++} ++ + #endif +Index: frmts/pdf/pdfio.h +=================================================================== +--- frmts/pdf/pdfio.h.orig ++++ frmts/pdf/pdfio.h +@@ -93,6 +93,10 @@ class VSIPDFFileStream: public BaseStrea + virtual void close(); + + private: ++ /* Added in poppler 0.15.0 */ ++ virtual GBool hasGetChars(); ++ virtual int getChars(int nChars, Guchar *buffer); ++ + VSIPDFFileStream *poParent; + GooString *poFilename; + VSILFILE *f; diff --git a/gdal.changes b/gdal.changes index 2880e9b..756fbce 100644 --- a/gdal.changes +++ b/gdal.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Mar 27 13:53:57 UTC 2015 - dimstar@opensuse.org + +- Add gdal-poppler-0.31.patch: Fix build with poppler 0.31+. + ------------------------------------------------------------------- Tue Mar 10 10:35:47 UTC 2015 - schubert.seb@gmail.com diff --git a/gdal.spec b/gdal.spec index 1cde685..7f0ca12 100644 --- a/gdal.spec +++ b/gdal.spec @@ -32,6 +32,8 @@ Patch2: gdal-perl.patch Patch3: GDALmake.opt.in.patch # Fix hard coded name of libproj library Patch4: gdal-libproj.patch +# PATCH-FIX-UPSTREAM gdal-poppler-0.31.patch dimstar@opensuse.org -- Fix build with poppler 0.31+, taken from upstream svn. +Patch5: gdal-poppler-0.31.patch BuildRequires: blas-devel BuildRequires: chrpath BuildRequires: curl-devel @@ -132,6 +134,7 @@ The GDAL python modules provide support to handle multiple GIS file formats. %patch2 -p1 %patch3 -p0 %patch4 -p0 +%patch5 -p0 # need to regenerate (old ones don't support perl 5.10) rm swig/perl/{gdal_wrap.cpp,gdalconst_wrap.c,ogr_wrap.cpp,osr_wrap.cpp}