diff --git a/src/grib_dumper_class_bufr_decode_C.c b/src/grib_dumper_class_bufr_decode_C.c index 7eb4f1ddc..3c9fb2f3f 100644 --- a/src/grib_dumper_class_bufr_decode_C.c +++ b/src/grib_dumper_class_bufr_decode_C.c @@ -162,12 +162,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_double(a,&value,&size); } @@ -222,18 +222,18 @@ 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_decode_C *self = (grib_dumper_bufr_decode_C*)d; - double value; size_t size = 0; + double value=0; size_t size = 0; int err = 0; long count=0; char* sval; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_double(a,&value,&size); } @@ -287,11 +287,12 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); + if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) + return; + grib_value_count(a,&count); size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) return; - if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf==0) { char* prefix; @@ -366,12 +367,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr long count=0; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_long(a,&value,&size); } @@ -423,10 +424,10 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) grib_handle* h=grib_handle_of_accessor(a); grib_context* c=h->context; - grib_unpack_double(a,&value,&size); if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_unpack_double(a,&value,&size); self->empty=0; r=compute_bufr_key_rank(h,self->keys,a->name); @@ -459,7 +460,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_decode_C *self = (grib_dumper_bufr_decode_C*)d; - char **values; + char **values = NULL; size_t size = 0; grib_context* c=NULL; int err = 0; diff --git a/src/grib_dumper_class_bufr_decode_filter.c b/src/grib_dumper_class_bufr_decode_filter.c index 6bc8d93c8..42c94b3ee 100644 --- a/src/grib_dumper_class_bufr_decode_filter.c +++ b/src/grib_dumper_class_bufr_decode_filter.c @@ -145,19 +145,19 @@ static int destroy(grib_dumper* d) static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_decode_filter *self = (grib_dumper_bufr_decode_filter*)d; - double value; size_t size = 0; + double value=0; size_t size = 0; int err = 0; int r; long count=0; grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size<=1) { err=grib_unpack_double(a,&value,&size); } @@ -203,17 +203,17 @@ 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_decode_filter *self = (grib_dumper_bufr_decode_filter*)d; - double value; size_t size = 0; + double value=0; size_t size = 0; int err = 0; long count=0; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size<=1) { err=grib_unpack_double(a,&value,&size); } @@ -251,11 +251,11 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); + if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) return; + grib_value_count(a,&count); size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) return; - if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf==0) { char* prefix; @@ -346,15 +346,15 @@ 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_decode_filter *self = (grib_dumper_bufr_decode_filter*)d; - double value; size_t size = 1; + double value=0; size_t size = 1; int r; grib_handle* h=grib_handle_of_accessor(a); grib_context* c=h->context; - grib_unpack_double(a,&value,&size); if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_unpack_double(a,&value,&size); self->begin=0; self->empty=0; diff --git a/src/grib_dumper_class_bufr_decode_fortran.c b/src/grib_dumper_class_bufr_decode_fortran.c index bde6fa20e..b9ed248f0 100644 --- a/src/grib_dumper_class_bufr_decode_fortran.c +++ b/src/grib_dumper_class_bufr_decode_fortran.c @@ -154,12 +154,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size<=1) { err=grib_unpack_double(a,&value,&size); } @@ -209,12 +209,12 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* long count=0; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_double(a,&value,&size); } @@ -254,11 +254,12 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); + if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) + return; + grib_value_count(a,&count); size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) return; - if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf==0) { char* prefix; @@ -328,12 +329,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr long count=0; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_long(a,&value,&size); } @@ -378,10 +379,10 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) grib_handle* h=grib_handle_of_accessor(a); grib_context* c=h->context; - grib_unpack_double(a,&value,&size); if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_unpack_double(a,&value,&size); self->empty=0; r=compute_bufr_key_rank(h,self->keys,a->name); diff --git a/src/grib_dumper_class_bufr_decode_python.c b/src/grib_dumper_class_bufr_decode_python.c index 4b113f996..510d5f107 100644 --- a/src/grib_dumper_class_bufr_decode_python.c +++ b/src/grib_dumper_class_bufr_decode_python.c @@ -162,12 +162,12 @@ static void dump_values(grib_dumper* d,grib_accessor* a) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_double(a,&value,&size); } @@ -221,12 +221,12 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p char* sval; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_double(a,&value,&size); } @@ -272,11 +272,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) grib_context* c=a->context; grib_handle* h=grib_handle_of_accessor(a); + if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) + return; + grib_value_count(a,&count); size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 ) return; - if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf==0) { char* prefix; @@ -344,12 +345,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr long count=0; grib_context* c=a->context; - grib_value_count(a,&count); - size=count; - if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_value_count(a,&count); + size=count; + if (size <= 1) { err=grib_unpack_long(a,&value,&size); } @@ -392,10 +393,10 @@ static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment) grib_handle* h=grib_handle_of_accessor(a); grib_context* c=h->context; - grib_unpack_double(a,&value,&size); if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; + grib_unpack_double(a,&value,&size); self->empty=0; r=compute_bufr_key_rank(h,self->keys,a->name);