mirror of https://github.com/ecmwf/eccodes.git
Accessors: Return correct array length
This commit is contained in:
parent
6f710bdcbf
commit
9cda220036
|
@ -908,9 +908,9 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*len < rlen) {
|
if (*len < rlen) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%lu) for %s, it contains %ld values",
|
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %ld values",
|
||||||
*len, a->name, rlen);
|
*len, a->name, rlen);
|
||||||
*len = 0;
|
*len = rlen;
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,8 +167,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
|
||||||
if (*len < rlen) {
|
if (*len < rlen) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||||
"Wrong size (%ld) for %s it contains %ld values", *len, a->name, rlen);
|
"Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen);
|
||||||
*len = 0;
|
*len = rlen;
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
if (*len < rlen) {
|
if (*len < rlen) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||||
"Wrong size (%ld) for %s, it contains %ld values", *len, a->name, rlen);
|
"Wrong size (%ld) for %s, it contains %ld values", *len, a->name, rlen);
|
||||||
*len = 0;
|
*len = rlen;
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||||
const double dval = *val;
|
const double dval = *val;
|
||||||
|
|
||||||
if (*len != 1) {
|
if (*len != 1) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1);
|
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains 1 value", a->name);
|
||||||
*len = 1;
|
*len = 1;
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ static int pack_float(grib_accessor* a, const float* val, size_t* len)
|
||||||
const double fval = *val;
|
const double fval = *val;
|
||||||
|
|
||||||
if (*len != 1) {
|
if (*len != 1) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1);
|
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains 1 value", a->name);
|
||||||
*len = 1;
|
*len = 1;
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
grib_accessor_variable* self = (grib_accessor_variable*)a;
|
grib_accessor_variable* self = (grib_accessor_variable*)a;
|
||||||
|
|
||||||
if (*len != 1) {
|
if (*len != 1) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1);
|
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains 1 value", a->name);
|
||||||
*len = 1;
|
*len = 1;
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue