[trunk] Fix wrong return value for opj_setup_encoder & opj_set_decoded_resolution_factor (fixes issue 497)
Thanks Aaron.
This commit is contained in:
parent
73881d0e52
commit
6def7e38b4
|
@ -1768,7 +1768,12 @@ int main(int argc, char **argv) {
|
|||
parameters.cp_tdx = 512;
|
||||
parameters.cp_tdy = 512;
|
||||
}
|
||||
opj_setup_encoder(l_codec, ¶meters, image);
|
||||
if (! opj_setup_encoder(l_codec, ¶meters, 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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue