diff --git a/tools/bufr_compare.cc b/tools/bufr_compare.cc index dd2a897d7..294a1da26 100644 --- a/tools/bufr_compare.cc +++ b/tools/bufr_compare.cc @@ -1311,7 +1311,7 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt if (options->compare[i].type == CODES_NAMESPACE) { iter = grib_keys_iterator_new(handle1, 0, options->compare[i].name); if (!iter) { - grib_context_log(handle1->context, GRIB_LOG_ERROR, "unable to get iterator"); + grib_context_log(handle1->context, GRIB_LOG_ERROR, "unable to create the BUFR keys iterator"); exit(1); } while (grib_keys_iterator_next(iter)) { @@ -1372,12 +1372,11 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt iter = grib_keys_iterator_new(handle1, 0, options->compare[i].name); if (!iter) { grib_context_log(handle1->context, GRIB_LOG_ERROR, - "ERROR: unable to get keys iterator for %s", options->compare[i].name); + "unable to create the BUFR keys iterator for %s", options->compare[i].name); exit(1); } while (grib_keys_iterator_next(iter)) { name = grib_keys_iterator_get_name(iter); - /*printf("----- comparing %s\n",name);*/ if (blocklisted(name)) continue; diff --git a/tools/grib_compare.cc b/tools/grib_compare.cc index a538f2a8c..9d99498fb 100644 --- a/tools/grib_compare.cc +++ b/tools/grib_compare.cc @@ -1227,7 +1227,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option h22 = grib_handle_new_from_partial_message(h1->context, msg2, size2); 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"); exit(1); @@ -1235,7 +1234,6 @@ 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);*/ if (blocklisted(name)) continue; @@ -1258,7 +1256,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option int num_keys_in_namespace = 0; iter = grib_keys_iterator_new(h1, 0, options->compare[i].name); if (!iter) { - printf("ERROR: unable to get keys iterator for namespace \"%s\".\n", options->compare[i].name); + grib_context_log(context, GRIB_LOG_ERROR, "unable to create the GRIB keys iterator for %s", options->compare[i].name); exit(1); } while (grib_keys_iterator_next(iter)) { @@ -1292,9 +1290,8 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option return 0; iter = grib_keys_iterator_new(h1, GRIB_KEYS_ITERATOR_SKIP_COMPUTED, NULL); - if (!iter) { - printf("ERROR: unable to get keys iterator\n"); + grib_context_log(context, GRIB_LOG_ERROR, "unable to create the GRIB keys iterator"); exit(1); } @@ -1318,7 +1315,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option if (options->compare[i].type == CODES_NAMESPACE) { iter = grib_keys_iterator_new(h1, 0, options->compare[i].name); if (!iter) { - printf("ERROR: unable to get iterator for %s\n", options->compare[i].name); + fprintf(stderr, "Error: unable to get keys iterator for %s\n", options->compare[i].name); exit(1); } while (grib_keys_iterator_next(iter)) {