diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-04-25 08:07:42 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-04-25 08:07:42 (GMT) |
commit | 568c3624de786dd3240fbddea4f5035febe6ee01 (patch) | |
tree | 6dd9ff590e14a0a574b649579fa452163d051935 /src | |
parent | 4fbe80acc27bc0e84eec9880c3c4257802e5bae5 (diff) | |
download | hdf5-568c3624de786dd3240fbddea4f5035febe6ee01.zip hdf5-568c3624de786dd3240fbddea4f5035febe6ee01.tar.gz hdf5-568c3624de786dd3240fbddea4f5035febe6ee01.tar.bz2 |
Improvements to the H5Fis_accessible() and H5Fis_hdf5() tests
in tfile.c.
* General code tidying.
* Expanded tests to work with multi-file VFDs.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDfamily.c | 4 | ||||
-rw-r--r-- | src/H5FDmulti.c | 52 | ||||
-rw-r--r-- | src/H5Fint.c | 2 |
3 files changed, 29 insertions, 29 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 047fb25..c8893f9 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -715,7 +715,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, (0==file->nmembs ? flags : t_flags), file->memb_fapl_id, HADDR_UNDEF); } H5E_END_TRY; if (!file->memb[file->nmembs]) { - if (0==file->nmembs) + if (0 == file->nmembs) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file") H5E_clear_stack(NULL); break; @@ -723,7 +723,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, file->nmembs++; } - /* If the file is reopened and there's only one member file existing, this file maybe + /* If the file is reopened and there's only one member file existing, this file may be * smaller than the size specified through H5Pset_fapl_family(). Update the actual * member size. */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index fac0909..6cfef55 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -981,8 +981,7 @@ H5FD_multi_fapl_free(void *_fa) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr) +H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_multi_t *file=NULL; hid_t close_fapl=-1; @@ -996,7 +995,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, /* Check arguments */ if (!name || !*name) H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL) - if (0==maxaddr || HADDR_UNDEF==maxaddr) + if (0 == maxaddr || HADDR_UNDEF == maxaddr) H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL) /* @@ -1007,41 +1006,41 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, */ if(NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL) - if(H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) { + if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) { close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE)<0) + if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) } fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); assert(fa); ALL_MEMBERS(mt) { - file->fa.memb_map[mt] = fa->memb_map[mt]; - file->fa.memb_addr[mt] = fa->memb_addr[mt]; - if (fa->memb_fapl[mt]>=0) - H5Iinc_ref(fa->memb_fapl[mt]); + file->fa.memb_map[mt] = fa->memb_map[mt]; + file->fa.memb_addr[mt] = fa->memb_addr[mt]; + if (fa->memb_fapl[mt] >= 0) + H5Iinc_ref(fa->memb_fapl[mt]); file->fa.memb_fapl[mt] = fa->memb_fapl[mt]; - if (fa->memb_name[mt]) - file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]); - else - file->fa.memb_name[mt] = NULL; + if (fa->memb_name[mt]) + file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]); + else + file->fa.memb_name[mt] = NULL; } END_MEMBERS; file->fa.relax = fa->relax; file->flags = flags; file->name = my_strdup(name); - if (close_fapl>=0) - if(H5Pclose(close_fapl)<0) + if (close_fapl >= 0) + if(H5Pclose(close_fapl) < 0) H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error) /* Compute derived properties and open member files */ - if (compute_next(file)<0) + if (compute_next(file) < 0) H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", error); - if (open_members(file)<0) + if (open_members(file) < 0) H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error); /* We must have opened at least the superblock file */ - if (H5FD_MEM_DEFAULT==(m=file->fa.memb_map[H5FD_MEM_SUPER])) + if (H5FD_MEM_DEFAULT == (m = file->fa.memb_map[H5FD_MEM_SUPER])) m = H5FD_MEM_SUPER; - if (NULL==file->memb[m]) + if (NULL == file->memb[m]) goto error; return (H5FD_t*)file; @@ -1049,13 +1048,14 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, error: /* Cleanup and fail */ if (file) { - ALL_MEMBERS(mt) { - if (file->memb[mt]) (void)H5FDclose(file->memb[mt]); - if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); - if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); - } END_MEMBERS; - if (file->name) free(file->name); - free(file); + ALL_MEMBERS(mt) { + if (file->memb[mt]) (void)H5FDclose(file->memb[mt]); + if (file->fa.memb_fapl[mt] >= 0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); + if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); + } END_MEMBERS; + if (file->name) + free(file->name); + free(file); } return NULL; } diff --git a/src/H5Fint.c b/src/H5Fint.c index 5d03b3b..2e8771c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -853,7 +853,7 @@ htri_t H5F__is_hdf5(const char *name, hid_t fapl_id) { H5FD_t *file = NULL; /* Low-level file struct */ - haddr_t sig_addr; /* Addess of hdf5 file signature */ + haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE |