From 2a5409cf5c184bb18bade07655fe53955a2df590 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 27 Oct 1998 10:32:23 -0500 Subject: [svn-r805] Fixed H5Fis_hdf5 from reporting "true" for non-HDF5 files. --- src/H5F.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 21a26df..5785efe 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -414,6 +414,7 @@ static herr_t H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms, haddr_t *addr/*out*/) { + herr_t ret_value=FAIL; haddr_t max_addr; uint8 buf[H5F_SIGNATURE_LEN]; uintn n = 9; @@ -423,16 +424,18 @@ H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms, H5F_low_size(f_handle, &max_addr); H5F_addr_reset(addr); while (H5F_addr_lt(addr, &max_addr)) { - if (H5F_low_read(f_handle, access_parms, H5D_XFER_DFLT, addr, - H5F_SIGNATURE_LEN, buf) < 0) { - HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read file"); - } - if (!HDmemcmp(buf, H5F_SIGNATURE, H5F_SIGNATURE_LEN)) - break; - H5F_addr_pow2(n++, addr); + if (H5F_low_read(f_handle, access_parms, H5D_XFER_DFLT, addr, + H5F_SIGNATURE_LEN, buf) < 0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read file"); + } + if (!HDmemcmp(buf, H5F_SIGNATURE, H5F_SIGNATURE_LEN)) { + ret_value=SUCCEED; + break; + } + H5F_addr_pow2(n++, addr); } - FUNC_LEAVE(SUCCEED); + FUNC_LEAVE(ret_value); } -- cgit v0.12