Formatting and cleanups

This commit is contained in:
shahramn 2024-07-31 13:27:52 +01:00
parent 2554d17256
commit 86dc278ee3
4 changed files with 42 additions and 30 deletions

View File

@ -163,7 +163,8 @@ static int check_overridden_reference_values(const grib_context* c, long* refVal
#define DYN_ARRAY_SIZE_INIT 1000 /* Initial size for grib_iarray_new and grib_darray_new */ #define DYN_ARRAY_SIZE_INIT 1000 /* Initial size for grib_iarray_new and grib_darray_new */
#define DYN_ARRAY_SIZE_INCR 1000 /* Increment size for grib_iarray_new and grib_darray_new */ #define DYN_ARRAY_SIZE_INCR 1000 /* Increment size for grib_iarray_new and grib_darray_new */
void grib_accessor_class_bufr_data_array_t::init(grib_accessor* a, const long v, grib_arguments* params){ void grib_accessor_class_bufr_data_array_t::init(grib_accessor* a, const long v, grib_arguments* params)
{
grib_accessor_class_gen_t::init(a, v, params); grib_accessor_class_gen_t::init(a, v, params);
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
int n = 0; int n = 0;
@ -228,7 +229,8 @@ static int check_end_data(grib_context* c, bufr_descriptor* bd, grib_accessor_bu
return 0; return 0;
} }
void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self){ void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self)
{
grib_context_free(c, self->canBeMissing); grib_context_free(c, self->canBeMissing);
grib_vdarray_delete_content(c, self->numericValues); grib_vdarray_delete_content(c, self->numericValues);
grib_vdarray_delete(c, self->numericValues); grib_vdarray_delete(c, self->numericValues);
@ -257,30 +259,36 @@ void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self){
if (self->inputBitmap) grib_context_free(c, self->inputBitmap); if (self->inputBitmap) grib_context_free(c, self->inputBitmap);
} }
int grib_accessor_class_bufr_data_array_t::get_native_type(grib_accessor* a){ int grib_accessor_class_bufr_data_array_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE; return GRIB_TYPE_DOUBLE;
} }
long grib_accessor_class_bufr_data_array_t::byte_count(grib_accessor* a){ long grib_accessor_class_bufr_data_array_t::byte_count(grib_accessor* a)
{
return 0; return 0;
} }
long grib_accessor_class_bufr_data_array_t::byte_offset(grib_accessor* a){ long grib_accessor_class_bufr_data_array_t::byte_offset(grib_accessor* a)
{
return a->offset; return a->offset;
} }
long grib_accessor_class_bufr_data_array_t::next_offset(grib_accessor* a){ long grib_accessor_class_bufr_data_array_t::next_offset(grib_accessor* a)
{
return a->offset; return a->offset;
} }
int grib_accessor_class_bufr_data_array_t::pack_long(grib_accessor* a, const long* val, size_t* len){ int grib_accessor_class_bufr_data_array_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
self->do_decode = 1; self->do_decode = 1;
return GRIB_NOT_IMPLEMENTED; return GRIB_NOT_IMPLEMENTED;
} }
int grib_accessor_class_bufr_data_array_t::pack_double(grib_accessor* a, const double* val, size_t* len){ int grib_accessor_class_bufr_data_array_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
self->do_decode = 1; self->do_decode = 1;
return process_elements(a, PROCESS_ENCODE, 0, 0, 0); return process_elements(a, PROCESS_ENCODE, 0, 0, 0);
@ -536,7 +544,8 @@ static int encode_string_array(grib_context* c, grib_buffer* buff, long* pos, bu
return err; return err;
} }
void set_missing_long_to_double(grib_darray* dvalues){ void set_missing_long_to_double(grib_darray* dvalues)
{
size_t i, n = grib_darray_used_size(dvalues); size_t i, n = grib_darray_used_size(dvalues);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (dvalues->v[i] == GRIB_MISSING_LONG) if (dvalues->v[i] == GRIB_MISSING_LONG)
@ -3166,14 +3175,15 @@ static int process_elements(grib_accessor* a, int flag, long onlySubset, long st
return err; return err;
} }
void grib_accessor_class_bufr_data_array_t::dump(grib_accessor* a, grib_dumper* dumper){ void grib_accessor_class_bufr_data_array_t::dump(grib_accessor* a, grib_dumper* dumper)
{
// grib_accessor_bufr_data_array_t *self =(grib_accessor_bufr_data_array_t*)a; // grib_accessor_bufr_data_array_t *self =(grib_accessor_bufr_data_array_t*)a;
// int err=process_elements(a,PROCESS_DECODE); // int err=process_elements(a,PROCESS_DECODE);
// grib_dump_section(dumper,a,self->dataKeys->block); // grib_dump_section(dumper,a,self->dataKeys->block);
return;
} }
int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* count){ int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* count)
{
int err = 0, l; int err = 0, l;
long i; long i;
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
@ -3196,7 +3206,8 @@ int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* c
return err; return err;
} }
int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, double* val, size_t* len){ int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
int err = 0, i, k, ii; int err = 0, i, k, ii;
int proc_flag = PROCESS_DECODE; int proc_flag = PROCESS_DECODE;
size_t l = 0, elementsInSubset; size_t l = 0, elementsInSubset;
@ -3249,7 +3260,8 @@ int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, doubl
return GRIB_SUCCESS; return GRIB_SUCCESS;
} }
void grib_accessor_class_bufr_data_array_t::destroy(grib_context* c, grib_accessor* a){ void grib_accessor_class_bufr_data_array_t::destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
self_clear(c, self); self_clear(c, self);
if (self->dataAccessors) if (self->dataAccessors)

View File

@ -1,4 +1,3 @@
/* /*
* (C) Copyright 2005- ECMWF. * (C) Copyright 2005- ECMWF.
* *
@ -15,7 +14,8 @@ grib_accessor_class_bufr_group_t _grib_accessor_class_bufr_group{"bufr_group"};
grib_accessor_class* grib_accessor_class_bufr_group = &_grib_accessor_class_bufr_group; grib_accessor_class* grib_accessor_class_bufr_group = &_grib_accessor_class_bufr_group;
void grib_accessor_class_bufr_group_t::dump(grib_accessor* a, grib_dumper* dumper){ void grib_accessor_class_bufr_group_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_section(dumper, a, a->sub_section->block); grib_dump_section(dumper, a, a->sub_section->block);
} }

View File

@ -1,4 +1,3 @@
/* /*
* (C) Copyright 2005- ECMWF. * (C) Copyright 2005- ECMWF.
* *
@ -15,8 +14,8 @@ grib_accessor_class_data_g1shsimple_packing_t _grib_accessor_class_data_g1shsimp
grib_accessor_class* grib_accessor_class_data_g1shsimple_packing = &_grib_accessor_class_data_g1shsimple_packing; grib_accessor_class* grib_accessor_class_data_g1shsimple_packing = &_grib_accessor_class_data_g1shsimple_packing;
int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a, long* count)
int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a, long* count){ {
grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a; grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a;
size_t len = 0; size_t len = 0;
int err = 0; int err = 0;
@ -28,7 +27,8 @@ int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a,
return err; return err;
} }
int grib_accessor_class_data_g1shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ int grib_accessor_class_data_g1shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a; grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a;
int err = GRIB_SUCCESS; int err = GRIB_SUCCESS;

View File

@ -1,4 +1,3 @@
/* /*
* (C) Copyright 2005- ECMWF. * (C) Copyright 2005- ECMWF.
* *
@ -15,7 +14,8 @@ grib_accessor_class_g1fcperiod_t _grib_accessor_class_g1fcperiod{"g1fcperiod"};
grib_accessor_class* grib_accessor_class_g1fcperiod = &_grib_accessor_class_g1fcperiod; grib_accessor_class* grib_accessor_class_g1fcperiod = &_grib_accessor_class_g1fcperiod;
int grib_accessor_class_g1fcperiod_t::unpack_string(grib_accessor* a, char* val, size_t* len){ int grib_accessor_class_g1fcperiod_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
long start = 0, theEnd = 0; long start = 0, theEnd = 0;
char tmp[1024]; char tmp[1024];
const size_t tmpLen = sizeof(tmp); const size_t tmpLen = sizeof(tmp);