[trunk] Another round of fixes for sign conversion warnings.

Update issue 256
This commit is contained in:
Mathieu Malaterre 2014-03-07 12:01:41 +00:00
parent 740924fa61
commit 472ce19183

View File

@ -481,7 +481,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'd': /* Input decode ROI */ case 'd': /* Input decode ROI */
{ {
int size_optarg = (int)strlen(opj_optarg) + 1; int size_optarg = (int)strlen(opj_optarg) + 1;
char *ROI_values = (char*) malloc(size_optarg); char *ROI_values = (char*) malloc((size_t)size_optarg);
ROI_values[0] = '\0'; ROI_values[0] = '\0';
strncpy(ROI_values, opj_optarg, strlen(opj_optarg)); strncpy(ROI_values, opj_optarg, strlen(opj_optarg));
ROI_values[strlen(opj_optarg)] = '\0'; ROI_values[strlen(opj_optarg)] = '\0';
@ -639,8 +639,8 @@ int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsi
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else{ else{
*DA_x0 = values[0]; *DA_y0 = values[1]; *DA_x0 = (OPJ_UINT32)values[0]; *DA_y0 = (OPJ_UINT32)values[1];
*DA_x1 = values[2]; *DA_y1 = values[3]; *DA_x1 = (OPJ_UINT32)values[2]; *DA_y1 = (OPJ_UINT32)values[3];
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
} }
@ -710,8 +710,8 @@ int main(int argc, char **argv)
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t)); dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
if(dirptr){ if(dirptr){
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/ dirptr->filename_buf = (char*)malloc((size_t)num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
dirptr->filename = (char**) malloc(num_images*sizeof(char*)); dirptr->filename = (char**) malloc((size_t)num_images*sizeof(char*));
if(!dirptr->filename_buf){ if(!dirptr->filename_buf){
return EXIT_FAILURE; return EXIT_FAILURE;
@ -805,8 +805,8 @@ int main(int argc, char **argv)
if (!parameters.nb_tile_to_decode) { if (!parameters.nb_tile_to_decode) {
/* Optional if you want decode the entire image */ /* Optional if you want decode the entire image */
if (!opj_set_decode_area(l_codec, image, parameters.DA_x0, if (!opj_set_decode_area(l_codec, image, (OPJ_INT32)parameters.DA_x0,
parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)){ (OPJ_INT32)parameters.DA_y0, (OPJ_INT32)parameters.DA_x1, (OPJ_INT32)parameters.DA_y1)){
fprintf(stderr, "ERROR -> opj_decompress: failed to set the decoded area\n"); fprintf(stderr, "ERROR -> opj_decompress: failed to set the decoded area\n");
opj_stream_destroy_v3(l_stream); opj_stream_destroy_v3(l_stream);
opj_destroy_codec(l_codec); opj_destroy_codec(l_codec);