Fix code-style and merge duplicate if block.
This commit is contained in:
parent
f4088f9a74
commit
2abbcb9ef7
|
@ -4964,7 +4964,7 @@ static OPJ_BOOL opj_j2k_read_sod(opj_j2k_t *p_j2k,
|
||||||
/* Check enough bytes left in stream before allocation */
|
/* Check enough bytes left in stream before allocation */
|
||||||
if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
|
if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
|
||||||
opj_stream_get_number_byte_left(p_stream)) {
|
opj_stream_get_number_byte_left(p_stream)) {
|
||||||
if(p_j2k->m_cp.strict) {
|
if (p_j2k->m_cp.strict) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR,
|
opj_event_msg(p_manager, EVT_ERROR,
|
||||||
"Tile part length size inconsistent with stream length\n");
|
"Tile part length size inconsistent with stream length\n");
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
|
|
|
@ -433,7 +433,8 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec, OPJ_BOOL strict)
|
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
|
||||||
|
OPJ_BOOL strict)
|
||||||
{
|
{
|
||||||
if (p_codec) {
|
if (p_codec) {
|
||||||
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
|
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
|
||||||
|
@ -444,8 +445,9 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode(l_codec->m_codec,
|
l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode(
|
||||||
strict);
|
l_codec->m_codec,
|
||||||
|
strict);
|
||||||
return OPJ_TRUE;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
|
|
|
@ -1356,7 +1356,8 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
|
||||||
* @return true if the decoder is correctly set
|
* @return true if the decoder is correctly set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec, OPJ_BOOL strict);
|
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
|
||||||
|
OPJ_BOOL strict);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates worker threads for the compressor/decompressor.
|
* Allocates worker threads for the compressor/decompressor.
|
||||||
|
|
|
@ -1399,7 +1399,7 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||||
|
|
||||||
// if we have a partial data stream, set numchunks to zero
|
// if we have a partial data stream, set numchunks to zero
|
||||||
// since we have no data to actually decode.
|
// since we have no data to actually decode.
|
||||||
if(partial_buffer) {
|
if (partial_buffer) {
|
||||||
l_cblk->numchunks = 0;
|
l_cblk->numchunks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1427,7 +1427,7 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||||
(OPJ_SIZE_T)l_current_data) ||
|
(OPJ_SIZE_T)l_current_data) ||
|
||||||
(l_current_data + l_seg->newlen > p_src_data + p_max_length) ||
|
(l_current_data + l_seg->newlen > p_src_data + p_max_length) ||
|
||||||
(partial_buffer)) {
|
(partial_buffer)) {
|
||||||
if(p_t2->cp->strict) {
|
if (p_t2->cp->strict) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR,
|
opj_event_msg(p_manager, EVT_ERROR,
|
||||||
"read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
"read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
|
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
|
||||||
|
@ -1447,8 +1447,6 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||||
if (l_cblk->numnewpasses > 0) {
|
if (l_cblk->numnewpasses > 0) {
|
||||||
++l_seg;
|
++l_seg;
|
||||||
++l_cblk->numsegs;
|
++l_cblk->numsegs;
|
||||||
}
|
|
||||||
if(l_cblk->numnewpasses > 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -1515,7 +1513,7 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the number of bytes read
|
// return the number of bytes read
|
||||||
if(partial_buffer) {
|
if (partial_buffer) {
|
||||||
*(p_data_read) = p_max_length;
|
*(p_data_read) = p_max_length;
|
||||||
} else {
|
} else {
|
||||||
*(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
|
*(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
|
||||||
|
@ -1581,7 +1579,7 @@ static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2,
|
||||||
/* Check possible overflow then size */
|
/* Check possible overflow then size */
|
||||||
if (((*p_data_read + l_seg->newlen) < (*p_data_read)) ||
|
if (((*p_data_read + l_seg->newlen) < (*p_data_read)) ||
|
||||||
((*p_data_read + l_seg->newlen) > p_max_length)) {
|
((*p_data_read + l_seg->newlen) > p_max_length)) {
|
||||||
if(p_t2->cp->strict) {
|
if (p_t2->cp->strict) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR,
|
opj_event_msg(p_manager, EVT_ERROR,
|
||||||
"skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
"skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
|
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
|
||||||
|
|
Loading…
Reference in New Issue