diff --git a/src/accessor/grib_accessor_class_g1bitmap.cc b/src/accessor/grib_accessor_class_g1bitmap.cc index 331b800c5..afb713b30 100644 --- a/src/accessor/grib_accessor_class_g1bitmap.cc +++ b/src/accessor/grib_accessor_class_g1bitmap.cc @@ -77,7 +77,7 @@ int grib_accessor_class_g1bitmap_t::value_count(grib_accessor* a, long* count) int grib_accessor_class_g1bitmap_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len) { - unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; + const unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a; long tlen; int err; diff --git a/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc b/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc index 3bf953598..b8b02853a 100644 --- a/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc +++ b/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc @@ -18,7 +18,7 @@ void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, con { grib_accessor_class_abstract_vector_t::init(a, l, c); grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; - int n = 0; + int n = 0; self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; @@ -26,7 +26,7 @@ void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, con a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; self->number_of_elements = 6; - self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements); + self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements); a->length = 0; a->dirty = 1; @@ -90,8 +90,8 @@ int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor int grib_accessor_class_g1end_of_interval_monthly_t::value_count(grib_accessor* a, long* count) { - grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; - *count = self->number_of_elements; + const grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; + *count = self->number_of_elements; return 0; } @@ -111,9 +111,8 @@ int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, g long count = 0; size_t alen = 0; size_t blen = 0; - int err = 0; - err = a->value_count(&count); + int err = a->value_count(&count); if (err) return err; alen = count; @@ -133,7 +132,10 @@ int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, g a->dirty = 1; err = a->unpack_double(aval, &alen); + if (err) return err; err = b->unpack_double(bval, &blen); + if (err) return err; + for (size_t i = 0; i < alen && retval == GRIB_SUCCESS; ++i) { if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH; } diff --git a/src/accessor/grib_accessor_class_group.cc b/src/accessor/grib_accessor_class_group.cc index 74051d17d..c6e52bb9c 100644 --- a/src/accessor/grib_accessor_class_group.cc +++ b/src/accessor/grib_accessor_class_group.cc @@ -17,7 +17,7 @@ grib_accessor_class* grib_accessor_class_group = &_grib_accessor_class_group; void grib_accessor_class_group_t::init(grib_accessor* a, const long len, grib_arguments* arg) { grib_accessor_class_gen_t::init(a, len, arg); - grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; + const grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; grib_accessor_group_t* self = (grib_accessor_group_t*)a; size_t i = 0; diff --git a/src/accessor/grib_accessor_class_gts_header.cc b/src/accessor/grib_accessor_class_gts_header.cc index 5b158c6d1..d069b1c58 100644 --- a/src/accessor/grib_accessor_class_gts_header.cc +++ b/src/accessor/grib_accessor_class_gts_header.cc @@ -59,6 +59,6 @@ int grib_accessor_class_gts_header_t::value_count(grib_accessor* a, long* count) size_t grib_accessor_class_gts_header_t::string_length(grib_accessor* a) { - grib_handle* h = grib_handle_of_accessor(a); + const grib_handle* h = grib_handle_of_accessor(a); return h->gts_header_len; }