diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-09-06 00:38:48 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-09-06 00:38:48 (GMT) |
commit | 9e158b781668387bf82fbab9d60ece304f0e9729 (patch) | |
tree | 806b60dcd720eba8598284e718a0c16e565f80c8 /src/H5Lexternal.c | |
parent | d553c60eb0428adaa3b1d9c647a1b465b65b8408 (diff) | |
download | hdf5-9e158b781668387bf82fbab9d60ece304f0e9729.zip hdf5-9e158b781668387bf82fbab9d60ece304f0e9729.tar.gz hdf5-9e158b781668387bf82fbab9d60ece304f0e9729.tar.bz2 |
[svn-r12651] Description:
Clean up compiler warnings.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Lexternal.c')
-rw-r--r-- | src/H5Lexternal.c | 114 |
1 files changed, 63 insertions, 51 deletions
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 3452c20..a967d59 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -26,6 +26,48 @@ #include "H5Ppublic.h" /* Property lists */ #include "H5Gpkg.h" /* Groups */ +static hid_t H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, + void * udata, size_t UNUSED udata_size, hid_t lapl_id); +static ssize_t H5L_extern_query(const char UNUSED * link_name, void * udata, + size_t udata_size, void * buf /*out*/, size_t buf_size); + +/* Default External Link link class */ +const H5L_link_class_t H5L_EXTERN_LINK_CLASS[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */ + H5L_LINK_EXTERNAL, /* Link type id number */ + "external_link", /* Link name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move callback */ + NULL, /* Copy callback */ + H5L_extern_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + H5L_extern_query /* Query callback */ +}}; + + +/*-------------------------------------------------------------------------- +NAME + H5L_init_extern_interface -- Initialize interface-specific information +USAGE + herr_t H5L_init_extern_interface() + +RETURNS + Non-negative on success/Negative on failure + +DESCRIPTION + Initializes any interface-specific data or routines. (Just calls + H5L_init currently). + +--------------------------------------------------------------------------*/ +static herr_t +H5L_init_extern_interface(void) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5L_init_extern_interface) + + FUNC_LEAVE_NOAPI(H5L_init()) +} /* H5L_init_extern_interface() */ + + /*------------------------------------------------------------------------- * Function: H5L_extern_traverse * @@ -45,7 +87,9 @@ * *------------------------------------------------------------------------- */ -static hid_t H5L_extern_traverse(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id) +static hid_t +H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, + void * udata, size_t UNUSED udata_size, hid_t lapl_id) { hid_t fid; char *file_name; @@ -57,7 +101,7 @@ static hid_t H5L_extern_traverse(const char * link_name, hid_t cur_group, void * hid_t ret_value = -1; file_name = (char *) udata; - fname_len = strlen(file_name); + fname_len = HDstrlen(file_name); obj_name = ((char *) udata) + fname_len + 1; /* See if the external link prefix property is set */ @@ -72,12 +116,12 @@ static hid_t H5L_extern_traverse(const char * link_name, hid_t cur_group, void * buf_size = HDstrlen(prefix); /* Allocate a buffer to hold the filename plus prefix */ - file_name = malloc(buf_size + fname_len + 1); + file_name = H5MM_malloc(buf_size + fname_len + 1); fname_alloc = TRUE; /* Add the external link's filename to the prefix supplied */ - strcpy(file_name, prefix); - strcat(file_name, udata); + HDstrcpy(file_name, prefix); + HDstrcat(file_name, udata); } /* Figure out if we should open with read-write or read-only */ @@ -96,14 +140,15 @@ static hid_t H5L_extern_traverse(const char * link_name, hid_t cur_group, void * /* Free file_name if it's been allocated */ if(fname_alloc) - free(file_name); + H5MM_xfree(file_name); return ret_value; error: /* Free file_name if it's been allocated */ if(fname_alloc) - free(file_name); + H5MM_xfree(file_name); + return -1; } @@ -125,62 +170,28 @@ error: * *------------------------------------------------------------------------- */ -static ssize_t H5L_extern_query(const char * link_name, void * udata, size_t udata_size, void * buf /*out*/, size_t buf_size) +static ssize_t +H5L_extern_query(const char UNUSED * link_name, void * udata, + size_t udata_size, void * buf /*out*/, size_t buf_size) { size_t ret_value; /* If the buffer is NULL, skip writng anything in it and just return * the size needed */ - if(buf) - { + if(buf) { if(udata_size < buf_size) buf_size = udata_size; /* Copy the udata verbatim up to udata_size*/ - memcpy(buf, udata, udata_size); + HDmemcpy(buf, udata, udata_size); } ret_value = udata_size; + return ret_value; } -/* Default External Link link class */ -const H5L_link_class_t H5L_EXTERN_LINK_CLASS[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */ - H5L_LINK_EXTERNAL, /* Link type id number */ - "external_link", /* Link name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move callback */ - NULL, /* Copy callback */ - H5L_extern_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - H5L_extern_query /* Query callback */ -}}; - -/*-------------------------------------------------------------------------- -NAME - H5L_init_extern_interface -- Initialize interface-specific information -USAGE - herr_t H5L_init_extern_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5L_init_extern_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5L_init_extern_interface) - - FUNC_LEAVE_NOAPI(H5L_init()) -} /* H5L_init_extern_interface() */ - - - /*------------------------------------------------------------------------- * Function: H5Lcreate_external * @@ -232,7 +243,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrcpy(temp_name + (HDstrlen(file_name) + 1), obj_name); /* Create an external link */ - if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_LINK_EXTERNAL, H5G_TARGET_NORMAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_LINK_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -240,8 +251,8 @@ done: H5MM_free(temp_name); FUNC_LEAVE_API(ret_value); } /* end H5Lcreate_external() */ - + /*------------------------------------------------------------------------- * Function: H5L_register_external * @@ -257,9 +268,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_register_external() +H5L_register_external(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5L_register_external, FAIL) @@ -318,3 +329,4 @@ H5Lunpack_elink_val(char *ext_linkval, char **filename, char **obj_path) done: FUNC_LEAVE_API(ret_value) } + |