From 1a1b44662684d1f8596efdebe4fd13483e56e6db Mon Sep 17 00:00:00 2001 From: shahramn Date: Sun, 25 Feb 2024 15:56:00 +0000 Subject: [PATCH] Accessors: Type safety --- src/grib_accessor_class_gen.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/grib_accessor_class_gen.cc b/src/grib_accessor_class_gen.cc index c74479aeb..b611f5043 100644 --- a/src/grib_accessor_class_gen.cc +++ b/src/grib_accessor_class_gen.cc @@ -477,14 +477,13 @@ static int pack_double_array_as_long(grib_accessor* a, const double* v, size_t* { grib_context* c = a->context; int ret = GRIB_SUCCESS; - size_t i = 0; size_t numBytes = *len * (sizeof(long)); long* lValues = (long*)grib_context_malloc(c, numBytes); if (!lValues) { grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes", numBytes); return GRIB_OUT_OF_MEMORY; } - for (i = 0; i < *len; i++) + for (size_t i = 0; i < *len; i++) lValues[i] = (long)v[i]; /* convert from double to long */ ret = grib_pack_long(a, lValues, len); grib_context_free(c, lValues);