summaryrefslogtreecommitdiff
path: root/sci-libs/gdal/files/gdal-2.0.2-jasper2.patch
blob: a418e4159c0aa9531580f63043d7f32eb7a35c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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.
 \******************************************************************************/
 
-static void JPEG2000_VSIL_jas_stream_initbuf(jas_stream_t *stream, int bufmode, char *buf,
-  int bufsize)
+static void JPEG2000_VSIL_jas_stream_initbuf(jas_stream_t *stream, int bufmode)
 {
 	/* If this function is being called, the buffer should not have been
 	  initialized yet. */
 	assert(!stream->bufbase_);
 
 	if (bufmode != JAS_STREAM_UNBUF) {
-		/* The full- or line-buffered mode is being employed. */
-		if (!buf) {
-			/* The caller has not specified a buffer to employ, so allocate
-			  one. */
-			if ((stream->bufbase_ = (unsigned char*)jas_malloc(JAS_STREAM_BUFSIZE +
-			  JAS_STREAM_MAXPUTBACK))) {
-				stream->bufmode_ |= JAS_STREAM_FREEBUF;
-				stream->bufsize_ = JAS_STREAM_BUFSIZE;
-			} else {
-				/* The buffer allocation has failed.  Resort to unbuffered
-				  operation. */
-				stream->bufbase_ = stream->tinybuf_;
-				stream->bufsize_ = 1;
-			}
+		if ((stream->bufbase_ = (unsigned char*)jas_malloc(JAS_STREAM_BUFSIZE +
+		  JAS_STREAM_MAXPUTBACK))) {
+			stream->bufmode_ |= JAS_STREAM_FREEBUF;
+			stream->bufsize_ = JAS_STREAM_BUFSIZE;
 		} else {
-			/* The caller has specified a buffer to employ. */
-			/* The buffer must be large enough to accommodate maximum
-			  putback. */
-			assert(bufsize > JAS_STREAM_MAXPUTBACK);
-			stream->bufbase_ = JAS_CAST(uchar *, buf);
-			stream->bufsize_ = bufsize - JAS_STREAM_MAXPUTBACK;
+			/* The buffer allocation has failed.  Resort to unbuffered
+			  operation. */
+			stream->bufbase_ = stream->tinybuf_;
+			stream->bufsize_ = 1;
 		}
 	} else {
 		/* The unbuffered mode is being employed. */
-		/* A buffer should not have been supplied by the caller. */
-		assert(!buf);
 		/* Use a trivial one-character buffer. */
 		stream->bufbase_ = stream->tinybuf_;
 		stream->bufsize_ = 1;
@@ -282,7 +267,7 @@
 	}
 
 	/* By default, use full buffering for this type of stream. */
-	JPEG2000_VSIL_jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
+	JPEG2000_VSIL_jas_stream_initbuf(stream, JAS_STREAM_FULLBUF);
 
 	return stream;
 }