From b85b85348bc346bc6abaf1436d6f13714bfb634e Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 19 Feb 2024 14:43:23 +0000 Subject: [PATCH] Accessors: Refactoring --- src/grib_accessor_class_divdouble.cc | 6 ------ src/grib_accessor_class_multdouble.cc | 6 ------ tools/grib_options.cc | 2 +- tools/grib_tools.cc | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/grib_accessor_class_divdouble.cc b/src/grib_accessor_class_divdouble.cc index f9586e9d7..8ab86e22e 100644 --- a/src/grib_accessor_class_divdouble.cc +++ b/src/grib_accessor_class_divdouble.cc @@ -115,13 +115,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) int ret = GRIB_SUCCESS; double value = 0; - if (*len < 1) { - *len = 1; - return GRIB_ARRAY_TOO_SMALL; - } - ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value); - if (ret != GRIB_SUCCESS) return ret; diff --git a/src/grib_accessor_class_multdouble.cc b/src/grib_accessor_class_multdouble.cc index 437031852..ac5771627 100644 --- a/src/grib_accessor_class_multdouble.cc +++ b/src/grib_accessor_class_multdouble.cc @@ -116,13 +116,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) int ret = GRIB_SUCCESS; double value = 0; - if (*len < 1) { - *len = 1; - return GRIB_ARRAY_TOO_SMALL; - } - ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value); - if (ret != GRIB_SUCCESS) return ret; diff --git a/tools/grib_options.cc b/tools/grib_options.cc index 3d792ca4e..f9ef49400 100644 --- a/tools/grib_options.cc +++ b/tools/grib_options.cc @@ -256,7 +256,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g #ifndef ECCODES_ON_WINDOWS /* Check at compile time to ensure our file offset is at least 64 bits */ - COMPILE_TIME_ASSERT(sizeof(options->infile_offset) >= 8); + static_assert(sizeof(options->infile_offset) >= 8); #endif has_output = grib_options_on("U"); diff --git a/tools/grib_tools.cc b/tools/grib_tools.cc index 7a79fd718..2124bc0ab 100644 --- a/tools/grib_tools.cc +++ b/tools/grib_tools.cc @@ -340,7 +340,7 @@ static int grib_tool_without_orderby(grib_runtime_options* options) if (options->infile_offset) { #ifndef ECCODES_ON_WINDOWS /* Check at compile time to ensure our file offset is at least 64 bits */ - COMPILE_TIME_ASSERT(sizeof(options->infile_offset) >= 8); + static_assert(sizeof(options->infile_offset) >= 8); #endif err = fseeko(infile->file, options->infile_offset, SEEK_SET); if (err) {