summaryrefslogtreecommitdiff
path: root/applications
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2011-07-29 08:50:55 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2011-07-29 08:50:55 +0000
commit5743cca5f851a6c33462f66c2006ca5fc78f3c12 (patch)
tree79b6e8fa9323b1213d64019b2b7acfe364e81543 /applications
parente716a316f60f66cd5a6fb07b88b2cb8b9c815cec (diff)
solve some obvious warnings for WIN platform, increase number of warning reported on the dashboard, correct last warnings with gcc 4.4 (-Wall)
Diffstat (limited to 'applications')
-rw-r--r--applications/codec/convert.c33
-rw-r--r--applications/codec/image_to_j2k.c10
-rw-r--r--applications/codec/j2k_dump.c18
-rw-r--r--applications/codec/j2k_to_image.c16
-rw-r--r--applications/common/getopt.c2
-rw-r--r--applications/common/getopt.h2
6 files changed, 44 insertions, 37 deletions
diff --git a/applications/codec/convert.c b/applications/codec/convert.c
index c7adabe9..7b255092 100644
--- a/applications/codec/convert.c
+++ b/applications/codec/convert.c
@@ -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='+';
diff --git a/applications/codec/image_to_j2k.c b/applications/codec/image_to_j2k.c
index e19ecdb7..92353970 100644
--- a/applications/codec/image_to_j2k.c
+++ b/applications/codec/image_to_j2k.c
@@ -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){
diff --git a/applications/codec/j2k_dump.c b/applications/codec/j2k_dump.c
index 170c4324..b0f44043 100644
--- a/applications/codec/j2k_dump.c
+++ b/applications/codec/j2k_dump.c
@@ -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");
diff --git a/applications/codec/j2k_to_image.c b/applications/codec/j2k_to_image.c
index 3da83119..2b421369 100644
--- a/applications/codec/j2k_to_image.c
+++ b/applications/codec/j2k_to_image.c
@@ -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");
diff --git a/applications/common/getopt.c b/applications/common/getopt.c
index a02dde96..3edd969d 100644
--- a/applications/common/getopt.c
+++ b/applications/common/getopt.c
@@ -60,7 +60,7 @@ typedef struct option
#define EMSG ""
/* As this class remembers its values from one Java call to the other, reset the values before each use */
-void reset_options_reading() {
+void reset_options_reading(void) {
opterr = 1;
optind = 1;
}
diff --git a/applications/common/getopt.h b/applications/common/getopt.h
index 779fe470..1b32d2b6 100644
--- a/applications/common/getopt.h
+++ b/applications/common/getopt.h
@@ -24,6 +24,6 @@ extern char *optarg;
extern int getopt(int nargc, char *const *nargv, const char *ostr);
extern int getopt_long(int argc, char * const argv[], const char *optstring,
const struct option *longopts, int totlen);
-extern void reset_options_reading();
+extern void reset_options_reading(void);
#endif /* _GETOPT_H_ */