GRIB-140: GRIB2 JPEG packing error

This commit is contained in:
Shahram Najm 2014-10-17 19:51:59 +01:00
parent a449eca244
commit c0d87b53ce
1 changed files with 4 additions and 2 deletions

View File

@ -172,9 +172,11 @@ int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper) {
/* increase the number of guard bits */
strcat(opts,"\nnumgbits=4");
grib_context_log(c, GRIB_LOG_ERROR, "JASPER: error %d, increasing the number of guard bits", jaserr);
jaserr=jas_stream_close(istream);
jas_stream_close(istream); istream = 0;
jas_stream_close(jpcstream); jpcstream = 0;
istream = jas_stream_memopen((char *)encoded,buflen);
jaserr=jas_stream_close(jpcstream);
cmpt.stream_ = istream;
jpcstream = jas_stream_memopen((char*)helper->jpeg_buffer,helper->buffer_size);
jaserr = jpc_encode(&image,jpcstream,opts);
}