Clang static analyser warnings

This commit is contained in:
Shahram Najm 2020-02-19 12:07:34 +00:00
parent c190be37de
commit 514e84ab75
7 changed files with 8 additions and 22 deletions

View File

@ -721,8 +721,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
for (i = 1; i < maxv; i++) for (i = 1; i < maxv; i++)
scals[i] = ((double)pow(i * (i + 1), laplacianOperator)); scals[i] = ((double)pow(i * (i + 1), laplacianOperator));
i = 0;
mmax = 0; mmax = 0;
maxv = pen_j + 1; maxv = pen_j + 1;
i = 0; i = 0;

View File

@ -377,7 +377,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
for (hcount = 0; hcount < sub_k + 1; hcount++) { for (hcount = 0; hcount < sub_k + 1; hcount++) {
dummy = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); dummy = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes));
dummy = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); dummy = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes));
(void)dummy;
lup++; lup++;
} }
sub_k--; sub_k--;
@ -406,8 +406,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
Assert(*len >= i); Assert(*len >= i);
*len = n_vals; *len = n_vals;
(void)dummy; /* suppress gcc warning */
grib_context_free(a->context, scals); grib_context_free(a->context, scals);
return ret; return ret;

View File

@ -370,14 +370,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
/* pscals=scals+lup; */ /* pscals=scals+lup; */
for (lcount = hcount; lcount < maxv; lcount++) { for (lcount = hcount; lcount < maxv; lcount++) {
dummy = d * (double)((grib_decode_unsigned_long(lres, &lpos, dummy = d * (double)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value);
bits_per_value) * dummy = d * (double)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value);
s) + (void)dummy; /* suppress gcc warning */
reference_value);
dummy = d * (double)((grib_decode_unsigned_long(lres, &lpos,
bits_per_value) *
s) +
reference_value);
lup++; lup++;
} }
@ -389,8 +384,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
Assert(*len >= i); Assert(*len >= i);
*len = n_vals; *len = n_vals;
(void)dummy; /* suppress gcc warning */
grib_context_free(a->context, scals); grib_context_free(a->context, scals);
return ret; return ret;

View File

@ -257,7 +257,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
switch (type_first) { switch (type_first) {
case 100: /* Pa */ case 100: /* Pa */
scale_first = 0;
if (!strcmp(pressure_units, "hPa")) if (!strcmp(pressure_units, "hPa"))
value_first *= 100; value_first *= 100;
break; break;

View File

@ -226,8 +226,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
unsigned long i = 0; unsigned long i = 0;
long rlen = 0; long rlen = 0;
ret = value_count(a, &rlen); ret = value_count(a, &rlen);
if (ret) if (ret) return ret;
return ret;
/* /*
if(*len < rlen) if(*len < rlen)
@ -239,10 +238,10 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
*/ */
if (*len != rlen) if (*len != rlen)
ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, *len); ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, *len);
if (ret) return ret;
ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits);
if (ret) if (ret) return ret;
return ret;
if (numberOfBits == 0) { if (numberOfBits == 0) {
grib_buffer_replace(a, NULL, 0, 1, 1); grib_buffer_replace(a, NULL, 0, 1, 1);
return GRIB_SUCCESS; return GRIB_SUCCESS;

View File

@ -525,7 +525,6 @@ static grib_accessor* _grib_find_accessor(const grib_handle* ch, const char* nam
char name_space[MAX_NAMESPACE_LEN]; char name_space[MAX_NAMESPACE_LEN];
char* basename = p + 1; char* basename = p + 1;
p--; p--;
i = 0;
len = p - name + 1; len = p - name + 1;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)

View File

@ -89,7 +89,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
if (values) if (values)
free(values); free(values);
values = (double*)malloc(size * sizeof(double)); values = (double*)malloc(size * sizeof(double));
last_size = size; /*last_size = size;*/
if (!values) { if (!values) {
fprintf(stderr, "Failed to allocate memory for values (%lu bytes)\n", size * sizeof(double)); fprintf(stderr, "Failed to allocate memory for values (%lu bytes)\n", size * sizeof(double));
exit(1); exit(1);