Fix compiler warnings

This commit is contained in:
Shahram Najm 2024-01-23 14:50:27 +00:00
parent ce72f44c17
commit 44adab0569
3 changed files with 14 additions and 4 deletions

View File

@ -280,12 +280,13 @@ grib_handle* codes_bufr_handle_new_from_samples(grib_context* c, const char* nam
}
g = codes_external_template(c, PRODUCT_BUFR, name);
if (!g)
if (!g) {
grib_context_log(c, GRIB_LOG_ERROR,
"Unable to load BUFR sample file '%s.tmpl'\n"
" from %s\n"
" (ecCodes Version=%s)",
name, c->grib_samples_path, ECCODES_VERSION_STR);
}
return g;
}

View File

@ -25,6 +25,10 @@ int main(int argc, char** argv)
assert(argc == 2);
outfilename = argv[1];
// Test non-existent sample file. Should fail
h = codes_bufr_handle_new_from_samples(NULL, "some rubbish");
assert(!h);
h = codes_bufr_handle_new_from_samples(NULL, sampleName);
assert(h);

View File

@ -7,7 +7,12 @@
* 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 <stdio.h>
#include <iostream>
using std::cerr;
using std::cout;
using std::endl;
#undef NDEBUG
#include <assert.h>
#include "eccodes.h"
@ -24,7 +29,7 @@ int main(int argc, char* argv[])
assert (argc == 3);
printf("%ld\n", codes_get_api_version());
cout << codes_get_api_version() << endl;
in = fopen(argv[1], "rb");
assert(in);
@ -33,7 +38,7 @@ int main(int argc, char* argv[])
assert(source_handle);
CODES_CHECK(codes_get_message_offset(source_handle, &offset), 0);
printf("offset = %lld\n", offset);
cout << "offset = "<< offset << endl;
// How big is the input GRIB message?
CODES_CHECK(codes_get_message_size(source_handle, &totalLength), 0);