diff --git a/src/accessor/grib_accessor_class_signed.cc b/src/accessor/grib_accessor_class_signed.cc index 36c20bd59..d240836ac 100644 --- a/src/accessor/grib_accessor_class_signed.cc +++ b/src/accessor/grib_accessor_class_signed.cc @@ -199,17 +199,16 @@ long grib_accessor_class_signed_t::next_offset(grib_accessor* a) int grib_accessor_class_signed_t::is_missing(grib_accessor* a) { - int i = 0; - unsigned char ff = 0xff; + unsigned char ff = 0xff; unsigned long offset = a->offset; - grib_handle* hand = grib_handle_of_accessor(a); + const grib_handle* hand = grib_handle_of_accessor(a); if (a->length == 0) { Assert(a->vvalue != NULL); return a->vvalue->missing; } - for (i = 0; i < a->length; i++) { + for (long i = 0; i < a->length; i++) { if (hand->buffer->data[offset] != ff) return 0; offset++; diff --git a/src/accessor/grib_accessor_class_uint64.cc b/src/accessor/grib_accessor_class_uint64.cc index a800a4630..78e1a54c0 100644 --- a/src/accessor/grib_accessor_class_uint64.cc +++ b/src/accessor/grib_accessor_class_uint64.cc @@ -16,9 +16,9 @@ grib_accessor_class* grib_accessor_class_uint64 = &_grib_accessor_class_uint64; int grib_accessor_class_uint64_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - long value = 0; - long pos = a->offset; - unsigned char* data = grib_handle_of_accessor(a)->buffer->data; + long value = 0; + long pos = a->offset; + const unsigned char* data = grib_handle_of_accessor(a)->buffer->data; unsigned long long result = 0, tmp; int i; diff --git a/src/accessor/grib_accessor_class_uint64_little_endian.cc b/src/accessor/grib_accessor_class_uint64_little_endian.cc index 25e537dbe..b98b7a90f 100644 --- a/src/accessor/grib_accessor_class_uint64_little_endian.cc +++ b/src/accessor/grib_accessor_class_uint64_little_endian.cc @@ -16,17 +16,16 @@ grib_accessor_class* grib_accessor_class_uint64_little_endian = &_grib_accessor_ int grib_accessor_class_uint64_little_endian_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - long value = 0; - long pos = a->offset; - unsigned char* data = grib_handle_of_accessor(a)->buffer->data; + long value = 0; + long pos = a->offset; + const unsigned char* data = grib_handle_of_accessor(a)->buffer->data; unsigned long long result = 0, tmp; - int i; if (*len < 1) { return GRIB_ARRAY_TOO_SMALL; } - for (i = 7; i >= 0; i--) { + for (int i = 7; i >= 0; i--) { result <<= 8; result |= data[pos + i]; } diff --git a/src/accessor/grib_accessor_class_uint8.cc b/src/accessor/grib_accessor_class_uint8.cc index 90236aa50..9840353df 100644 --- a/src/accessor/grib_accessor_class_uint8.cc +++ b/src/accessor/grib_accessor_class_uint8.cc @@ -18,7 +18,7 @@ int grib_accessor_class_uint8_t::unpack_long(grib_accessor* a, long* val, size_t { long value = 0; long pos = a->offset; - unsigned char* data = grib_handle_of_accessor(a)->buffer->data; + const unsigned char* data = grib_handle_of_accessor(a)->buffer->data; if (*len < 1) { return GRIB_ARRAY_TOO_SMALL; diff --git a/src/accessor/grib_accessor_class_unsigned.cc b/src/accessor/grib_accessor_class_unsigned.cc index 14ca831a3..d2394072d 100644 --- a/src/accessor/grib_accessor_class_unsigned.cc +++ b/src/accessor/grib_accessor_class_unsigned.cc @@ -162,7 +162,7 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, in int grib_accessor_class_unsigned_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a; + const grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a; long rlen = 0; unsigned long i = 0; @@ -245,7 +245,7 @@ int grib_accessor_class_unsigned_t::is_missing(grib_accessor* a) { const unsigned char ff = 0xff; unsigned long offset = a->offset; - grib_handle* hand = grib_handle_of_accessor(a); + const grib_handle* hand = grib_handle_of_accessor(a); if (a->length == 0) { Assert(a->vvalue != NULL);