Closed Kzer-Za closed 3 years ago
The problem is that the jasper library changed their API so now the write
call takes a const
ponter. Also some int
got changed to unsigned
int the most recent version. For example, see https://github.com/jasper-software/jasper/commit/46dbba47210c7e16f7304f67a896b2f0faea4859#diff-251b049c7bd7658b9d34baa3ace6a1af0445780f3013f5e6181fe4784d8cdb86
It's pretty ugly from DevIL's perspective... if you want to support building against different versions of jasper we'll either need to do some decltype tricks or cmake autodetection
Digging into the jasper history a bit more:
Up through 2.0.16 the callbacks were:
int (*read_)(jas_stream_obj_t *obj, char *buf, int cnt);
int (*write_)(jas_stream_obj_t *obj, char *buf, int cnt);
Then for 2.0.17 - 2.0.19 the count changed to unsigned
(729996abbeabe698b7ee249c2146405b9a347a01):
int (*read_)(jas_stream_obj_t *obj, char *buf, unsigned cnt);
int (*write_)(jas_stream_obj_t *obj, char *buf, unsigned cnt);
before finally in 2.0.20 the write interface became more const-correct (46dbba47210c7e16f7304f67a896b2f0faea4859):
int (*write_)(jas_stream_obj_t *obj, const char *buf, unsigned cnt);
so far, no changes to the other callbacks like seek_()
It would be handy if there were a simple way of detecting what version of jasper we are building against directly using #ifdef
. There is a jasper/jas_version.h
header available, but unfortunate it only exports a JAS_VERSION
string, nothing like major/minor as numbers...
So basically twice in the last few months the API for jas_stream_ops_t
has changed in source-incompatible ways :-(
cc @MaxKellermann
Looks like this is the hack that gdal went with to deal with the API drift: https://github.com/OSGeo/gdal/commit/9ef8e16e27c5fc4c491debe50bf2b7f3e94ed334
The compilation throws this error: