diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-11-21 15:07:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-11-21 15:07:32 (GMT) |
commit | cdffac61e52cbee121205da162c6fb75954c2734 (patch) | |
tree | c2d76b38c8e8795091d39fb87462dd7aa9ff91d5 /src | |
parent | 2a2d3b21aafa2559c49fd0c47ef2690c1efbd856 (diff) | |
download | hdf5-cdffac61e52cbee121205da162c6fb75954c2734.zip hdf5-cdffac61e52cbee121205da162c6fb75954c2734.tar.gz hdf5-cdffac61e52cbee121205da162c6fb75954c2734.tar.bz2 |
[svn-r4632] Purpose:
Bug fix
Description:
Fix deep copies of property lists with H5P_DEFAULT values.
Platforms tested:
FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDfamily.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 2069850..0ecf171 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -319,10 +319,17 @@ H5FD_family_fapl_copy(const void *_old_fa) if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_family_fapl_t)))) HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + /* Copy the fields of the structure */ memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t)); - if(NULL == (plist = H5I_object(old_fa->memb_fapl_id))) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); - new_fa->memb_fapl_id = H5P_copy_plist(plist); + + /* Deep copy the property list objects in the structure */ + if(old_fa->memb_fapl_id==H5P_DEFAULT) + new_fa->memb_fapl_id = H5P_DEFAULT; + else { + if(NULL == (plist = H5I_object(old_fa->memb_fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + new_fa->memb_fapl_id = H5P_copy_plist(plist); + } /* end else */ FUNC_LEAVE(new_fa); } @@ -474,9 +481,13 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); fa = H5P_get_driver_info(plist); - if(NULL == (plist = H5I_object(fa->memb_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); - file->memb_fapl_id = H5P_copy_plist(plist); + if(fa->memb_fapl_id==H5P_DEFAULT) + file->memb_fapl_id = H5P_DEFAULT; + else { + if(NULL == (plist = H5I_object(fa->memb_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + file->memb_fapl_id = H5P_copy_plist(plist); + } /* end else */ file->memb_size = fa->memb_size; } file->name = H5MM_strdup(name); |