From 53bf3d9bec3f5433e4693556a84532e24092f284 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 6 Feb 2020 18:17:52 +0000 Subject: [PATCH] Metar: fix test --- src/grib_expression_class_accessor.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/grib_expression_class_accessor.c b/src/grib_expression_class_accessor.c index 372888cc8..b46603b30 100644 --- a/src/grib_expression_class_accessor.c +++ b/src/grib_expression_class_accessor.c @@ -125,16 +125,14 @@ static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, siz start += *size; if (e->length != 0) { - if (start > 0) + if (start >= 0) memcpy(buf, mybuf + start, e->length); buf[e->length] = 0; } else { - if (*size > 0) { - memcpy(buf, mybuf, *size); - if (*size == 1024) - *size = *size - 1; /* ECC-336 */ - } + memcpy(buf, mybuf, *size); + if (*size == 1024) + *size = *size - 1; /* ECC-336 */ buf[*size] = 0; } return buf;