Fix some coverity warnings

This commit is contained in:
mayeut 2016-04-30 12:15:22 +02:00
parent f40a2ff2ad
commit cd77b6003b
2 changed files with 7 additions and 11 deletions

View File

@ -9343,16 +9343,19 @@ void j2k_dump (opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream)
/* Dump the codestream info from main header */ /* Dump the codestream info from main header */
if (flag & OPJ_J2K_MH_INFO){ if (flag & OPJ_J2K_MH_INFO){
opj_j2k_dump_MH_info(p_j2k, out_stream); if (p_j2k->m_private_image)
opj_j2k_dump_MH_info(p_j2k, out_stream);
} }
/* Dump all tile/codestream info */ /* Dump all tile/codestream info */
if (flag & OPJ_J2K_TCH_INFO){ if (flag & OPJ_J2K_TCH_INFO){
OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw; OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
OPJ_UINT32 i; OPJ_UINT32 i;
opj_tcp_t * l_tcp = p_j2k->m_cp.tcps; opj_tcp_t * l_tcp = p_j2k->m_cp.tcps;
for (i=0;i<l_nb_tiles;++i) { if (p_j2k->m_private_image) {
opj_j2k_dump_tile_info( l_tcp,(OPJ_INT32)p_j2k->m_private_image->numcomps, out_stream); for (i=0;i<l_nb_tiles;++i) {
++l_tcp; opj_j2k_dump_tile_info( l_tcp,(OPJ_INT32)p_j2k->m_private_image->numcomps, out_stream);
++l_tcp;
}
} }
} }

View File

@ -486,7 +486,6 @@ OPJ_BOOL opj_tcd_rateallocate( opj_tcd_t *tcd,
for (layno = 0; layno < tcd_tcp->numlayers; layno++) { for (layno = 0; layno < tcd_tcp->numlayers; layno++) {
OPJ_FLOAT64 lo = min; OPJ_FLOAT64 lo = min;
OPJ_FLOAT64 hi = max; OPJ_FLOAT64 hi = max;
OPJ_BOOL success = OPJ_FALSE;
OPJ_UINT32 maxlen = tcd_tcp->rates[layno] > 0.0f ? opj_uint_min(((OPJ_UINT32) ceil(tcd_tcp->rates[layno])), len) : len; OPJ_UINT32 maxlen = tcd_tcp->rates[layno] > 0.0f ? opj_uint_min(((OPJ_UINT32) ceil(tcd_tcp->rates[layno])), len) : len;
OPJ_FLOAT64 goodthresh = 0; OPJ_FLOAT64 goodthresh = 0;
OPJ_FLOAT64 stable_thresh = 0; OPJ_FLOAT64 stable_thresh = 0;
@ -559,19 +558,13 @@ OPJ_BOOL opj_tcd_rateallocate( opj_tcd_t *tcd,
} }
} }
success = OPJ_TRUE;
goodthresh = stable_thresh == 0? thresh : stable_thresh; goodthresh = stable_thresh == 0? thresh : stable_thresh;
opj_t2_destroy(t2); opj_t2_destroy(t2);
} else { } else {
success = OPJ_TRUE;
goodthresh = min; goodthresh = min;
} }
if (!success) {
return OPJ_FALSE;
}
if(cstr_info) { /* Threshold for Marcela Index */ if(cstr_info) { /* Threshold for Marcela Index */
cstr_info->tile[tcd->tcd_tileno].thresh[layno] = goodthresh; cstr_info->tile[tcd->tcd_tileno].thresh[layno] = goodthresh;
} }