From db30325fbfa3125195db8c66b43e35c52f0eb0a7 Mon Sep 17 00:00:00 2001 From: shahramn Date: Tue, 27 Feb 2024 12:39:33 +0000 Subject: [PATCH] Cleanup --- src/action_class_list.cc | 5 ++--- src/grib_accessor_class_section_pointer.cc | 14 +++++++------- src/grib_index.cc | 16 ++++++++-------- src/grib_nearest_class_latlon_reduced.cc | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/action_class_list.cc b/src/action_class_list.cc index 0a4b8a630..c9693a554 100644 --- a/src/action_class_list.cc +++ b/src/action_class_list.cc @@ -10,7 +10,6 @@ /*************************************************************************** * Jean Baptiste Filippi - 01.11.2005 * - * Enrico Fucile * ***************************************************************************/ #include "grib_api_internal.h" /* @@ -107,7 +106,7 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* h) long val = 0; if ((ret = grib_expression_evaluate_long(p->h, a->expression, &val)) != GRIB_SUCCESS) { - grib_context_log(p->h->context, GRIB_LOG_DEBUG, "List %s creating %d values unable to evaluate long", act->name, val); + grib_context_log(p->h->context, GRIB_LOG_DEBUG, "List %s creating %ld values: Unable to evaluate long", act->name, val); return ret; } @@ -166,7 +165,7 @@ static grib_action* reparse(grib_action* a, grib_accessor* acc, int* doit) if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(acc), self->expression, &val)) != GRIB_SUCCESS) { grib_context_log(acc->context, GRIB_LOG_ERROR, - "List %s creating %ld values, unable to evaluate long", acc->name, val); + "List %s creating %ld values: Unable to evaluate long", acc->name, val); } *doit = (val != acc->loop); diff --git a/src/grib_accessor_class_section_pointer.cc b/src/grib_accessor_class_section_pointer.cc index e9b81614a..861ab12e7 100644 --- a/src/grib_accessor_class_section_pointer.cc +++ b/src/grib_accessor_class_section_pointer.cc @@ -107,7 +107,7 @@ grib_accessor_class* grib_accessor_class_section_pointer = &_grib_accessor_class static void init(grib_accessor* a, const long len, grib_arguments* arg) { - int n = 0; + int n = 0; grib_accessor_section_pointer* self = (grib_accessor_section_pointer*)a; self->sectionOffset = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); @@ -162,13 +162,13 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) static long byte_count(grib_accessor* a) { grib_accessor_section_pointer* self = (grib_accessor_section_pointer*)a; - long sectionLength = 0; - int ret = 0; + long sectionLength = 0; + int ret = 0; ret = grib_get_long(grib_handle_of_accessor(a), self->sectionLength, §ionLength); if (ret) { grib_context_log(a->context, GRIB_LOG_ERROR, - "unable to get %s %s", + "Unable to get %s %s", self->sectionLength, grib_get_error_message(ret)); return -1; } @@ -179,13 +179,13 @@ static long byte_count(grib_accessor* a) static long byte_offset(grib_accessor* a) { grib_accessor_section_pointer* self = (grib_accessor_section_pointer*)a; - long sectionOffset = 0; - int ret = 0; + long sectionOffset = 0; + int ret = 0; ret = grib_get_long(grib_handle_of_accessor(a), self->sectionOffset, §ionOffset); if (ret) { grib_context_log(a->context, GRIB_LOG_ERROR, - "unable to get %s %s", + "Unable to get %s %s", self->sectionOffset, grib_get_error_message(ret)); return -1; } diff --git a/src/grib_index.cc b/src/grib_index.cc index 5571f6e90..66718a58b 100644 --- a/src/grib_index.cc +++ b/src/grib_index.cc @@ -543,7 +543,7 @@ grib_index* grib_index_new(grib_context* c, const char* key, int* err) index = (grib_index*)grib_context_malloc_clear(c, sizeof(grib_index)); if (!index) { - grib_context_log(c, GRIB_LOG_ERROR, "unable to create index"); + grib_context_log(c, GRIB_LOG_ERROR, "Unable to create index"); *err = GRIB_OUT_OF_MEMORY; return NULL; } @@ -1033,7 +1033,7 @@ int grib_index_search_same(grib_index* index, grib_handle* h) } if (err && err != GRIB_NOT_FOUND) { grib_context_log(c, GRIB_LOG_ERROR, - "unable to create index. \"%s\": %s", + "Unable to create index. \"%s\": %s", keys->name, grib_get_error_message(err)); return err; } @@ -1138,7 +1138,7 @@ static int codes_index_add_file_internal(grib_index* index, const char* filename if (!error && set_values_count != 0) { err = grib_set_values(h, set_values, set_values_count); if (err) { - grib_context_log(c, GRIB_LOG_ERROR,"codes_index_add_file: unable to set %s\n", envsetkeys); + grib_context_log(c, GRIB_LOG_ERROR,"codes_index_add_file: Unable to set %s\n", envsetkeys); return err; } } @@ -1148,7 +1148,7 @@ static int codes_index_add_file_internal(grib_index* index, const char* filename if (index->product_kind == PRODUCT_BUFR && index->unpack_bufr) { err = grib_set_long(h, "unpack", 1); if (err) { - grib_context_log(c, GRIB_LOG_ERROR, "unable to unpack BUFR to create index. \"%s\": %s", + grib_context_log(c, GRIB_LOG_ERROR, "Unable to unpack BUFR to create index. \"%s\": %s", index_key->name, grib_get_error_message(err)); return err; } @@ -1186,7 +1186,7 @@ static int codes_index_add_file_internal(grib_index* index, const char* filename return err; } if (err && err != GRIB_NOT_FOUND) { - grib_context_log(c, GRIB_LOG_ERROR, "unable to create index. key=\"%s\" (message #%lu): %s", + grib_context_log(c, GRIB_LOG_ERROR, "Unable to create index. key=\"%s\" (message #%lu): %s", index_key->name, message_count, grib_get_error_message(err)); return err; } @@ -1359,7 +1359,7 @@ static int codes_index_add_file_internal(grib_index* index, const char* filename // return err; // } // if (err && err != GRIB_NOT_FOUND) { -// grib_context_log(c,GRIB_LOG_ERROR,"unable to create index. \"%s\": %s",index_key->name,grib_get_error_message(err)); +// grib_context_log(c,GRIB_LOG_ERROR,"Unable to create index. \"%s\": %s",index_key->name,grib_get_error_message(err)); // return err; // } @@ -1495,7 +1495,7 @@ int grib_index_get_long(const grib_index* index, const char* key, long* values, if (!k) return GRIB_NOT_FOUND; if (k->type != GRIB_TYPE_LONG) { - grib_context_log(index->context, GRIB_LOG_ERROR, "unable to get index %s as long", key); + grib_context_log(index->context, GRIB_LOG_ERROR, "Unable to get index %s as long", key); return GRIB_WRONG_TYPE; } if (k->values_count > *size) @@ -1524,7 +1524,7 @@ int grib_index_get_double(const grib_index* index, const char* key, double* valu if (!k) return GRIB_NOT_FOUND; if (k->type != GRIB_TYPE_DOUBLE) { - grib_context_log(index->context, GRIB_LOG_ERROR, "unable to get index %s as double", key); + grib_context_log(index->context, GRIB_LOG_ERROR, "Unable to get index %s as double", key); return GRIB_WRONG_TYPE; } if (k->values_count > *size) diff --git a/src/grib_nearest_class_latlon_reduced.cc b/src/grib_nearest_class_latlon_reduced.cc index e38978188..a5d2af222 100644 --- a/src/grib_nearest_class_latlon_reduced.cc +++ b/src/grib_nearest_class_latlon_reduced.cc @@ -210,7 +210,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h, iter = grib_iterator_new(h, GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret) { - grib_context_log(h->context, GRIB_LOG_ERROR, "unable to create iterator"); + grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to create iterator"); return ret; } while (grib_iterator_next(iter, &lat, &lon, NULL)) {