mirror of https://github.com/ecmwf/eccodes.git
Clang static analyser warnings
This commit is contained in:
parent
c9ddef0599
commit
6d94d93aa9
|
@ -590,7 +590,7 @@ static int count_bufr_messages(grib_context* c, FILE* f, int* n, int strict_mode
|
|||
err = GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
(void)done;
|
||||
rewind(f);
|
||||
if (err == GRIB_END_OF_FILE)
|
||||
err = GRIB_SUCCESS;
|
||||
|
|
|
@ -249,7 +249,7 @@ static int value_count(grib_accessor* a, long* count)
|
|||
long *bitmap, *pbitmap;
|
||||
size_t numberOfPoints = 0;
|
||||
|
||||
if (plSize) {
|
||||
if (plSize && pl) {
|
||||
for (i = 0; i < numberOfRows; i++)
|
||||
numberOfPoints += pl[i];
|
||||
grib_context_free(c, pl);
|
||||
|
@ -342,7 +342,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
|||
long *bitmap, *pbitmap;
|
||||
size_t numberOfPoints = Ni * Nj;
|
||||
|
||||
if (plSize) {
|
||||
if (plSize && pl) {
|
||||
numberOfPoints = 0;
|
||||
for (i = 0; i < numberOfRows; i++)
|
||||
numberOfPoints += pl[i];
|
||||
|
@ -350,7 +350,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
|||
bitmap = (long*)grib_context_malloc_clear(a->context, sizeof(long) * numberOfPoints);
|
||||
pbitmap = bitmap;
|
||||
grib_get_long_array(gh, self->bitmap, bitmap, &numberOfPoints);
|
||||
if (plSize) {
|
||||
if (plSize && pl) {
|
||||
for (i = 0; i < numberOfRows; i++) {
|
||||
for (j = 0; j < pl[i]; j++) {
|
||||
numbersPerRow[i] += *(bitmap++);
|
||||
|
@ -369,7 +369,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
|||
grib_context_free(a->context, pbitmap);
|
||||
}
|
||||
else {
|
||||
if (plSize) {
|
||||
if (plSize && pl) {
|
||||
for (i = 0; i < numberOfRows; i++)
|
||||
numbersPerRow[i] = pl[i];
|
||||
}
|
||||
|
|
|
@ -593,8 +593,9 @@ static int is_missing(grib_accessor* a)
|
|||
if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) {
|
||||
if (a->vvalue == NULL) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "%s internal error (flags=0x%X)", a->name, a->flags);
|
||||
Assert(!"grib_accessor_class_gen::is_missing(): a->vvalue == NULL");
|
||||
return 0;
|
||||
}
|
||||
Assert(a->vvalue != NULL);
|
||||
return a->vvalue->missing;
|
||||
}
|
||||
Assert(a->length >= 0);
|
||||
|
|
|
@ -146,7 +146,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg)
|
|||
|
||||
self->offset = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++);
|
||||
self->length = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, n++);
|
||||
self->blacklist = 0;
|
||||
self->blacklist = NULL;
|
||||
while ((b = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++)) != NULL) {
|
||||
if (!self->blacklist) {
|
||||
self->blacklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
|
||||
|
@ -154,9 +154,12 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg)
|
|||
current = self->blacklist;
|
||||
}
|
||||
else {
|
||||
current->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
|
||||
current->next->value = grib_context_strdup(context, b);
|
||||
current = current->next;
|
||||
Assert(current);
|
||||
if (current) {
|
||||
current->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
|
||||
current->next->value = grib_context_strdup(context, b);
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
a->length = 0;
|
||||
|
|
|
@ -67,7 +67,7 @@ const char* grib_expression_get_name(grib_expression* g)
|
|||
return c->get_name(g);
|
||||
c = c->super ? *(c->super) : NULL;
|
||||
}
|
||||
printf("No expression_get_name() in %s\n", g->cclass->name);
|
||||
if (g->cclass) printf("No expression_get_name() in %s\n", g->cclass->name);
|
||||
Assert(1 == 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ unsigned long grib_ieee_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;
|
||||
|
||||
|
|
|
@ -2549,13 +2549,14 @@ static void scale_bitmap(double* vals, long n, void* data, dataset_t* subset)
|
|||
int i = 0;
|
||||
nc_type nctype = subset->att.nctype;
|
||||
|
||||
/*
|
||||
if(!subset->bitmap)
|
||||
{
|
||||
grib_context_log(ctx,GRIB_LOG_DEBUG,"No scale of bitmap required");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
/* if(!subset->bitmap) {
|
||||
grib_context_log(ctx,GRIB_LOG_DEBUG,"No scale of bitmap required");
|
||||
return;
|
||||
} */
|
||||
if (n > 0 && !vals) {
|
||||
Assert(!"scale_bitmap: n > 0 but vals == NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (nctype) {
|
||||
case NC_BYTE: {
|
||||
|
|
Loading…
Reference in New Issue