From 041e56526287225fe5675a5a2096692749cdf66d Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 10 Jul 2012 09:51:43 -0500 Subject: [svn-r22540] fix bug in H5R_get_name more named datatype bugs: - fix bug in Name replace traversal callback - fix bug in H5G_test A stable version finally.. --- src/H5F.c | 15 ++++++++++++--- src/H5Gname.c | 19 ++++++++++++++----- src/H5Gtest.c | 18 ++++++++++++------ src/H5R.c | 2 +- src/H5VLnative.c | 4 ---- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 00b3083..431e86f 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -514,7 +514,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") - ((H5F_t *)file)->file_id = ret_value; + /* MSC (need to change) - + * If this was done through the native plugin, store the ID created in the H5F_t struct */ + if((HDstrcmp(vol_plugin->cls->name, "native") == 0)) + ((H5F_t *)file)->file_id = ret_value; done: FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -597,7 +600,10 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") - ((H5F_t *)file)->file_id = ret_value; + /* MSC (need to change) - + * If this was done through the native plugin, store the ID created in the H5F_t struct */ + if((HDstrcmp(vol_plugin->cls->name, "native") == 0)) + ((H5F_t *)file)->file_id = ret_value; done: FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ @@ -804,7 +810,10 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") vol_plugin->nrefs ++; - ((H5F_t *)file)->file_id = ret_value; + /* MSC (need to change) - + * If this was done through the native plugin, store the ID created in the H5F_t struct */ + if((HDstrcmp(vol_plugin->cls->name, "native") == 0)) + ((H5F_t *)file)->file_id = ret_value; done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Gname.c b/src/H5Gname.c index 381518a..eb9cf10 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -819,12 +819,21 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) break; case H5I_DATATYPE: - /* Avoid non-named datatypes */ - if(!H5T_is_named((H5T_t *)obj_ptr)) - HGOTO_DONE(SUCCEED) /* Do not exit search over IDs */ + { + H5T_t *type = NULL; - oloc = H5T_oloc((H5T_t *)obj_ptr); - obj_path = H5T_nameof((H5T_t *)obj_ptr); + /* Get the actual datatype object that should be the vol_obj */ + if(NULL == (type = (H5T_t *)H5T_get_named_type((H5T_t*)obj_ptr))) + HGOTO_DONE(SUCCEED) /* Do not exit search over IDs */ + + /* Avoid non-named datatypes */ + if(!H5T_is_named(type)) + HGOTO_DONE(SUCCEED) /* Do not exit search over IDs */ + + oloc = H5T_oloc(type); + obj_path = H5T_nameof(type); + break; + } break; case H5I_UNINIT: diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 0af43f4..79ff06b 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -538,12 +538,18 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign break; case H5I_DATATYPE: - /* Avoid non-named datatypes */ - if(!H5T_is_named((H5T_t *)obj_ptr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a named datatype") - - obj_path = H5T_nameof((H5T_t *)obj_ptr); - break; + { + H5T_t *type = NULL; + + /* Get the actual datatype object that should be the vol_obj */ + if(NULL == (type = (H5T_t *)H5T_get_named_type((H5T_t*)obj_ptr))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a named datatype") + /* Avoid non-named datatypes */ + if(!H5T_is_named(type)) + HGOTO_DONE(SUCCEED) /* Do not exit search over IDs */ + obj_path = H5T_nameof(type); + break; + } case H5I_UNINIT: case H5I_BADID: diff --git a/src/H5R.c b/src/H5R.c index 053a811..4faf47b 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -889,12 +889,12 @@ H5R_get_name(H5G_loc_t *loc, hid_t lapl_id, hid_t dxpl_id, H5R_type_t ref_type, FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(f); HDassert(_ref); HDassert(name); /* Get the file pointer from the entry */ f = loc->oloc->file; + HDassert(f); /* Initialize the object location */ H5O_loc_reset(&oloc); diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 6bf8fc0..0bca739 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -3616,11 +3616,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ size_t size = va_arg (arguments, size_t); H5R_type_t ref_type = va_arg (arguments, H5R_type_t); void *ref = va_arg (arguments, void *); - //H5F_t *file; /* File object */ - /* Get the file pointer from the entry - file = loc.oloc->file; - */ /* Get name */ if((*ret = H5R_get_name(&loc, H5P_DEFAULT, H5AC_dxpl_id, ref_type, ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") -- cgit v0.12