Error messages

This commit is contained in:
shahramn 2024-10-31 16:41:46 +00:00
parent f83540af74
commit 7c13e374a0
1 changed files with 5 additions and 5 deletions

View File

@ -66,16 +66,16 @@ int grib_accessor_ascii_t::pack_string(const char* val, size_t* len)
{
grib_handle* hand = grib_handle_of_accessor(this);
const size_t alen = length_;
if (len[0] > (alen + 1)) {
if (*len > (alen + 1)) {
grib_context_log(context_, GRIB_LOG_ERROR,
"pack_string: Wrong size (%zu) for %s, it contains %ld values",
len[0], name_, length_ + 1);
len[0] = 0;
"%s: Buffer too small for %s. It is %zu bytes long (input string len=%zu)",
class_name_, name_, alen, *len);
*len = alen;
return GRIB_BUFFER_TOO_SMALL;
}
for (size_t i = 0; i < alen; i++) {
if (i < len[0])
if (i < *len)
hand->buffer->data[offset_ + i] = val[i];
else
hand->buffer->data[offset_ + i] = 0;