summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-02 04:54:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-02 04:54:19 (GMT)
commit19c9657f7c4029df52a804c7ed8b4d3b30cc6196 (patch)
tree6601816880f90040ae67df5bd27558c0f0670e86 /examples
parent0f84d2fb15813c10fca48f95772626c34039619d (diff)
downloadhdf5-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')
-rw-r--r--examples/h5_elink_unix2win.c26
-rw-r--r--examples/h5_extlink.c10
2 files changed, 18 insertions, 18 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;
diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c
index edf7609..33cac8e 100644
--- a/examples/h5_extlink.c
+++ b/examples/h5_extlink.c
@@ -50,7 +50,7 @@
* Creates two files and uses an external link to access an object in the
* second file from the first file.
*/
-void extlink_example()
+void extlink_example(void)
{
hid_t source_file_id, targ_file_id;
hid_t group_id, group2_id;
@@ -110,7 +110,7 @@ void extlink_example()
* where it is run (so to run this example on Unix, first mkdir red and mkdir
* blue).
*/
-void extlink_prefix_example()
+void extlink_prefix_example(void)
{
hid_t source_file_id, red_file_id, blue_file_id;
hid_t group_id, group2_id;
@@ -210,7 +210,7 @@ void extlink_prefix_example()
*/
static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, void *udata, size_t udata_size, hid_t lapl_id);
-void soft_link_example()
+void soft_link_example(void)
{
hid_t file_id;
hid_t group_id;
@@ -308,7 +308,7 @@ static herr_t UD_hard_create(const char *link_name, hid_t loc_group, void *udata
static herr_t UD_hard_delete(const char *link_name, hid_t loc_group, void *udata, size_t udata_size);
static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, void *udata, size_t udata_size, hid_t lapl_id);
-void hard_link_example()
+void hard_link_example(void)
{
hid_t file_id;
hid_t group_id;
@@ -521,7 +521,7 @@ static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, void * uda
*/
static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, void *udata, size_t udata_size, hid_t lapl_id);
-void plist_link_example()
+void plist_link_example(void)
{
hid_t file_id;
hid_t group_id, group2_id;