void-packages/srcpkgs/libgdal/patches/9ef8e16e27c5fc4c491debe50bf2b7f3e94ed334.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

53 lines
2.3 KiB
Diff

From 9ef8e16e27c5fc4c491debe50bf2b7f3e94ed334 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
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/frmts/jpeg2000/jpeg2000_vsil_io.cpp
+++ b/frmts/jpeg2000/jpeg2000_vsil_io.cpp
@@ -94,13 +94,24 @@
* File stream object.
\******************************************************************************/
+#if defined(PRIjas_seqent)
+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<int>(VSIFReadL(buf, 1, cnt, fileobj->fp));
}
+#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);
return static_cast<int>(VSIFWriteL(buf, 1, cnt, fileobj->fp));
diff --git a/gdal/frmts/jpeg2000/jpeg2000dataset.cpp b/gdal/frmts/jpeg2000/jpeg2000dataset.cpp
index a5a6b258ed9..bd1e7763186 100644
--- a/frmts/jpeg2000/jpeg2000dataset.cpp
+++ b/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<int>(jas_image_cmptprec( psImage, iBand )) ||
poBand->bSignedness != jas_image_cmptsgnd( psImage, iBand ))
{
CPLError(CE_Failure, CPLE_AppDefined,