diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-10 17:30:09 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-10 17:30:09 (GMT) |
commit | 37358db8ab62fa9c9057ea118b8576d5a4368ef1 (patch) | |
tree | a1290bfece5213bedc47eb9a0817ef19f5c9ea9b /src/H5Lexternal.c | |
parent | fbd4cf9bfea5418e2e4e2b81f31459db4aae4d61 (diff) | |
download | hdf5-37358db8ab62fa9c9057ea118b8576d5a4368ef1.zip hdf5-37358db8ab62fa9c9057ea118b8576d5a4368ef1.tar.gz hdf5-37358db8ab62fa9c9057ea118b8576d5a4368ef1.tar.bz2 |
[svn-r17862] Description:
Bring r17860 from trunk to 1.8 branch:
"Normalize" object names for external links, making them into the same
form as used for soft links.
Begin the process of adding more printf-like information to library
error reporting. HGOTO_ERROR() and HDONE_ERROR() macros can now use the last
parameter (a string) like a printf() formatting string and pass extra
parameters with additional information. (For example, see the HGOTO_ERROR
macros in H5FD_sec2_read() in src/H5FDsec2.c)
Bring the underlying H5E_printf_stack() routine from trunk to 1.8
branch also.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5Lexternal.c')
-rw-r--r-- | src/H5Lexternal.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 57414c7..640ac07 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -514,6 +514,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location to create link */ + char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ size_t buf_size; /* Size of buffer to hold external link */ uint8_t *p; /* Pointer into external link buffer */ @@ -533,8 +534,12 @@ H5Lcreate_external(const char *file_name, const char *obj_name, if(!link_name || !*link_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + /* Get normalized copy of the link target */ + if(NULL == (norm_obj_name = H5G_normalize(obj_name))) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize object name") + /* Combine the filename and link name into a single buffer to give to the UD link */ - buf_size = 1 + (HDstrlen(file_name) + 1) + (HDstrlen(obj_name) + 1); + buf_size = 1 + (HDstrlen(file_name) + 1) + (HDstrlen(norm_obj_name) + 1); if(NULL == (ext_link_buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer") @@ -543,14 +548,14 @@ H5Lcreate_external(const char *file_name, const char *obj_name, *p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */ HDstrcpy((char *)p, file_name); /* Name of file containing external link's object */ p += HDstrlen(file_name) + 1; - HDstrcpy((char *)p, obj_name); /* External link's object */ + HDstrcpy((char *)p, norm_obj_name); /* External link's object */ /* Create an external link */ if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: - if(ext_link_buf != NULL) + if(norm_obj_name) H5MM_free(ext_link_buf); FUNC_LEAVE_API(ret_value) |