From 08e73e71e5fcd615061502ab663f42b2cea48406 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 19 Feb 2020 16:39:06 +0000 Subject: [PATCH] Clang static analyser warnings --- fortran/grib_fortran.c | 2 +- src/grib_accessor_class_data_2order_packing.c | 2 +- src/grib_accessor_class_md5.c | 2 +- src/grib_accessor_class_to_double.c | 2 +- src/grib_handle.c | 1 - src/grib_ibmfloat.c | 2 +- tools/bufr_compare.c | 2 +- 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index 1d6743f33..cab1e8547 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -258,7 +258,7 @@ static int push_file(FILE* f,char* buffer) static void _push_handle(grib_handle *h,int *gid) { - l_grib_handle* current= handle_set; + l_grib_handle* current= NULL; l_grib_handle* previous= handle_set; l_grib_handle* the_new= NULL; int myindex= 1; diff --git a/src/grib_accessor_class_data_2order_packing.c b/src/grib_accessor_class_data_2order_packing.c index 8c0e6bf28..79fcff4e9 100644 --- a/src/grib_accessor_class_data_2order_packing.c +++ b/src/grib_accessor_class_data_2order_packing.c @@ -272,7 +272,7 @@ static int reverse_rows(unsigned long* data, long len, long number_along_paralle { long i = 0; long left = 0; - long right = number_along_parallel - 1; + long right = 0; long tmp = 0; long inc; diff --git a/src/grib_accessor_class_md5.c b/src/grib_accessor_class_md5.c index 465851bf5..6c646b563 100644 --- a/src/grib_accessor_class_md5.c +++ b/src/grib_accessor_class_md5.c @@ -254,7 +254,7 @@ static void destroy(grib_context* c, grib_accessor* a) grib_accessor_md5* self = (grib_accessor_md5*)a; if (self->blacklist) { grib_string_list* next = self->blacklist; - grib_string_list* cur = self->blacklist; + grib_string_list* cur = NULL; while (next) { cur = next; next = next->next; diff --git a/src/grib_accessor_class_to_double.c b/src/grib_accessor_class_to_double.c index b9ee9554f..4a55eec5d 100644 --- a/src/grib_accessor_class_to_double.c +++ b/src/grib_accessor_class_to_double.c @@ -227,7 +227,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) val[length] = 0; len[0] = length; - return GRIB_SUCCESS; + return err; } static int pack_string(grib_accessor* a, const char* val, size_t* len) diff --git a/src/grib_handle.c b/src/grib_handle.c index 26e1fe557..3d355012f 100644 --- a/src/grib_handle.c +++ b/src/grib_handle.c @@ -1141,7 +1141,6 @@ static grib_handle* grib_handle_new_from_file_no_multi(grib_context* c, FILE* f, if (gts_header) memcpy(gl->gts_header, gts_header, gtslen); gl->gts_header_len = gtslen; grib_context_free(c, save_gts_header); - gtslen = 0; } else { gl->gts_header = NULL; diff --git a/src/grib_ibmfloat.c b/src/grib_ibmfloat.c index 5785bf2fd..fd62861e9 100644 --- a/src/grib_ibmfloat.c +++ b/src/grib_ibmfloat.c @@ -112,7 +112,7 @@ unsigned long grib_ibm_to_long(double x) unsigned long s = 0; unsigned long mmax = 0xffffff; unsigned long mmin = 0x800000; - unsigned long m = mmax; + unsigned long m = 0; unsigned long e = 0; double rmmax = mmax + 0.5; diff --git a/tools/bufr_compare.c b/tools/bufr_compare.c index 3102ec6bb..8c2cae0de 100644 --- a/tools/bufr_compare.c +++ b/tools/bufr_compare.c @@ -104,7 +104,7 @@ static void new_keys_list() static void release_keys_list() { grib_string_list* next = keys_list; - grib_string_list* cur = keys_list; + grib_string_list* cur = NULL; grib_context* c = grib_context_get_default(); while (next) { cur = next;