mirror of https://github.com/ecmwf/eccodes.git
Const correctness
This commit is contained in:
parent
fc73927c42
commit
6924dc014a
|
@ -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 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++;
|
||||
|
|
|
@ -18,7 +18,7 @@ int grib_accessor_class_uint64_t::unpack_long(grib_accessor* a, long* val, size_
|
|||
{
|
||||
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;
|
||||
unsigned long long result = 0, tmp;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -18,15 +18,14 @@ int grib_accessor_class_uint64_little_endian_t::unpack_long(grib_accessor* a, lo
|
|||
{
|
||||
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;
|
||||
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];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue