Fix warnings (#763)
This commit is contained in:
parent
15f081c896
commit
be42e72d22
@ -378,12 +378,11 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
cmsColorSpaceSignature in_space, out_space;
|
cmsColorSpaceSignature in_space, out_space;
|
||||||
cmsUInt32Number intent, in_type, out_type;
|
cmsUInt32Number intent, in_type, out_type;
|
||||||
int *r, *g, *b;
|
int *r, *g, *b;
|
||||||
size_t nr_samples;
|
size_t nr_samples, i, max, max_w, max_h;
|
||||||
int prec, i, max, max_w, max_h, ok = 0;
|
int prec, ok = 0;
|
||||||
OPJ_COLOR_SPACE new_space;
|
OPJ_COLOR_SPACE new_space;
|
||||||
|
|
||||||
in_prof =
|
in_prof = cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
|
||||||
cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
|
|
||||||
#ifdef DEBUG_PROFILE
|
#ifdef DEBUG_PROFILE
|
||||||
FILE *icm = fopen("debug.icm","wb");
|
FILE *icm = fopen("debug.icm","wb");
|
||||||
fwrite( image->icc_profile_buf,1, image->icc_profile_len,icm);
|
fwrite( image->icc_profile_buf,1, image->icc_profile_len,icm);
|
||||||
@ -397,8 +396,8 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
intent = cmsGetHeaderRenderingIntent(in_prof);
|
intent = cmsGetHeaderRenderingIntent(in_prof);
|
||||||
|
|
||||||
|
|
||||||
max_w = (int)image->comps[0].w;
|
max_w = image->comps[0].w;
|
||||||
max_h = (int)image->comps[0].h;
|
max_h = image->comps[0].h;
|
||||||
prec = (int)image->comps[0].prec;
|
prec = (int)image->comps[0].prec;
|
||||||
|
|
||||||
if(out_space == cmsSigRgbData) /* enumCS 16 */
|
if(out_space == cmsSigRgbData) /* enumCS 16 */
|
||||||
@ -416,16 +415,14 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
out_prof = cmsCreate_sRGBProfile();
|
out_prof = cmsCreate_sRGBProfile();
|
||||||
new_space = OPJ_CLRSPC_SRGB;
|
new_space = OPJ_CLRSPC_SRGB;
|
||||||
}
|
}
|
||||||
else
|
else if(out_space == cmsSigGrayData) /* enumCS 17 */
|
||||||
if(out_space == cmsSigGrayData) /* enumCS 17 */
|
|
||||||
{
|
{
|
||||||
in_type = TYPE_GRAY_8;
|
in_type = TYPE_GRAY_8;
|
||||||
out_type = TYPE_RGB_8;
|
out_type = TYPE_RGB_8;
|
||||||
out_prof = cmsCreate_sRGBProfile();
|
out_prof = cmsCreate_sRGBProfile();
|
||||||
new_space = OPJ_CLRSPC_SRGB;
|
new_space = OPJ_CLRSPC_SRGB;
|
||||||
}
|
}
|
||||||
else
|
else if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
||||||
if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
|
||||||
{
|
{
|
||||||
in_type = TYPE_YCbCr_16;
|
in_type = TYPE_YCbCr_16;
|
||||||
out_type = TYPE_RGB_16;
|
out_type = TYPE_RGB_16;
|
||||||
@ -448,7 +445,6 @@ __FILE__,__LINE__,out_space,
|
|||||||
if(out_prof == NULL)
|
if(out_prof == NULL)
|
||||||
{
|
{
|
||||||
cmsCloseProfile(in_prof);
|
cmsCloseProfile(in_prof);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,8 +472,7 @@ fprintf(stderr,"\trender_intent (%u)\n\t"
|
|||||||
(void)in_space;
|
(void)in_space;
|
||||||
#endif /* DEBUG_PROFILE */
|
#endif /* DEBUG_PROFILE */
|
||||||
|
|
||||||
transform = cmsCreateTransform(in_prof, in_type,
|
transform = cmsCreateTransform(in_prof, in_type, out_prof, out_type, intent, 0);
|
||||||
out_prof, out_type, intent, 0);
|
|
||||||
|
|
||||||
#ifdef OPJ_HAVE_LIBLCMS2
|
#ifdef OPJ_HAVE_LIBLCMS2
|
||||||
/* Possible for: LCMS_VERSION >= 2000 :*/
|
/* Possible for: LCMS_VERSION >= 2000 :*/
|
||||||
@ -506,7 +501,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
|||||||
unsigned char *inbuf, *outbuf, *in, *out;
|
unsigned char *inbuf, *outbuf, *in, *out;
|
||||||
|
|
||||||
max = max_w * max_h;
|
max = max_w * max_h;
|
||||||
nr_samples = (size_t)(max * 3 * sizeof(unsigned char));
|
nr_samples = (size_t)(max * 3U * sizeof(unsigned char));
|
||||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||||
|
|
||||||
@ -516,7 +511,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
|||||||
g = image->comps[1].data;
|
g = image->comps[1].data;
|
||||||
b = image->comps[2].data;
|
b = image->comps[2].data;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i)
|
for(i = 0U; i < max; ++i)
|
||||||
{
|
{
|
||||||
*in++ = (unsigned char)*r++;
|
*in++ = (unsigned char)*r++;
|
||||||
*in++ = (unsigned char)*g++;
|
*in++ = (unsigned char)*g++;
|
||||||
@ -529,7 +524,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
|||||||
g = image->comps[1].data;
|
g = image->comps[1].data;
|
||||||
b = image->comps[2].data;
|
b = image->comps[2].data;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i)
|
for(i = 0U; i < max; ++i)
|
||||||
{
|
{
|
||||||
*r++ = (int)*out++;
|
*r++ = (int)*out++;
|
||||||
*g++ = (int)*out++;
|
*g++ = (int)*out++;
|
||||||
@ -538,15 +533,15 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
|||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
||||||
fails0:
|
fails0:
|
||||||
if(inbuf) free(inbuf);
|
free(inbuf);
|
||||||
if(outbuf) free(outbuf);
|
free(outbuf);
|
||||||
}
|
}
|
||||||
else /* prec > 8 */
|
else /* prec > 8 */
|
||||||
{
|
{
|
||||||
unsigned short *inbuf, *outbuf, *in, *out;
|
unsigned short *inbuf, *outbuf, *in, *out;
|
||||||
|
|
||||||
max = max_w * max_h;
|
max = max_w * max_h;
|
||||||
nr_samples = (size_t)(max * 3 * sizeof(unsigned short));
|
nr_samples = (size_t)(max * 3U * sizeof(unsigned short));
|
||||||
in = inbuf = (unsigned short*)malloc(nr_samples);
|
in = inbuf = (unsigned short*)malloc(nr_samples);
|
||||||
out = outbuf = (unsigned short*)malloc(nr_samples);
|
out = outbuf = (unsigned short*)malloc(nr_samples);
|
||||||
|
|
||||||
@ -556,7 +551,7 @@ fails0:
|
|||||||
g = image->comps[1].data;
|
g = image->comps[1].data;
|
||||||
b = image->comps[2].data;
|
b = image->comps[2].data;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i)
|
for(i = 0U ; i < max; ++i)
|
||||||
{
|
{
|
||||||
*in++ = (unsigned short)*r++;
|
*in++ = (unsigned short)*r++;
|
||||||
*in++ = (unsigned short)*g++;
|
*in++ = (unsigned short)*g++;
|
||||||
@ -578,8 +573,8 @@ fails0:
|
|||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
||||||
fails1:
|
fails1:
|
||||||
if(inbuf) free(inbuf);
|
free(inbuf);
|
||||||
if(outbuf) free(outbuf);
|
free(outbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* image->numcomps <= 2 : GRAY, GRAYA */
|
else /* image->numcomps <= 2 : GRAY, GRAYA */
|
||||||
@ -598,8 +593,7 @@ fails1:
|
|||||||
|
|
||||||
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails2;
|
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails2;
|
||||||
|
|
||||||
new_comps = (opj_image_comp_t*)
|
new_comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
||||||
realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
|
||||||
|
|
||||||
if(new_comps == NULL) goto fails2;
|
if(new_comps == NULL) goto fails2;
|
||||||
|
|
||||||
@ -618,7 +612,7 @@ fails1:
|
|||||||
|
|
||||||
r = image->comps[0].data;
|
r = image->comps[0].data;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i)
|
for(i = 0U; i < max; ++i)
|
||||||
{
|
{
|
||||||
*in++ = (unsigned char)*r++;
|
*in++ = (unsigned char)*r++;
|
||||||
}
|
}
|
||||||
@ -628,7 +622,7 @@ fails1:
|
|||||||
g = image->comps[1].data;
|
g = image->comps[1].data;
|
||||||
b = image->comps[2].data;
|
b = image->comps[2].data;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i)
|
for(i = 0U; i < max; ++i)
|
||||||
{
|
{
|
||||||
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
|
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
|
||||||
}
|
}
|
||||||
@ -636,10 +630,10 @@ fails1:
|
|||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
||||||
fails2:
|
fails2:
|
||||||
if(inbuf) free(inbuf);
|
free(inbuf);
|
||||||
if(outbuf) free(outbuf);
|
free(outbuf);
|
||||||
if(g) free(g);
|
free(g);
|
||||||
if(b) free(b);
|
free(b);
|
||||||
}
|
}
|
||||||
else /* prec > 8 */
|
else /* prec > 8 */
|
||||||
{
|
{
|
||||||
@ -647,7 +641,7 @@ fails2:
|
|||||||
opj_image_comp_t *new_comps;
|
opj_image_comp_t *new_comps;
|
||||||
|
|
||||||
max = max_w * max_h;
|
max = max_w * max_h;
|
||||||
nr_samples = (size_t)(max * 3 * sizeof(unsigned short));
|
nr_samples = (size_t)(max * 3U * sizeof(unsigned short));
|
||||||
in = inbuf = (unsigned short*)malloc(nr_samples);
|
in = inbuf = (unsigned short*)malloc(nr_samples);
|
||||||
out = outbuf = (unsigned short*)malloc(nr_samples);
|
out = outbuf = (unsigned short*)malloc(nr_samples);
|
||||||
g = (int*)calloc((size_t)max, sizeof(int));
|
g = (int*)calloc((size_t)max, sizeof(int));
|
||||||
@ -655,8 +649,7 @@ fails2:
|
|||||||
|
|
||||||
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails3;
|
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails3;
|
||||||
|
|
||||||
new_comps = (opj_image_comp_t*)
|
new_comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
||||||
realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
|
||||||
|
|
||||||
if(new_comps == NULL) goto fails3;
|
if(new_comps == NULL) goto fails3;
|
||||||
|
|
||||||
@ -675,7 +668,7 @@ fails2:
|
|||||||
|
|
||||||
r = image->comps[0].data;
|
r = image->comps[0].data;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i)
|
for(i = 0U; i < max; ++i)
|
||||||
{
|
{
|
||||||
*in++ = (unsigned short)*r++;
|
*in++ = (unsigned short)*r++;
|
||||||
}
|
}
|
||||||
@ -693,10 +686,10 @@ fails2:
|
|||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
||||||
fails3:
|
fails3:
|
||||||
if(inbuf) free(inbuf);
|
free(inbuf);
|
||||||
if(outbuf) free(outbuf);
|
free(outbuf);
|
||||||
if(g) free(g);
|
free(g);
|
||||||
if(b) free(b);
|
free(b);
|
||||||
}
|
}
|
||||||
}/* if(image->numcomps > 2) */
|
}/* if(image->numcomps > 2) */
|
||||||
|
|
||||||
|
@ -2451,7 +2451,7 @@ static OPJ_BOOL opj_j2k_write_cod( opj_j2k_t *p_j2k,
|
|||||||
opj_write_bytes(l_current_data,l_tcp->csty,1); /* Scod */
|
opj_write_bytes(l_current_data,l_tcp->csty,1); /* Scod */
|
||||||
++l_current_data;
|
++l_current_data;
|
||||||
|
|
||||||
opj_write_bytes(l_current_data,l_tcp->prg,1); /* SGcod (A) */
|
opj_write_bytes(l_current_data,(OPJ_UINT32)l_tcp->prg,1); /* SGcod (A) */
|
||||||
++l_current_data;
|
++l_current_data;
|
||||||
|
|
||||||
opj_write_bytes(l_current_data,l_tcp->numlayers,2); /* SGcod (B) */
|
opj_write_bytes(l_current_data,l_tcp->numlayers,2); /* SGcod (B) */
|
||||||
@ -3174,7 +3174,7 @@ static void opj_j2k_write_poc_in_memory( opj_j2k_t *p_j2k,
|
|||||||
opj_write_bytes(l_current_data,l_current_poc->compno1,l_poc_room); /* CEpoc_i */
|
opj_write_bytes(l_current_data,l_current_poc->compno1,l_poc_room); /* CEpoc_i */
|
||||||
l_current_data+=l_poc_room;
|
l_current_data+=l_poc_room;
|
||||||
|
|
||||||
opj_write_bytes(l_current_data,l_current_poc->prg,1); /* Ppoc_i */
|
opj_write_bytes(l_current_data, (OPJ_UINT32)l_current_poc->prg,1); /* Ppoc_i */
|
||||||
++l_current_data;
|
++l_current_data;
|
||||||
|
|
||||||
/* change the value of the max layer according to the actual number of layers in the file, components and resolutions*/
|
/* change the value of the max layer according to the actual number of layers in the file, components and resolutions*/
|
||||||
@ -5371,7 +5371,7 @@ static OPJ_BOOL opj_j2k_write_mcc_record( opj_j2k_t *p_j2k,
|
|||||||
l_current_data+=l_nb_bytes_for_comp;
|
l_current_data+=l_nb_bytes_for_comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
l_tmcc = ((!p_mcc_record->m_is_irreversible)&1)<<16;
|
l_tmcc = ((!p_mcc_record->m_is_irreversible) & 1U) << 16;
|
||||||
|
|
||||||
if (p_mcc_record->m_decorrelation_array) {
|
if (p_mcc_record->m_decorrelation_array) {
|
||||||
l_tmcc |= p_mcc_record->m_decorrelation_array->m_index;
|
l_tmcc |= p_mcc_record->m_decorrelation_array->m_index;
|
||||||
|
@ -88,7 +88,7 @@ OPJ_UINT32 opj_raw_decode(opj_raw_t *raw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
raw->ct--;
|
raw->ct--;
|
||||||
d = (raw->c >> raw->ct) & 0x01;
|
d = ((OPJ_UINT32)raw->c >> raw->ct) & 0x01U;
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user