solve some obvious warnings for WIN platform, increase number of warning reported on the dashboard, correct last warnings with gcc 4.4 (-Wall)

This commit is contained in:
Mickael Savinaud
2011-07-29 08:50:55 +00:00
parent e716a316f6
commit 5743cca5f8
12 changed files with 62 additions and 51 deletions

View File

@@ -158,9 +158,14 @@ int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
memset(&tga, 0, sizeof(tga_header));
tga.pixel_depth = bits_per_pixel;
tga.image_width = width;
tga.image_height = height;
if ( bits_per_pixel < 256 )
tga.pixel_depth = (unsigned char)bits_per_pixel;
else{
fprintf(stderr,"ERROR: Wrong bits per pixel inside tga_header");
return 0;
}
tga.image_width = (unsigned short)width;
tga.image_height = (unsigned short)height;
tga.image_type = 2; // Uncompressed.
tga.image_desc = 8; // 8 bits per component.
@@ -639,9 +644,9 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
has_color = 0;
for (j = 0; j < Info_h.biClrUsed; j++)
{
table_B[j] = getc(IN);
table_G[j] = getc(IN);
table_R[j] = getc(IN);
table_B[j] = (unsigned char)getc(IN);
table_G[j] = (unsigned char)getc(IN);
table_R[j] = (unsigned char)getc(IN);
getc(IN);
has_color +=
!(table_R[j] == table_G[j] && table_R[j] == table_B[j]);
@@ -757,9 +762,9 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
has_color = 0;
for (j = 0; j < Info_h.biClrUsed; j++)
{
table_B[j] = getc(IN);
table_G[j] = getc(IN);
table_R[j] = getc(IN);
table_B[j] = (unsigned char)getc(IN);
table_G[j] = (unsigned char)getc(IN);
table_R[j] = (unsigned char)getc(IN);
getc(IN);
has_color += !(table_R[j] == table_G[j] && table_R[j] == table_B[j]);
}
@@ -822,7 +827,7 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
c1 = getc(IN);
for (i = 0; i < c && x < W && pix < beyond; i++, x++, pix++)
*pix = c1;
*pix = (unsigned char)c1;
}
else
{
@@ -850,7 +855,7 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
for (; i < c && x < W && pix < beyond; i++, x++, pix++)
{
c1 = getc(IN);
*pix = c1;
*pix = (unsigned char)c1;
}
if (c & 1) /* skip padding byte */
getc(IN);
@@ -1187,8 +1192,10 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters) {
}
fseek(f, 0, SEEK_SET);
fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d",temp,&endian1,&endian2,signtmp,&prec,temp,&w,temp,&h);
if( fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d",temp,&endian1,&endian2,signtmp,&prec,temp,&w,temp,&h) != 9){
fprintf(stderr, "ERROR: Failed to read the right number of element from the fscanf() function!\n");
return NULL;
}
i=0;
sign='+';

View File

@@ -82,7 +82,7 @@ typedef struct img_folder{
float *rates;
}img_fol_t;
void encode_help_display() {
void encode_help_display(void) {
fprintf(stdout,"HELP for image_to_j2k\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
@@ -573,7 +573,7 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
int i, j,totlen;
int i, j, totlen, c;
option_t long_option[]={
{"cinema2K",REQ_ARG, NULL ,'w'},
{"cinema4K",NO_ARG, NULL ,'y'},
@@ -597,8 +597,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
img_fol->set_out_format=0;
raw_cp->rawWidth = 0;
while (1) {
int c = getopt_long(argc, argv, optlist,long_option,totlen);
do{
c = getopt_long(argc, argv, optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
@@ -1376,7 +1376,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
fprintf(stderr, "ERROR -> Command line not valid\n");
return 1;
}
}
}while(c != -1);
/* check for possible errors */
if (parameters->cp_cinema){

View File

@@ -73,7 +73,7 @@ typedef struct img_folder{
}img_fol_t;
void decode_help_display() {
void decode_help_display(void) {
fprintf(stdout,"HELP for j2k_dump\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
@@ -196,7 +196,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
/* parse the command line */
int totlen;
int totlen, c;
option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
};
@@ -204,8 +204,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
const char optlist[] = "i:o:h";
totlen=sizeof(long_option);
img_fol->set_out_format = 0;
while (1) {
int c = getopt_long(argc, argv,optlist,long_option,totlen);
do {
c = getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
@@ -259,7 +259,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
break;
}
}
}while(c != -1);
/* check for possible errors */
if(img_fol->set_imgdir==1){
@@ -412,7 +412,7 @@ int main(int argc, char *argv[])
file_length = ftell(fsrc);
fseek(fsrc, 0, SEEK_SET);
src = (unsigned char *) malloc(file_length);
if (fread(src, 1, file_length, fsrc) != file_length)
if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
{
free(src);
fclose(fsrc);
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
/* Write the index to disk */
if (*indexfilename) {
char bSuccess;
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
@@ -514,7 +514,7 @@ int main(int argc, char *argv[])
/* Write the index to disk */
if (*indexfilename) {
char bSuccess;
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
@@ -556,7 +556,7 @@ int main(int argc, char *argv[])
/* Write the index to disk */
if (*indexfilename) {
char bSuccess;
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");

View File

@@ -85,7 +85,7 @@ typedef struct img_folder{
}img_fol_t;
void decode_help_display() {
void decode_help_display(void) {
fprintf(stdout,"HELP for j2k_to_image\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
@@ -237,7 +237,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
/* parse the command line */
int totlen;
int totlen, c;
option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
{"OutFor",REQ_ARG, NULL ,'O'},
@@ -253,8 +253,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
"h" ;
totlen=sizeof(long_option);
img_fol->set_out_format = 0;
while (1) {
int c = getopt_long(argc, argv,optlist,long_option,totlen);
do {
c = getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
@@ -457,7 +457,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
break;
}
}
}while(c != -1);
/* check for possible errors */
if(img_fol->set_imgdir==1){
@@ -641,7 +641,7 @@ int main(int argc, char **argv) {
/* Write the index to disk */
if (*indexfilename) {
char bSuccess;
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
@@ -683,7 +683,7 @@ int main(int argc, char **argv) {
/* Write the index to disk */
if (*indexfilename) {
char bSuccess;
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
@@ -725,7 +725,7 @@ int main(int argc, char **argv) {
/* Write the index to disk */
if (*indexfilename) {
char bSuccess;
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");