diff --git a/src/grib_handle.cc b/src/grib_handle.cc index d4c94e4e3..f476ab9f2 100644 --- a/src/grib_handle.cc +++ b/src/grib_handle.cc @@ -428,6 +428,8 @@ grib_handle* codes_handle_new_from_file(grib_context* c, FILE* f, ProductKind pr return metar_new_from_file(c, f, error); if (product == PRODUCT_GTS) return gts_new_from_file(c, f, error); + //if (product == PRODUCT_TAF) + // return taf_new_from_file(c, f, error); if (product == PRODUCT_ANY) return any_new_from_file(c, f, error); diff --git a/src/grib_io.cc b/src/grib_io.cc index 978885c09..d4d876cca 100644 --- a/src/grib_io.cc +++ b/src/grib_io.cc @@ -1274,7 +1274,6 @@ int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len) // reader r; // u.user_buffer = buffer; // u.buffer_size = *len; - // r.read_data = f; // r.read = &stdio_read; // r.alloc_data = &u; @@ -1724,7 +1723,6 @@ int grib_read_any_from_memory(grib_context* ctx, unsigned char** data, size_t* d err = read_any(&r, /*no_alloc=*/0, 1, ECCODES_READS_BUFR, ECCODES_READS_HDF5, ECCODES_READS_WRAP); *len = r.message_size; - *data_length = m.data_len; *data = m.data; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a02568dbf..7f36206d0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -160,6 +160,7 @@ if( HAVE_BUILD_TOOLS ) # and/or take much longer list(APPEND tests_extra grib_data_quality_checks + grib_repair grib_g1monthlydate grib_g1fcperiod grib_bpv_limit diff --git a/tests/grib_repair.sh b/tests/grib_repair.sh new file mode 100755 index 000000000..3d7178408 --- /dev/null +++ b/tests/grib_repair.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +. ./include.ctest.sh + +label="grib_repair_test" +tempText=temp.$label.txt +tempGrib=temp.$label.grib + +export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3 + +${tools_dir}/grib_repair $data_dir/bad.grib $tempGrib > $tempText 2>&1 +${tools_dir}/grib_ls $tempGrib + +grep -q "Wrong message length" $tempText + +# Clean up +rm -f $tempText $tempGrib