summaryrefslogtreecommitdiffstats
path: root/examples/h5_elink_unix2win.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-04-03 19:51:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-04-03 19:51:14 (GMT)
commit0fb88ded47762bcafdd4317a3cd48f4c706a011c (patch)
treef46e14f62d1c6f3ebd1fb9aab18fab97509782bd /examples/h5_elink_unix2win.c
parentd53775c9468afe01b058e59db8dfc7a4d79f0340 (diff)
downloadhdf5-0fb88ded47762bcafdd4317a3cd48f4c706a011c.zip
hdf5-0fb88ded47762bcafdd4317a3cd48f4c706a011c.tar.gz
hdf5-0fb88ded47762bcafdd4317a3cd48f4c706a011c.tar.bz2
[svn-r13580] Description:
Add version # and flags to external link format (as fields in a single byte), in order to accomodate future changes/expansions. Tested on: Mac OS X/32 10.4.9 (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty)
Diffstat (limited to 'examples/h5_elink_unix2win.c')
-rw-r--r--examples/h5_elink_unix2win.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c
index ef38626..abf7512 100644
--- a/examples/h5_elink_unix2win.c
+++ b/examples/h5_elink_unix2win.c
@@ -39,12 +39,12 @@
* Note that this may not be necessary on your system; many Windows systems can
* understand Unix paths.
*/
-static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id)
+static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group,
+ const void *udata, size_t udata_size, hid_t lapl_id)
{
hid_t fid;
- char *file_name = NULL;
- char *obj_name;
- char *elink_prefix; /* External link prefix */
+ const char *file_name;
+ const char *obj_name;
char *new_fname = NULL; /* Buffer allocated to hold Unix file path */
ssize_t prefix_len; /* External link prefix length */
size_t fname_len;
@@ -54,7 +54,7 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void *
printf("Converting Unix path to Windows path.\n");
- if(H5Lunpack_elink_val(udata, udata_size, &file_name, &obj_name) < 0)
+ if(H5Lunpack_elink_val(udata, udata_size, NULL, &file_name, &obj_name) < 0)
goto error;
fname_len = strlen(file_name);
@@ -71,7 +71,7 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void *
new_fname = malloc(prefix_len + fname_len + 1);
/* Copy the prefix into the buffer */
- if(H5Pget_elink_prefix(lapl_id, new_fname, prefix_len + 1) < 0)
+ if(H5Pget_elink_prefix(lapl_id, new_fname, (size_t)(prefix_len + 1)) < 0)
goto error;
start_pos = prefix_len;
@@ -102,16 +102,14 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void *
if(H5Fclose(fid) < 0)
goto error;
- /* Free file names if they've been allocated */
+ /* Free file name if it's been allocated */
if(new_fname)
free(new_fname);
- if(file_name)
- free(file_name);
return ret_value;
error:
- /* Free file_name if it's been allocated */
+ /* Free file name if it's been allocated */
if(new_fname)
free(new_fname);
return -1;
@@ -138,7 +136,7 @@ const H5L_class_t elink_unix2win_class[1] = {{
* follows the external link to open the target file.
*/
static int
-unix2win_example()
+unix2win_example(void)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */