Remove pack_ methods on read-only accessors

This commit is contained in:
Shahram Najm 2023-09-02 18:42:11 +01:00
parent adcaaee3a6
commit 2aa1e7efd1
1 changed files with 6 additions and 29 deletions

View File

@ -7,9 +7,6 @@
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by * 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. * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/ */
/***********************************************************
* Enrico Fucile
***********************************************************/
#include "grib_api_internal.h" #include "grib_api_internal.h"
/* /*
@ -18,9 +15,9 @@
START_CLASS_DEF START_CLASS_DEF
CLASS = accessor CLASS = accessor
SUPER = grib_accessor_class_gen SUPER = grib_accessor_class_gen
IMPLEMENTS = unpack_string;pack_string IMPLEMENTS = unpack_string
IMPLEMENTS = unpack_long;pack_long IMPLEMENTS = unpack_long
IMPLEMENTS = unpack_double;pack_double IMPLEMENTS = unpack_double
IMPLEMENTS = init;dump;string_length IMPLEMENTS = init;dump;string_length
IMPLEMENTS = value_count IMPLEMENTS = value_count
IMPLEMENTS = next_offset 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 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_double(grib_accessor*, double* val, size_t* len);
static int unpack_long(grib_accessor*, long* 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); 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, /* get sub_section */
0, /* pack_missing */ 0, /* pack_missing */
0, /* is_missing */ 0, /* is_missing */
&pack_long, /* pack_long */ 0, /* pack_long */
&unpack_long, /* unpack_long */ &unpack_long, /* unpack_long */
&pack_double, /* pack_double */ 0, /* pack_double */
0, /* pack_float */ 0, /* pack_float */
&unpack_double, /* unpack_double */ &unpack_double, /* unpack_double */
0, /* unpack_float */ 0, /* unpack_float */
&pack_string, /* pack_string */ 0, /* pack_string */
&unpack_string, /* unpack_string */ &unpack_string, /* unpack_string */
0, /* pack_string_array */ 0, /* pack_string_array */
0, /* unpack_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; 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) static int unpack_long(grib_accessor* a, long* v, size_t* len)
{ {
char val[1024] = {0,}; char val[1024] = {0,};