From 8ea1fc564f3686d14f30ccf00a0d7079473d3830 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 13 Nov 2000 12:02:55 -0500 Subject: [svn-r2874] Purpose: API cleanup Description: Tweaked some parts of the generic properties API to reduce warnings. Platforms tested: FreeBSD 4.1.1 (hawkwind) & SGI O2K (modi4) --- src/H5P.c | 30 +++++++++++++++++------------- src/H5Pprivate.h | 2 +- src/H5Ppublic.h | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/H5P.c b/src/H5P.c index 7e64ec2..2be5c24 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -4292,7 +4292,6 @@ herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, H5P_prp_close_func_t prp_close) { H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ - H5P_genprop_t *tmp_prop; /* Temporary property pointer */ herr_t ret_value=FAIL; /* return value */ FUNC_ENTER (H5P_insert, FAIL); @@ -4302,7 +4301,7 @@ herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, assert((size>0 && value!=NULL) || (size==0)); /* Check for duplicate named properties */ - if((tmp_prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))!=NULL) + if(H5P_find_prop(plist->props,plist->pclass->hashsize,name)!=NULL) HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); /* Create property object from parameters */ @@ -4683,34 +4682,36 @@ done: herr_t H5P_get_size(plist, name) H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query + size_t *size; OUT: Size of property RETURNS - Success: Size of property value in bytes. + Success: non-negative value Failure: negative value DESCRIPTION - This routine returns the size of a property's value in bytes. Zero- - sized properties are allowed and return 0. + This routine retrieves the size of a property's value in bytes. Zero- + sized properties are allowed and return a value of 0. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5P_get_size(H5P_genplist_t *plist, const char *name) +herr_t H5P_get_size(H5P_genplist_t *plist, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=FAIL; /* return value */ + herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER (H5P_get_size, FAIL); assert(plist); assert(name); + assert(size); /* Find property */ if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Get property size */ - ret_value=prop->size; + *size=prop->size; done: FUNC_LEAVE (ret_value); @@ -4726,19 +4727,20 @@ done: herr_t H5Pget_size(plist_id, name) hid_t plist_id; IN: Property list to check const char *name; IN: Name of property to query + size_t *size; OUT: Size of property RETURNS - Success: Size of property value in bytes. + Success: non-negative value Failure: negative value DESCRIPTION - This routine returns the size of a property's value in bytes. Zero- - sized properties are allowed and return 0. + This routine retrieves the size of a property's value in bytes. Zero- + sized properties are allowed and return a value of 0. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5Pget_size(hid_t plist_id, const char *name) +herr_t H5Pget_size(hid_t plist_id, const char *name, size_t *size) { H5P_genplist_t *plist; /* Property list to modify */ herr_t ret_value=FAIL; /* return value */ @@ -4750,9 +4752,11 @@ herr_t H5Pget_size(hid_t plist_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); + if (size==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property size"); /* Create the new property list class */ - if ((ret_value=H5P_get_size(plist,name))<0) + if ((ret_value=H5P_get_size(plist,name,size))<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); done: diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index a2484c8..c12e1ad 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -116,7 +116,7 @@ __DLL__ herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, H5P_prp_close_func_t prp_close); __DLL__ herr_t H5P_set(hid_t plist_id, const char *name, void *value); __DLL__ htri_t H5P_exist(H5P_genplist_t *plist, const char *name); -__DLL__ herr_t H5P_get_size(H5P_genplist_t *plist, const char *name); +__DLL__ herr_t H5P_get_size(H5P_genplist_t *plist, const char *name, size_t *size); __DLL__ herr_t H5P_get(hid_t plist_id, const char *name, void *value); __DLL__ herr_t H5P_remove(H5P_genplist_t *plist, const char *name); __DLL__ herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index f25eba9..684e6d4 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -94,7 +94,7 @@ __DLL__ herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, H5P_prp_close_func_t prp_close); __DLL__ herr_t H5Pset(hid_t plist_id, const char *name, void *value); __DLL__ htri_t H5Pexist(hid_t plist_id, const char *name); -__DLL__ herr_t H5Pget_size(hid_t plist_id, const char *name); +__DLL__ herr_t H5Pget_size(hid_t plist_id, const char *name, size_t *size); __DLL__ herr_t H5Pget(hid_t plist_id, const char *name, void * value); __DLL__ herr_t H5Premove(hid_t plist_id, const char *name); __DLL__ herr_t H5Punregister(hid_t pclass_id, const char *name); -- cgit v0.12