[trunk] Fix wrong return value for opj_setup_encoder & opj_set_decoded_resolution_factor (fixes issue 497)

Thanks Aaron.
This commit is contained in:
Matthieu Darbois 2015-05-29 21:58:08 +00:00
parent 73881d0e52
commit 6def7e38b4
2 changed files with 8 additions and 6 deletions

View File

@ -1768,7 +1768,12 @@ int main(int argc, char **argv) {
parameters.cp_tdx = 512;
parameters.cp_tdy = 512;
}
opj_setup_encoder(l_codec, &parameters, image);
if (! opj_setup_encoder(l_codec, &parameters, image)) {
fprintf(stderr, "failed to encode image: opj_setup_encoder\n");
opj_destroy_codec(l_codec);
opj_image_destroy(image);
return 1;
}
/* open a byte stream for writing and allocate memory for all tiles */
l_stream = opj_stream_create_default_file_stream(parameters.outfile,OPJ_FALSE);

View File

@ -524,14 +524,12 @@ OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_codec,
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
if ( !l_codec ){
fprintf(stderr, "[ERROR] Input parameters of the setup_decoder function are incorrect.\n");
return OPJ_FALSE;
}
l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor(l_codec->m_codec,
return l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor(l_codec->m_codec,
res_factor,
&(l_codec->m_event_mgr) );
return OPJ_TRUE;
}
/* ---------------------------------------------------------------------- */
@ -700,11 +698,10 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec,
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
if (! l_codec->is_decompressor) {
l_codec->m_codec_data.m_compression.opj_setup_encoder( l_codec->m_codec,
return l_codec->m_codec_data.m_compression.opj_setup_encoder( l_codec->m_codec,
parameters,
p_image,
&(l_codec->m_event_mgr) );
return OPJ_TRUE;
}
}