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
This commit is contained in:
Martin Pluskal 2015-03-27 16:48:14 +00:00 committed by Git OBS Bridge
parent e9ac50f688
commit 181da5e258
3 changed files with 130 additions and 0 deletions

122
gdal-poppler-0.31.patch Normal file
View File

@ -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;

View File

@ -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 Tue Mar 10 10:35:47 UTC 2015 - schubert.seb@gmail.com

View File

@ -32,6 +32,8 @@ Patch2: gdal-perl.patch
Patch3: GDALmake.opt.in.patch Patch3: GDALmake.opt.in.patch
# Fix hard coded name of libproj library # Fix hard coded name of libproj library
Patch4: gdal-libproj.patch 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: blas-devel
BuildRequires: chrpath BuildRequires: chrpath
BuildRequires: curl-devel BuildRequires: curl-devel
@ -132,6 +134,7 @@ The GDAL python modules provide support to handle multiple GIS file formats.
%patch2 -p1 %patch2 -p1
%patch3 -p0 %patch3 -p0
%patch4 -p0 %patch4 -p0
%patch5 -p0
# need to regenerate (old ones don't support perl 5.10) # 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} rm swig/perl/{gdal_wrap.cpp,gdalconst_wrap.c,ogr_wrap.cpp,osr_wrap.cpp}