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 | |
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)
-rw-r--r-- | src/H5Gstab.c | 2 | ||||
-rw-r--r-- | src/H5Gtraverse.c | 4 | ||||
-rw-r--r-- | src/H5L.c | 27 | ||||
-rw-r--r-- | src/H5Lexternal.c | 114 | ||||
-rw-r--r-- | src/H5Lpkg.h | 4 |
5 files changed, 80 insertions, 71 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 5f52b16..c4dc677 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -119,7 +119,7 @@ H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t d /* Create symbol table private heap */ if(H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") - name_offset = H5HL_insert(f, dxpl_id, stab->heap_addr, 1, ""); + name_offset = H5HL_insert(f, dxpl_id, stab->heap_addr, (size_t)1, ""); if((size_t)(-1) == name_offset) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap") diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index acdd665..5a58e2b 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -58,9 +58,6 @@ static herr_t H5G_traverse_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk, H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t lapl_id, hid_t dxpl_id); -static herr_t H5G_traverse_elink(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk, - H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t lapl_id, - hid_t dxpl_id); static herr_t H5G_traverse_slink(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk, H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t lapl_id, hid_t dxpl_id); @@ -160,7 +157,6 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk, H5O_loc_t grp_oloc_copy; H5O_loc_t *new_oloc=NULL; H5F_t *temp_file=NULL; - H5F_t *new_file=NULL; H5G_t *grp; H5P_genplist_t *lapl_default; H5P_genplist_t *lapl; /* LAPL with nlinks set */ @@ -691,7 +691,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_link_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) +H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_link_t link_type, + const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; herr_t ret_value = SUCCEED; /* Return value */ @@ -708,7 +709,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_link_t link_type, con /* Create external link */ if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, - H5G_TARGET_NORMAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + lcpl_id, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -1039,7 +1040,6 @@ herr_t H5L_link(H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) { - H5F_t *file = NULL; /* File link will be in */ H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1107,7 +1107,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED /* Set the link's name correctly */ /* Casting away const OK -QAK */ - udata->lnk->name = name; + udata->lnk->name = (char *)name; /* Insert link into group */ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0) @@ -1425,9 +1425,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, void * ud_data, - size_t ud_data_size, H5L_link_t type, unsigned traverse_flags, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) +H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data, + size_t ud_data_size, H5L_link_t type, hid_t lcpl_id, hid_t lapl_id, + hid_t dxpl_id) { H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1438,7 +1438,6 @@ H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, void * ud_data, HDassert(type >= H5L_LINK_UD_MIN && type <= H5L_LINK_MAX); HDassert(link_loc); HDassert(link_name && *link_name); - HDassert(ud_data_size >= 0); HDassert(ud_data_size == 0 || ud_data); /* Initialize the link struct's pointer to its udata buffer */ @@ -1720,8 +1719,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, + const H5O_link_t UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, + H5G_own_loc_t *own_loc/*out*/) { H5L_trav_ud10_t *udata = (H5L_trav_ud10_t *)_udata; /* User data passed in */ H5RS_str_t *dst_name_r = NULL; /* Ref-counted version of dest name */ @@ -1796,6 +1796,7 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *l } } } + done: /* Close the location given to the user callback if it was created */ if(grp_id >= 0) @@ -2043,7 +2044,7 @@ done: */ static herr_t H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) + H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5L_trav_ud1_t *udata = (H5L_trav_ud1_t *)_udata; /* User data passed in */ H5L_linkinfo_t *linfo = udata->linfo; @@ -2086,7 +2087,7 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const link_class = H5L_find_class(lnk->type); if(link_class != NULL && link_class->query_func != NULL) { - if((cb_ret = (link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, NULL, 0)) < 0) + if((cb_ret = (link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, NULL, (size_t)0)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query buffer size callback returned failure") linfo->u.link_size = cb_ret; @@ -2153,7 +2154,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5L_get_default_lcpl() +H5L_get_default_lcpl(void) { hid_t ret_value = FAIL; /* Return value */ 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) } + diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index 8a02791..f5e719e 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -35,8 +35,8 @@ /******************************/ H5_DLL herr_t H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, - void * ud_data, size_t ud_data_size, H5L_link_t type, - unsigned traverse_flags, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); + const void * ud_data, size_t ud_data_size, H5L_link_t type, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); #endif /* _H5Lpkg_H */ |