diff options
-rw-r--r-- | examples/h5_extlink.c | 2 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 20 | ||||
-rw-r--r-- | src/H5Oalloc.c | 2 | ||||
-rw-r--r-- | src/H5Obtreek.c | 6 | ||||
-rw-r--r-- | src/H5Odrvinfo.c | 6 | ||||
-rw-r--r-- | src/H5Ofill.c | 4 | ||||
-rw-r--r-- | src/H5Olink.c | 2 | ||||
-rw-r--r-- | src/H5Orefcount.c | 6 | ||||
-rw-r--r-- | src/H5Osdspace.c | 2 | ||||
-rw-r--r-- | src/H5Oshared.c | 4 | ||||
-rw-r--r-- | src/H5P.c | 44 | ||||
-rw-r--r-- | src/H5Pdeprec.c | 168 | ||||
-rw-r--r-- | src/H5Pint.c | 6 | ||||
-rw-r--r-- | src/H5Ppublic.h | 22 | ||||
-rw-r--r-- | src/H5vers.txt | 1 | ||||
-rw-r--r-- | src/H5version.h | 15 | ||||
-rw-r--r-- | test/gen_bogus.c | 2 | ||||
-rw-r--r-- | test/links.c | 6 | ||||
-rw-r--r-- | test/tgenprop.c | 126 | ||||
-rw-r--r-- | testpar/t_coll_chunk.c | 37 |
20 files changed, 343 insertions, 138 deletions
diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index f40e509..1e25ef6 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -583,7 +583,7 @@ static void plist_link_example(void) /* There is no HDF5 API for setting the property that controls these * links, so we have to add the property manually */ - H5Pinsert(gapl_id, PLIST_LINK_PROP, sizeof(const char *), &(path), NULL, NULL, NULL, NULL, NULL, NULL); + H5Pinsert2(gapl_id, PLIST_LINK_PROP, sizeof(const char *), &(path), NULL, NULL, NULL, NULL, NULL, NULL); /* Set the property to point to the first group. */ path = "group_1"; diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 54f99d0..3f8bebf 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -2365,7 +2365,7 @@ nh5pinsertc_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, _fcd v /*---------------------------------------------------------------------------- * Name: h5pinsert_c - * Purpose: Call H5Pinsert to iinsert a temporary property + * Purpose: Call H5Pinsert2 to iinsert a temporary property * Inputs: plist - property list class identifier * name - name of the new property * name_len - length of the "name" buffer @@ -2379,24 +2379,22 @@ nh5pinsertc_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, _fcd v int_f nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void UNUSED *value) { + char* c_name = NULL; int_f ret_value = -1; - hid_t c_plist; - char* c_name; - size_t c_size; - c_name = (char *)HD5f2cstring(name, (size_t)*name_len); - if (c_name == NULL) goto DONE; - c_size = (size_t)*size; - c_plist = (hid_t)*plist; + if(NULL == ( c_name = (char *)HD5f2cstring(name, (size_t)*name_len))) + goto DONE; /* - * Call H5Pinsert function. + * Call H5Pinsert2 function. */ - if( H5Pinsert(c_plist, c_name, c_size, value, NULL,NULL,NULL,NULL,NULL,NULL) <0) goto DONE; + if(H5Pinsert2((hid_t)*plist, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + goto DONE; ret_value = 0; DONE: - if(c_name != NULL) HDfree(c_name); + if(c_name) + HDfree(c_name); return ret_value; } diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index d5f17e0..03eb956 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -724,7 +724,7 @@ H5O_alloc_new_chunk(H5F_t *f, uint8_t *end_msg = curr_msg->raw + curr_msg->raw_size; /* End of current message */ size_t gap_size = 0; /* Size of gap after current message */ size_t null_size = 0; /* Size of NULL message after current message */ - unsigned null_msgno; /* Index of NULL message after current message */ + unsigned null_msgno = 0; /* Index of NULL message after current message */ size_t total_size; /* Total size of available space "around" current message */ /* Check if the message is the last one in the chunk */ diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 57f8f47..e116ff2 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -78,7 +78,7 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_btreek_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, +H5O_btreek_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ @@ -124,7 +124,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_btreek_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O_btreek_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; @@ -200,7 +200,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_btreek_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED *_mesg) +H5O_btreek_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void UNUSED *_mesg) { size_t ret_value; diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 727449b..fd2d049 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -79,7 +79,7 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, +H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ @@ -138,7 +138,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_drvinfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O_drvinfo_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; @@ -224,7 +224,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_drvinfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg) +H5O_drvinfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; size_t ret_value; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 08f0d39..1335274 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -355,7 +355,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_fill) +H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; @@ -604,7 +604,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_fill_new_size(const H5F_t *f, const void *_fill) +H5O_fill_new_size(const H5F_t UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; size_t ret_value; diff --git a/src/H5Olink.c b/src/H5Olink.c index a11bf9a..175c937 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -119,7 +119,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, const uint8_t *p) { H5O_link_t *lnk = NULL; /* Pointer to link message */ - size_t len; /* Length of a string in the message */ + size_t len = 0; /* Length of a string in the message */ unsigned char link_flags; /* Flags for encoding link info */ void *ret_value; /* Return value */ diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index 2fd3f94..0a06d11 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -89,7 +89,7 @@ H5FL_DEFINE_STATIC(H5O_refcount_t); *------------------------------------------------------------------------- */ static void * -H5O_refcount_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, +H5O_refcount_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, const uint8_t *p) { H5O_refcount_t *refcount = NULL; /* Reference count */ @@ -137,7 +137,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_refcount_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O_refcount_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; @@ -271,7 +271,7 @@ H5O_refcount_free(void *mesg) */ static herr_t H5O_refcount_pre_copy_file(H5F_t UNUSED *file_src, const void UNUSED *native_src, - hbool_t *deleted, const H5O_copy_t *cpy_info, void UNUSED *udata) + hbool_t *deleted, const H5O_copy_t UNUSED *cpy_info, void UNUSED *udata) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_refcount_pre_copy_file) diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 5e8a7a4..79adf43 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -439,7 +439,7 @@ H5O_sdspace_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src, +H5O_sdspace_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src, hbool_t UNUSED *deleted, const H5O_copy_t UNUSED *cpy_info, void *_udata) { const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 5739016..e406065 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -555,9 +555,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst, +H5O_shared_copy_file(H5F_t UNUSED *file_src, H5F_t *file_dst, const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst, - hbool_t *recompute_size, H5O_copy_t *cpy_info, void UNUSED *udata, + hbool_t UNUSED *recompute_size, H5O_copy_t *cpy_info, void UNUSED *udata, hid_t dxpl_id) { const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */ @@ -463,11 +463,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5Pinsert + H5Pinsert2 PURPOSE Routine to insert a new property in a property list. USAGE - herr_t H5Pinsert(plist, name, size, value, prp_set, prp_get, prp_close) + herr_t H5Pinsert2(plist, name, size, value, prp_set, prp_get, prp_close) hid_t plist; IN: Property list to add property to const char *name; IN: Name of property to add size_t size; IN: Size of property in bytes @@ -600,52 +600,34 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -#ifdef H5_WANT_H5_V1_6_COMPAT herr_t -H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, - H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, - H5P_prp_close_func_t prp_close) -#else /* H5_WANT_H5_V1_6_COMPAT */ -herr_t -H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, +H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5P_genplist_t *plist; /* Property list to modify */ herr_t ret_value; /* return value */ - FUNC_ENTER_API(H5Pinsert, FAIL); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5TRACE9("e","iszxxxxxx",plist_id,name,size,value,prp_set,prp_get, - prp_delete,prp_copy,prp_close); -#else /* H5_WANT_H5_V1_6_COMPAT */ + FUNC_ENTER_API(H5Pinsert2, FAIL); H5TRACE10("e","iszxxxxxxx",plist_id,name,size,value,prp_set,prp_get, prp_delete,prp_copy,prp_cmp,prp_close); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Check arguments. */ if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + 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>0 && value==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name") + if(size > 0 && value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") /* Create the new property list class */ -#ifdef H5_WANT_H5_V1_6_COMPAT - if((ret_value = H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_copy,NULL,prp_close)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); -#else /* H5_WANT_H5_V1_6_COMPAT */ - if((ret_value = H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist") done: FUNC_LEAVE_API(ret_value); -} /* H5Pinsert() */ +} /* H5Pinsert2() */ /*-------------------------------------------------------------------------- @@ -1201,7 +1183,7 @@ done: Removes a property from a property list. Both properties which were in existance when the property list was created (i.e. properties registered with H5Pregister2) and properties added to the list after it was created - (i.e. added with H5Pinsert) may be removed from a property list. + (i.e. added with H5Pinsert2) may be removed from a property list. Properties do not need to be removed a property list before the list itself is closed, they will be released automatically when H5Pclose is called. The 'close' callback for this property is called before the property is @@ -1264,7 +1246,7 @@ done: 'copy' callback for the property, if one exists). If the property does not exist in the destination class or list, this call - is equivalent to calling H5Pregister2 or H5Pinsert (for a class or list, as + is equivalent to calling H5Pregister2 or H5Pinsert2 (for a class or list, as appropriate) and the 'create' callback will be called in the case of the property being copied into a list (if such a callback exists for the property). diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 924e68f..e6ff099 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -272,5 +272,173 @@ done: FUNC_LEAVE_API(ret_value); } /* H5Pregister1() */ + +/*-------------------------------------------------------------------------- + NAME + H5Pinsert1 + PURPOSE + Routine to insert a new property in a property list. + USAGE + herr_t H5Pinsert1(plist, name, size, value, prp_set, prp_get, prp_close) + hid_t plist; IN: Property list to add property to + const char *name; IN: Name of property to add + size_t size; IN: Size of property in bytes + void *value; IN: Pointer to the value for the property + H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback + H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback + H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback + H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback + H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback + H5P_prp_close_func_t prp_close; IN: Function pointer to property close + callback + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Inserts a temporary property into a property list. The property will + exist only in this property list object. The name of the property must not + already exist. The value must be provided unless the property is zero- + sized. Any of the callback routines may be set to NULL if they are not + needed. + + Zero-sized properties are allowed and do not store any data in the + property list. These may be used as flags to indicate the presence or + absence of a particular piece of information. The 'value' pointer for a + zero-sized property may be set to NULL. The property 'close' callback is + called for zero-sized properties, but the 'set' and 'get' callbacks are + never called. + + The 'set' callback is called before a new value is copied into the + property. H5P_prp_set_func_t is defined as: + typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, + size_t size, void *value); + where the parameters to the callback function are: + hid_t prop_id; IN: The ID of the property list being modified. + const char *name; IN: The name of the property being modified. + size_t size; IN: The size of the property value + void *new_value; IN/OUT: The value being set for the property. + The 'set' routine may modify the value to be set and those changes will be + stored as the value of the property. If the 'set' routine returns a + negative value, the new property value is not copied into the property and + the property list set routine returns an error value. + + The 'get' callback is called before a value is retrieved from the + property. H5P_prp_get_func_t is defined as: + typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, + size_t size, void *value); + where the parameters to the callback function are: + hid_t prop_id; IN: The ID of the property list being queried. + const char *name; IN: The name of the property being queried. + size_t size; IN: The size of the property value + void *value; IN/OUT: The value being retrieved for the property. + The 'get' routine may modify the value to be retrieved and those changes + will be returned to the calling function. If the 'get' routine returns a + negative value, the property value is returned and the property list get + routine returns an error value. + + The 'delete' callback is called when a property is deleted from a + property list. H5P_prp_del_func_t is defined as: + typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, + size_t size, void *value); + where the parameters to the callback function are: + hid_t prop_id; IN: The ID of the property list the property is deleted from. + const char *name; IN: The name of the property being deleted. + size_t size; IN: The size of the property value + void *value; IN/OUT: The value of the property being deleted. + The 'delete' routine may modify the value passed in, but the value is not + used by the library when the 'delete' routine returns. If the + 'delete' routine returns a negative value, the property list deletion + routine returns an error value but the property is still deleted. + + The 'copy' callback is called when a property list with this + property is copied. H5P_prp_copy_func_t is defined as: + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, size_t size, + void *value); + where the parameters to the callback function are: + const char *name; IN: The name of the property being copied. + size_t size; IN: The size of the property value + void *value; IN: The value of the property being copied. + The 'copy' routine may modify the value to be copied and those changes will be + stored as the value of the property. If the 'copy' routine returns a + negative value, the new property value is not copied into the property and + the property list copy routine returns an error value. + + The 'compare' callback is called when a property list with this + property is compared to another property list. H5P_prp_compare_func_t is + defined as: + typedef int (*H5P_prp_compare_func_t)( void *value1, void *value2, + size_t size); + where the parameters to the callback function are: + const void *value1; IN: The value of the first property being compared. + const void *value2; IN: The value of the second property being compared. + size_t size; IN: The size of the property value + The 'compare' routine may not modify the values to be compared. The + 'compare' routine should return a positive value if VALUE1 is greater than + VALUE2, a negative value if VALUE2 is greater than VALUE1 and zero if VALUE1 + and VALUE2 are equal. + + The 'close' callback is called when a property list with this + property is being destroyed. H5P_prp_close_func_t is defined as: + typedef herr_t (*H5P_prp_close_func_t)(const char *name, size_t size, + void *value); + where the parameters to the callback function are: + const char *name; IN: The name of the property being closed. + size_t size; IN: The size of the property value + void *value; IN: The value of the property being closed. + The 'close' routine may modify the value passed in, but the value is not + used by the library when the 'close' routine returns. If the + 'close' routine returns a negative value, the property list close + routine returns an error value but the property list is still closed. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + The 'set' callback function may be useful to range check the value being + set for the property or may perform some tranformation/translation of the + value set. The 'get' callback would then [probably] reverse the + transformation, etc. A single 'get' or 'set' callback could handle + multiple properties by performing different actions based on the property + name or other properties in the property list. + + There is no 'create' callback routine for temporary property list + objects, the initial value is assumed to have any necessary setup already + performed on it. + + I would like to say "the property list is not closed" when a 'close' + routine fails, but I don't think that's possible due to other properties in + the list being successfully closed & removed from the property list. I + suppose that it would be possible to just remove the properties which have + successful 'close' callbacks, but I'm not happy with the ramifications + of a mangled, un-closable property list hanging around... Any comments? -QAK + + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close) +{ + H5P_genplist_t *plist; /* Property list to modify */ + herr_t ret_value; /* return value */ + + FUNC_ENTER_API(H5Pinsert1, FAIL); + H5TRACE9("e","iszxxxxxx",plist_id,name,size,value,prp_set,prp_get, + prp_delete,prp_copy,prp_close); + + /* Check arguments. */ + if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + 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 > 0 && value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") + + /* Create the new property list class */ + if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist") + +done: + FUNC_LEAVE_API(ret_value); +} /* H5Pinsert1() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 3147020..46eb293 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -3690,7 +3690,7 @@ done: Removes a property from a property list. Both properties which were in existance when the property list was created (i.e. properties registered with H5Pregister2) and properties added to the list after it was created - (i.e. added with H5Pinsert) may be removed from a property list. + (i.e. added with H5Pinsert2) may be removed from a property list. Properties do not need to be removed a property list before the list itself is closed, they will be released automatically when H5Pclose is called. The 'close' callback for this property is called before the property is @@ -3829,7 +3829,7 @@ done: 'copy' callback for the property, if one exists). If the property does not exist in the destination list, this call is - equivalent to calling H5Pinsert and the 'create' callback will be called + equivalent to calling H5Pinsert2 and the 'create' callback will be called (if such a callback exists for the property). GLOBAL VARIABLES @@ -3880,7 +3880,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) /* Increment the number of properties in list */ dst_plist->nprops++; } /* end if */ - /* If not, get the information required to do an H5Pinsert with the property into the destination list */ + /* If not, get the information required to do an H5Pinsert2 with the property into the destination list */ else { /* Get the pointer to the source property */ prop=H5P_find_prop_plist(src_plist,name); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 5d0c7d3..297798f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -179,20 +179,10 @@ H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -#ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, - void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, - H5P_prp_copy_func_t prp_copy, - H5P_prp_close_func_t prp_close); -#else /* H5_WANT_H5_V1_6_COMPAT */ -H5_DLL herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, - void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, - H5P_prp_copy_func_t prp_copy, - H5P_prp_compare_func_t prp_cmp, - H5P_prp_close_func_t prp_close); -#endif /* H5_WANT_H5_V1_6_COMPAT */ +H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, + void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, void *value); H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); @@ -426,6 +416,10 @@ H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); +H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, + void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5vers.txt b/src/H5vers.txt index 213af52..81e5656 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -59,6 +59,7 @@ FUNCTION: H5Eset_auto; ; v10, v18 FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 FUNCTION: H5Gcreate; ; v10, v18 FUNCTION: H5Gopen; ; v10, v18 +FUNCTION: H5Pinsert; ; v14, v18 FUNCTION: H5Pregister; ; v14, v18 FUNCTION: H5Rget_obj_type; ; v16, v18 FUNCTION: H5Tcommit; ; v10, v18 diff --git a/src/H5version.h b/src/H5version.h index 11841d3..7f48122 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -94,6 +94,10 @@ #define H5Gopen_vers 1 #endif /* !defined(H5Gopen_vers) */ +#if !defined(H5Pinsert_vers) +#define H5Pinsert_vers 1 +#endif /* !defined(H5Pinsert_vers) */ + #if !defined(H5Pregister_vers) #define H5Pregister_vers 1 #endif /* !defined(H5Pregister_vers) */ @@ -291,6 +295,17 @@ #error "H5Gopen_vers set to invalid value" #endif /* H5Gopen_vers */ +#if !defined(H5Pinsert_vers) || H5Pinsert_vers == 2 +#ifndef H5Pinsert_vers +#define H5Pinsert_vers 2 +#endif /* H5Pinsert_vers */ +#define H5Pinsert H5Pinsert2 +#elif H5Pinsert_vers == 1 +#define H5Pinsert H5Pinsert1 +#else /* H5Pinsert_vers */ +#error "H5Pinsert_vers set to invalid value" +#endif /* H5Pinsert_vers */ + #if !defined(H5Pregister_vers) || H5Pregister_vers == 2 #ifndef H5Pregister_vers #define H5Pregister_vers 2 diff --git a/test/gen_bogus.c b/test/gen_bogus.c index a4daedc..a8b88bf 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -53,7 +53,7 @@ int main(void) if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* Add property for bogus message flags */ - if(H5Pinsert(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error; + if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error; /* Create dataset with "bogus" message, but no message flags */ if((did = H5Dcreate2(fid, "/Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; diff --git a/test/links.c b/test/links.c index 52d76cd..e99dd37 100644 --- a/test/links.c +++ b/test/links.c @@ -4550,11 +4550,7 @@ lapl_udata(hid_t fapl, hbool_t new_format) /* Create a non-default lapl with a new property pointing to group a*/ if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR HDstrcpy(group_a_name, "group_a"); -#ifdef H5_WANT_H5_V1_6_COMPAT - if(H5Pinsert(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR -#else /* H5_WANT_H5_V1_6_COMPAT */ - if(H5Pinsert(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR -#endif /* H5_WANT_H5_V1_6_COMPAT */ + if(H5Pinsert2(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR /* Try opening group through UD link */ if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR diff --git a/test/tgenprop.c b/test/tgenprop.c index efc2b3b..931133e 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -650,20 +650,12 @@ test_genprop_basic_list_prop(void) /* Add temporary properties */ /* Insert first temporary property into class (with no callbacks) */ -#ifdef H5_WANT_H5_V1_6_COMPAT - ret = H5Pinsert(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - ret = H5Pinsert(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ - CHECK_I(ret, "H5Pinsert"); + ret = H5Pinsert2(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK_I(ret, "H5Pinsert2"); /* Insert second temporary property into class (with no callbacks) */ -#ifdef H5_WANT_H5_V1_6_COMPAT - ret = H5Pinsert(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - ret = H5Pinsert(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ - CHECK_I(ret, "H5Pinsert"); + ret = H5Pinsert2(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK_I(ret, "H5Pinsert2"); /* Check the number of properties in list */ ret = H5Pget_nprops(lid1,&nprops); @@ -824,20 +816,12 @@ test_genprop_list_iter(void) /* Add temporary properties */ /* Insert first temporary property into class (with no callbacks) */ -#ifdef H5_WANT_H5_V1_6_COMPAT - ret = H5Pinsert(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - ret = H5Pinsert(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ - CHECK_I(ret, "H5Pinsert"); + ret = H5Pinsert2(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK_I(ret, "H5Pinsert2"); /* Insert second temporary property into class (with no callbacks) */ -#ifdef H5_WANT_H5_V1_6_COMPAT - ret = H5Pinsert(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - ret = H5Pinsert(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ - CHECK_I(ret, "H5Pinsert"); + ret = H5Pinsert2(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK_I(ret, "H5Pinsert2"); /* Check the number of properties in list */ ret = H5Pget_nprops(lid1,&nprops); @@ -984,7 +968,6 @@ test_genprop_prop_cop_cb1(const char *name, size_t size, void *value) return(SUCCEED); } -#ifndef H5_WANT_H5_V1_6_COMPAT /**************************************************************** ** ** test_genprop_prop_cmp_cb1(): Property comparison callback for test_genprop_list_callback @@ -998,7 +981,6 @@ test_genprop_prop_cmp_cb1(const void UNUSED *value1, const void UNUSED *value2, return(0); } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /**************************************************************** ** @@ -1191,14 +1173,12 @@ test_genprop_list_callback(void) VERIFY(cop_cb_struct.count, 1, "H5Pcopy"); VERIFY(cop_cb_struct.id, lid2, "H5Pcopy"); -#ifndef H5_WANT_H5_V1_6_COMPAT /* Compare the two lists */ ret = H5Pequal(lid1,lid2); VERIFY(ret, 1, "H5Pequal"); /* Verify compare callback information for properties tracked */ VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal"); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Close first list */ ret = H5Pclose(lid1); @@ -1267,12 +1247,8 @@ test_genprop_list_addprop(void) CHECK(pid, FAIL, "H5Pcreate"); /* Insert temporary property into class (with no callbacks) */ -#ifdef H5_WANT_H5_V1_6_COMPAT - ret = H5Pinsert(pid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - ret = H5Pinsert(pid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ - CHECK_I(ret, "H5Pinsert"); + ret = H5Pinsert2(pid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK_I(ret, "H5Pinsert2"); /* Check existence of added property */ ret = H5Pexist(pid, PROP1_NAME); @@ -1599,12 +1575,12 @@ test_genprop_refcount(void) #ifndef H5_NO_DEPRECATED_SYMBOLS /**************************************************************** ** -** test_genprop_deprec(): Test basic generic property list code. -** Tests deprecated API routines. +** test_genprop_deprec_class(): Test basic generic property list code. +** Tests deprecated property class API routines. ** ****************************************************************/ static void -test_genprop_deprec(void) +test_genprop_deprec_class(void) { hid_t cid1; /* Generic Property class ID */ size_t size; /* Size of property */ @@ -1723,7 +1699,78 @@ test_genprop_deprec(void) /* Close class */ ret = H5Pclose_class(cid1); CHECK_I(ret, "H5Pclose_class"); -} /* end test_genprop_deprec() */ +} /* end test_genprop_deprec_class() */ + +/**************************************************************** +** +** test_genprop_deprec2(): Test basic generic property list code. +** Tests deprecated property list API routines. +** +****************************************************************/ +static void +test_genprop_deprec_list(void) +{ + hid_t fid; /* File ID */ + hid_t did; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t pid; /* Property List ID */ + int prop1_value; /* Value for property #1 */ + herr_t ret; /* Generic return value */ + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create scalar dataspace for dataset */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create a dataset creation property list */ + pid = H5Pcreate(H5P_DATASET_CREATE); + CHECK(pid, FAIL, "H5Pcreate"); + + /* Insert temporary property into class (with no callbacks) */ + ret = H5Pinsert1(pid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL); + CHECK_I(ret, "H5Pinsert1"); + + /* Check existence of added property */ + ret = H5Pexist(pid, PROP1_NAME); + VERIFY(ret, 1, "H5Pexist"); + + /* Check values of property (set with default value) */ + ret = H5Pget(pid, PROP1_NAME,&prop1_value); + CHECK_I(ret, "H5Pget"); + VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); + + /* Create a dataset */ + did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dcreate2"); + + /* Check existence of added property (after using property list) */ + ret = H5Pexist(pid, PROP1_NAME); + VERIFY(ret, 1, "H5Pexist"); + + /* Check values of property (set with default value) (after using property list) */ + ret = H5Pget(pid, PROP1_NAME, &prop1_value); + CHECK_I(ret, "H5Pget"); + VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); + + /* Close property list */ + ret = H5Pclose(pid); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close disk dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} /* end test_genprop_deprec_list() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /**************************************************************** @@ -1756,7 +1803,8 @@ test_genprop(void) test_genprop_refcount(); /* Tests for class reference counting */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_genprop_deprec(); /* Tests for deprecated routines */ + test_genprop_deprec_class(); /* Tests for deprecated routines */ + test_genprop_deprec_list(); /* Tests for deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_genprop() */ diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 7886066..8f4fdf2 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -680,48 +680,51 @@ coll_chunktest(const char* filename, #ifdef H5_HAVE_INSTRUMENTED_LIBRARY if(facc_type == FACC_MPIO) { - switch(api_option){ + switch(api_option) { case API_LINK_HARD: prop_value = H5D_XFER_COLL_CHUNK_DEF; - status = H5Pinsert(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_HARD_NAME,H5D_XFER_COLL_CHUNK_SIZE,&prop_value, - NULL,NULL,NULL,NULL,NULL,NULL); + status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); break; + case API_MULTI_HARD: prop_value = H5D_XFER_COLL_CHUNK_DEF; - status = H5Pinsert(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME,H5D_XFER_COLL_CHUNK_SIZE,&prop_value, - NULL,NULL,NULL,NULL,NULL,NULL); + status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); break; + case API_LINK_TRUE: prop_value = H5D_XFER_COLL_CHUNK_DEF; - status = H5Pinsert(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME,H5D_XFER_COLL_CHUNK_SIZE,&prop_value, - NULL,NULL,NULL,NULL,NULL,NULL); + status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); break; + case API_LINK_FALSE: prop_value = H5D_XFER_COLL_CHUNK_DEF; - status = H5Pinsert(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME,H5D_XFER_COLL_CHUNK_SIZE,&prop_value, - NULL,NULL,NULL,NULL,NULL,NULL); + status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + case API_MULTI_COLL: prop_value = H5D_XFER_COLL_CHUNK_DEF; - status = H5Pinsert(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME,H5D_XFER_COLL_CHUNK_SIZE,&prop_value, - NULL,NULL,NULL,NULL,NULL,NULL); + status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + case API_MULTI_IND: prop_value = H5D_XFER_COLL_CHUNK_DEF; - status = H5Pinsert(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME,H5D_XFER_COLL_CHUNK_SIZE,&prop_value, - NULL,NULL,NULL,NULL,NULL,NULL); + status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + default: - ; + ; } } #endif |