[trunk] remove warnings raised by vs11-beta analyzer
This commit is contained in:
parent
94880d8f36
commit
0e3c467a5b
|
@ -809,15 +809,17 @@ void opj_j2k_update_tlm (opj_j2k_t * p_j2k, OPJ_UINT32 p_tile_part_size )
|
||||||
*
|
*
|
||||||
* @param p_tile_no the tile to output
|
* @param p_tile_no the tile to output
|
||||||
* @param p_comp_no the component to output
|
* @param p_comp_no the component to output
|
||||||
* @param p_stream the stream to write data to.
|
* @param nb_comps the number of components
|
||||||
* @param p_j2k J2K codec.
|
* @param p_stream the stream to write data to.
|
||||||
|
* @param p_j2k J2K codec.
|
||||||
* @param p_manager the user event manager.
|
* @param p_manager the user event manager.
|
||||||
*/
|
*/
|
||||||
static opj_bool opj_j2k_write_rgn( opj_j2k_t *p_j2k,
|
static opj_bool opj_j2k_write_rgn( opj_j2k_t *p_j2k,
|
||||||
OPJ_UINT32 p_tile_no,
|
OPJ_UINT32 p_tile_no,
|
||||||
OPJ_UINT32 p_comp_no,
|
OPJ_UINT32 p_comp_no,
|
||||||
opj_stream_private_t *p_stream,
|
OPJ_UINT32 nb_comps,
|
||||||
opj_event_mgr_t * p_manager );
|
opj_stream_private_t *p_stream,
|
||||||
|
opj_event_mgr_t * p_manager );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a RGN marker (Region Of Interest)
|
* Reads a RGN marker (Region Of Interest)
|
||||||
|
@ -4260,16 +4262,15 @@ opj_bool opj_j2k_read_sod (opj_j2k_t *p_j2k,
|
||||||
}
|
}
|
||||||
|
|
||||||
opj_bool opj_j2k_write_rgn(opj_j2k_t *p_j2k,
|
opj_bool opj_j2k_write_rgn(opj_j2k_t *p_j2k,
|
||||||
OPJ_UINT32 p_tile_no,
|
OPJ_UINT32 p_tile_no,
|
||||||
OPJ_UINT32 p_comp_no,
|
OPJ_UINT32 p_comp_no,
|
||||||
opj_stream_private_t *p_stream,
|
OPJ_UINT32 nb_comps,
|
||||||
opj_event_mgr_t * p_manager
|
opj_stream_private_t *p_stream,
|
||||||
|
opj_event_mgr_t * p_manager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
OPJ_BYTE * l_current_data = 00;
|
OPJ_BYTE * l_current_data = 00;
|
||||||
OPJ_UINT32 l_nb_comp;
|
|
||||||
OPJ_UINT32 l_rgn_size;
|
OPJ_UINT32 l_rgn_size;
|
||||||
opj_image_t *l_image = 00;
|
|
||||||
opj_cp_t *l_cp = 00;
|
opj_cp_t *l_cp = 00;
|
||||||
opj_tcp_t *l_tcp = 00;
|
opj_tcp_t *l_tcp = 00;
|
||||||
opj_tccp_t *l_tccp = 00;
|
opj_tccp_t *l_tccp = 00;
|
||||||
|
@ -4284,9 +4285,7 @@ opj_bool opj_j2k_read_sod (opj_j2k_t *p_j2k,
|
||||||
l_tcp = &l_cp->tcps[p_tile_no];
|
l_tcp = &l_cp->tcps[p_tile_no];
|
||||||
l_tccp = &l_tcp->tccps[p_comp_no];
|
l_tccp = &l_tcp->tccps[p_comp_no];
|
||||||
|
|
||||||
l_nb_comp = l_image->numcomps;
|
if (nb_comps <= 256) {
|
||||||
|
|
||||||
if (l_nb_comp <= 256) {
|
|
||||||
l_comp_room = 1;
|
l_comp_room = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -4303,13 +4302,13 @@ opj_bool opj_j2k_read_sod (opj_j2k_t *p_j2k,
|
||||||
opj_write_bytes(l_current_data,l_rgn_size-2,2); /* Lrgn */
|
opj_write_bytes(l_current_data,l_rgn_size-2,2); /* Lrgn */
|
||||||
l_current_data += 2;
|
l_current_data += 2;
|
||||||
|
|
||||||
opj_write_bytes(l_current_data,p_comp_no,l_comp_room); /* Crgn */
|
opj_write_bytes(l_current_data,p_comp_no,l_comp_room); /* Crgn */
|
||||||
l_current_data+=l_comp_room;
|
l_current_data+=l_comp_room;
|
||||||
|
|
||||||
opj_write_bytes(l_current_data, 0,1); /* Srgn */
|
opj_write_bytes(l_current_data, 0,1); /* Srgn */
|
||||||
++l_current_data;
|
++l_current_data;
|
||||||
|
|
||||||
opj_write_bytes(l_current_data, l_tccp->roishift,1); /* SPrgn */
|
opj_write_bytes(l_current_data, l_tccp->roishift,1); /* SPrgn */
|
||||||
++l_current_data;
|
++l_current_data;
|
||||||
|
|
||||||
if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_rgn_size,p_manager) != l_rgn_size) {
|
if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_rgn_size,p_manager) != l_rgn_size) {
|
||||||
|
@ -4747,7 +4746,7 @@ opj_bool opj_j2k_write_regions( opj_j2k_t *p_j2k,
|
||||||
for (compno = 0; compno < p_j2k->m_private_image->numcomps; ++compno) {
|
for (compno = 0; compno < p_j2k->m_private_image->numcomps; ++compno) {
|
||||||
if (l_tccp->roishift) {
|
if (l_tccp->roishift) {
|
||||||
|
|
||||||
if (! opj_j2k_write_rgn(p_j2k,0,compno,p_stream,p_manager)) {
|
if (! opj_j2k_write_rgn(p_j2k,0,compno,p_j2k->m_private_image->numcomps,p_stream,p_manager)) {
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8453,6 +8452,8 @@ opj_codestream_info_v2_t* j2k_get_cstr_info(opj_j2k_t* p_j2k)
|
||||||
OPJ_UINT32 numcomps = p_j2k->m_private_image->numcomps;
|
OPJ_UINT32 numcomps = p_j2k->m_private_image->numcomps;
|
||||||
opj_tcp_t *l_default_tile;
|
opj_tcp_t *l_default_tile;
|
||||||
opj_codestream_info_v2_t* cstr_info = (opj_codestream_info_v2_t*) opj_calloc(1,sizeof(opj_codestream_info_v2_t));
|
opj_codestream_info_v2_t* cstr_info = (opj_codestream_info_v2_t*) opj_calloc(1,sizeof(opj_codestream_info_v2_t));
|
||||||
|
if (!cstr_info)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
cstr_info->nbcomps = p_j2k->m_private_image->numcomps;
|
cstr_info->nbcomps = p_j2k->m_private_image->numcomps;
|
||||||
|
|
||||||
|
@ -8473,6 +8474,11 @@ opj_codestream_info_v2_t* j2k_get_cstr_info(opj_j2k_t* p_j2k)
|
||||||
cstr_info->m_default_tile_info.mct = l_default_tile->mct;
|
cstr_info->m_default_tile_info.mct = l_default_tile->mct;
|
||||||
|
|
||||||
cstr_info->m_default_tile_info.tccp_info = (opj_tccp_info_t*) opj_calloc(cstr_info->nbcomps, sizeof(opj_tccp_info_t));
|
cstr_info->m_default_tile_info.tccp_info = (opj_tccp_info_t*) opj_calloc(cstr_info->nbcomps, sizeof(opj_tccp_info_t));
|
||||||
|
if (!cstr_info->m_default_tile_info.tccp_info)
|
||||||
|
{
|
||||||
|
opj_destroy_cstr_info(&cstr_info);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (compno = 0; compno < numcomps; compno++) {
|
for (compno = 0; compno < numcomps; compno++) {
|
||||||
opj_tccp_t *l_tccp = &(l_default_tile->tccps[compno]);
|
opj_tccp_t *l_tccp = &(l_default_tile->tccps[compno]);
|
||||||
|
|
|
@ -842,10 +842,31 @@ opj_bool opj_jp2_read_pclr( opj_jp2_t *jp2,
|
||||||
nr_channels = (OPJ_UINT16) l_value;
|
nr_channels = (OPJ_UINT16) l_value;
|
||||||
|
|
||||||
entries = (OPJ_UINT32*) opj_malloc(nr_channels * nr_entries * sizeof(OPJ_UINT32));
|
entries = (OPJ_UINT32*) opj_malloc(nr_channels * nr_entries * sizeof(OPJ_UINT32));
|
||||||
|
if (!entries)
|
||||||
|
return OPJ_FALSE;
|
||||||
channel_size = (OPJ_BYTE*) opj_malloc(nr_channels);
|
channel_size = (OPJ_BYTE*) opj_malloc(nr_channels);
|
||||||
|
if (!channel_size)
|
||||||
|
{
|
||||||
|
opj_free(entries);
|
||||||
|
return OPJ_FALSE;
|
||||||
|
}
|
||||||
channel_sign = (OPJ_BYTE*) opj_malloc(nr_channels);
|
channel_sign = (OPJ_BYTE*) opj_malloc(nr_channels);
|
||||||
|
if (!channel_sign)
|
||||||
|
{
|
||||||
|
opj_free(entries);
|
||||||
|
opj_free(channel_size);
|
||||||
|
return OPJ_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
jp2_pclr = (opj_jp2_pclr_t*)opj_malloc(sizeof(opj_jp2_pclr_t));
|
jp2_pclr = (opj_jp2_pclr_t*)opj_malloc(sizeof(opj_jp2_pclr_t));
|
||||||
|
if (!jp2_pclr)
|
||||||
|
{
|
||||||
|
opj_free(entries);
|
||||||
|
opj_free(channel_size);
|
||||||
|
opj_free(channel_sign);
|
||||||
|
return OPJ_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
jp2_pclr->channel_sign = channel_sign;
|
jp2_pclr->channel_sign = channel_sign;
|
||||||
jp2_pclr->channel_size = channel_size;
|
jp2_pclr->channel_size = channel_size;
|
||||||
jp2_pclr->entries = entries;
|
jp2_pclr->entries = entries;
|
||||||
|
@ -891,7 +912,7 @@ opj_bool opj_jp2_read_cmap( opj_jp2_t * jp2,
|
||||||
assert(jp2 != 00);
|
assert(jp2 != 00);
|
||||||
assert(p_cmap_header_data != 00);
|
assert(p_cmap_header_data != 00);
|
||||||
assert(p_manager != 00);
|
assert(p_manager != 00);
|
||||||
(void)p_cmap_header_size;
|
(void)p_cmap_header_size;
|
||||||
|
|
||||||
/* Need nr_channels: */
|
/* Need nr_channels: */
|
||||||
if(jp2->color.jp2_pclr == NULL) {
|
if(jp2->color.jp2_pclr == NULL) {
|
||||||
|
@ -909,6 +930,9 @@ opj_bool opj_jp2_read_cmap( opj_jp2_t * jp2,
|
||||||
|
|
||||||
nr_channels = jp2->color.jp2_pclr->nr_channels;
|
nr_channels = jp2->color.jp2_pclr->nr_channels;
|
||||||
cmap = (opj_jp2_cmap_comp_t*) opj_malloc(nr_channels * sizeof(opj_jp2_cmap_comp_t));
|
cmap = (opj_jp2_cmap_comp_t*) opj_malloc(nr_channels * sizeof(opj_jp2_cmap_comp_t));
|
||||||
|
if (!cmap)
|
||||||
|
return OPJ_FALSE;
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < nr_channels; ++i) {
|
for(i = 0; i < nr_channels; ++i) {
|
||||||
opj_read_bytes(p_cmap_header_data, &l_value, 2); /* CMP^i */
|
opj_read_bytes(p_cmap_header_data, &l_value, 2); /* CMP^i */
|
||||||
|
@ -993,8 +1017,15 @@ opj_bool opj_jp2_read_cdef( opj_jp2_t * jp2,
|
||||||
}
|
}
|
||||||
|
|
||||||
cdef_info = (opj_jp2_cdef_info_t*) opj_malloc(l_value * sizeof(opj_jp2_cdef_info_t));
|
cdef_info = (opj_jp2_cdef_info_t*) opj_malloc(l_value * sizeof(opj_jp2_cdef_info_t));
|
||||||
|
if (!cdef_info)
|
||||||
|
return OPJ_FALSE;
|
||||||
|
|
||||||
jp2->color.jp2_cdef = (opj_jp2_cdef_t*)opj_malloc(sizeof(opj_jp2_cdef_t));
|
jp2->color.jp2_cdef = (opj_jp2_cdef_t*)opj_malloc(sizeof(opj_jp2_cdef_t));
|
||||||
|
if(!jp2->color.jp2_cdef)
|
||||||
|
{
|
||||||
|
opj_free(cdef_info);
|
||||||
|
return OPJ_FALSE;
|
||||||
|
}
|
||||||
jp2->color.jp2_cdef->info = cdef_info;
|
jp2->color.jp2_cdef->info = cdef_info;
|
||||||
jp2->color.jp2_cdef->n = (OPJ_UINT16) l_value;
|
jp2->color.jp2_cdef->n = (OPJ_UINT16) l_value;
|
||||||
|
|
||||||
|
@ -1066,7 +1097,11 @@ opj_bool opj_jp2_read_colr( opj_jp2_t *jp2,
|
||||||
|
|
||||||
jp2->color.icc_profile_len = icc_len;
|
jp2->color.icc_profile_len = icc_len;
|
||||||
jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_malloc(icc_len);
|
jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_malloc(icc_len);
|
||||||
|
if (!jp2->color.icc_profile_buf)
|
||||||
|
{
|
||||||
|
jp2->color.icc_profile_len = 0;
|
||||||
|
return OPJ_FALSE;
|
||||||
|
}
|
||||||
memset(jp2->color.icc_profile_buf, 0, icc_len * sizeof(OPJ_BYTE));
|
memset(jp2->color.icc_profile_buf, 0, icc_len * sizeof(OPJ_BYTE));
|
||||||
|
|
||||||
for (it_icc_value = 0; it_icc_value < icc_len; ++it_icc_value)
|
for (it_icc_value = 0; it_icc_value < icc_len; ++it_icc_value)
|
||||||
|
@ -1396,12 +1431,23 @@ void opj_jp2_setup_encoder( opj_jp2_t *jp2,
|
||||||
jp2->minversion = 0; /* MinV */
|
jp2->minversion = 0; /* MinV */
|
||||||
jp2->numcl = 1;
|
jp2->numcl = 1;
|
||||||
jp2->cl = (OPJ_UINT32*) opj_malloc(jp2->numcl * sizeof(OPJ_UINT32));
|
jp2->cl = (OPJ_UINT32*) opj_malloc(jp2->numcl * sizeof(OPJ_UINT32));
|
||||||
|
if (!jp2->cl){
|
||||||
|
jp2->cl = NULL;
|
||||||
|
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory when setup the JP2 encoder\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
jp2->cl[0] = JP2_JP2; /* CL0 : JP2 */
|
jp2->cl[0] = JP2_JP2; /* CL0 : JP2 */
|
||||||
|
|
||||||
/* Image Header box */
|
/* Image Header box */
|
||||||
|
|
||||||
jp2->numcomps = image->numcomps; /* NC */
|
jp2->numcomps = image->numcomps; /* NC */
|
||||||
jp2->comps = (opj_jp2_comps_t*) opj_malloc(jp2->numcomps * sizeof(opj_jp2_comps_t));
|
jp2->comps = (opj_jp2_comps_t*) opj_malloc(jp2->numcomps * sizeof(opj_jp2_comps_t));
|
||||||
|
if (!jp2->comps) {
|
||||||
|
jp2->comps = NULL;
|
||||||
|
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory when setup the JP2 encoder\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
jp2->h = image->y1 - image->y0; /* HEIGHT */
|
jp2->h = image->y1 - image->y0; /* HEIGHT */
|
||||||
jp2->w = image->x1 - image->x0; /* WIDTH */
|
jp2->w = image->x1 - image->x0; /* WIDTH */
|
||||||
/* BPC */
|
/* BPC */
|
||||||
|
|
Loading…
Reference in New Issue