From 1fc934731609204cc7e4cfef0f50ced56defe005 Mon Sep 17 00:00:00 2001 From: shahramn Date: Wed, 28 Feb 2024 17:48:00 +0000 Subject: [PATCH] Reformatting --- ...cessor_class_data_apply_boustrophedonic.cc | 32 ++++---- src/grib_dumper_class_bufr_encode_C.cc | 79 ++++++++++--------- src/grib_dumper_class_bufr_encode_fortran.cc | 78 ++++++++++-------- 3 files changed, 103 insertions(+), 86 deletions(-) diff --git a/src/grib_accessor_class_data_apply_boustrophedonic.cc b/src/grib_accessor_class_data_apply_boustrophedonic.cc index 1f10885e0..e01917384 100644 --- a/src/grib_accessor_class_data_apply_boustrophedonic.cc +++ b/src/grib_accessor_class_data_apply_boustrophedonic.cc @@ -119,7 +119,7 @@ grib_accessor_class* grib_accessor_class_data_apply_boustrophedonic = &_grib_acc static void init(grib_accessor* a, const long v, grib_arguments* args) { - int n = 0; + int n = 0; grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); @@ -138,10 +138,10 @@ static void dump(grib_accessor* a, grib_dumper* dumper) static int value_count(grib_accessor* a, long* numberOfPoints) { grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; - int ret = 0; + int ret = 0; *numberOfPoints = 0; - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints); + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints); return ret; } @@ -150,12 +150,13 @@ template static int unpack(grib_accessor* a, T* val, size_t* len) { grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; - size_t plSize = 0; - long* pl = 0; - double* values = 0; - double* pvalues = 0; - T* pval = 0; - size_t valuesSize = 0; + + size_t plSize = 0; + long* pl = 0; + double* values = 0; + double* pvalues = 0; + T* pval = 0; + size_t valuesSize = 0; long i, j; int ret; long numberOfPoints, numberOfRows, numberOfColumns; @@ -306,12 +307,13 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; - size_t plSize = 0; - long* pl = 0; - double* values = 0; - double* pvalues = 0; - double* pval = 0; - size_t valuesSize = 0; + + size_t plSize = 0; + long* pl = 0; + double* values = 0; + double* pvalues = 0; + double* pval = 0; + size_t valuesSize = 0; long i, j; int ret; long numberOfPoints, numberOfRows, numberOfColumns; diff --git a/src/grib_dumper_class_bufr_encode_C.cc b/src/grib_dumper_class_bufr_encode_C.cc index d07825434..568a035bb 100644 --- a/src/grib_dumper_class_bufr_encode_C.cc +++ b/src/grib_dumper_class_bufr_encode_C.cc @@ -102,13 +102,14 @@ static void init_class(grib_dumper_class* c) {} static int init(grib_dumper* d) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - grib_context* c = d->context; - self->section_offset = 0; - self->empty = 1; - d->count = 1; - self->isLeaf = 0; - self->isAttribute = 0; - self->keys = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list)); + + grib_context* c = d->context; + self->section_offset = 0; + self->empty = 1; + d->count = 1; + self->isLeaf = 0; + self->isAttribute = 0; + self->keys = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list)); return GRIB_SUCCESS; } @@ -116,9 +117,9 @@ static int init(grib_dumper* d) static int destroy(grib_dumper* d) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - grib_string_list* next = self->keys; - grib_string_list* cur = NULL; - grib_context* c = d->context; + grib_string_list* next = self->keys; + grib_string_list* cur = NULL; + grib_context* c = d->context; while (next) { cur = next; next = next->next; @@ -152,10 +153,11 @@ static char* dval_to_string(grib_context* c, double v) static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - double value = 0; + + double value = 0; size_t size = 0, size2 = 0; - double* values = NULL; - int err = 0; + double* values = NULL; + int err = 0; int i, r, icount; int cols = 2; long count = 0; @@ -248,10 +250,11 @@ static void dump_values(grib_dumper* d, grib_accessor* a) static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* prefix) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - double value = 0; + + double value = 0; size_t size = 0, size2 = 0; - double* values = NULL; - int err = 0; + double* values = NULL; + int err = 0; int i, icount; int cols = 2; long count = 0; @@ -333,16 +336,17 @@ static int is_hidden(grib_accessor* a) static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - long value = 0; + + long value = 0; size_t size = 0, size2 = 0; - long* values = NULL; - int err = 0; + long* values = NULL; + int err = 0; int i, r, icount; - int cols = 4; - long count = 0; - char* sval = NULL; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); + int cols = 4; + long count = 0; + char* sval = NULL; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); int doing_unexpandedDescriptors = 0; if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) { /* key does not have the dump attribute */ @@ -471,10 +475,11 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - long value = 0; + + long value = 0; size_t size = 0, size2 = 0; - long* values = NULL; - int err = 0; + long* values = NULL; + int err = 0; int i, icount; int cols = 4; long count = 0; @@ -552,8 +557,9 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - double value = 0; - size_t size = 1; + + double value = 0; + size_t size = 1; int r; char* sval; grib_handle* h = grib_handle_of_accessor(a); @@ -667,12 +673,13 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - char* value = NULL; - char* p = NULL; - size_t size = 0; - grib_context* c = a->context; + + char* value = NULL; + char* p = NULL; + size_t size = 0; + grib_context* c = a->context; int r = 0, err = 0; - grib_handle* h = grib_handle_of_accessor(a); + grib_handle* h = grib_handle_of_accessor(a); const char* acc_name = a->name; grib_get_string_length_acc(a, &size); @@ -814,7 +821,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix) { - int i = 0; + int i = 0; grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; unsigned long flags; while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) { @@ -846,7 +853,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix static void header(grib_dumper* d, grib_handle* h) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; - char sampleName[200] = { 0 }; + char sampleName[200] = { 0 }; long localSectionPresent, edition, bufrHeaderCentre, isSatellite; Assert(h->product_kind == PRODUCT_BUFR); diff --git a/src/grib_dumper_class_bufr_encode_fortran.cc b/src/grib_dumper_class_bufr_encode_fortran.cc index c689867b8..e76bd0872 100644 --- a/src/grib_dumper_class_bufr_encode_fortran.cc +++ b/src/grib_dumper_class_bufr_encode_fortran.cc @@ -103,13 +103,14 @@ static void init_class(grib_dumper_class* c) {} static int init(grib_dumper* d) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - grib_context* c = d->context; - self->section_offset = 0; - self->empty = 1; - d->count = 1; - self->isLeaf = 0; - self->isAttribute = 0; - self->keys = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list)); + + grib_context* c = d->context; + self->section_offset = 0; + self->empty = 1; + d->count = 1; + self->isLeaf = 0; + self->isAttribute = 0; + self->keys = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list)); return GRIB_SUCCESS; } @@ -117,9 +118,10 @@ static int init(grib_dumper* d) static int destroy(grib_dumper* d) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - grib_string_list* next = self->keys; - grib_string_list* cur = NULL; - grib_context* c = d->context; + + grib_string_list* next = self->keys; + grib_string_list* cur = NULL; + grib_context* c = d->context; while (next) { cur = next; next = next->next; @@ -200,10 +202,11 @@ static char* break_line(grib_context* c, const char* input) static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - double value = 0; + + double value = 0; size_t size = 0, size2 = 0; - double* values = NULL; - int err = 0; + double* values = NULL; + int err = 0; int i, r, icount; int cols = 2; long count = 0; @@ -295,10 +298,11 @@ static void dump_values(grib_dumper* d, grib_accessor* a) static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* prefix) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - double value = 0; + + double value = 0; size_t size = 0, size2 = 0; - double* values = NULL; - int err = 0; + double* values = NULL; + int err = 0; int i, icount; int cols = 2; long count = 0; @@ -381,16 +385,17 @@ static int is_hidden(grib_accessor* a) static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - long value = 0; + + long value = 0; size_t size = 0, size2 = 0; - long* values = NULL; - int err = 0; + long* values = NULL; + int err = 0; int i, r, icount; - int cols = 4; - long count = 0; - char* sval = NULL; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); + int cols = 4; + long count = 0; + char* sval = NULL; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); int doing_unexpandedDescriptors = 0; if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) { /* key does not have the dump attribute */ @@ -516,10 +521,11 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - long value = 0; + + long value = 0; size_t size = 0, size2 = 0; - long* values = NULL; - int err = 0; + long* values = NULL; + int err = 0; int i, icount; int cols = 4; long count = 0; @@ -603,8 +609,9 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - double value = 0; - size_t size = 1; + + double value = 0; + size_t size = 1; int r; char* sval; grib_handle* h = grib_handle_of_accessor(a); @@ -715,10 +722,11 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - char* value = NULL; - char* p = NULL; - size_t size = 0; - grib_context* c = a->context; + + char* value = NULL; + char* p = NULL; + size_t size = 0; + grib_context* c = a->context; int r; int err = 0; grib_handle* h = grib_handle_of_accessor(a); @@ -860,7 +868,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix) { - int i = 0; + int i = 0; grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; unsigned long flags; while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) { @@ -892,7 +900,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix static void header(grib_dumper* d, grib_handle* h) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; - char sampleName[200] = { 0 }; + char sampleName[200] = { 0 }; long localSectionPresent, edition, bufrHeaderCentre, isSatellite; grib_get_long(h, "localSectionPresent", &localSectionPresent);