From 5918bee6453b4d93cbb56e5012c1804318d85e0a Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 19 Feb 2024 17:14:32 +0000 Subject: [PATCH] Fix compiler warnings --- src/grib_nearest_class_latlon_reduced.cc | 2 +- src/grib_nearest_class_reduced.cc | 2 +- src/grib_nearest_class_regular.cc | 2 +- tests/grib_nearest_test.cc | 7 +++---- tools/grib_histogram.cc | 3 ++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/grib_nearest_class_latlon_reduced.cc b/src/grib_nearest_class_latlon_reduced.cc index 992b29f2e..e38978188 100644 --- a/src/grib_nearest_class_latlon_reduced.cc +++ b/src/grib_nearest_class_latlon_reduced.cc @@ -409,7 +409,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h, if (values) { /* ECC-499 */ grib_get_double_element_internal(h, self->values_key, self->k[kk], &(values[kk])); } - indexes[kk] = self->k[kk]; + indexes[kk] = (int)self->k[kk]; kk++; } } diff --git a/src/grib_nearest_class_reduced.cc b/src/grib_nearest_class_reduced.cc index 603c1a441..f17d3b4e3 100644 --- a/src/grib_nearest_class_reduced.cc +++ b/src/grib_nearest_class_reduced.cc @@ -490,7 +490,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h, grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_reduced: Unable to compute index. Value too large"); return GRIB_OUT_OF_RANGE; } else { - indexes[kk] = self->k[kk]; + indexes[kk] = (int)self->k[kk]; } kk++; } diff --git a/src/grib_nearest_class_regular.cc b/src/grib_nearest_class_regular.cc index 4e007ce7a..7ff90e38f 100644 --- a/src/grib_nearest_class_regular.cc +++ b/src/grib_nearest_class_regular.cc @@ -351,7 +351,7 @@ static int find(grib_nearest* nearest, grib_handle* h, grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_regular: Unable to compute index. Value too large"); return GRIB_OUT_OF_RANGE; } else { - indexes[kk] = self->k[kk]; + indexes[kk] = (int)self->k[kk]; } kk++; } diff --git a/tests/grib_nearest_test.cc b/tests/grib_nearest_test.cc index 5731f6bb2..24b76f457 100644 --- a/tests/grib_nearest_test.cc +++ b/tests/grib_nearest_test.cc @@ -31,10 +31,9 @@ int main(int argc, char** argv) { int err = 0; long step = 0; - size_t nfiles = 0; - size_t i = 0, j = 0; - codes_fieldset* set = NULL; - const size_t max_numfiles = 100; + int nfiles = 0, i = 0, j = 0; + codes_fieldset* set = NULL; + const int max_numfiles = 100; codes_handle* h = NULL; char param[20] = {0,}; size_t len = 20; diff --git a/tools/grib_histogram.cc b/tools/grib_histogram.cc index 08ce17f89..90a7e8532 100644 --- a/tools/grib_histogram.cc +++ b/tools/grib_histogram.cc @@ -58,10 +58,11 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi */ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { - size_t i, j, err = 0; + size_t i, j; size_t last_size = 0; long missingValuesPresent; double delta; + int err = 0; double* values = NULL; size_t size;