/*
- * Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
+ * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
{
case 'b':
sizemembasefile = (int)strlen(opj_optarg)+1;
- param->base_filename = (char*) malloc(sizemembasefile);
+ param->base_filename = (char*) malloc((size_t)sizemembasefile);
param->base_filename[0] = '\0';
strncpy(param->base_filename, opj_optarg, strlen(opj_optarg));
param->base_filename[strlen(opj_optarg)] = '\0';
break;
case 't':
sizememtestfile = (int) strlen(opj_optarg) + 1;
- param->test_filename = (char*) malloc(sizememtestfile);
+ param->test_filename = (char*) malloc((size_t)sizememtestfile);
param->test_filename[0] = '\0';
strncpy(param->test_filename, opj_optarg, strlen(opj_optarg));
param->test_filename[strlen(opj_optarg)] = '\0';
}
printf("Ok.\n");
- pos=ftell(fbase);
+ pos=(unsigned long)ftell(fbase);
while(!feof(fbase))
{
if(chbase != chtest)
{
- size_t nbytes = 2048;
+ int nbytes = 2048;
int CRLF_shift=1;
char *strbase, *strtest, *strbase_d, *strtest_d;
printf("Files differ at line %lu:\n", l);
- fseek(fbase,pos,SEEK_SET);
+ fseek(fbase,(long)pos,SEEK_SET);
/* Take into account CRLF characters when we write \n into
// dump file when we used WIN platform*/
CRLF_shift = 2;
fseek(ftest,pos + l - 1,SEEK_SET);
#else
- fseek(ftest,pos,SEEK_SET);
+ fseek(ftest,(long)pos,SEEK_SET);
#endif
- strbase = (char *) malloc(nbytes + 1);
- strtest = (char *) malloc(nbytes + 1);
+ strbase = (char *) malloc((size_t)nbytes + 1);
+ strtest = (char *) malloc((size_t)nbytes + 1);
if (fgets(strbase, nbytes, fbase) == NULL)
fprintf(stderr,"\nWARNING: fgets return a NULL value");
strbase_d = (char *) malloc(strlen(strbase)+1);
strtest_d = (char *) malloc(strlen(strtest)+1);
strncpy(strbase_d, strbase, strlen(strbase)-1);
- strncpy(strtest_d, strtest, strlen(strtest)-CRLF_shift);
+ strncpy(strtest_d, strtest, strlen(strtest)-(size_t)CRLF_shift);
strbase_d[strlen(strbase)-1] = '\0';
- strtest_d[strlen(strtest)-CRLF_shift] = '\0';
+ strtest_d[strlen(strtest)-(size_t)CRLF_shift] = '\0';
printf("<%s> vs. <%s>\n", strbase_d, strtest_d);
free(strbase_d);free(strtest_d);
}
if (chbase == '\n')
{
l++;
- pos = ftell(fbase);
+ pos = (unsigned long)ftell(fbase);
}
}
}