summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-12-26 05:28:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-12-26 05:28:18 (GMT)
commit83929ea716220890e41f923566aa5c89e8e735d3 (patch)
tree22193da0d9129fc7c06a57db35b2f4a57458cf50 /src/H5I.c
parentdb551ec15e771b4536c35cc6f3eabb7d28681510 (diff)
downloadhdf5-83929ea716220890e41f923566aa5c89e8e735d3.zip
hdf5-83929ea716220890e41f923566aa5c89e8e735d3.tar.gz
hdf5-83929ea716220890e41f923566aa5c89e8e735d3.tar.bz2
[svn-r11838] Purpose:
Bug fix Description: Retrieving an object's name could fail (in various ways) under certain circumstances (mostly having to do with mounted files). Solution: Re-write & simplify "get object name" code to fix error in a better way than adding yet another hack to the previous pile of hacks... :-) Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/H5I.c b/src/H5I.c
index bfcef6b..00b8dad 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1825,29 +1825,25 @@ done:
* Failure: NULL
*
* Programmer: James Laird
- * Nathaniel Furrer
+ * Nathaniel Furrer
* Friday, April 23, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key)
{
- void * ret_value; /* Return value */
+ void * ret_value; /* Return value */
- FUNC_ENTER_API(H5Isearch, NULL);
+ FUNC_ENTER_API(H5Isearch, NULL)
- if( H5I_IS_LIB_TYPE( type ) )
- {
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type");
- }
+ if( H5I_IS_LIB_TYPE( type ) )
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
- ret_value = H5I_search(type, func, key);
+ ret_value = H5I_search(type, func, key);
- done:
- FUNC_LEAVE_API(ret_value);
-}
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Isearch() */
/*-------------------------------------------------------------------------
@@ -1997,35 +1993,19 @@ H5I_find_id(hid_t id)
* If a zero is returned for the name's length, then there is no name
* associated with the ID.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
ssize_t
H5Iget_name(hid_t id, char *name/*out*/, size_t size)
{
- H5G_loc_t loc; /* Object location */
- size_t len = 0;
ssize_t ret_value;
FUNC_ENTER_API(H5Iget_name, FAIL)
H5TRACE3("Zs","ixz",id,name,size);
- /* get object location */
- if(H5G_loc(id, &loc) >= 0) {
- if(loc.path->user_path_r != NULL && loc.path->user_path_hidden == 0) {
- len = H5RS_len(loc.path->user_path_r);
-
- if(name) {
- HDstrncpy(name, H5RS_get_str(loc.path->user_path_r), MIN(len + 1, size));
- if(len >= size)
- name[size-1] = '\0';
- } /* end if */
- } /* end if */
- } /* end if */
-
- /* Set return value */
- ret_value = (ssize_t)len;
+ /* Call internal group routine to retrieve object's name */
+ if((ret_value = H5G_get_name(id, name, size)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
done:
FUNC_LEAVE_API(ret_value)