Skip to content

Instantly share code, notes, and snippets.

@dakcarto
Last active November 16, 2016 00:47
Show Gist options
  • Save dakcarto/1b250872d52b2e87ee2f6efbb6bc8bd7 to your computer and use it in GitHub Desktop.
Save dakcarto/1b250872d52b2e87ee2f6efbb6bc8bd7 to your computer and use it in GitHub Desktop.
diff --git a/frmts/jpeg2000/jpeg2000_vsil_io.cpp b/frmts/jpeg2000/jpeg2000_vsil_io.cpp
index 74f1e64..789e9ef 100644
--- a/frmts/jpeg2000/jpeg2000_vsil_io.cpp
+++ b/frmts/jpeg2000/jpeg2000_vsil_io.cpp
@@ -194,7 +194,7 @@ static void JPEG2000_VSIL_jas_stream_initbuf(jas_stream_t *stream, int bufmode,
if (!buf) {
/* The caller has not specified a buffer to employ, so allocate
one. */
- if ((stream->bufbase_ = (unsigned char*)jas_malloc(JAS_STREAM_BUFSIZE +
+ if ((stream->bufbase_ = (jas_uchar*)jas_malloc(JAS_STREAM_BUFSIZE +
JAS_STREAM_MAXPUTBACK))) {
stream->bufmode_ |= JAS_STREAM_FREEBUF;
stream->bufsize_ = JAS_STREAM_BUFSIZE;
@@ -209,7 +209,7 @@ static void JPEG2000_VSIL_jas_stream_initbuf(jas_stream_t *stream, int bufmode,
/* The buffer must be large enough to accommodate maximum
putback. */
assert(bufsize > JAS_STREAM_MAXPUTBACK);
- stream->bufbase_ = JAS_CAST(uchar *, buf);
+ stream->bufbase_ = JAS_CAST(jas_uchar *, buf);
stream->bufsize_ = bufsize - JAS_STREAM_MAXPUTBACK;
}
} else {
diff --git a/frmts/jpeg2000/jpeg2000_vsil_io.h b/frmts/jpeg2000/jpeg2000_vsil_io.h
index 3af42cf..b918a27 100644
--- a/frmts/jpeg2000/jpeg2000_vsil_io.h
+++ b/frmts/jpeg2000/jpeg2000_vsil_io.h
@@ -32,6 +32,11 @@
#include <jasper/jasper.h>
+/* Handle prefix renaming in jasper 1.900.28 */
+#ifndef jas_uchar
+#define jas_uchar unsigned char
+#endif
+
jas_stream_t *JPEG2000_VSIL_fopen(const char *filename, const char *mode);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment