summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_ref.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-01-23 20:46:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-01-23 20:46:34 (GMT)
commit56e3f667d6e3e265ac044f3faf1b17137556e0f7 (patch)
tree70f04688f0596ca5be22dd4e9260f601ee77bbd8 /tools/lib/h5tools_ref.c
parentb09695738a95d8f1fb823894d1880f28dc16669c (diff)
downloadhdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.zip
hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.tar.gz
hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.tar.bz2
[svn-r11886] Purpose:
Code cleanup Description: Check in some of the code cleanups from working on the external link support. (This doesn't include any of the external link features) Platforms tested: FreeBSD 4.11 (sleipnir) Mac OSX.4 (amazon) Linux 2.4
Diffstat (limited to 'tools/lib/h5tools_ref.c')
-rw-r--r--tools/lib/h5tools_ref.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index c93d2e5..89bdaf1 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -156,17 +156,26 @@ haddr_t
ref_path_table_lookup(const char *thepath)
{
H5G_stat_t sb;
- haddr_t ret_value;
- /* Get object ID for object at path */
- if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0)
- /* fatal error ? */
+ /* Check for external link first, so we don't return the OID of an object in another file */
+ if(H5Gget_objinfo(thefile, thepath, FALSE, &sb)<0)
return HADDR_UNDEF;
-
- /* Return OID or HADDR_UNDEF */
- ret_value = ref_path_table_find(sb.u.obj.objno) ? sb.u.obj.objno : HADDR_UNDEF;
-
- return(ret_value);
+ if(sb.type == H5G_LINK) {
+ /* Get object ID for object at path */
+ /* (If the object is not a soft link, we've already retrieved the
+ * correct information and don't have to perform this call. -QAK
+ */
+ if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0)
+ /* fatal error ? */
+ return HADDR_UNDEF;
+ } /* end if */
+
+
+ /* All existing objects in the file had better be in the table */
+ HDassert(ref_path_table_find(sb.u.obj.objno));
+
+ /* Return OID */
+ return(sb.u.obj.objno);
}
/*-------------------------------------------------------------------------