diff options
author | Songyu Lu <songyulu@hdfgroup.org> | 2019-04-17 22:42:01 (GMT) |
---|---|---|
committer | Songyu Lu <songyulu@hdfgroup.org> | 2019-04-17 22:42:01 (GMT) |
commit | b5ef82a1786605ae86502bc82086047720b7d4ca (patch) | |
tree | ce00e05f1cf3cb5bd6ea5d2e54392353b1242e6e /src | |
parent | fc47e2e07a252f9421c6d11e88cfd63e5a337183 (diff) | |
download | hdf5-b5ef82a1786605ae86502bc82086047720b7d4ca.zip hdf5-b5ef82a1786605ae86502bc82086047720b7d4ca.tar.gz hdf5-b5ef82a1786605ae86502bc82086047720b7d4ca.tar.bz2 |
Moving the handling of null prefix into H5_combine_path.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Defl.c | 18 | ||||
-rw-r--r-- | src/H5system.c | 6 |
2 files changed, 7 insertions, 17 deletions
diff --git a/src/H5Defl.c b/src/H5Defl.c index eef758c..91caa61 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -287,13 +287,8 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip)) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if(dset->shared->extfile_prefix) { - if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") - } else { - if(H5_combine_path("", efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") - } + if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") if((fd = HDopen(full_name, O_RDONLY)) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0) @@ -384,13 +379,8 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip)) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if(dset->shared->extfile_prefix) { - if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") - } else { - if(H5_combine_path("", efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") - } + if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") if((fd = HDopen(full_name, O_CREAT | O_RDWR, H5_POSIX_CREATE_MODE_RW)) < 0) { if(HDaccess(full_name, F_OK) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") diff --git a/src/H5system.c b/src/H5system.c index 2ddc29a..35123db 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1256,13 +1256,13 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) FUNC_ENTER_NOAPI_NOINIT - HDassert(path1); HDassert(path2); - path1_len = HDstrlen(path1); + if(path1) + path1_len = HDstrlen(path1); path2_len = HDstrlen(path2); - if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { + if(path1 == NULL || *path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { /* If path1 is empty or path2 is absolute, simply use path2 */ if(NULL == (*full_name = (char *)H5MM_strdup(path2))) |