diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDfamily.c | 38 | ||||
-rw-r--r-- | src/H5HFdblock.c | 2 | ||||
-rw-r--r-- | src/H5HFiblock.c | 4 | ||||
-rw-r--r-- | src/H5HFman.c | 19 | ||||
-rw-r--r-- | src/H5HFpkg.h | 3 | ||||
-rw-r--r-- | src/H5HFsection.c | 7 | ||||
-rw-r--r-- | src/H5I.c | 38 | ||||
-rw-r--r-- | src/H5Iprivate.h | 1 | ||||
-rw-r--r-- | src/H5P.c | 72 | ||||
-rw-r--r-- | src/H5Pdapl.c | 6 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 8 | ||||
-rw-r--r-- | src/H5Pdeprec.c | 22 | ||||
-rw-r--r-- | src/H5Pdxpl.c | 42 | ||||
-rw-r--r-- | src/H5Pfapl.c | 38 | ||||
-rw-r--r-- | src/H5Pfcpl.c | 26 | ||||
-rw-r--r-- | src/H5Pfmpl.c | 2 | ||||
-rw-r--r-- | src/H5Pgcpl.c | 6 | ||||
-rw-r--r-- | src/H5Pint.c | 1024 | ||||
-rw-r--r-- | src/H5Plapl.c | 14 | ||||
-rw-r--r-- | src/H5Plcpl.c | 3 | ||||
-rwxr-xr-x | src/H5Pocpl.c | 12 | ||||
-rwxr-xr-x | src/H5Pocpypl.c | 3 | ||||
-rw-r--r-- | src/H5Ppkg.h | 25 | ||||
-rw-r--r-- | src/H5Pprivate.h | 5 | ||||
-rw-r--r-- | src/H5Pstrcpl.c | 3 | ||||
-rw-r--r-- | src/H5Spoint.c | 58 |
26 files changed, 892 insertions, 589 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index bb89570..67bb107 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -894,45 +894,43 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5FD_family_close(H5FD_t *_file) { - H5FD_family_t *file = (H5FD_family_t*)_file; - unsigned nerrors=0; /* Number of errors while closing member files */ - unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_family_t *file = (H5FD_family_t*)_file; + unsigned nerrors = 0; /* Number of errors while closing member files */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_family_close, FAIL) /* Close as many members as possible. Use private function here to avoid clearing * the error stack. We need the error message to indicate wrong member file size. */ - for (u=0; u<file->nmembs; u++) { - if (file->memb[u]) { - if (H5FD_close(file->memb[u])<0) + for(u = 0; u < file->nmembs; u++) { + if(file->memb[u]) { + if(H5FD_close(file->memb[u]) < 0) nerrors++; else file->memb[u] = NULL; - } - } - if (nerrors) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close member files") + } /* end if */ + } /* end for */ + if(nerrors) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close member files") /* Clean up other stuff */ - if(H5I_dec_ref(file->memb_fapl_id, FALSE)<0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") - if (file->memb) - H5MM_xfree(file->memb); - if (file->name) - H5MM_xfree(file->name); + if(H5I_dec_ref(file->memb_fapl_id, FALSE) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") + H5MM_xfree(file->memb); + H5MM_xfree(file->name); H5MM_xfree(file); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_family_close() */ /*------------------------------------------------------------------------- diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 027146c..7a511a0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -312,7 +312,7 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock, done: /* Unprotect the indirect block, with appropriate flags */ - if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, cache_flags) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 809a720..26c60a3 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -852,7 +852,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_alloc_indirect2 + * Function: H5HF_man_iblock_alloc_row * * Purpose: Allocate a "single" section for an object, out of a * "row" section. @@ -872,7 +872,7 @@ H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t ** { H5HF_indirect_t *iblock = NULL; /* Pointer to indirect block */ H5HF_free_section_t *old_sec_node = *sec_node; /* Pointer to old indirect section node */ - unsigned dblock_entry; /* Entry for direct block */ + unsigned dblock_entry; /* Entry for direct block */ hbool_t iblock_held = FALSE; /* Flag to indicate that indirect block is held */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFman.c b/src/H5HFman.c index 47478e6..0ec6f5f 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -482,7 +482,7 @@ done: herr_t H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) { - H5HF_free_section_t *sec_node; /* Pointer to free space section for block */ + H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */ H5HF_indirect_t *iblock = NULL; /* Pointer to indirect block */ hbool_t did_protect; /* Whether we protected the indirect block or not */ hsize_t obj_off; /* Object's offset in heap */ @@ -571,24 +571,29 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) iblock = NULL; } /* end if */ - /* Update statistics about heap */ - hdr->man_nobjs--; - /* Increase space available in heap (marks header dirty) */ if(H5HF_hdr_adj_free(hdr, (ssize_t)obj_len) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") + /* Update statistics about heap */ + hdr->man_nobjs--; + /* Return free space to the heap's list of space */ if(H5HF_space_add(hdr, dxpl_id, sec_node, H5FS_ADD_RETURNED_SPACE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + sec_node = NULL; done: if(ret_value < 0) { - /* Unlock indirect block */ - if(iblock && H5HF_man_iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + /* Release section node */ + if(sec_node && H5HF_sect_single_free((H5FS_section_info_t *)sec_node) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node") } /* end if */ + /* Unlock indirect block */ + if(iblock && H5HF_man_iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_man_remove() */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 3c5567c..61f018f 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -169,7 +169,7 @@ #define H5HF_FSPACE_SECT_SINGLE 0 /* Section is a range of actual bytes in a direct block */ #define H5HF_FSPACE_SECT_FIRST_ROW 1 /* Section is first range of blocks in an indirect block row */ #define H5HF_FSPACE_SECT_NORMAL_ROW 2 /* Section is a range of blocks in an indirect block row */ -#define H5HF_FSPACE_SECT_INDIRECT 3 /* Section is a span of blocks in an indirect block */ +#define H5HF_FSPACE_SECT_INDIRECT 3 /* Section is a span of blocks in an indirect block */ /* Flags for 'op' operations */ #define H5HF_OP_MODIFY 0x0001 /* Operation will modify object */ @@ -721,6 +721,7 @@ H5_DLL herr_t H5HF_sect_row_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5_DLL H5HF_indirect_t *H5HF_sect_row_get_iblock(H5HF_free_section_t *sect); H5_DLL herr_t H5HF_sect_indirect_add(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries); +H5_DLL herr_t H5HF_sect_single_free(H5FS_section_info_t *sect); /* Internal operator callbacks */ H5_DLL herr_t H5HF_op_read(const void *obj, size_t obj_len, void *op_data); diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 9b23e5d..d763897 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -97,7 +97,6 @@ static htri_t H5HF_sect_single_can_shrink(const H5FS_section_info_t *sect, void *udata); static herr_t H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void *udata); -static herr_t H5HF_sect_single_free(H5FS_section_info_t *sect); static herr_t H5HF_sect_single_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *sect); @@ -465,7 +464,7 @@ H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on section's indirect block") /* Release the section */ - (void)H5FL_FREE(H5HF_free_section_t, sect); + sect = H5FL_FREE(H5HF_free_section_t, sect); done: FUNC_LEAVE_NOAPI(ret_value) @@ -517,7 +516,7 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, done: if(!ret_value && sect) { /* Release the section */ - (void)H5FL_FREE(H5HF_free_section_t, sect); + sect = H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1169,7 +1168,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5HF_sect_single_free(H5FS_section_info_t *_sect) { H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Pointer to section to free */ @@ -924,6 +924,44 @@ done: /*------------------------------------------------------------------------- + * Function: H5I_subst + * + * Purpose: Substitute a new object pointer for the specified ID. + * + * Return: Success: Non-null previsou object pointer associated + * with the specified ID. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Saturday, February 27, 2010 + * + *------------------------------------------------------------------------- + */ +void * +H5I_subst(hid_t id, const void *new_object) +{ + H5I_id_info_t *id_ptr; /* Ptr to the atom */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_subst, NULL) + + /* General lookup of the ID */ + if(NULL == (id_ptr = H5I_find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") + + /* Get the old object pointer to return */ + /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; + + /* Set the new object pointer for the ID */ + id_ptr->obj_ptr = new_object; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end if */ + + +/*------------------------------------------------------------------------- * Function: H5I_object * * Purpose: Find an object pointer for the specified ID. diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 475871b..ef83908 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -55,6 +55,7 @@ H5_DLL int H5I_nmembers(H5I_type_t type); H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref); H5_DLL int H5I_destroy_type(H5I_type_t type); H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); +H5_DLL void *H5I_subst(hid_t id, const void *new_object); H5_DLL void *H5I_object(hid_t id); H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL H5I_type_t H5I_get_type(hid_t id); @@ -217,7 +217,7 @@ H5Pcreate_class(hid_t parent, const char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class") /* Create the new property list class */ - if(NULL == (pclass = H5P_create_class(par_class, name, 0, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) + if(NULL == (pclass = H5P_create_class(par_class, name, FALSE, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class") /* Get an atom for the class */ @@ -437,27 +437,43 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { - H5P_genclass_t *pclass; /* Property list class to modify */ - herr_t ret_value; /* return value */ + H5P_genclass_t *pclass; /* Property list class to modify */ + H5P_genclass_t *orig_pclass; /* Original property class */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Pregister2, FAIL); + FUNC_ENTER_API(H5Pregister2, FAIL) H5TRACE11("e", "i*sz*xxxxxxxx", cls_id, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close); /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name"); - if(size>0 && def_value==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name") + if(size > 0 && def_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_register(pclass,name,size,def_value,prp_create,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 class"); + orig_pclass = pclass; + if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, 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 class") + + /* Check if the property class changed and needs to be substituted in the ID */ + if(pclass != orig_pclass) { + H5P_genclass_t *old_pclass; /* Old property class */ + + /* Substitute the new property class in the ID */ + if(NULL == (old_pclass = (H5P_genclass_t *)H5I_subst(cls_id, pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID") + HDassert(old_pclass == orig_pclass); + + /* Close the previous class */ + if(H5P_close_class(orig_pclass) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") + } /* end if */ done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Pregister2() */ @@ -1259,36 +1275,38 @@ done: herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name) { - void *src_obj, *dst_obj; /* Property objects to copy between */ - herr_t ret_value=SUCCEED; /* return value */ + H5I_type_t src_id_type, dst_id_type; /* ID types */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pcopy_prop, FAIL); + FUNC_ENTER_API(H5Pcopy_prop, FAIL) H5TRACE3("e", "ii*s", dst_id, src_id, name); /* Check arguments. */ - if((H5I_GENPROP_LST != H5I_get_type(src_id) && H5I_GENPROP_CLS != H5I_get_type(src_id)) - || (H5I_GENPROP_LST != H5I_get_type(dst_id) && H5I_GENPROP_CLS != H5I_get_type(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property objects"); - if(H5I_get_type(src_id) != H5I_get_type(dst_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not the same kind of property objects"); + if((src_id_type = H5I_get_type(src_id)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid source ID") + if((dst_id_type = H5I_get_type(dst_id)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid destination ID") + if((H5I_GENPROP_LST != src_id_type && H5I_GENPROP_CLS != src_id_type) + || (H5I_GENPROP_LST != dst_id_type && H5I_GENPROP_CLS != dst_id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property objects") + if(src_id_type != dst_id_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not the same kind of property objects") if(!name || !*name) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); - if(NULL == (src_obj = H5I_object(src_id)) || NULL == (dst_obj = H5I_object(dst_id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") /* Compare property lists */ - if(H5I_GENPROP_LST == H5I_get_type(src_id)) { + if(H5I_GENPROP_LST == src_id_type) { if(H5P_copy_prop_plist(dst_id, src_id, name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists") } /* end if */ /* Must be property classes */ else { - if(H5P_copy_prop_pclass((H5P_genclass_t *)dst_obj, (H5P_genclass_t *)src_obj, name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes"); + if(H5P_copy_prop_pclass(dst_id, src_id, name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes") } /* end else */ done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Pcopy_prop() */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index db66366..356c42d 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -129,15 +129,15 @@ H5P_dacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_dacc_reg_prop) /* Register the size of raw data chunk cache (elements) */ - if(H5P_register(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 82053e4..ba1bb50 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -183,19 +183,19 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_reg_prop) /* Register the storage layout property */ - if(H5P_register(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the fill value property */ - if(H5P_register(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the space allocation time state property */ - if(H5P_register(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file list property */ - if(H5P_register(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 5c72247..1528df5 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -249,8 +249,9 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, 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_genclass_t *pclass; /* Property list class to modify */ - herr_t ret_value; /* return value */ + H5P_genclass_t *pclass; /* Property list class to modify */ + H5P_genclass_t *orig_pclass; /* Original property class */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Pregister1, FAIL); H5TRACE10("e", "i*sz*xxxxxxx", cls_id, name, size, def_value, prp_create, @@ -265,9 +266,24 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ - if((ret_value = H5P_register(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0) + orig_pclass = pclass; + if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); + /* Check if the property class changed and needs to be substituted in the ID */ + if(pclass != orig_pclass) { + H5P_genclass_t *old_pclass; /* Old property class */ + + /* Substitute the new property class in the ID */ + if(NULL == (old_pclass = (H5P_genclass_t *)H5I_subst(cls_id, pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID") + HDassert(old_pclass == orig_pclass); + + /* Close the previous class */ + if(H5P_close_class(orig_pclass) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") + } /* end if */ + done: FUNC_LEAVE_API(ret_value); } /* H5Pregister1() */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index aab8b57..1186868 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -210,81 +210,81 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_reg_prop) /* Register the max. temp buffer size property */ - if(H5P_register(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion buffer property */ - if(H5P_register(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &def_tconv_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &def_tconv_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer property */ - if(H5P_register(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &def_bkgr_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &def_bkgr_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer type property */ - if(H5P_register(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &def_bkgr_buf_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &def_bkgr_buf_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the B-Tree node splitting ratios property */ - if(H5P_register(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, def_btree_split_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, def_btree_split_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation function property */ - if(H5P_register(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &def_vlen_alloc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &def_vlen_alloc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation information property */ - if(H5P_register(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &def_vlen_alloc_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &def_vlen_alloc_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free function property */ - if(H5P_register(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &def_vlen_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &def_vlen_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free information property */ - if(H5P_register(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID property */ - if(H5P_register(pclass, H5D_XFER_VFL_ID_NAME, H5D_XFER_VFL_ID_SIZE, &def_vfl_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_VFL_ID_NAME, H5D_XFER_VFL_ID_SIZE, &def_vfl_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver info property */ - if(H5P_register(pclass, H5D_XFER_VFL_INFO_NAME, H5D_XFER_VFL_INFO_SIZE, &def_vfl_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_VFL_INFO_NAME, H5D_XFER_VFL_INFO_SIZE, &def_vfl_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vector size property */ - if(H5P_register(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the I/O transfer mode property */ - if(H5P_register(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &def_io_xfer_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &def_io_xfer_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &def_mpio_collective_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &def_mpio_collective_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &def_mpio_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &def_mpio_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &def_mpio_chunk_opt_num, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &def_mpio_chunk_opt_num, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &def_mpio_chunk_opt_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &def_mpio_chunk_opt_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the EDC property */ - if(H5P_register(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &enable_edc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &enable_edc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the filter callback property */ - if(H5P_register(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &filter_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &filter_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion callback property */ - if(H5P_register(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &conv_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &conv_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data transform property */ - if(H5P_register(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, NULL, H5D_XFER_XFORM_CLOSE) < 0) + if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, NULL, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 5d73afe..6ff3b73 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -215,80 +215,80 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_facc_reg_prop) /* Register the initial metadata cache resize configuration */ - if(H5P_register(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &alignment, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &alignment, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID */ - if(H5P_register(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &driver_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &driver_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver info */ - if(H5P_register(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &close_degree, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &close_degree, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ - if(H5P_register(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ - if(H5P_register(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &mem_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &mem_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'use the latest version of the format' flag */ - if(H5P_register(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ - if(H5P_register(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &want_posix_fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &want_posix_fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index cb3bccd..a0f2f89 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -162,49 +162,49 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_fcrt_reg_prop) /* Register the user block size */ - if(H5P_register(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &userblock_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &userblock_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for symbol table leaf nodes */ - if(H5P_register(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for btree internal nodes */ - if(H5P_register(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, btree_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, btree_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for an address */ - if(H5P_register(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for object size */ - if(H5P_register(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &sizeof_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &sizeof_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the superblock version number */ - if(H5P_register(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &superblock_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &superblock_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH message information */ - if(H5P_register(pclass,H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &num_sohm_indexes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass,H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &num_sohm_indexes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass,H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &sohm_index_flags,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &sohm_index_flags,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass,H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &sohm_index_minsizes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &sohm_index_minsizes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH cutoff size information */ - if(H5P_register(pclass,H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &sohm_list_max,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass,H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &sohm_list_max,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file space handling strategy */ - if(H5P_register(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &file_space_strategy, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &file_space_strategy, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free space section threshold */ - if(H5P_register(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &free_space_threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &free_space_threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index ab405ca..43c6055 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -113,7 +113,7 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_fmnt_reg_prop) /* Register property of whether symlinks is local to file */ - if(H5P_register(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &local, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &local, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 913c5f1..72784eb 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -113,13 +113,11 @@ H5P_gcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_gcrt_reg_prop) /* Register group info property */ - if(H5P_register(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, - &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register link info property */ - if(H5P_register(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, - &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pint.c b/src/H5Pint.c index 7111cba..46a4ee3 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -265,29 +265,29 @@ H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) H5P_genprop_t *pcopy=NULL; /* Copy of property to insert into skip list */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_do_prop_cb1); + FUNC_ENTER_NOAPI_NOINIT(H5P_do_prop_cb1) /* Allocate space for a temporary copy of the property value */ if(NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") HDmemcpy(tmp_value,prop->value,prop->size); /* Call "type 1" callback ('create', 'copy' or 'close') */ if(cb(prop->name,prop->size,tmp_value) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") /* Check if the property value changed */ if((prop->cmp)(tmp_value,prop->value,prop->size)) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") /* Copy the changed value into the new property */ HDmemcpy(pcopy->value,tmp_value,prop->size); /* Insert the changed property into the property list */ if(H5P_add_prop(slist,pcopy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into skip list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into skip list") } /* end if */ done: @@ -301,7 +301,7 @@ done: H5P_free_prop(pcopy); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_do_prop_cb1() */ @@ -451,7 +451,7 @@ H5P_term_interface(void) int nclass=0; int n=0; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_term_interface); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_term_interface) if(H5_interface_initialize_g) { /* Destroy HDF5 library property classes & lists */ @@ -520,7 +520,7 @@ H5P_term_interface(void) H5_interface_initialize_g = 0; } } - FUNC_LEAVE_NOAPI(n); + FUNC_LEAVE_NOAPI(n) } @@ -551,9 +551,9 @@ H5P_copy_pclass(H5P_genclass_t *pclass) H5P_genprop_t *pcopy; /* Copy of property to insert into class */ H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_copy_pclass); + FUNC_ENTER_NOAPI_NOINIT(H5P_copy_pclass) - assert(pclass); + HDassert(pclass); /* * Create new property class object @@ -561,7 +561,7 @@ H5P_copy_pclass(H5P_genclass_t *pclass) /* Create the new property list class */ if(NULL==(new_pclass=H5P_create_class(pclass->parent, pclass->name, 0, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class") /* Copy the properties registered for this class */ if(pclass->nprops>0) { @@ -572,11 +572,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) while(curr_node!=NULL) { /* Make a copy of the class's property */ if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property") /* Insert the initialized property into the property list */ if(H5P_add_prop(new_pclass->props,pcopy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class") /* Increment property count for class */ new_pclass->nprops++; @@ -593,7 +593,7 @@ done: if(ret_value==NULL && new_pclass) H5P_close_class(new_pclass); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_copy_pclass() */ @@ -632,9 +632,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) hbool_t has_parent_class; /* Flag to indicate that this property list's class has a parent */ hid_t ret_value=FAIL; /* return value */ - FUNC_ENTER_NOAPI(H5P_copy_plist, FAIL); + FUNC_ENTER_NOAPI(H5P_copy_plist, FAIL) - assert(old_plist); + HDassert(old_plist); /* * Create new property list object @@ -642,20 +642,20 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Allocate room for the property list */ if(NULL==(new_plist = H5FL_CALLOC(H5P_genplist_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,"memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,"memory allocation failed") /* Set class state */ new_plist->pclass = old_plist->pclass; new_plist->nprops = 0; /* Initially the plist has the same number of properties as the class */ - new_plist->class_init = 0; /* Initially, wait until the class callback finishes to set */ + new_plist->class_init = FALSE; /* Initially, wait until the class callback finishes to set */ /* Initialize the skip list to hold the changed properties */ if((new_plist->props = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for changed properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for changed properties") /* Create the skip list for deleted properties */ if((new_plist->del = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for deleted properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for deleted properties") /* Create the skip list to hold names of properties already seen * (This prevents a property in the class hierarchy from having it's @@ -663,7 +663,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) * already been seen) */ if((seen = H5SL_create(H5SL_TYPE_STR))== NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties") nseen = 0; /* Cycle through the deleted properties & copy them into the new list's deleted section */ @@ -674,15 +674,15 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Duplicate string for insertion into new deleted property skip list */ if((new_name=H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") /* Insert property name into deleted list */ if(H5SL_insert(new_plist->del,new_name,new_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") /* Add property name to "seen" list */ if(H5SL_insert(seen,new_name,new_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") nseen++; /* Get the next property node in the skip list */ @@ -705,19 +705,19 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if(new_prop->copy) { if((new_prop->copy)(new_prop->name,new_prop->size,new_prop->value) < 0) { H5P_free_prop(new_prop); - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") } /* end if */ } /* end if */ /* Insert the initialized property into the property list */ if(H5P_add_prop(new_plist->props,new_prop) < 0) { H5P_free_prop(new_prop); - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") } /* end if */ /* Add property name to "seen" list */ if(H5SL_insert(seen,new_prop->name,new_prop->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") nseen++; /* Increment the number of properties in list */ @@ -748,13 +748,13 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if(tmp->copy) { /* Call the callback & insert changed value into skip list (if necessary) */ if(H5P_do_prop_cb1(new_plist->props,tmp,tmp->copy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't create property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't create property") } /* end if */ /* Add property name to "seen" list, if we have other classes to work on */ if(has_parent_class) { if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") nseen++; } /* end if */ @@ -772,12 +772,12 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) } /* end while */ /* Increment the number of property lists derived from class */ - if(H5P_access_class(new_plist->pclass,H5P_MOD_INC_LST) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ref count"); + if(H5P_access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't increment class ref count") /* Get an atom for the property list */ if((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ new_plist->plist_id=new_plist_id; @@ -800,7 +800,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) } /* end while */ /* Set the class initialization flag */ - new_plist->class_init=1; + new_plist->class_init = TRUE; /* Set the return value */ ret_value=new_plist_id; @@ -813,7 +813,7 @@ done: if(ret_value<0 && new_plist) H5P_close(new_plist); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_copy_plist() */ @@ -859,7 +859,7 @@ H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) /* Duplicating property for a class */ if(type == H5P_PROP_WITHIN_CLASS) { HDassert(oprop->type == H5P_PROP_WITHIN_CLASS); - HDassert(oprop->shared_name == 0); + HDassert(oprop->shared_name == FALSE); /* Duplicate name */ prop->name = H5MM_xstrdup(oprop->name); @@ -877,10 +877,10 @@ H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) /* Duplicating a property from a class */ else { HDassert(oprop->type == H5P_PROP_WITHIN_CLASS); - HDassert(oprop->shared_name == 0); + HDassert(oprop->shared_name == FALSE); /* Share the name */ - prop->shared_name = 1; + prop->shared_name = TRUE; /* Set the type */ prop->type = type; @@ -956,26 +956,26 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_create_prop); + FUNC_ENTER_NOAPI_NOINIT(H5P_create_prop) - assert(name); - assert((size>0 && value!=NULL) || (size==0)); - assert(type!=H5P_PROP_WITHIN_UNKNOWN); + HDassert(name); + HDassert((size>0 && value!=NULL) || (size==0)); + HDassert(type!=H5P_PROP_WITHIN_UNKNOWN); /* Allocate the new property */ if(NULL==(prop = H5FL_MALLOC (H5P_genprop_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the property initial values */ prop->name = H5MM_xstrdup(name); /* Duplicate name */ - prop->shared_name=0; - prop->size=size; - prop->type=type; + prop->shared_name = FALSE; + prop->size = size; + prop->type = type; /* Duplicate value, if it exists */ if(value!=NULL) { if(NULL==(prop->value = H5MM_malloc (prop->size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(prop->value,value,prop->size); } /* end if */ else @@ -1009,7 +1009,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_create_prop() */ @@ -1034,21 +1034,21 @@ done: herr_t H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_add_prop,FAIL); + FUNC_ENTER_NOAPI(H5P_add_prop, FAIL) - assert(slist); - assert(prop); - assert(prop->type!=H5P_PROP_WITHIN_UNKNOWN); + HDassert(slist); + HDassert(prop); + HDassert(prop->type != H5P_PROP_WITHIN_UNKNOWN); /* Insert property into skip list */ - if(H5SL_insert(slist,prop,prop->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into skip list"); + if(H5SL_insert(slist, prop, prop->name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into skip list") done: - FUNC_LEAVE_NOAPI(ret_value); -} /* H5P_add_prop() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P_add_prop() */ /*-------------------------------------------------------------------------- @@ -1169,21 +1169,21 @@ done: static herr_t H5P_free_prop(H5P_genprop_t *prop) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_free_prop); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_free_prop) - assert(prop); + HDassert(prop); /* Release the property value if it exists */ if(prop->value) H5MM_xfree(prop->value); /* Only free the name if we own it */ - if(prop->shared_name==0) + if(!prop->shared_name) H5MM_xfree(prop->name); - (void)H5FL_FREE(H5P_genprop_t, prop); + prop = H5FL_FREE(H5P_genprop_t, prop); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5P_free_prop() */ @@ -1210,21 +1210,21 @@ H5P_free_prop(H5P_genprop_t *prop) static herr_t H5P_free_prop_cb(void *item, void UNUSED *key, void *op_data) { - H5P_genprop_t *tprop=(H5P_genprop_t *)item; /* Temporary pointer to property */ - unsigned make_cb=*(unsigned *)op_data; /* Whether to make property 'close' callback */ + H5P_genprop_t *tprop=(H5P_genprop_t *)item; /* Temporary pointer to property */ + hbool_t make_cb = *(hbool_t *)op_data; /* Whether to make property 'close' callback */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_free_prop_cb); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_free_prop_cb) - assert(tprop); + HDassert(tprop); /* Call the close callback and ignore the return value, there's nothing we can do about it */ - if(make_cb && tprop->close!=NULL) - (tprop->close)(tprop->name,tprop->size,tprop->value); + if(make_cb && tprop->close != NULL) + (tprop->close)(tprop->name, tprop->size, tprop->value); /* Free the property, ignoring return value, nothing we can do */ H5P_free_prop(tprop); - FUNC_LEAVE_NOAPI(0); + FUNC_LEAVE_NOAPI(0) } /* H5P_free_prop_cb() */ @@ -1252,14 +1252,14 @@ H5P_free_del_name_cb(void *item, void UNUSED *key, void UNUSED *op_data) { char *del_name=(char *)item; /* Temporary pointer to deleted name */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_free_del_name_cb); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_free_del_name_cb) - assert(del_name); + HDassert(del_name); /* Free the name */ H5MM_xfree(del_name); - FUNC_LEAVE_NOAPI(0); + FUNC_LEAVE_NOAPI(0) } /* H5P_free_del_name_cb() */ @@ -1288,10 +1288,10 @@ H5P_free_del_name_cb(void *item, void UNUSED *key, void UNUSED *op_data) herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_access_class); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_access_class) - assert(pclass); - assert(mod>H5P_MOD_ERR && mod<H5P_MOD_MAX); + HDassert(pclass); + HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); switch(mod) { case H5P_MOD_INC_CLS: /* Increment the dependant class count*/ @@ -1313,7 +1313,7 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) case H5P_MOD_INC_REF: /* Increment the ID reference count*/ /* Reset the deleted flag if incrementing the reference count */ if(pclass->deleted) - pclass->deleted=0; + pclass->deleted = FALSE; pclass->ref_count++; break; @@ -1321,8 +1321,8 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) pclass->ref_count--; /* Mark the class object as deleted if reference count drops to zero */ - if(pclass->ref_count==0) - pclass->deleted=1; + if(pclass->ref_count == 0) + pclass->deleted = TRUE; break; case H5P_MOD_ERR: @@ -1332,27 +1332,27 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) } /* end switch */ /* Check if we can release the class information now */ - if(pclass->deleted && pclass->plists==0 && pclass->classes==0 ) { - H5P_genclass_t *par_class=pclass->parent; /* Pointer to class's parent */ + if(pclass->deleted && pclass->plists == 0 && pclass->classes == 0) { + H5P_genclass_t *par_class = pclass->parent; /* Pointer to class's parent */ - assert(pclass->name); + HDassert(pclass->name); H5MM_xfree(pclass->name); /* Free the class properties without making callbacks */ if(pclass->props) { - unsigned make_cb=0; + hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); } /* end if */ - (void)H5FL_FREE(H5P_genclass_t, pclass); + pclass = H5FL_FREE(H5P_genclass_t, pclass); /* Reduce the number of dependent classes on parent class also */ - if(par_class!=NULL) + if(par_class != NULL) H5P_access_class(par_class, H5P_MOD_DEC_CLS); } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5P_access_class() */ @@ -1384,11 +1384,11 @@ H5P_check_class(void *_obj, hid_t UNUSED id, void *_key) const H5P_check_class_t *key=(const H5P_check_class_t *)_key; /* Pointer to key information for comparison */ int ret_value=0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_check_class); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_check_class) - assert(obj); - assert(H5I_GENPROP_CLS==H5I_get_type(id)); - assert(key); + HDassert(obj); + HDassert(H5I_GENPROP_CLS==H5I_get_type(id)); + HDassert(key); /* Check if the class object has the same parent as the new class */ if(obj->parent==key->parent) { @@ -1397,7 +1397,7 @@ H5P_check_class(void *_obj, hid_t UNUSED id, void *_key) ret_value=1; /* Indicate a match */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_check_class() */ @@ -1411,7 +1411,7 @@ H5P_check_class(void *_obj, hid_t UNUSED id, void *_key) cls_create, create_data, cls_close, close_data) H5P_genclass_t *par_class; IN: Pointer to parent class const char *name; IN: Name of class we are creating - unsigned internal; IN: Whether this is an internal class or not + hbool_t internal; IN: Whether this is an internal class or not H5P_cls_create_func_t; IN: The callback function to call when each property list in this class is created. void *create_data; IN: Pointer to user data to pass along to class @@ -1435,7 +1435,7 @@ H5P_check_class(void *_obj, hid_t UNUSED id, void *_key) REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned internal, +H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) @@ -1445,31 +1445,31 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned internal, FUNC_ENTER_NOAPI(H5P_create_class, NULL) - assert(name); + HDassert(name); /* Allow internal classes to break some rules */ /* (This allows the root of the tree to be created with this routine -QAK) */ - if(!internal) { - assert(par_class); - } + if(!internal) + HDassert(par_class); /* Allocate room for the class */ - if(NULL==(pclass = H5FL_CALLOC(H5P_genclass_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,"memory allocation failed"); + if(NULL == (pclass = H5FL_CALLOC(H5P_genclass_t))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class allocation failed") /* Set class state */ pclass->parent = par_class; - pclass->name = H5MM_xstrdup(name); + if(NULL == (pclass->name = H5MM_xstrdup(name))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed") pclass->nprops = 0; /* Classes are created without properties initially */ pclass->plists = 0; /* No properties lists of this class yet */ pclass->classes = 0; /* No classes derived from this class yet */ pclass->ref_count = 1; /* This is the first reference to the new class */ pclass->internal = internal; - pclass->deleted = 0; /* Not deleted yet... :-) */ + pclass->deleted = FALSE; /* Not deleted yet... :-) */ pclass->revision = H5P_GET_NEXT_REV; /* Get a revision number for the class */ /* Create the skip list for properties */ - if((pclass->props = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for properties"); + if(NULL == (pclass->props = H5SL_create(H5SL_TYPE_STR))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for properties") /* Set callback functions and pass-along data */ pclass->create_func = cls_create; @@ -1480,19 +1480,27 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned internal, pclass->close_data = close_data; /* Increment parent class's derived class value */ - if(par_class!=NULL) { - if(H5P_access_class(par_class,H5P_MOD_INC_CLS) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment parent class ref count"); + if(par_class != NULL) { + if(H5P_access_class(par_class, H5P_MOD_INC_CLS) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment parent class ref count") } /* end if */ /* Set return value */ - ret_value=pclass; + ret_value = pclass; done: /* Free any resources allocated */ - if(ret_value==NULL) - if(pclass!=NULL) - (void)H5FL_FREE(H5P_genclass_t, pclass); + if(ret_value == NULL) + if(pclass) { + if(pclass->name) + H5MM_xfree(pclass->name); + if(pclass->props) { + hbool_t make_cb = FALSE; + + H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + } /* end if */ + pclass = H5FL_FREE(H5P_genclass_t, pclass); + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* H5P_create_class() */ @@ -1532,9 +1540,9 @@ H5P_create(H5P_genclass_t *pclass) H5SL_t *seen=NULL; /* Skip list to hold names of properties already seen */ H5P_genplist_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_create); + FUNC_ENTER_NOAPI_NOINIT(H5P_create) - assert(pclass); + HDassert(pclass); /* * Create new property list object @@ -1542,20 +1550,20 @@ H5P_create(H5P_genclass_t *pclass) /* Allocate room for the property list */ if(NULL==(plist = H5FL_CALLOC(H5P_genplist_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,"memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,"memory allocation failed") /* Set class state */ plist->pclass = pclass; plist->nprops = 0; /* Initially the plist has the same number of properties as the class */ - plist->class_init = 0; /* Initially, wait until the class callback finishes to set */ + plist->class_init = FALSE; /* Initially, wait until the class callback finishes to set */ /* Create the skip list for changed properties */ if((plist->props = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for changed properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for changed properties") /* Create the skip list for deleted properties */ if((plist->del = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for deleted properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for deleted properties") /* Create the skip list to hold names of properties already seen * (This prevents a property in the class hierarchy from having it's @@ -1563,7 +1571,7 @@ H5P_create(H5P_genclass_t *pclass) * already been seen) */ if((seen = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for seen properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for seen properties") /* * Check if we should copy class properties (up through list of parent classes also), @@ -1586,12 +1594,12 @@ H5P_create(H5P_genclass_t *pclass) if(tmp->create) { /* Call the callback & insert changed value into skip list (if necessary) */ if(H5P_do_prop_cb1(plist->props,tmp,tmp->create) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't create property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL,"Can't create property") } /* end if */ /* Add property name to "seen" list */ if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,NULL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,NULL,"can't insert property into seen skip list") /* Increment the number of properties in list */ plist->nprops++; @@ -1608,7 +1616,7 @@ H5P_create(H5P_genclass_t *pclass) /* Increment the number of property lists derived from class */ if(H5P_access_class(plist->pclass,H5P_MOD_INC_LST) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count") /* Set return value */ ret_value=plist; @@ -1637,7 +1645,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_create() */ @@ -1671,17 +1679,17 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) hid_t plist_id = FAIL; /* Property list ID */ hid_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_create_id, FAIL); + FUNC_ENTER_NOAPI(H5P_create_id, FAIL) - assert(pclass); + HDassert(pclass); /* Create the new property list */ if((plist=H5P_create(pclass)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") /* Get an atom for the property list */ if((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ plist->plist_id=plist_id; @@ -1704,7 +1712,7 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) } /* end while */ /* Set the class initialization flag */ - plist->class_init=1; + plist->class_init = TRUE; /* Set the return value */ ret_value=plist_id; @@ -1713,18 +1721,18 @@ done: if(ret_value<0 && plist) H5P_close(plist); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_create_id() */ /*-------------------------------------------------------------------------- NAME - H5P_register + H5P_register_real PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) - H5P_genclass_t *class; IN: Property list class to close + herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, prp_get, prp_close) + H5P_genclass_t *class; IN: Property list class to modify const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes void *def_value; IN: Pointer to buffer containing default value @@ -1872,89 +1880,274 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, +H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, 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) { - H5P_genclass_t *new_class; /* New class pointer */ - H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ - H5P_genprop_t *pcopy; /* Property copy */ - herr_t ret_value=SUCCEED; /* Return value */ + H5P_genprop_t *new_prop = NULL; /* Temporary property pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_register, FAIL); + FUNC_ENTER_NOAPI(H5P_register_real, FAIL) - assert(pclass); - assert(name); - assert((size>0 && def_value!=NULL) || (size==0)); + HDassert(pclass); + HDassert(0 == pclass->plists); + HDassert(0 == pclass->classes); + HDassert(name); + HDassert((size > 0 && def_value != NULL) || (size == 0)); /* Check for duplicate named properties */ - if(H5SL_search(pclass->props,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); + if(NULL != H5SL_search(pclass->props, name)) + HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") + + /* Create property object from parameters */ + if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") + + /* Insert property into property list class */ + if(H5P_add_prop(pclass->props, new_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") + + /* Increment property count for class */ + pclass->nprops++; + + /* Update the revision for the class */ + pclass->revision = H5P_GET_NEXT_REV; + +done: + if(ret_value < 0) + if(new_prop && H5P_free_prop(new_prop) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P_register_real() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_register + PURPOSE + Internal routine to register a new property in a property list class. + USAGE + herr_t H5P_register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) + H5P_genclass_t **class; IN: Property list class to modify + const char *name; IN: Name of property to register + size_t size; IN: Size of property in bytes + void *def_value; IN: Pointer to buffer containing default value + for property in newly created property lists + H5P_prp_create_func_t prp_create; IN: Function pointer to property + creation callback + 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 + Registers a new property with a property list class. The property will + exist in all property list objects of that class after this routine is + finished. The name of the property must not already exist. The default + property value must be provided and all new property lists created with this + property will have the property value set to the default provided. 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 'default' pointer for a + zero-sized property may be set to NULL. The property 'create' & 'close' + callbacks are called for zero-sized properties, but the 'set' and 'get' + callbacks are never called. + + The 'create' callback is called when a new property list with this + property is being created. H5P_prp_create_func_t is defined as: + typedef herr_t (*H5P_prp_create_func_t)(hid_t prop_id, const char *name, + size_t size, void *initial_value); + where the parameters to the callback function are: + hid_t prop_id; IN: The ID of the property list being created. + const char *name; IN: The name of the property being modified. + size_t size; IN: The size of the property value + void *initial_value; IN/OUT: The initial value for the property being created. + (The 'default' value passed to H5Pregister2) + The 'create' routine may modify the value to be set and those changes will + be stored as the initial value of the property. If the 'create' routine + returns a negative value, the new property value is not copied into the + property and the property list creation routine returns an error value. + + 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. + + 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 +H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, + const void *def_value, H5P_prp_create_func_t prp_create, 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) +{ + H5P_genclass_t *pclass = *ppclass; /* Pointer to class to modify */ + H5P_genclass_t *new_class = NULL; /* New class pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5P_register, FAIL) + + /* Sanity check */ + HDassert(ppclass); + HDassert(pclass); /* Check if class needs to be split because property lists or classes have * been created since the last modification was made to the class. */ - if(pclass->plists>0 || pclass->classes>0) { - if((new_class=H5P_create_class(pclass->parent,pclass->name, - pclass->internal,pclass->create_func,pclass->create_data, - pclass->copy_func,pclass->copy_data, - pclass->close_func,pclass->close_data)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class"); + if(pclass->plists > 0 || pclass->classes > 0) { + if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name, + pclass->internal, pclass->create_func, pclass->create_data, + pclass->copy_func, pclass->copy_data, + pclass->close_func, pclass->close_data))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class") /* Walk through the skip list of the old class and copy properties */ - if(pclass->nprops>0) { + if(pclass->nprops > 0) { H5SL_node_t *curr_node; /* Current node in skip list */ /* Walk through the properties in the old class */ - curr_node=H5SL_first(pclass->props); + curr_node = H5SL_first(pclass->props); while(curr_node != NULL) { + H5P_genprop_t *pcopy; /* Property copy */ + /* Make a copy of the class's property */ if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") - /* Insert the initialized property into the property list */ - if(H5P_add_prop(new_class->props,pcopy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class"); + /* Insert the initialized property into the property class */ + if(H5P_add_prop(new_class->props, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ new_class->nprops++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Use the new class instead of the old one */ - pclass=new_class; + pclass = new_class; } /* end if */ - /* Create property object from parameters */ - if((new_prop=H5P_create_prop(name,size,H5P_PROP_WITHIN_CLASS,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); - - /* Insert property into property list class */ - if(H5P_add_prop(pclass->props,new_prop) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class"); - - /* Increment property count for class */ - pclass->nprops++; + /* Really register the property in the class */ + if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property") - /* Update the revision for the class */ - pclass->revision = H5P_GET_NEXT_REV; + /* Update pointer to pointer to class, if a new one was generated */ + if(new_class) + *ppclass = pclass; done: - if(ret_value==FAIL) { - if(new_prop!=NULL) { - if(new_prop->name!=NULL) - H5MM_xfree(new_prop->name); - if(new_prop->value!=NULL) - H5MM_xfree(new_prop->value); - (void)H5FL_FREE(H5P_genprop_t, new_prop); - } /* end if */ - } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + if(ret_value < 0) + if(new_class && H5P_close_class(new_class) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class") + + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_register() */ @@ -2103,72 +2296,62 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, 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) { - H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + H5P_genprop_t *new_prop = NULL; /* Temporary property pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_insert); + FUNC_ENTER_NOAPI_NOINIT(H5P_insert) - assert(plist); - assert(name); - assert((size>0 && value!=NULL) || (size==0)); + HDassert(plist); + HDassert(name); + HDassert((size > 0 && value != NULL) || (size == 0)); /* Check for duplicate named properties */ - if(H5SL_search(plist->props,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); + if(NULL != H5SL_search(plist->props, name)) + HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") /* Check if the property has been deleted */ - if(H5SL_search(plist->del,name)!=NULL) { + if(NULL != H5SL_search(plist->del, name)) { /* Remove the property name from the deleted property skip list */ - if(H5SL_remove(plist->del,name) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from deleted skip list"); - - /* Fall through to add property to list */ + if(NULL == H5SL_remove(plist->del, name)) + HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from deleted skip list") } /* end if */ else { H5P_genclass_t *tclass; /* Temporary class pointer */ /* Check if the property is already in the class hierarchy */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { + tclass = plist->pclass; + while(tclass) { + if(tclass->nprops > 0) { /* Find the property in the class */ - if(H5SL_search(tclass->props,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); + if(NULL != H5SL_search(tclass->props, name)) + HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") } /* end if */ /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ - - /* Fall through to add property to list */ } /* end else */ /* Ok to add to property list */ /* Create property object from parameters */ - if((new_prop=H5P_create_prop(name,size,H5P_PROP_WITHIN_LIST,value,NULL,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); + if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") /* Insert property into property list class */ - if(H5P_add_prop(plist->props,new_prop) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class"); + if(H5P_add_prop(plist->props, new_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") /* Increment property count for class */ plist->nprops++; done: - if(ret_value==FAIL) { - if(new_prop!=NULL) { - if(new_prop->name!=NULL) - H5MM_xfree(new_prop->name); - if(new_prop->value!=NULL) - H5MM_xfree(new_prop->value); - (void)H5FL_FREE(H5P_genprop_t, new_prop); - } /* end if */ - } /* end if */ + if(ret_value < 0) + if(new_prop && H5P_free_prop(new_prop) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") - FUNC_LEAVE_NOAPI(ret_value); -} /* H5P_insert() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P_insert() */ /*-------------------------------------------------------------------------- @@ -2209,21 +2392,21 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_set, FAIL); + FUNC_ENTER_NOAPI(H5P_set, FAIL) - assert(plist); - assert(name); - assert(value); + HDassert(plist); + HDassert(name); + HDassert(value); /* Check if the property has been deleted */ if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Find property in changed list */ if(NULL != (prop = (H5P_genprop_t *)H5SL_search(plist->props, name))) { /* Check for property size >0 */ if(prop->size==0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Make a copy of the value and pass to 'set' callback */ if(prop->set!=NULL) { @@ -2231,13 +2414,13 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) /* Make a copy of the current value, in case the callback fails */ if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") HDmemcpy(tmp_value,value,prop->size); /* Call user's callback */ if((*(prop->set))(plist->plist_id,name,prop->size,tmp_value) < 0) { H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") } /* end if */ /* Copy new [possibly unchanged] value into property value */ @@ -2264,7 +2447,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) /* Check for property size >0 */ if(prop->size==0) - HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size"); + HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size") /* Make a copy of the value and pass to 'set' callback */ if(prop->set!=NULL) { @@ -2272,26 +2455,26 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) /* Make a copy of the current value, in case the callback fails */ if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") HDmemcpy(tmp_value,value,prop->size); /* Call user's callback */ if((*(prop->set))(plist->plist_id,name,prop->size,tmp_value) < 0) { H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") } /* end if */ if((prop->cmp)(tmp_value,prop->value,prop->size)) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") /* Copy new value into property value */ HDmemcpy(pcopy->value,tmp_value,pcopy->size); /* Insert the changed property into the property list */ if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") } /* end if */ /* Free the temporary value buffer */ @@ -2302,13 +2485,13 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) if((prop->cmp)(value,prop->value,prop->size)) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") HDmemcpy(pcopy->value,value,pcopy->size); /* Insert the changed property into the property list */ if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") } /* end if */ } /* end else */ @@ -2324,11 +2507,11 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) /* If we get this far, then it wasn't in the list of changed properties, * nor in the properties in the class hierarchy, indicate an error */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_set() */ @@ -2356,39 +2539,39 @@ done: htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name) { - htri_t ret_value=FAIL; /* return value */ + htri_t ret_value = FAIL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_exist_plist); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_exist_plist) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Check for property in deleted property list */ - if(H5SL_search(plist->del,name)!=NULL) - ret_value=0; + if(H5SL_search(plist->del, name) != NULL) + ret_value = FALSE; else { /* Check for property in changed property list */ - if(H5SL_search(plist->props,name)!=NULL) - ret_value=1; + if(H5SL_search(plist->props, name) != NULL) + ret_value = TRUE; else { H5P_genclass_t *tclass; /* Temporary class pointer */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(H5SL_search(tclass->props,name)!=NULL) - HGOTO_DONE(1); + tclass = plist->pclass; + while(tclass != NULL) { + if(H5SL_search(tclass->props, name) != NULL) + HGOTO_DONE(TRUE) /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* If we've reached here, we couldn't find the property */ - ret_value=0; + ret_value = FALSE; } /* end else */ } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_exist_plist() */ @@ -2402,11 +2585,11 @@ done: H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to check for RETURNS - Success: Positive if the property exists in the property list, zero + Success: Positive if the property exists in the property class, zero if the property does not exist. Failure: negative value DESCRIPTION - This routine checks if a property exists within a property list. + This routine checks if a property exists within a property class. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -2416,20 +2599,34 @@ done: htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) { - htri_t ret_value=FAIL; /* return value */ + htri_t ret_value = FAIL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_exist_pclass); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_exist_pclass) - assert(pclass); - assert(name); + HDassert(pclass); + HDassert(name); /* Check for property in property list */ - if(H5SL_search(pclass->props,name) == NULL) - ret_value=0; - else - ret_value=1; + if(H5SL_search(pclass->props, name) != NULL) + ret_value = TRUE; + else { + H5P_genclass_t *tclass; /* Temporary class pointer */ + + tclass = pclass->parent; + while(tclass != NULL) { + if(H5SL_search(tclass->props, name) != NULL) + HGOTO_DONE(TRUE) + + /* Go up to parent class */ + tclass = tclass->parent; + } /* end while */ - FUNC_LEAVE_NOAPI(ret_value); + /* If we've reached here, we couldn't find the property */ + ret_value = FALSE; + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_exist_pclass() */ @@ -2461,21 +2658,21 @@ H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_get_size_plist); + FUNC_ENTER_NOAPI_NOINIT(H5P_get_size_plist) - assert(plist); - assert(name); - assert(size); + HDassert(plist); + HDassert(name); + HDassert(size); /* Find property */ if((prop=H5P_find_prop_plist(plist,name)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Get property size */ *size=prop->size; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_size_plist() */ @@ -2507,21 +2704,21 @@ H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_get_size_pclass); + FUNC_ENTER_NOAPI_NOINIT(H5P_get_size_pclass) - assert(pclass); - assert(name); - assert(size); + HDassert(pclass); + HDassert(name); + HDassert(size); /* Find property */ if((prop=H5P_find_prop_pclass(pclass,name)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Get property size */ *size=prop->size; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_size_pclass() */ @@ -2549,14 +2746,14 @@ H5P_get_class(const H5P_genplist_t *plist) { H5P_genclass_t *ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_class); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_class) HDassert(plist); /* Get property size */ ret_value = plist->pclass; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_class() */ @@ -2583,7 +2780,7 @@ H5P_get_class(const H5P_genplist_t *plist) herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_nprops_plist); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_nprops_plist) HDassert(plist); HDassert(nprops); @@ -2591,7 +2788,7 @@ H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) /* Get property size */ *nprops = plist->nprops; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5P_get_nprops_plist() */ @@ -2669,7 +2866,7 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) int cmp_value; /* Value from comparison */ int ret_value = 0; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_cmp_prop); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_cmp_prop) HDassert(prop1); HDassert(prop2); @@ -2727,7 +2924,7 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_cmp_prop() */ @@ -2760,7 +2957,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) int cmp_value; /* Value from comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_cmp_class); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_cmp_class) HDassert(pclass1); HDassert(pclass2); @@ -2833,7 +3030,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_cmp_class() */ @@ -2866,7 +3063,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2) int cmp_value; /* Value from comparison */ int ret_value = 0; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_cmp_plist); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_cmp_plist) HDassert(plist1); HDassert(plist2); @@ -2940,7 +3137,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2) HGOTO_DONE(cmp_value); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_cmp_plist() */ @@ -2972,10 +3169,10 @@ H5P_isa_class_real(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2) { htri_t ret_value; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_isa_class_real); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_isa_class_real) - assert(pclass1); - assert(pclass2); + HDassert(pclass1); + HDassert(pclass2); /* Compare property classes */ if(H5P_cmp_class(pclass1, pclass2) == 0) { @@ -2989,7 +3186,7 @@ H5P_isa_class_real(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2) } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_isa_class_real() */ @@ -3025,20 +3222,20 @@ H5P_isa_class(hid_t plist_id, hid_t pclass_id) H5P_genclass_t *pclass; /* Property list class */ htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_isa_class, FAIL); + FUNC_ENTER_NOAPI(H5P_isa_class, FAIL) /* Check arguments. */ if(NULL == (plist = (H5P_genplist_t *)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(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") /* Compare the property list's class against the other class */ if((ret_value = H5P_isa_class_real(plist->pclass, pclass)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to compare property list classes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to compare property list classes") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_isa_class() */ @@ -3152,18 +3349,18 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_ int curr_idx = 0; /* Current iteration index */ int ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_iterate_plist); + FUNC_ENTER_NOAPI_NOINIT(H5P_iterate_plist) HDassert(idx); HDassert(iter_func); /* Get the property list object */ if(NULL == (plist = (H5P_genplist_t *)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") /* Create the skip list to hold names of properties already seen */ if((seen = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties") /* Walk through the changed properties in the list */ if(H5SL_count(plist->props) > 0) { @@ -3186,7 +3383,7 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_ /* Add property name to "seen" list */ if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") /* Get the next property node in the skip list */ curr_node=H5SL_next(curr_node); @@ -3224,7 +3421,7 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_ /* Add property name to "seen" list */ if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") } /* end if */ /* Get the next property node in the skip list */ @@ -3244,7 +3441,7 @@ done: if(seen!=NULL) H5SL_close(seen); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_iterate_plist() */ @@ -3308,14 +3505,14 @@ H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *ite int curr_idx=0; /* Current iteration index */ int ret_value=FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_iterate_pclass); + FUNC_ENTER_NOAPI_NOINIT(H5P_iterate_pclass) - assert(idx); - assert(iter_func); + HDassert(idx); + HDassert(iter_func); /* Get the property list object */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") /* Cycle through the properties and call the callback */ curr_idx=0; @@ -3344,7 +3541,7 @@ done: /* Set the index we stopped at */ *idx=curr_idx; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_iterate_pclass() */ @@ -3380,16 +3577,16 @@ H5P_peek_unsigned(H5P_genplist_t *plist, const char *name) { unsigned ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_peek_unsigned, UFAIL); + FUNC_ENTER_NOAPI(H5P_peek_unsigned, UFAIL) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Get the value to return, don't worry about the return value, we can't return it */ H5P_get(plist,name,&ret_value); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_peek_unsigned() */ @@ -3425,16 +3622,16 @@ H5P_peek_hid_t(H5P_genplist_t *plist, const char *name) { hid_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_peek_hid_t, FAIL); + FUNC_ENTER_NOAPI(H5P_peek_hid_t, FAIL) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Get the value to return, don't worry about the return value, we can't return it */ H5P_get(plist,name,&ret_value); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_peek_hid_t() */ @@ -3470,16 +3667,16 @@ H5P_peek_voidp(H5P_genplist_t *plist, const char *name) { void * ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_peek_voidp, NULL); + FUNC_ENTER_NOAPI(H5P_peek_voidp, NULL) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Get the value to return, don't worry about the return value, we can't return it */ H5P_get(plist,name,&ret_value); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_peek_voidp() */ @@ -3515,16 +3712,16 @@ H5P_peek_size_t(H5P_genplist_t *plist, const char *name) { size_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_peek_size_t, UFAIL); + FUNC_ENTER_NOAPI(H5P_peek_size_t, UFAIL) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Get the value to return, don't worry about the return value, we can't return it */ H5P_get(plist,name,&ret_value); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_peek_size_t() */ @@ -3563,21 +3760,21 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_get, FAIL); + FUNC_ENTER_NOAPI(H5P_get, FAIL) - assert(plist); - assert(name); - assert(value); + HDassert(plist); + HDassert(name); + HDassert(value); /* Check if the property has been deleted */ if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Find property */ if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { /* Check for property size >0 */ if(prop->size==0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Make a copy of the value and pass to 'get' callback */ if(prop->get!=NULL) { @@ -3585,12 +3782,12 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) /* Make a copy of the current value, in case the callback fails */ if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") HDmemcpy(tmp_value,prop->value,prop->size); /* Call user's callback */ if((*(prop->get))(plist->plist_id,name,prop->size,tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't get property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't get property value") /* Copy new [possibly unchanged] value into return value */ HDmemcpy(value,tmp_value,prop->size); @@ -3614,7 +3811,7 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { /* Check for property size >0 */ if(prop->size==0) - HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size"); + HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size") /* Call the 'get' callback, if there is one */ if(prop->get!=NULL) { @@ -3622,13 +3819,13 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) /* Make a copy of the current value, in case the callback fails */ if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") HDmemcpy(tmp_value,prop->value,prop->size); /* Call user's callback */ if((*(prop->get))(plist->plist_id,name,prop->size,tmp_value) < 0) { H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") } /* end if */ if((prop->cmp)(tmp_value,prop->value,prop->size)) { @@ -3636,14 +3833,14 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") /* Copy new value into property value */ HDmemcpy(pcopy->value,tmp_value,prop->size); /* Insert the changed property into the property list */ if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") } /* end if */ /* Copy new [possibly unchanged] value into return value */ @@ -3668,11 +3865,11 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) /* If we get this far, then it wasn't in the list of changed properties, * nor in the properties in the class hierarchy, indicate an error */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get() */ @@ -3710,14 +3907,14 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) char *del_name; /* Pointer to deleted name */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_remove,FAIL); + FUNC_ENTER_NOAPI(H5P_remove, FAIL) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Indicate that the property isn't in the list if it has been deleted already */ if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") /* Get the property node from the changed property skip list */ if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { @@ -3725,20 +3922,20 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) if(prop->del!=NULL) { /* Call user's callback */ if((*(prop->del))(plist_id,name,prop->size,prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") } /* end if */ /* Duplicate string for insertion into new deleted property skip list */ if((del_name=H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") /* Insert property name into deleted list */ if(H5SL_insert(plist->del,del_name,del_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") /* Remove the property from the skip list */ if(H5SL_remove(plist->props,prop->name) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list") /* Free the property, ignoring return value, nothing we can do */ H5P_free_prop(prop); @@ -3763,13 +3960,13 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) /* Allocate space for a temporary copy of the property value */ if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") HDmemcpy(tmp_value,prop->value,prop->size); /* Call user's callback */ if((*(prop->del))(plist_id,name,prop->size,tmp_value) < 0) { H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") } /* end if */ /* Release the temporary value buffer */ @@ -3778,11 +3975,11 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) /* Duplicate string for insertion into new deleted property skip list */ if((del_name=H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") /* Insert property name into deleted list */ if(H5SL_insert(plist->del,del_name,del_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") /* Decrement the number of properties in list */ plist->nprops--; @@ -3799,11 +3996,11 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) /* If we get this far, then it wasn't in the list of changed properties, * nor in the properties in the class hierarchy, indicate an error */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_remove() */ @@ -3847,36 +4044,36 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *new_prop=NULL; /* Pointer to new property */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_copy_prop_plist); + FUNC_ENTER_NOAPI_NOINIT(H5P_copy_prop_plist) - assert(name); + HDassert(name); /* Get the objects to operate on */ if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_id)) || NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist") /* If the property exists in the destination alread */ if(H5P_find_prop_plist(dst_plist,name)!=NULL) { /* Delete the property from the destination list, calling the 'close' callback if necessary */ if(H5P_remove(dst_id,dst_plist,name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") /* Get the pointer to the source property */ prop=H5P_find_prop_plist(src_plist,name); /* Make a copy of the source property */ if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") /* Call property copy callback, if it exists */ if(new_prop->copy) { if((new_prop->copy)(new_prop->name,new_prop->size,new_prop->value) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") } /* end if */ /* Insert the initialized property into the property list */ if(H5P_add_prop(dst_plist->props,new_prop) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") /* Increment the number of properties in list */ dst_plist->nprops++; @@ -3888,17 +4085,17 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) /* Create property object from parameters */ if((new_prop=H5P_create_prop(prop->name,prop->size,H5P_PROP_WITHIN_LIST,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->cmp,prop->close)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") /* Call property creation callback, if it exists */ if(new_prop->create) { if((new_prop->create)(new_prop->name,new_prop->size,new_prop->value) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") } /* end if */ /* Insert property into property list class */ if(H5P_add_prop(dst_plist->props,new_prop) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ dst_plist->nprops++; @@ -3912,7 +4109,7 @@ done: H5P_free_prop(new_prop); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_copy_prop_plist() */ @@ -3946,36 +4143,59 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_pclass(H5P_genclass_t *dst_pclass, H5P_genclass_t *src_pclass, const char *name) +H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) { + H5P_genclass_t *src_pclass; /* Source property class, containing property to copy */ + H5P_genclass_t *dst_pclass; /* Destination property class */ + H5P_genclass_t *orig_dst_pclass; /* Original destination property class */ H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_copy_prop_pclass); + FUNC_ENTER_NOAPI_NOINIT(H5P_copy_prop_pclass) - assert(dst_pclass); - assert(src_pclass); - assert(name); + /* Sanity check */ + HDassert(name); + + /* Get propery list classes */ + if(NULL == (src_pclass = (H5P_genclass_t *)H5I_object(src_id))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "source property class object doesn't exist") + if(NULL == (dst_pclass = (H5P_genclass_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "destination property class object doesn't exist") + + /* Get the property from the source */ + if(NULL == (prop = H5P_find_prop_pclass(src_pclass, name))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property") /* If the property exists in the destination already */ - if(H5P_exist_pclass(dst_pclass,name)) { + if(H5P_exist_pclass(dst_pclass, name)) { /* Delete the old property from the destination class */ - if(H5P_unregister(dst_pclass,name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); + if(H5P_unregister(dst_pclass, name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") } /* end if */ - /* Get the property from the source */ - if((prop=H5P_find_prop_pclass(src_pclass,name)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property"); - /* Register the property into the destination */ - if(H5P_register(dst_pclass,name,prop->size,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->cmp,prop->close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); + orig_dst_pclass = dst_pclass; + if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, prop->del, prop->copy, prop->cmp, prop->close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") + + /* Check if the property class changed and needs to be substituted in the ID */ + if(dst_pclass != orig_dst_pclass) { + H5P_genclass_t *old_dst_pclass; /* Old destination property class */ + + /* Substitute the new destination property class in the ID */ + if(NULL == (old_dst_pclass = (H5P_genclass_t *)H5I_subst(dst_id, dst_pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID") + HDassert(old_dst_pclass == orig_dst_pclass); + + /* Close the previous class */ + if(H5P_close_class(orig_dst_pclass) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") + } /* end if */ done: /* Cleanup, if necessary */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_copy_prop_pclass() */ @@ -4006,18 +4226,18 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_unregister); + FUNC_ENTER_NOAPI_NOINIT(H5P_unregister) - assert(pclass); - assert(name); + HDassert(pclass); + HDassert(name); /* Get the property node from the skip list */ if((prop = (H5P_genprop_t *)H5SL_search(pclass->props,name)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") /* Remove the property from the skip list */ if(H5SL_remove(pclass->props,prop->name) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list") /* Free the property, ignoring return value, nothing we can do */ H5P_free_prop(prop); @@ -4029,7 +4249,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) pclass->revision = H5P_GET_NEXT_REV; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_unregister() */ @@ -4071,14 +4291,14 @@ H5P_close(void *_plist) unsigned make_cb=0; /* Operator data for property free callback */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_close); + FUNC_ENTER_NOAPI_NOINIT(H5P_close) - assert(plist); + HDassert(plist); /* Make call to property list class close callback, if needed * (up through chain of parent classes also) */ - if(plist->class_init !=0) { + if(plist->class_init) { tclass = plist->pclass; while(NULL != tclass) { if(NULL != tclass->close_func) { @@ -4097,7 +4317,7 @@ H5P_close(void *_plist) * already been seen) */ if((seen = H5SL_create(H5SL_TYPE_STR)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties") nseen = 0; /* Walk through the changed properties in the list */ @@ -4115,7 +4335,7 @@ H5P_close(void *_plist) /* Add property name to "seen" list */ if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") nseen++; /* Get the next property node in the skip list */ @@ -4152,7 +4372,7 @@ H5P_close(void *_plist) /* Allocate space for a temporary copy of the property value */ if(NULL==(tmp_value=H5MM_malloc(tmp->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") HDmemcpy(tmp_value,tmp->value,tmp->size); /* Call the 'close' callback */ @@ -4165,7 +4385,7 @@ H5P_close(void *_plist) /* Add property name to "seen" list, if we have other classes to work on */ if(has_parent_class) { if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list"); + HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") nseen++; } /* end if */ } /* end if */ @@ -4181,7 +4401,7 @@ H5P_close(void *_plist) /* Decrement class's dependant property list value! */ if(H5P_access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") /* Free the list of 'seen' properties */ H5SL_close(seen); @@ -4201,7 +4421,7 @@ done: if(seen != NULL) H5SL_close(seen); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_close() */ @@ -4230,15 +4450,15 @@ H5P_get_class_name(H5P_genclass_t *pclass) { char *ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_get_class_name, NULL); + FUNC_ENTER_NOAPI(H5P_get_class_name, NULL) - assert(pclass); + HDassert(pclass); /* Get class name */ ret_value=H5MM_xstrdup(pclass->name); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_class_name() */ @@ -4271,9 +4491,9 @@ H5P_get_class_path(H5P_genclass_t *pclass) size_t my_path_len; /* This class's name's length */ char *ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_get_class_path); + FUNC_ENTER_NOAPI_NOINIT(H5P_get_class_path) - assert(pclass); + HDassert(pclass); /* Recursively build the full path */ if(pclass->parent!=NULL) { @@ -4288,7 +4508,7 @@ H5P_get_class_path(H5P_genclass_t *pclass) * separator, this class's name and the string terminator */ if(NULL == (ret_value = (char *)H5MM_malloc(par_path_len + 1 + my_path_len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") /* Build the full path for this class */ HDstrcpy(ret_value,par_path); @@ -4305,7 +4525,7 @@ H5P_get_class_path(H5P_genclass_t *pclass) ret_value=H5MM_xstrdup(pclass->name); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_class_path() */ @@ -4359,7 +4579,7 @@ H5P_open_class_path(const char *path) /* Find the class with this name & parent by iterating over the open classes */ if(NULL == (curr_class = (H5P_genclass_t *)H5I_search(H5I_GENPROP_CLS, H5P_check_class, &check_info, FALSE))) - HGOTO_ERROR (H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") /* Advance the pointer in the path to the start of the next component */ curr_name=delimit+1; @@ -4411,14 +4631,14 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) { H5P_genclass_t *ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_class_parent); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_class_parent) - assert(pclass); + HDassert(pclass); /* Get property size */ ret_value = pclass->parent; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_class_parent() */ @@ -4442,18 +4662,18 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) herr_t H5P_close_class(void *_pclass) { - H5P_genclass_t *pclass=(H5P_genclass_t *)_pclass; - herr_t ret_value=SUCCEED; /* Return value */ + H5P_genclass_t *pclass = (H5P_genclass_t *)_pclass; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_close_class); + FUNC_ENTER_NOAPI_NOINIT(H5P_close_class) - assert(pclass); + HDassert(pclass); /* Decrement the reference count & check if the object should go away */ - if(H5P_access_class(pclass,H5P_MOD_DEC_REF) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_NOTFOUND, FAIL, "Can't decrement ID ref count"); + if(H5P_access_class(pclass, H5P_MOD_DEC_REF) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_close_class() */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 608240f..22cef28 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -158,27 +158,23 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_lacc_reg_prop) /* Register property for number of links traversed */ - if(H5P_register(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, - &nlinks, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &nlinks, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link prefix */ - if(H5P_register(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, - &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ - if(H5P_register(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &def_fapl_id, NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, NULL, H5L_ACS_ELINK_FAPL_CLOSE) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &def_fapl_id, NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, NULL, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file access flags */ - if(H5P_register(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, - &elink_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &elink_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file traversal callback */ - if(H5P_register(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, - &elink_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &elink_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 1e4355e..ffc68fa 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -119,8 +119,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI(H5P_lcrt_reg_prop, FAIL) /* Register create intermediate groups property */ - if(H5P_register(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, - &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 9f144f1..ac46228 100755 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -136,23 +136,19 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT(H5P_ocrt_reg_prop) /* Register max. compact attribute storage property */ - if(H5P_register(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, - &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register min. dense attribute storage property */ - if(H5P_register(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, - &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object header flags property */ - if(H5P_register(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, - &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the pipeline property */ - if(H5P_register(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, - &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 2b43428..963dddc 100755 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -118,8 +118,7 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI(H5P_ocpy_reg_prop, FAIL) /* Register copy options property */ - if(H5P_register(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, - &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index fd9c65a..1e71049 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -69,7 +69,7 @@ typedef struct H5P_genprop_t { size_t size; /* Size of property value */ void *value; /* Pointer to property value */ H5P_prop_within_t type; /* Type of object the property is within */ - unsigned shared_name; /* Boolean: whether the name is shared or not */ + hbool_t shared_name; /* Whether the name is shared or not */ /* Callback function pointers & info */ H5P_prp_create_func_t create; /* Function to call when a property is created */ @@ -89,8 +89,8 @@ struct H5P_genclass_t { unsigned plists; /* Number of property lists that have been created since the last modification to the class */ unsigned classes; /* Number of classes that have been derived since the last modification to the class */ unsigned ref_count; /* Number of oustanding ID's open on this class object */ - unsigned internal; /* Whether this class is internal to the library or not */ - unsigned deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */ + hbool_t internal; /* Whether this class is internal to the library or not */ + hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */ unsigned revision; /* Revision number of a particular class (global) */ H5SL_t *props; /* Skip list containing properties */ @@ -106,9 +106,9 @@ struct H5P_genclass_t { /* Define structure to hold property list information */ struct H5P_genplist_t { H5P_genclass_t *pclass; /* Pointer to class info */ - hid_t plist_id; /* Copy of the property list ID (for use in close callback) */ - size_t nprops; /* Number of properties in class */ - unsigned class_init:1; /* Whether the class initialization callback finished successfully */ + hid_t plist_id; /* Copy of the property list ID (for use in close callback) */ + size_t nprops; /* Number of properties in class */ + hbool_t class_init; /* Whether the class initialization callback finished successfully */ H5SL_t *del; /* Skip list containing names of deleted properties */ H5SL_t *props; /* Skip list containing properties */ }; @@ -155,6 +155,16 @@ H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass); +H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, + const void *def_value, H5P_prp_create_func_t prp_create, 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 H5P_register(H5P_genclass_t **pclass, const char *name, size_t size, + const void *def_value, H5P_prp_create_func_t prp_create, 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 H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name); @@ -171,8 +181,7 @@ H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *iter_data); H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_copy_prop_pclass(H5P_genclass_t *dst_pclass, H5P_genclass_t *src_pclass, - const char *name); +H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass); H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index f544dbc..ab3f1d0 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -70,11 +70,6 @@ H5_DLL htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); -H5_DLL herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, - const void *def_value, H5P_prp_create_func_t prp_create, 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 hid_t H5P_get_driver(H5P_genplist_t *plist); H5_DLL void * H5P_get_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 7e3195e..5125511 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -117,8 +117,7 @@ H5P_strcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI(H5P_strcrt_reg_prop, FAIL) /* Register character encoding */ - if(H5P_register(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, - &char_encoding, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &char_encoding, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 5f4c74d..d2e46cf 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -384,8 +384,8 @@ H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter) static herr_t H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { - H5S_pnt_node_t *top, *curr, *new_node; /* Point selection nodes */ - unsigned i; /* Counter */ + H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */ + unsigned u; /* Counter */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5S_point_add) @@ -395,26 +395,27 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co HDassert(coord); HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); - top = curr = NULL; - for(i = 0; i < num_elem; i++) { + for(u = 0; u < num_elem; u++) { /* Allocate space for the new node */ if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node") + /* Initialize fields in node */ + new_node->next = NULL; if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(space->extent.rank * sizeof(hsize_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information") /* Copy over the coordinates */ - HDmemcpy(new_node->pnt, coord + (i * space->extent.rank), (space->extent.rank * sizeof(hsize_t))); + HDmemcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t))); /* Link into list */ - new_node->next = NULL; if(top == NULL) top = new_node; else curr->next = new_node; curr = new_node; } /* end for */ + new_node = NULL; /* Insert the list of points selected in the proper place */ if(op == H5S_SELECT_SET || op == H5S_SELECT_PREPEND) { @@ -426,13 +427,15 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co space->select.sel_info.pnt_lst->head = top; } /* end if */ else { /* op==H5S_SELECT_APPEND */ - new_node = space->select.sel_info.pnt_lst->head; - if(new_node != NULL) { - while(new_node->next != NULL) - new_node = new_node->next; + H5S_pnt_node_t *tmp_node; /* Temporary point selection node */ + + tmp_node = space->select.sel_info.pnt_lst->head; + if(tmp_node != NULL) { + while(tmp_node->next != NULL) + tmp_node = tmp_node->next; /* Append new list to point selection */ - new_node->next = top; + tmp_node->next = top; } /* end if */ else space->select.sel_info.pnt_lst->head = top; @@ -445,6 +448,20 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co space->select.num_elem += num_elem; done: + if(ret_value < 0) { + /* Release possibly partially initialized new node */ + if(new_node) + new_node = H5FL_FREE(H5S_pnt_node_t, new_node); + + /* Release possible linked list of nodes */ + while(top) { + curr = top->next; + H5MM_xfree(top->pnt); + top = H5FL_FREE(H5S_pnt_node_t, top); + top = curr; + } /* end while */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_add() */ @@ -477,20 +494,19 @@ H5S_point_release (H5S_t *space) HDassert(space); /* Delete all the nodes from the list */ - curr=space->select.sel_info.pnt_lst->head; - while(curr!=NULL) { - next=curr->next; + curr = space->select.sel_info.pnt_lst->head; + while(curr != NULL) { + next = curr->next; H5MM_xfree(curr->pnt); - (void)H5FL_FREE(H5S_pnt_node_t, curr); - curr=next; + curr = H5FL_FREE(H5S_pnt_node_t, curr); + curr = next; } /* end while */ /* Free & reset the point list header */ - (void)H5FL_FREE(H5S_pnt_list_t, space->select.sel_info.pnt_lst); - space->select.sel_info.pnt_lst=NULL; + space->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, space->select.sel_info.pnt_lst); /* Reset the number of elements in the selection */ - space->select.num_elem=0; + space->select.num_elem = 0; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_release() */ |