From 2c18053bbfacc5b65a44c7ecbb48d16ae6d887ca Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 1 Sep 2017 17:52:05 +0100 Subject: [PATCH] Compiler warnings: Intel --- tools/bufr_index_build.c | 21 ++++++++++----------- tools/codes_count.c | 2 +- tools/codes_info.c | 14 ++++++-------- tools/grib2ppm.c | 2 +- tools/grib_get.c | 2 +- tools/grib_get_data.c | 5 +++-- tools/grib_histogram.c | 4 ++-- tools/grib_merge.c | 4 ++-- tools/grib_tools.c | 6 +++--- tools/gts_compare.c | 4 ++-- tools/gts_ls.c | 4 ++-- 11 files changed, 33 insertions(+), 35 deletions(-) diff --git a/tools/bufr_index_build.c b/tools/bufr_index_build.c index 1544b8b1a..72d2b2884 100644 --- a/tools/bufr_index_build.c +++ b/tools/bufr_index_build.c @@ -106,11 +106,10 @@ void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h) int grib_tool_finalise_action(grib_runtime_options* options) { - grib_index_key* keys; + grib_index_key* the_keys; grib_string_list* values; int first; - if (compress_index) { grib_index_compress(idx); } @@ -118,18 +117,18 @@ int grib_tool_finalise_action(grib_runtime_options* options) grib_tool_name,options->outfile->name); printf("--- "); first=1; - keys=idx->keys; - while (keys) { + the_keys=idx->keys; + while (the_keys) { if (!first) printf(", "); - printf("%s",keys->name); - keys=keys->next; + printf("%s",the_keys->name); + the_keys=the_keys->next; first=0; } printf("\n"); - keys=idx->keys; - while (keys) { - printf("--- %s = { ",keys->name); - values=keys->values; + the_keys=idx->keys; + while (the_keys) { + printf("--- %s = { ",the_keys->name); + values=the_keys->values; first=1; while (values) { if (!first) printf(", "); @@ -138,7 +137,7 @@ int grib_tool_finalise_action(grib_runtime_options* options) values=values->next; } printf(" }\n"); - keys=keys->next; + the_keys=the_keys->next; } printf("--- %d messages indexed\n",idx->count); diff --git a/tools/codes_count.c b/tools/codes_count.c index 958af212c..f438ac422 100644 --- a/tools/codes_count.c +++ b/tools/codes_count.c @@ -10,7 +10,7 @@ #include "grib_api_internal.h" -void usage(const char* prog) +static void usage(const char* prog) { printf("usage: %s [-v] infile1 infile2 ... \n",prog); exit(1); diff --git a/tools/codes_info.c b/tools/codes_info.c index e8bb14f73..5df1ef919 100644 --- a/tools/codes_info.c +++ b/tools/codes_info.c @@ -10,7 +10,10 @@ #include "grib_tools.h" -void usage(const char*); +static void usage_and_exit(const char* progname) { + printf("\nUsage: %s [-v] [-d] [-s]\n",progname); + exit(1); +} #define INFO_PRINT_ALL 0 #define INFO_PRINT_VERSION (1<<0) @@ -43,12 +46,12 @@ int main( int argc,char* argv[]) print_flags|=INFO_PRINT_SAMPLES_PATH; break; default: - usage(argv[0]); + usage_and_exit(argv[0]); } } nfiles=argc-optind; - if (nfiles != 0) usage(argv[0]); + if (nfiles != 0) usage_and_exit(argv[0]); if (print_flags == INFO_PRINT_ALL) { printf("\n"); @@ -114,8 +117,3 @@ int main( int argc,char* argv[]) return 0; } - -void usage(const char* progname) { - printf("\nUsage: %s [-v] [-d] [-s]\n",progname); - exit(1); -} diff --git a/tools/grib2ppm.c b/tools/grib2ppm.c index ec331d148..2bf8033af 100644 --- a/tools/grib2ppm.c +++ b/tools/grib2ppm.c @@ -37,7 +37,7 @@ unsigned char unused(char c) } */ -int next(FILE *f, char *buf) +static int next(FILE *f, char *buf) { int c; int i = 0; diff --git a/tools/grib_get.c b/tools/grib_get.c index ee69a6f96..1e375812e 100644 --- a/tools/grib_get.c +++ b/tools/grib_get.c @@ -177,7 +177,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options,grib_handle* h) } if (options->latlon) { - int err=0; + err=0; double min; int i; if (!n) n=grib_nearest_new(h,&err); diff --git a/tools/grib_get_data.c b/tools/grib_get_data.c index be683343c..0df164db9 100644 --- a/tools/grib_get_data.c +++ b/tools/grib_get_data.c @@ -89,7 +89,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) size_t bmp_len = 0; double *data_values=0,*lats=0,*lons=0; int n = 0; - size_t size=0; + size_t size=0, num_bytes=0; long hasMissingValues = 0; if (grib_options_on("m:")) { @@ -125,10 +125,11 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) iter=grib_iterator_new(h,0,&err); + num_bytes = (numberOfPoints+1)*sizeof(double); data_values=(double*)calloc(numberOfPoints+1, sizeof(double)); if (!data_values) { fprintf(dump_file, "ERROR: failed to allocate %ld bytes for data values (number of points=%ld)\n", - (numberOfPoints+1)*sizeof(double), numberOfPoints); + (long)num_bytes, numberOfPoints); exit(GRIB_OUT_OF_MEMORY); } diff --git a/tools/grib_histogram.c b/tools/grib_histogram.c index 07de7544f..7c735c9eb 100644 --- a/tools/grib_histogram.c +++ b/tools/grib_histogram.c @@ -16,7 +16,7 @@ static void usage(const char *prog) exit(1); } -int main(int argc, const char *argv[]) +int main(int argc, char *argv[]) { int i,j; FILE *in; @@ -60,7 +60,7 @@ int main(int argc, const char *argv[]) values = (double*)malloc(size*sizeof(double)); last_size = size; if (!values) { - fprintf(stderr, "Failed to allocate memory for values (%ld bytes)\n", size*sizeof(double)); + fprintf(stderr, "Failed to allocate memory for values (%lu bytes)\n", size*sizeof(double)); exit(1); } } diff --git a/tools/grib_merge.c b/tools/grib_merge.c index 6e1144e86..08127410e 100644 --- a/tools/grib_merge.c +++ b/tools/grib_merge.c @@ -78,7 +78,7 @@ int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* fil return 0; } -int idx(double lat,double lon,double latFirst,double lonFirst,double latLast,double lonLast, +static int idx(double lat,double lon,double latFirst,double lonFirst,double latLast,double lonLast, long Ni,double di,double dj) { long ilon,ilat; @@ -96,7 +96,7 @@ int idx(double lat,double lon,double latFirst,double lonFirst,double latLast,dou return ilon+ilat*Ni; } -grib_handle* merge(grib_handle* h1,grib_handle* h2) +static grib_handle* merge(grib_handle* h1,grib_handle* h2) { char s1[100]={0,}; size_t len1; diff --git a/tools/grib_tools.c b/tools/grib_tools.c index 64bda062a..6b0713552 100644 --- a/tools/grib_tools.c +++ b/tools/grib_tools.c @@ -890,9 +890,9 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h) if (options->latlon) { if (options->latlon_mode==4){ - int i=0; - for (i=0;i<4;i++) { - fprintf(dump_file,options->format,options->values[i]); + int ii=0; + for (ii=0;ii<4;ii++) { + fprintf(dump_file,options->format,options->values[ii]); fprintf(dump_file," "); } written_to_dump=1; diff --git a/tools/gts_compare.c b/tools/gts_compare.c index ee967abff..50c6bce23 100644 --- a/tools/gts_compare.c +++ b/tools/gts_compare.c @@ -262,10 +262,10 @@ static void printInfo(grib_handle* h) lastPrint=count; } -static void print_index_key_values(grib_index* index,int counter,const char* error_message) +static void print_index_key_values(grib_index* index,int cnt,const char* error_message) { grib_index_key* keys=index->keys; - printf("== %d == ",counter); + printf("== %d == ", cnt); if (error_message) printf("%s == ",error_message); while (keys) { printf("%s=%s ",keys->name,keys->value); diff --git a/tools/gts_ls.c b/tools/gts_ls.c index cf81924a2..6c6bf153f 100644 --- a/tools/gts_ls.c +++ b/tools/gts_ls.c @@ -36,7 +36,7 @@ char* grib_tool_description="List content of GTS files printing values of " "some keys.\n\tIt does not fail when a key is not found."; char* grib_tool_name="gts_ls"; char* grib_tool_usage="[options] file file ..."; -static char* new_handle=""; +/*static char* new_handle="";*/ int grib_options_count=sizeof(grib_options)/sizeof(grib_option); int mode=0; @@ -95,7 +95,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) if( err != GRIB_SUCCESS && options->fail) exit(err); } - new_handle="\n,"; + /*new_handle="\n,";*/ return 0; }