From 2aa1e7efd1104fce07c313e667698315d5ef02cf Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 2 Sep 2023 18:42:11 +0100 Subject: [PATCH] Remove pack_ methods on read-only accessors --- src/grib_accessor_class_group.cc | 35 ++++++-------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/grib_accessor_class_group.cc b/src/grib_accessor_class_group.cc index d4c09a2f5..32f337d3b 100644 --- a/src/grib_accessor_class_group.cc +++ b/src/grib_accessor_class_group.cc @@ -7,9 +7,6 @@ * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/*********************************************************** - * Enrico Fucile - ***********************************************************/ #include "grib_api_internal.h" /* @@ -18,9 +15,9 @@ START_CLASS_DEF CLASS = accessor SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double;pack_double + IMPLEMENTS = unpack_string + IMPLEMENTS = unpack_long + IMPLEMENTS = unpack_double IMPLEMENTS = init;dump;string_length IMPLEMENTS = value_count IMPLEMENTS = next_offset @@ -42,9 +39,6 @@ or edit "accessor.class" and rerun ./make_class.pl */ static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); static int unpack_long(grib_accessor*, long* val, size_t* len); static int unpack_string(grib_accessor*, char*, size_t* len); @@ -84,13 +78,13 @@ static grib_accessor_class _grib_accessor_class_group = { 0, /* get sub_section */ 0, /* pack_missing */ 0, /* is_missing */ - &pack_long, /* pack_long */ + 0, /* pack_long */ &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ + 0, /* pack_double */ 0, /* pack_float */ &unpack_double, /* unpack_double */ 0, /* unpack_float */ - &pack_string, /* pack_string */ + 0, /* pack_string */ &unpack_string, /* unpack_string */ 0, /* pack_string_array */ 0, /* unpack_string_array */ @@ -194,23 +188,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_SUCCESS; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_long(grib_accessor* a, const long* v, size_t* len) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as long", a->name); - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_double(grib_accessor* a, const double* v, size_t* len) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as double", a->name); - return GRIB_NOT_IMPLEMENTED; -} - static int unpack_long(grib_accessor* a, long* v, size_t* len) { char val[1024] = {0,};