From 34a41104af8ba31e32c7883c2049a91742ef23b0 Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Sun, 22 Nov 2020 12:36:59 +0100 Subject: [PATCH] even more fixes for even newer jasper --- jasper.patch | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/jasper.patch b/jasper.patch index 9a2aae6..773c84f 100644 --- a/jasper.patch +++ b/jasper.patch @@ -67,3 +67,62 @@ index e780d2bcaed..10a4f96f0ee 100644 { jas_stream_VSIFL_t *fileobj = JAS_CAST(jas_stream_VSIFL_t *, obj); return static_cast(VSIFWriteL(buf, 1, cnt, fileobj->fp)); +From 1562e215c6f53a53efa66263113ecc6e761818d2 Mon Sep 17 00:00:00 2001 +From: Even Rouault +Date: Mon, 5 Oct 2020 12:11:52 +0200 +Subject: [PATCH] JPEG2000: make it build with Jasper 2.0.21 (fixes #3012) + +--- + gdal/frmts/jpeg2000/jpeg2000_vsil_io.cpp | 16 +++++++++------- + gdal/frmts/jpeg2000/jpeg2000dataset.cpp | 2 +- + 2 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/gdal/frmts/jpeg2000/jpeg2000_vsil_io.cpp b/gdal/frmts/jpeg2000/jpeg2000_vsil_io.cpp +index 10a4f96f0ee..ebcac4010ce 100644 +--- a/gdal/frmts/jpeg2000/jpeg2000_vsil_io.cpp ++++ b/gdal/frmts/jpeg2000/jpeg2000_vsil_io.cpp +@@ -94,22 +94,24 @@ typedef struct { + * File stream object. + \******************************************************************************/ + ++#if defined(PRIjas_seqent) + // PRIjas_seqent macro is defined since Jasper 2.0.17 +- +-#ifndef PRIjas_seqent +-static int JPEG2000_VSIL_read(jas_stream_obj_t *obj, char *buf, int cnt) +-#else + static int JPEG2000_VSIL_read(jas_stream_obj_t *obj, char *buf, unsigned cnt) ++#else ++static int JPEG2000_VSIL_read(jas_stream_obj_t *obj, char *buf, int cnt) + #endif + { + jas_stream_VSIFL_t *fileobj = JAS_CAST(jas_stream_VSIFL_t *, obj); + return static_cast(VSIFReadL(buf, 1, cnt, fileobj->fp)); + } + +-#ifndef PRIjas_seqent +-static int JPEG2000_VSIL_write(jas_stream_obj_t *obj, char *buf, int cnt) +-#else ++#if defined(JAS_INCLUDE_JP2_CODEC) ++// Jasper 2.0.21 ++static int JPEG2000_VSIL_write(jas_stream_obj_t *obj, const char *buf, unsigned int cnt) ++#elif defined(PRIjas_seqent) + static int JPEG2000_VSIL_write(jas_stream_obj_t *obj, char *buf, unsigned int cnt) ++#else ++static int JPEG2000_VSIL_write(jas_stream_obj_t *obj, char *buf, int cnt) + #endif + { + jas_stream_VSIFL_t *fileobj = JAS_CAST(jas_stream_VSIFL_t *, obj); +diff --git a/gdal/frmts/jpeg2000/jpeg2000dataset.cpp b/gdal/frmts/jpeg2000/jpeg2000dataset.cpp +index a5a6b258ed9..bd1e7763186 100644 +--- a/gdal/frmts/jpeg2000/jpeg2000dataset.cpp ++++ b/gdal/frmts/jpeg2000/jpeg2000dataset.cpp +@@ -513,7 +513,7 @@ int JPEG2000Dataset::DecodeImage() + for ( iBand = 0; iBand < nBands; iBand++ ) + { + JPEG2000RasterBand* poBand = (JPEG2000RasterBand*) GetRasterBand(iBand+1); +- if (poBand->iDepth != jas_image_cmptprec( psImage, iBand ) || ++ if (poBand->iDepth != static_cast(jas_image_cmptprec( psImage, iBand )) || + poBand->bSignedness != jas_image_cmptsgnd( psImage, iBand )) + { + CPLError(CE_Failure, CPLE_AppDefined, -- 2.43.0