diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-11-02 04:54:19 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-11-02 04:54:19 (GMT) |
commit | 19c9657f7c4029df52a804c7ed8b4d3b30cc6196 (patch) | |
tree | 6601816880f90040ae67df5bd27558c0f0670e86 /examples/h5_elink_unix2win.c | |
parent | 0f84d2fb15813c10fca48f95772626c34039619d (diff) | |
download | hdf5-19c9657f7c4029df52a804c7ed8b4d3b30cc6196.zip hdf5-19c9657f7c4029df52a804c7ed8b4d3b30cc6196.tar.gz hdf5-19c9657f7c4029df52a804c7ed8b4d3b30cc6196.tar.bz2 |
[svn-r12842] Description:
Refactor generic property list initialization code to put property list
specific routines in property list modules, instead of scattered to the four
winds. Also, introduce property list class initialization objects, to make
adding new property list classes in the library easier.
Fix daily test failure by using H5Pget_elink_prefix() API routine instead
of looking at the "raw" generic property list information.
Tested on:
Mac OS X/32 10.4.8 (amazon)
FreeBSD/32 4.11 (sleipnir) w/threadsafe
Linux/32 2.4 (heping) w/C++ & FORTRAN
Linux/64 2.4 (mir) w/build-all & 1.6 compat
Diffstat (limited to 'examples/h5_elink_unix2win.c')
-rw-r--r-- | examples/h5_elink_unix2win.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c index 7266347..b4998fd 100644 --- a/examples/h5_elink_unix2win.c +++ b/examples/h5_elink_unix2win.c @@ -41,13 +41,11 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id) { hid_t fid; - char *file_name; - hbool_t fname_alloc = 0; /* Whether file_name has been allocated */ + char *file_name = NULL; char *obj_name; + char *elink_prefix; /* External link prefix */ char *new_fname = NULL; /* Buffer allocated to hold Unix file path */ size_t fname_len; - htri_t result; - size_t buf_size; /* Size prefix buffer */ size_t start_pos; /* Initial position in new_fname buffer */ size_t x; /* Counter variable */ hid_t ret_value = -1; @@ -59,25 +57,25 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void * fname_len = strlen(file_name); /* See if the external link prefix property is set */ - if((result = H5Pexist(lapl_id, H5L_ELINK_PREFIX_PROP)) < 0) + if(H5Pget_elink_prefix(lapl_id, &elink_prefix) < 0) goto error; /* If so, prepend it to the filename. We assume that the prefix * is in the correct format for the current file system. */ - if(result > 0) + if(elink_prefix != NULL) { - if(H5Pget_size(lapl_id, H5L_ELINK_PREFIX_PROP, &buf_size) < 0) - goto error; + size_t buf_size; /* Size prefix buffer */ + + buf_size = strlen(elink_prefix); /* Allocate a buffer to hold the filename plus prefix */ new_fname = malloc(buf_size + fname_len + 1); /* Copy the prefix into the buffer */ - if(H5Pget(lapl_id, H5L_ELINK_PREFIX_PROP, new_fname) < 0) - goto error; + strcpy(new_fname, elink_prefix); - start_pos = buf_size - 1; + start_pos = buf_size; } else { @@ -105,8 +103,10 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void * if(H5Fclose(fid) < 0) goto error; - /* Free file_name if it's been allocated */ - if(fname_alloc) + /* Free file names if they've been allocated */ + if(new_fname) + free(new_fname); + if(file_name) free(file_name); return ret_value; |