diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-08-06 00:15:57 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-08-06 00:15:57 (GMT) |
commit | 65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849 (patch) | |
tree | f0382ca8b00fb2c158da2cb502ee3f6d3cdf1106 /test | |
parent | f59bb712dec221a076728b6c582818bcf814d71a (diff) | |
download | hdf5-65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849.zip hdf5-65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849.tar.gz hdf5-65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849.tar.bz2 |
Warning fixes in tools and h5test.c
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/test/h5test.c b/test/h5test.c index 1b445dd..28513b9 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2097,8 +2097,14 @@ h5_compare_file_bytes(char *f1name, char *f2name) HDrewind(f1ptr); HDrewind(f2ptr); for (ii = 0; ii < f1size; ii++) { - HDfread(&f1char, 1, 1, f1ptr); - HDfread(&f2char, 1, 1, f2ptr); + if(HDfread(&f1char, 1, 1, f1ptr) != 1) { + ret_value = -1; + goto done; + } + if(HDfread(&f2char, 1, 1, f2ptr) != 1) { + ret_value = -1; + goto done; + } if (f1char != f2char) { HDfprintf(stderr, "Mismatch @ 0x%llX: 0x%X != 0x%X\n", ii, f1char, f2char); ret_value = -1; @@ -2107,13 +2113,11 @@ h5_compare_file_bytes(char *f1name, char *f2name) } done: - if (f1ptr) { + if (f1ptr) HDfclose(f1ptr); - } - if (f2ptr) { + if (f2ptr) HDfclose(f2ptr); - } - return(ret_value); + return ret_value; } /* end h5_compare_file_bytes() */ /*------------------------------------------------------------------------- @@ -2220,7 +2224,10 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) } while (read_size > 0) { - HDfread(dup_buf, read_size, 1, orig_ptr); /* warning: no error-check */ + if(HDfread(dup_buf, read_size, 1, orig_ptr) != 1) { + ret_value = -1; + goto done; + } HDfwrite(dup_buf, read_size, 1, dest_ptr); fsize -= read_size; read_size = MIN(fsize, max_buf); |