Skip to content

Commit

Permalink
Error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Oct 31, 2024
1 parent f83540a commit 7c13e37
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/accessor/grib_accessor_class_ascii.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7c13e37

Please sign in to comment.