summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-10-27 15:32:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-10-27 15:32:23 (GMT)
commit2a5409cf5c184bb18bade07655fe53955a2df590 (patch)
treea144ce18889368a6f7f14e641ff581ffd746ccf1
parent1e88d9ac676a6672770bab3eef5cb512bef40194 (diff)
downloadhdf5-2a5409cf5c184bb18bade07655fe53955a2df590.zip
hdf5-2a5409cf5c184bb18bade07655fe53955a2df590.tar.gz
hdf5-2a5409cf5c184bb18bade07655fe53955a2df590.tar.bz2
[svn-r805] Fixed H5Fis_hdf5 from reporting "true" for non-HDF5 files.
-rw-r--r--src/H5F.c19
1 files 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);
}