From 4c55ce239ac39acd2e177b10c0e2480510337254 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 27 Jun 2023 16:44:29 +0100 Subject: [PATCH] Revert accidental commit (ECC-1621) - switching to a branch --- tools/grib_compare.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tools/grib_compare.cc b/tools/grib_compare.cc index ddf90c4f6..7e9d5e2f0 100644 --- a/tools/grib_compare.cc +++ b/tools/grib_compare.cc @@ -1157,16 +1157,17 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option if (headerMode) { const void *msg1 = NULL, *msg2 = NULL; size_t size1 = 0, size2 = 0; - size_t endOfHeadersOffset = 0; + grib_handle *h11, *h22; GRIB_CHECK_NOLINE(grib_get_message_headers(h1, &msg1, &size1), 0); GRIB_CHECK_NOLINE(grib_get_message_headers(h2, &msg2, &size2), 0); if (size1 == size2 && !memcmp(msg1, msg2, size1)) return 0; err = 0; - GRIB_CHECK_NOLINE(grib_get_offset(h1, "endOfHeadersMarker", &endOfHeadersOffset), 0); + h11 = grib_handle_new_from_partial_message(h1->context, msg1, size1); + h22 = grib_handle_new_from_partial_message(h1->context, msg2, size2); - iter = grib_keys_iterator_new(h1, GRIB_KEYS_ITERATOR_SKIP_COMPUTED, NULL); + iter = grib_keys_iterator_new(h11, GRIB_KEYS_ITERATOR_SKIP_COMPUTED, NULL); if (!iter) { grib_context_log(context, GRIB_LOG_ERROR, "unable to create the GRIB keys iterator"); @@ -1176,19 +1177,16 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option while (grib_keys_iterator_next(iter)) { name = grib_keys_iterator_get_name(iter); /*printf("----- comparing %s\n",name);*/ - size_t keyOffset = 0; - GRIB_CHECK_NOLINE(grib_get_offset(h1, name, &keyOffset), 0); if (blocklisted(name)) continue; - if (keyOffset < endOfHeadersOffset) { - if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) { - err++; - } - } + if (compare_values(options, h11, h22, name, GRIB_TYPE_UNDEFINED)) + err++; } grib_keys_iterator_delete(iter); + grib_handle_delete(h11); + grib_handle_delete(h22); return err; }