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_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_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
int n = 0;
@ -228,7 +229,8 @@ static int check_end_data(grib_context* c, bufr_descriptor* bd, grib_accessor_bu
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_vdarray_delete_content(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);
}
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;
}
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;
}
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;
}
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;
}
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;
self->do_decode = 1;
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;
self->do_decode = 1;
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;
}
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);
for (i = 0; i < n; i++) {
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;
}
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;
// int err=process_elements(a,PROCESS_DECODE);
// 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;
long i;
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;
}
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 proc_flag = PROCESS_DECODE;
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;
}
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;
self_clear(c, self);
if (self->dataAccessors)

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,11 +10,12 @@
#include "grib_accessor_class_bufr_group.h"
grib_accessor_class_bufr_group_t _grib_accessor_class_bufr_group{"bufr_group"};
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;
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);
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,15 +10,15 @@
#include "grib_accessor_class_data_g1shsimple_packing.h"
grib_accessor_class_data_g1shsimple_packing_t _grib_accessor_class_data_g1shsimple_packing{"data_g1shsimple_packing"};
grib_accessor_class_data_g1shsimple_packing_t _grib_accessor_class_data_g1shsimple_packing{ "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;
size_t len = 0;
int err = 0;
size_t len = 0;
int err = 0;
err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &len);
len += 1;
@ -28,9 +27,10 @@ int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a,
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;
int err = GRIB_SUCCESS;
int err = GRIB_SUCCESS;
size_t coded_n_vals = 0;
size_t n_vals = 0;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,16 +10,17 @@
#include "grib_accessor_class_g1fcperiod.h"
grib_accessor_class_g1fcperiod_t _grib_accessor_class_g1fcperiod{"g1fcperiod"};
grib_accessor_class_g1fcperiod_t _grib_accessor_class_g1fcperiod{ "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;
char tmp[1024];
const size_t tmpLen = sizeof(tmp);
int err = grib_g1_step_get_steps(a, &start, &theEnd);
size_t l = 0;
int err = grib_g1_step_get_steps(a, &start, &theEnd);
size_t l = 0;
if (err)
return err;