sci-libs/gdal: add jasper patch bug #599626
authorAmy Winston <amynka@gentoo.org>
Sat, 3 Dec 2016 10:26:23 +0000 (11:26 +0100)
committerAmy Winston <amynka@gentoo.org>
Sat, 3 Dec 2016 10:26:23 +0000 (11:26 +0100)
Package-Manager: portage-2.3.0

sci-libs/gdal/files/gdal-2.0.2-jasper2.patch [new file with mode: 0644]
sci-libs/gdal/gdal-2.0.2-r3.ebuild

diff --git a/sci-libs/gdal/files/gdal-2.0.2-jasper2.patch b/sci-libs/gdal/files/gdal-2.0.2-jasper2.patch
new file mode 100644 (file)
index 0000000..a418e41
--- /dev/null
@@ -0,0 +1,62 @@
+diff -urN orig/frmts/jpeg2000/jpeg2000_vsil_io.cpp dwok/frmts/jpeg2000/jpeg2000_vsil_io.cpp
+--- orig/frmts/jpeg2000/jpeg2000_vsil_io.cpp   2016-01-26 16:21:48.000000000 +0100
++++ dwok/frmts/jpeg2000/jpeg2000_vsil_io.cpp   2016-11-16 21:53:15.280302723 +0100
+@@ -179,40 +179,25 @@
+ * Buffer initialization code.\r
+ \******************************************************************************/\r
+ \r
+-static void JPEG2000_VSIL_jas_stream_initbuf(jas_stream_t *stream, int bufmode, char *buf,\r
+-  int bufsize)\r
++static void JPEG2000_VSIL_jas_stream_initbuf(jas_stream_t *stream, int bufmode)\r
+ {\r
+       /* If this function is being called, the buffer should not have been\r
+         initialized yet. */\r
+       assert(!stream->bufbase_);\r
+ \r
+       if (bufmode != JAS_STREAM_UNBUF) {\r
+-              /* The full- or line-buffered mode is being employed. */\r
+-              if (!buf) {\r
+-                      /* The caller has not specified a buffer to employ, so allocate\r
+-                        one. */\r
+-                      if ((stream->bufbase_ = (unsigned char*)jas_malloc(JAS_STREAM_BUFSIZE +\r
+-                        JAS_STREAM_MAXPUTBACK))) {\r
+-                              stream->bufmode_ |= JAS_STREAM_FREEBUF;\r
+-                              stream->bufsize_ = JAS_STREAM_BUFSIZE;\r
+-                      } else {\r
+-                              /* The buffer allocation has failed.  Resort to unbuffered\r
+-                                operation. */\r
+-                              stream->bufbase_ = stream->tinybuf_;\r
+-                              stream->bufsize_ = 1;\r
+-                      }\r
++              if ((stream->bufbase_ = (unsigned char*)jas_malloc(JAS_STREAM_BUFSIZE +\r
++                JAS_STREAM_MAXPUTBACK))) {\r
++                      stream->bufmode_ |= JAS_STREAM_FREEBUF;\r
++                      stream->bufsize_ = JAS_STREAM_BUFSIZE;\r
+               } else {\r
+-                      /* The caller has specified a buffer to employ. */\r
+-                      /* The buffer must be large enough to accommodate maximum\r
+-                        putback. */\r
+-                      assert(bufsize > JAS_STREAM_MAXPUTBACK);\r
+-                      stream->bufbase_ = JAS_CAST(uchar *, buf);\r
+-                      stream->bufsize_ = bufsize - JAS_STREAM_MAXPUTBACK;\r
++                      /* The buffer allocation has failed.  Resort to unbuffered\r
++                        operation. */\r
++                      stream->bufbase_ = stream->tinybuf_;\r
++                      stream->bufsize_ = 1;\r
+               }\r
+       } else {\r
+               /* The unbuffered mode is being employed. */\r
+-              /* A buffer should not have been supplied by the caller. */\r
+-              assert(!buf);\r
+               /* Use a trivial one-character buffer. */\r
+               stream->bufbase_ = stream->tinybuf_;\r
+               stream->bufsize_ = 1;\r
+@@ -282,7 +267,7 @@
+       }\r
+ \r
+       /* By default, use full buffering for this type of stream. */\r
+-      JPEG2000_VSIL_jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);\r
++      JPEG2000_VSIL_jas_stream_initbuf(stream, JAS_STREAM_FULLBUF);\r
+ \r
+       return stream;\r
+ }\r
index 2dae2cd0c96eff08f0d33e8189714a22cd1fc7a7..f8a672cb9fcdff7c0ac7512e7562080564851892 100644 (file)
@@ -87,6 +87,7 @@ src_prepare() {
 
        if use jpeg2k; then
                epatch "${FILESDIR}"/${P}-jasper.patch
+               epatch "${FILESDIR}"/${P}-jasper2.patch #bug 599626
        fi
 
        # -soname is only accepted by GNU ld/ELF