mirror of https://github.com/ecmwf/eccodes.git
Fix key comparisons
This commit is contained in:
parent
8e5132f0be
commit
dc58a160c0
|
@ -446,7 +446,7 @@ static int get_native_type(grib_accessor* a)
|
||||||
|
|
||||||
static int compare(grib_accessor* a, grib_accessor* b)
|
static int compare(grib_accessor* a, grib_accessor* b)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = GRIB_SUCCESS;
|
||||||
double* aval = 0;
|
double* aval = 0;
|
||||||
double* bval = 0;
|
double* bval = 0;
|
||||||
|
|
||||||
|
@ -475,10 +475,8 @@ static int compare(grib_accessor* a, grib_accessor* b)
|
||||||
grib_unpack_double(b, bval, &blen);
|
grib_unpack_double(b, bval, &blen);
|
||||||
|
|
||||||
retval = GRIB_SUCCESS;
|
retval = GRIB_SUCCESS;
|
||||||
while (alen != 0) {
|
for (size_t i=0; i<alen && retval == GRIB_SUCCESS; ++i) {
|
||||||
if (*bval != *aval)
|
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
||||||
retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
|
||||||
alen--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grib_context_free(a->context, aval);
|
grib_context_free(a->context, aval);
|
||||||
|
|
|
@ -241,10 +241,8 @@ static int compare(grib_accessor* a, grib_accessor* b)
|
||||||
grib_unpack_long(b, bval, &blen);
|
grib_unpack_long(b, bval, &blen);
|
||||||
|
|
||||||
retval = GRIB_SUCCESS;
|
retval = GRIB_SUCCESS;
|
||||||
while (alen != 0) {
|
for (size_t i=0; i<alen && retval == GRIB_SUCCESS; ++i) {
|
||||||
if (*bval != *aval)
|
if (aval[i] != bval[i]) retval = GRIB_LONG_VALUE_MISMATCH;
|
||||||
retval = GRIB_LONG_VALUE_MISMATCH;
|
|
||||||
alen--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grib_context_free(a->context, aval);
|
grib_context_free(a->context, aval);
|
||||||
|
|
|
@ -313,10 +313,9 @@ static int compare(grib_accessor* a, grib_accessor* b)
|
||||||
grib_unpack_double(a, aval, &alen);
|
grib_unpack_double(a, aval, &alen);
|
||||||
grib_unpack_double(b, bval, &blen);
|
grib_unpack_double(b, bval, &blen);
|
||||||
|
|
||||||
while (alen != 0) {
|
retval = GRIB_SUCCESS;
|
||||||
if (*bval != *aval)
|
for (size_t i=0; i<alen && retval == GRIB_SUCCESS; ++i) {
|
||||||
retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
||||||
alen--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grib_context_free(a->context, aval);
|
grib_context_free(a->context, aval);
|
||||||
|
|
|
@ -266,10 +266,8 @@ static int compare(grib_accessor* a, grib_accessor* b)
|
||||||
grib_unpack_double(b, bval, &blen);
|
grib_unpack_double(b, bval, &blen);
|
||||||
|
|
||||||
retval = GRIB_SUCCESS;
|
retval = GRIB_SUCCESS;
|
||||||
while (alen != 0) {
|
for (size_t i=0; i<alen && retval == GRIB_SUCCESS; ++i) {
|
||||||
if (*bval != *aval)
|
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
||||||
retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
|
||||||
alen--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grib_context_free(a->context, aval);
|
grib_context_free(a->context, aval);
|
||||||
|
|
Loading…
Reference in New Issue