summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-27 20:51:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-27 20:51:49 (GMT)
commitc3e5a191940ab521fad2c917e852622cbebd67c8 (patch)
tree3cafb70c78389ee106a78eb60fd28b7bef98c1ad
parentc56a7d4ee29dc2ae89e76c8915bc142bd62485b1 (diff)
downloadhdf5-c3e5a191940ab521fad2c917e852622cbebd67c8.zip
hdf5-c3e5a191940ab521fad2c917e852622cbebd67c8.tar.gz
hdf5-c3e5a191940ab521fad2c917e852622cbebd67c8.tar.bz2
[svn-r18348] Description:
Bring r18346 from trunk to 1.8 branch: Bring Coverity fixes back from branch to trunk: r18336: Fix coverity issues 275, 276, 277, 323, 432, 433, and 434 r18337: Fix Coverity issue #106: release free space section node on error r18338: Fixed Coverity #94 - In H5P_register, new_class wasn't closed when there's an error after it's created. r18339: Fix Coverity #185 - In test_conv_str_1, BUF wasn't freed when there's an error in this function. r18340: Correct error in r18337 that wasn't releasing indirect fractal heap block early enough. r18341: Close nodes if any failed in the middle of allocating new nodes. Coverity 140 and 141 r18342: Correct [another] problem w/r18337. r18343: Fix coverity items 185, 20, and 21. r18344: Fix Coverity 213 - In H5FD_family_close, the double pointer file->memb was dereferenced without NULL checking (We believe). r18345: Fix Coverity issue # 210; removed NULL check after pointer dereferenced in H5HFdblock.c. Also assigned NULL to pointer in H5Pint.c to fix segmentation fault. Tested on: FreeBSD/32 6.3 (duty) w/debug) (h5committested on trunk)
-rw-r--r--src/H5FDfamily.c38
-rw-r--r--src/H5HFdblock.c2
-rw-r--r--src/H5HFiblock.c4
-rw-r--r--src/H5HFman.c19
-rw-r--r--src/H5HFpkg.h3
-rw-r--r--src/H5HFsection.c7
-rw-r--r--src/H5I.c38
-rw-r--r--src/H5Iprivate.h1
-rw-r--r--src/H5P.c72
-rw-r--r--src/H5Pdapl.c6
-rw-r--r--src/H5Pdcpl.c8
-rw-r--r--src/H5Pdeprec.c22
-rw-r--r--src/H5Pdxpl.c42
-rw-r--r--src/H5Pfapl.c38
-rw-r--r--src/H5Pfcpl.c22
-rw-r--r--src/H5Pfmpl.c2
-rw-r--r--src/H5Pgcpl.c6
-rw-r--r--src/H5Pint.c1024
-rw-r--r--src/H5Plapl.c14
-rw-r--r--src/H5Plcpl.c3
-rwxr-xr-xsrc/H5Pocpl.c12
-rwxr-xr-xsrc/H5Pocpypl.c3
-rw-r--r--src/H5Ppkg.h25
-rw-r--r--src/H5Pprivate.h5
-rw-r--r--src/H5Pstrcpl.c3
-rw-r--r--src/H5Spoint.c58
-rw-r--r--test/dsets.c122
-rw-r--r--test/dtransform.c14
-rw-r--r--test/dtypes.c576
-rw-r--r--test/tgenprop.c48
30 files changed, 1303 insertions, 934 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 2716554..cde747c 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -313,7 +313,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 5b28d88..6fa8b42 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 1728248..44577f4 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 */
@@ -722,6 +722,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 */
diff --git a/src/H5I.c b/src/H5I.c
index cf78d3b..db3cf6c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -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);
diff --git a/src/H5P.c b/src/H5P.c
index 212b308..2e69461 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -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 208fcb2..5050c95 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 d0418e5..4442187 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -155,41 +155,41 @@ 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")
done:
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() */
diff --git a/test/dsets.c b/test/dsets.c
index 1b2aca4..b484365 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -690,93 +690,100 @@ test_compact_io(hid_t fapl)
* Purpose: Tests compact dataset of maximal size.
*
* Return: Success: 0
- *
* Failure: -1
*
* Programmer: Raymond Lu
* August 8, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_max_compact(hid_t fapl)
{
- hid_t file, dataset, space, plist;
+ hid_t file = -1;
+ hid_t dataset = -1;
+ hid_t space = -1;
+ hid_t plist = -1;
hsize_t dims[1];
- hsize_t compact_size;
- herr_t status;
- int *wbuf, *rbuf;
+ size_t compact_size;
+ int *wbuf = NULL;
+ int *rbuf = NULL;
char filename[FILENAME_BUF_SIZE];
- int i, n;
+ int n;
+ size_t u;
TESTING("compact dataset of maximal size");
/* Test compact dataset of size 64KB-64 */
/* Initialize data */
- compact_size = (SIXTY_FOUR_KB-64)/sizeof(int);
+ compact_size = (SIXTY_FOUR_KB - 64) / sizeof(int);
- wbuf = (int*)HDmalloc(sizeof(int)*(size_t)compact_size);
- assert(wbuf);
- rbuf = (int*)HDmalloc(sizeof(int)*(size_t)compact_size);
- assert(rbuf);
+ if(NULL == (wbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
+ TEST_ERROR
+ if(NULL == (rbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
+ TEST_ERROR
- n=0;
- for(i=0; i<(int)compact_size; i++)
- wbuf[i] = n++;
+ n = 0;
+ for(u = 0; u < compact_size; u++)
+ wbuf[u] = n++;
/* Create a small data space for compact dataset */
- dims[0] = compact_size;
- space = H5Screate_simple(1, dims, NULL);
- assert(space>=0);
+ dims[0] = (hsize_t)compact_size;
+ if((space = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create a file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create property list for compact dataset creation */
- plist = H5Pcreate(H5P_DATASET_CREATE);
- assert(plist >= 0);
- status = H5Pset_layout(plist, H5D_COMPACT);
- assert(status >= 0);
+ if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(plist, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
/* Create and write to a compact dataset */
if((dataset = H5Dcreate2(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR
if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
- goto error;
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Sclose(space) < 0) goto error;
- if(H5Pclose(plist) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(plist) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/*
* Open the file and check data
*/
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- goto error;
+ FAIL_STACK_ERROR
if((dataset = H5Dopen2(file, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- goto error;
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written */
- for(i = 0; i < (int)compact_size; i++)
- if(rbuf[i] != wbuf[i]) {
+ for(u = 0; u < compact_size; u++)
+ if(rbuf[u] != wbuf[u]) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %d\n", i);
+ printf(" At index %u\n", (unsigned)u);
goto error;
} /* end if */
- if(H5Dclose(dataset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
HDfree(wbuf);
wbuf = NULL;
HDfree(rbuf);
@@ -785,20 +792,20 @@ test_max_compact(hid_t fapl)
/* Test compact dataset of size 64KB */
/* Create a data space for compact dataset */
- compact_size = SIXTY_FOUR_KB/sizeof(int);
- dims[0] = compact_size;
- space = H5Screate_simple(1, dims, NULL);
- assert(space>=0);
+ compact_size = SIXTY_FOUR_KB / sizeof(int);
+ dims[0] = (hsize_t)compact_size;
+ if((space = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Open file */
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
goto error;
/* Create property list for compact dataset creation */
- plist = H5Pcreate(H5P_DATASET_CREATE);
- assert(plist >= 0);
- status = H5Pset_layout(plist, H5D_COMPACT);
- assert(status >= 0);
+ if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(plist, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
/* Create and write to a compact dataset */
H5E_BEGIN_TRY {
@@ -806,9 +813,12 @@ test_max_compact(hid_t fapl)
} H5E_END_TRY;
/* Close file */
- H5Sclose(space);
- H5Pclose(plist);
- H5Fclose(file);
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(plist) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
@@ -828,7 +838,7 @@ error:
} H5E_END_TRY;
return -1;
-}
+} /* end test_max_compact() */
/*-------------------------------------------------------------------------
@@ -1003,10 +1013,10 @@ test_tconv(hid_t file)
hid_t space = -1, dataset = -1;
int i;
- out = (char *)HDmalloc((size_t)(4 * 1000 * 1000));
- HDassert(out);
- in = (char *)HDmalloc((size_t)(4 * 1000 * 1000));
- HDassert(in);
+ if ((out = (char *)HDmalloc((size_t)(4 * 1000 * 1000))) == NULL)
+ goto error;
+ if ((in = (char *)HDmalloc((size_t)(4 * 1000 * 1000))) == NULL)
+ goto error;
TESTING("data type conversion");
diff --git a/test/dtransform.c b/test/dtransform.c
index 3b1133a..9af1dfb 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -240,7 +240,13 @@ const int transformData[ROWS][COLS] =
int main(void)
{
- hid_t dxpl_id_c_to_f = -1, dxpl_id_c_to_f_copy = -1, dxpl_id_simple = -1, dxpl_id_polynomial = -1, dxpl_id_polynomial_copy = -1, dxpl_id_utrans_inv = -1, file_id = -1;
+ hid_t dxpl_id_c_to_f = -1;
+ hid_t dxpl_id_c_to_f_copy = 1;
+ hid_t dxpl_id_simple = -1;
+ hid_t dxpl_id_polynomial = -1;
+ hid_t dxpl_id_polynomial_copy = -1;
+ hid_t dxpl_id_utrans_inv = -1;
+ hid_t file_id = -1;
const char* c_to_f = "(9/5.0)*x + 32";
const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
@@ -367,7 +373,11 @@ init_test(hid_t file_id)
/* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */
const char* utrans = "((x+100)/4)*3";
- hid_t dataspace = -1, dxpl_id_f_to_c = -1, dxpl_id_utrans = -1, cparms = -1, filespace = -1;
+ hid_t dataspace = -1;
+ hid_t dxpl_id_f_to_c = -1;
+ hid_t dxpl_id_utrans = -1;
+ hid_t cparms = -1;
+ hid_t filespace = -1;
hsize_t dim[2] = { ROWS, COLS };
hsize_t offset[2] = { 0, 0 };
diff --git a/test/dtypes.c b/test/dtypes.c
index 3751841..227cf79 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -34,9 +34,6 @@
/* For test_compound_8 and test_compound_10 */
#define ARRAY_DIM 4
-/* Epsilon for floating-point comparisons */
-#define FP_EPSILON 0.000001
-
/*
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
@@ -92,13 +89,6 @@ typedef struct complex_t {
double im;
} complex_t;
-/*
- * Count up or down depending on whether the machine is big endian or little
- * endian. If local variable `endian' is H5T_ORDER_BE then the result will
- * be I, otherwise the result will be Z-(I+1).
- */
-#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
-
typedef enum dtype_t {
INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, FLT_FLOAT, FLT_DOUBLE,
@@ -528,7 +518,7 @@ test_compound_1(void)
/* Attempt to add the new compound datatype as a field within itself */
H5E_BEGIN_TRY {
- ret=H5Tinsert(complex_id, "compound", 0, complex_id);
+ ret=H5Tinsert(complex_id, "compound", (size_t)0, complex_id);
} H5E_END_TRY;
if (ret>=0) {
FAIL_PUTS_ERROR("Inserted compound datatype into itself?");
@@ -1045,8 +1035,8 @@ test_compound_5(void)
{"two", 202, {204, 205, 206, 207}}};
dst_type_t *dst;
- void *buf = calloc(2, sizeof(dst_type_t));
- void *bkg = calloc(2, sizeof(dst_type_t));
+ void *buf = HDcalloc((size_t)2, sizeof(dst_type_t));
+ void *bkg = HDcalloc((size_t)2, sizeof(dst_type_t));
int retval = 1;
#if 1
@@ -1061,16 +1051,16 @@ test_compound_5(void)
/* Build datatypes */
short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short));
array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
- H5Tinsert(short_array, "_", 0, array_dt);
+ H5Tinsert(short_array, "_", (size_t)0, array_dt);
H5Tclose(array_dt);
int_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(int));
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, dims);
- H5Tinsert(int_array, "_", 0, array_dt);
+ H5Tinsert(int_array, "_", (size_t)0, array_dt);
H5Tclose(array_dt);
string = H5Tcopy(H5T_C_S1);
- H5Tset_size(string, 16);
+ H5Tset_size(string, (size_t)16);
src_type = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t));
H5Tinsert(src_type, "name", HOFFSET(src_type_t, name), string );
@@ -1084,7 +1074,7 @@ test_compound_5(void)
/* Convert data */
HDmemcpy(buf, src, sizeof(src));
- H5Tconvert(src_type, dst_type, 2, buf, bkg, H5P_DEFAULT);
+ H5Tconvert(src_type, dst_type, (size_t)2, buf, bkg, H5P_DEFAULT);
dst = (dst_type_t*)buf;
/* Cleanup */
@@ -2073,14 +2063,14 @@ test_compound_11(void)
if((bkg=HDmalloc(sizeof(big_t)*NTESTELEM))==NULL) TEST_ERROR
/* Initialize buffer */
- for(u=0; u<NTESTELEM; u++) {
- ((big_t *)buf)[u].d1=(double)u*(double)1.5;
- ((big_t *)buf)[u].d2=(double)u*(double)2.5;
- ((big_t *)buf)[u].d3=(double)u*(double)3.5;
- ((big_t *)buf)[u].i1=u*3;
- ((big_t *)buf)[u].i2=u*5;
- ((big_t *)buf)[u].s1=HDmalloc(32);
- sprintf(((big_t *)buf)[u].s1,"%u",(unsigned)u);
+ for(u = 0; u < NTESTELEM; u++) {
+ ((big_t *)buf)[u].d1 = (double)u * (double)1.5;
+ ((big_t *)buf)[u].d2 = (double)u * (double)2.5;
+ ((big_t *)buf)[u].d3 = (double)u * (double)3.5;
+ ((big_t *)buf)[u].i1 = u * 3;
+ ((big_t *)buf)[u].i2 = u * 5;
+ ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
+ sprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */
/* Make copy of buffer before conversion */
@@ -2093,7 +2083,7 @@ test_compound_11(void)
if((little_tid2=H5Tcopy(little_tid)) < 0) TEST_ERROR
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid2,little_tid2,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tconvert(big_tid2,little_tid2,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
@@ -2121,9 +2111,9 @@ test_compound_11(void)
} /* end for */
/* Build source and destination types for conversion routine */
- if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
if(H5Tset_tag(opaq_src_tid, "opaque source type") < 0) TEST_ERROR
- if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
if(H5Tset_tag(opaq_dst_tid, "opaque destination type") < 0) TEST_ERROR
/* Register new type conversion routine */
@@ -2133,7 +2123,7 @@ test_compound_11(void)
HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM);
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tconvert(big_tid,little_tid,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
@@ -2167,7 +2157,7 @@ test_compound_11(void)
HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM);
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tconvert(big_tid,little_tid,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
@@ -2248,7 +2238,7 @@ test_compound_12(void)
TESTING("adjust size of compound datatypes");
/* Create a compound type of minimal size */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, 1)) < 0) goto error;
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, (size_t)1)) < 0) goto error;
/* Verify the size */
if((new_size=H5Tget_size(complex_id))==0) goto error;
@@ -2502,19 +2492,19 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid,"c1",0,H5T_STD_I64BE) < 0) {
+ if(H5Tinsert(cmpd_f1_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid,"c2",8,H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_f1_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid, "vl_string",8 + 1, str_id) < 0) {
+ if(H5Tinsert(cmpd_f1_tid, "vl_string",(size_t)(8 + 1), str_id) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'vl_string'\n");
goto error;
@@ -2576,19 +2566,19 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"c1",0,H5T_STD_I64BE) < 0) {
+ if(H5Tinsert(cmpd_f2_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"c2",8,H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_f2_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid, "vl_string", 8 + 1, str_id) < 0) {
+ if(H5Tinsert(cmpd_f2_tid, "vl_string", (size_t)(8 + 1), str_id) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'vl_string'\n");
goto error;
@@ -2837,7 +2827,7 @@ test_compound_15(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m_tid,"i1",0,H5T_NATIVE_INT) < 0) {
+ if(H5Tinsert(cmpd_m_tid,"i1",(size_t)0,H5T_NATIVE_INT) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'i1'\n");
goto error;
@@ -2972,7 +2962,7 @@ test_compound_16(void)
/* Create file compound datatype */
if((cmpd_f_tid = H5Tcreate(H5T_COMPOUND, 2 * sizeof(int) + 2)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_f_tid, "i1", 0, int_id) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_f_tid, "i1", (size_t)0, int_id) < 0) TEST_ERROR
if(H5Tinsert(cmpd_f_tid, "i2", sizeof(int) + 1, int_id) < 0) TEST_ERROR
/* Create memory compound datatype */
@@ -2993,7 +2983,7 @@ test_compound_16(void)
}
/* Check behavior of H5Fget_obj_ids */
- if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, 2, open_dtypes) < 0) TEST_ERROR
+ if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, (size_t)2, open_dtypes) < 0) TEST_ERROR
if(open_dtypes[1]) {
H5_FAILED(); AT();
printf(" H5Fget_obj_ids returned as second id: %d; expected: 0\n", open_dtypes[1]);
@@ -3047,8 +3037,8 @@ test_compound_17(void)
/* Create inner compound datatype. This type will be "packed" according
* to the internal field, but will have trailing space at the end. */
- if((cmpd_int = H5Tcreate(H5T_COMPOUND, 4)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_int, "c", 0, H5T_NATIVE_CHAR) < 0) TEST_ERROR
+ if((cmpd_int = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_int, "c", (size_t)0, H5T_NATIVE_CHAR) < 0) TEST_ERROR
/* Create inner array datatype */
if((arr_int = H5Tarray_create2(cmpd_int, 1, dims)) < 0) TEST_ERROR
@@ -3056,8 +3046,8 @@ test_compound_17(void)
/* Create outer compound datatype. This type will be truly packed, with no
* trailing space. However, the internal compound contained within is not
* packed. */
- if((cmpd_ext = H5Tcreate(H5T_COMPOUND, 8)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_ext, "arr", 0, arr_int) < 0) TEST_ERROR
+ if((cmpd_ext = H5Tcreate(H5T_COMPOUND, (size_t)8)) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_ext, "arr", (size_t)0, arr_int) < 0) TEST_ERROR
/* Create outer array datatype */
if((arr_ext = H5Tarray_create2(cmpd_ext, 1, dims)) < 0) TEST_ERROR
@@ -3067,7 +3057,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(2 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 2\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3077,7 +3067,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(4 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 4\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3111,7 +3101,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(2 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 2\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3121,7 +3111,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(4 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 4\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3343,7 +3333,7 @@ test_query(void)
/* Query member name by member value, for enumeration type */
enum_val = 14;
- if(H5Tenum_nameof(tid2, &enum_val, enum_name, 16) < 0) {
+ if(H5Tenum_nameof(tid2, &enum_val, enum_name, (size_t)16) < 0) {
H5_FAILED();
printf("Can't get name for enum member\n");
goto error;
@@ -3419,7 +3409,7 @@ test_transient (hid_t fapl)
/* Predefined types cannot be modified or closed */
H5E_BEGIN_TRY {
- status = H5Tset_precision (H5T_NATIVE_INT, 256);
+ status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -3436,8 +3426,8 @@ test_transient (hid_t fapl)
}
/* Copying a predefined type results in a modifiable copy */
- if ((type=H5Tcopy (H5T_NATIVE_INT)) < 0) goto error;
- if (H5Tset_precision (type, 256) < 0) goto error;
+ if((type=H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ if(H5Tset_precision(type, (size_t)256) < 0) goto error;
/* It should not be possible to create an attribute for a transient type */
H5E_BEGIN_TRY {
@@ -3458,7 +3448,7 @@ test_transient (hid_t fapl)
/* The type returned from a dataset should not be modifiable */
if((t2 = H5Dget_type(dset)) < 0) goto error;
H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, 256);
+ status = H5Tset_precision(t2, (size_t)256);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -3475,7 +3465,7 @@ test_transient (hid_t fapl)
if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
if((t2 = H5Dget_type(dset)) < 0) goto error;
H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, 256);
+ status = H5Tset_precision(t2, (size_t)256);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -3489,7 +3479,7 @@ test_transient (hid_t fapl)
* result should be modifiable.
*/
if((t2=H5Tcopy(dset)) < 0) goto error;
- if(H5Tset_precision(t2, 256) < 0) goto error;
+ if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
@@ -3569,7 +3559,7 @@ test_named (hid_t fapl)
/* We should not be able to modify a type after it has been committed. */
H5E_BEGIN_TRY {
- status = H5Tset_precision (type, 256);
+ status = H5Tset_precision (type, (size_t)256);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -3607,7 +3597,7 @@ test_named (hid_t fapl)
HDputs (" Copying a named type should result in a transient type!");
goto error;
}
- if(H5Tset_precision(t2, 256) < 0) goto error;
+ if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
/*
@@ -3675,7 +3665,7 @@ test_named (hid_t fapl)
* result should be modifiable.
*/
if((t2 = H5Tcopy(dset)) < 0) goto error;
- if(H5Tset_precision(t2, 256) < 0) goto error;
+ if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
if(H5Dclose(dset) < 0) goto error;
@@ -3757,14 +3747,11 @@ error:
* Purpose: Create a new string datatype
*
* Return: Success: New type
- *
* Failure: -1
*
* Programmer: Robb Matzke
* Monday, August 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -3772,9 +3759,13 @@ mkstr(size_t len, H5T_str_t strpad)
{
hid_t t;
- if ((t=H5Tcopy(H5T_C_S1)) < 0) return -1;
- if (H5Tset_size(t, len) < 0) return -1;
- if (H5Tset_strpad(t, strpad) < 0) return -1;
+ if((t = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if(H5Tset_size(t, len) < 0)
+ return -1;
+ if(H5Tset_strpad(t, strpad) < 0)
+ return -1;
+
return t;
}
@@ -3785,21 +3776,19 @@ mkstr(size_t len, H5T_str_t strpad)
* Purpose: Test string conversions
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Monday, August 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_conv_str_1(void)
{
- char *buf=NULL;
- hid_t src_type, dst_type;
+ char *buf = NULL;
+ hid_t src_type = -1;
+ hid_t dst_type = -1;
TESTING("string conversions");
@@ -3807,69 +3796,72 @@ test_conv_str_1(void)
* Convert a null-terminated string to a shorter and longer null
* terminated string.
*/
- src_type = mkstr(10, H5T_STR_NULLTERM);
- dst_type = mkstr(5, H5T_STR_NULLTERM);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) {
H5_FAILED();
HDputs(" Truncated C-string test failed");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Extended C-string test failed");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Convert a null padded string to a shorter and then longer string.
*/
- src_type = mkstr(10, H5T_STR_NULLPAD);
- dst_type = mkstr(5, H5T_STR_NULLPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Truncated C buffer test failed");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Extended C buffer test failed");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Convert a space-padded string to a shorter and then longer string.
*/
- src_type = mkstr(10, H5T_STR_SPACEPAD);
- dst_type = mkstr(5, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Truncated Fortran-string test failed");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde abcde ", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) {
H5_FAILED();
HDputs(" Extended Fortran-string test failed");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
@@ -3879,151 +3871,161 @@ test_conv_str_1(void)
* the destination is a different size or type of string then the right
* thing should happen.
*/
- src_type = mkstr(10, H5T_STR_NULLTERM);
- dst_type = mkstr(10, H5T_STR_NULLTERM);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Non-terminated string test 1");
goto error;
}
H5Tclose(dst_type);
- dst_type = mkstr(5, H5T_STR_NULLTERM);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", 20)) {
+ if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Non-terminated string test 2");
goto error;
}
- HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", 20);
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20);
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Non-terminated string test 2");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Test C string to Fortran and vice versa.
*/
- src_type = mkstr(10, H5T_STR_NULLTERM);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghi abcdefghi ", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) {
H5_FAILED();
HDputs(" C string to Fortran test 1");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C string test 1");
goto error;
}
if (H5Tclose(dst_type) < 0) goto error;
- dst_type = mkstr(5, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) {
+ if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" C string to Fortran test 2");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C string test 2");
goto error;
}
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
- src_type = mkstr(5, H5T_STR_NULLTERM);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd abcd ", 20)) {
+ if((src_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" C string to Fortran test 3");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C string test 3");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Test C buffer to Fortran and vice versa.
*/
- src_type = mkstr(10, H5T_STR_NULLPAD);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" C buffer to Fortran test 1");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C buffer test 1");
goto error;
}
if (H5Tclose(dst_type) < 0) goto error;
- dst_type = mkstr(5, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) {
+ if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" C buffer to Fortran test 2");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C buffer test 2");
goto error;
}
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
- src_type = mkstr(5, H5T_STR_NULLPAD);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd abcd ", 20)) {
+ if((src_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" C buffer to Fortran test 3");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C buffer test 3");
goto error;
}
+ if(H5Tclose(src_type) < 0) goto error;
+ if(H5Tclose(dst_type) < 0) goto error;
HDfree(buf);
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
PASSED();
reset_hdf5();
return 0;
- error:
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(src_type);
+ H5Tclose(dst_type);
+ } H5E_END_TRY;
+
+ if(buf)
+ HDfree(buf);
+
reset_hdf5();
return 1;
}
@@ -4035,21 +4037,19 @@ test_conv_str_1(void)
* Purpose: Tests C-to-Fortran and Fortran-to-C string conversion speed.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Monday, August 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_conv_str_2(void)
{
- char *buf=NULL, s[80];
- hid_t c_type, f_type;
+ char *buf = NULL, s[80];
+ hid_t c_type = -1;
+ hid_t f_type = -1;
const size_t nelmts = NTESTELEM, ntests=NTESTS;
size_t i, j, nchars;
int ret_value = 1;
@@ -4057,37 +4057,43 @@ test_conv_str_2(void)
/*
* Initialize types and buffer.
*/
- c_type = mkstr(8, H5T_STR_NULLPAD);
- f_type = mkstr(8, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(nelmts, 8);
- for (i=0; i<nelmts; i++) {
+ if((c_type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0) goto error;
+ if((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) goto error;
+ for(i = 0; i < nelmts; i++) {
nchars = HDrand() % 8;
- for (j=0; j<nchars; j++)
- buf[i*8+j] = 'a' + HDrand()%26;
- while (j<nchars)
- buf[i*8+j++] = '\0';
- }
+ for(j = 0; j < nchars; j++)
+ buf[i * 8 + j] = 'a' + HDrand() % 26;
+ while(j < nchars)
+ buf[i * 8 + j++] = '\0';
+ } /* end for */
/* Do the conversions */
- for (i=0; i<ntests; i++) {
- if (ntests>1) {
- sprintf(s, "Testing random string conversion speed (test %d/%d)",
- (int)(i+1), (int)ntests);
- } else {
+ for(i = 0; i < ntests; i++) {
+ if(ntests > 1)
+ sprintf(s, "Testing random string conversion speed (test %d/%d)", (int)(i + 1), (int)ntests);
+ else
sprintf(s, "Testing random string conversion speed");
- }
- printf("%-70s", s);
- HDfflush(stdout);
- if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- PASSED();
- }
+ PASSED();
+ } /* end for */
+
ret_value = 0;
- error:
- if (buf) HDfree(buf);
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(c_type);
+ H5Tclose(f_type);
+ } H5E_END_TRY;
+
+ if(buf)
+ HDfree(buf);
+
reset_hdf5();
return ret_value;
}
@@ -4100,21 +4106,19 @@ test_conv_str_2(void)
* for string type.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Raymond Lu
* Tuesday, April 4, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_conv_str_3(void)
{
char *buf=NULL;
- hid_t type, super;
+ hid_t type = -1;
+ hid_t super = -1;
const size_t nelmts = NTESTELEM;
size_t i, j, nchars;
int ret_value = 1;
@@ -4129,63 +4133,64 @@ test_conv_str_3(void)
/*
* Initialize types and buffer.
*/
- type = mkstr(8, H5T_STR_NULLPAD);
- buf = (char*)HDcalloc(nelmts, 8);
- for (i=0; i<nelmts; i++) {
+ if((type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8)))
+ FAIL_PUTS_ERROR("Allocation failed.");
+ for(i = 0; i < nelmts; i++) {
nchars = HDrand() % 8;
- for (j=0; j<nchars; j++)
- buf[i*8+j] = 'a' + HDrand()%26;
- while (j<nchars)
- buf[i*8+j++] = '\0';
- }
+ for(j = 0; j < nchars; j++)
+ buf[i * 8 + j] = 'a' + HDrand() % 26;
+ while(j < nchars)
+ buf[i * 8 + j++] = '\0';
+ } /* end for */
if(H5Tget_precision(type) == 0) FAIL_STACK_ERROR
if(H5Tget_size(type) == 0) FAIL_STACK_ERROR
if(H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE) < 0) FAIL_STACK_ERROR
if(H5Tget_cset(type) < 0) FAIL_STACK_ERROR
if(H5Tget_strpad(type) < 0) FAIL_STACK_ERROR
- if(H5Tset_offset(type, 0) < 0) FAIL_STACK_ERROR
+ if(H5Tset_offset(type, (size_t)0) < 0) FAIL_STACK_ERROR
if(H5Tget_order(type) < 0) FAIL_STACK_ERROR
H5E_BEGIN_TRY {
- ret=H5Tset_precision(type, nelmts);
+ ret = H5Tset_precision(type, nelmts);
} H5E_END_TRY;
- if (ret>=0) {
+ if(ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
size = H5Tget_ebias(type);
} H5E_END_TRY;
- if (size>0) {
+ if(size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
- inpad=H5Tget_inpad(type);
+ inpad = H5Tget_inpad(type);
} H5E_END_TRY;
- if (inpad>-1) {
+ if(inpad > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
- sign=H5Tget_sign(type);
+ sign = H5Tget_sign(type);
} H5E_END_TRY;
- if (sign>-1) {
+ if(sign > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
tag = H5Tget_tag(type);
} H5E_END_TRY;
- if (tag) {
+ if(tag) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
super = H5Tget_super(type);
} H5E_END_TRY;
- if (super>=0) {
+ if(super >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
@@ -4193,10 +4198,16 @@ test_conv_str_3(void)
ret_value = 0;
error:
- if(buf)
+ H5E_BEGIN_TRY {
+ H5Tclose(type);
+ H5Tclose(super);
+ } H5E_END_TRY;
+
+ if(buf)
HDfree(buf);
if(tag)
HDfree(tag);
+
reset_hdf5();
return ret_value; /* Number of errors */
}
@@ -4224,57 +4235,62 @@ test_conv_enum_1(void)
const size_t nelmts=NTESTELEM;
const int ntests=NTESTS;
int i, val, *buf=NULL;
- hid_t t1, t2;
+ hid_t t1 = -1;
+ hid_t t2 = -1;
char s[80];
int ret_value = 1;
+ size_t u;
/* Build the datatypes */
- t1 = H5Tcreate(H5T_ENUM, sizeof(int));
- t2 = H5Tenum_create(H5T_NATIVE_INT);
+ if((t1 = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) goto error;
+ if((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0) goto error;
s[1] = '\0';
- for (i=0; i<26; i++) {
- s[0] = 'A'+i;
+ for(i = 0; i < 26; i++) {
+ s[0] = 'A' + i;
H5Tenum_insert(t1, s, &i);
- H5Tenum_insert(t2, s, (val=i*1000+i, &val));
- }
+ H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
+ } /* end for */
/* Initialize the buffer */
- buf = (int*)HDmalloc(nelmts*MAX(H5Tget_size(t1), H5Tget_size(t2)));
- for (i=0; i<(int)nelmts; i++)
- buf[i] = HDrand() % 26;
+ if(NULL == (buf = (int*)HDmalloc(nelmts * MAX(H5Tget_size(t1), H5Tget_size(t2)))))
+ goto error;
+ for(u = 0; u < nelmts; u++)
+ buf[u] = HDrand() % 26;
/* Conversions */
- for (i=0; i<ntests; i++) {
- if (ntests>1) {
- sprintf(s, "Testing random enum conversion O(N) (test %d/%d)",
- i+1, ntests);
- } else {
+ for(i = 0; i < ntests; i++) {
+ if(ntests > 1)
+ sprintf(s, "Testing random enum conversion O(N) (test %d/%d)", i + 1, ntests);
+ else
sprintf(s, "Testing random enum conversion O(N)");
- }
- printf("%-70s", s);
- HDfflush(stdout);
- if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- }
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
+ } /* end for */
- for (i=0; i<ntests; i++) {
- if (ntests>1) {
- sprintf(s, "Testing random enum conversion O(N log N) "
- "(test %d/%d)", i+1, ntests);
- } else {
+ for(i = 0; i < ntests; i++) {
+ if(ntests > 1)
+ sprintf(s, "Testing random enum conversion O(N log N) (test %d/%d)", i + 1, ntests);
+ else
sprintf(s, "Testing random enum conversion O(N log N)");
- }
- printf("%-70s", s);
- HDfflush(stdout);
- if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
}
+
ret_value = 0;
- error:
- H5Tclose(t1);
- H5Tclose(t2);
- if (buf) HDfree(buf);
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(t1);
+ H5Tclose(t2);
+ } H5E_END_TRY;
+
+ if(buf)
+ HDfree(buf);
+
reset_hdf5();
return ret_value;
}
@@ -4312,7 +4328,7 @@ test_conv_enum_2(void)
/* Source enum type */
oddsize = H5Tcopy(H5T_STD_I32BE);
- H5Tset_size(oddsize, 3); /*reduce to 24 bits, not corresponding to any native size*/
+ H5Tset_size(oddsize, (size_t)3); /*reduce to 24 bits, not corresponding to any native size*/
srctype = H5Tenum_create(oddsize);
for (i=7; i>=0; --i) {
char pattern[3];
@@ -4323,7 +4339,7 @@ test_conv_enum_2(void)
/* Destination enum type */
dsttype = H5Tenum_create(H5T_NATIVE_INT);
- assert(H5Tget_size(dsttype)>H5Tget_size(srctype));
+ assert(H5Tget_size(dsttype) > H5Tget_size(srctype));
for (i=0; i<8; i++)
H5Tenum_insert(dsttype, mname[i], &i);
@@ -4336,7 +4352,7 @@ test_conv_enum_2(void)
}
/* Convert to destination type */
- H5Tconvert(srctype, dsttype, NTESTELEM, data, NULL, H5P_DEFAULT);
+ H5Tconvert(srctype, dsttype, (size_t)NTESTELEM, data, NULL, H5P_DEFAULT);
/* Check results */
for (i=0; i<NTESTELEM; i++) {
@@ -4400,7 +4416,7 @@ test_conv_bitfield(void)
dt = H5Tcopy(H5T_STD_B32LE);
buf[0] = buf[1] = 0xAA;
buf[2] = buf[3] = 0x55; /*irrelevant*/
- if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) {
H5_FAILED();
printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n",
@@ -4414,12 +4430,12 @@ test_conv_bitfield(void)
* __10 1010 1010 10__
* ____ ____ __10 1010 1010 10__ ____ ____
*/
- H5Tset_precision(st, 12);
- H5Tset_offset(st, 2);
- H5Tset_precision(dt, 12);
- H5Tset_offset(dt, 10);
+ H5Tset_precision(st, (size_t)12);
+ H5Tset_offset(st, (size_t)2);
+ H5Tset_precision(dt, (size_t)12);
+ H5Tset_offset(dt, (size_t)10);
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
- if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) {
H5_FAILED();
printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n",
@@ -4433,7 +4449,7 @@ test_conv_bitfield(void)
*/
H5Tset_pad(dt, H5T_PAD_ONE, H5T_PAD_ONE);
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
- if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) {
H5_FAILED();
printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n",
@@ -4495,8 +4511,8 @@ test_bitfield_funcs(void)
* field. Pad unused bits with ones.
* ____ ____ __10 1010 1010 10__ ____ ____
*/
- if(H5Tset_precision(type, 12) < 0) goto error;
- if(H5Tset_offset(type, 10) < 0) goto error;
+ if(H5Tset_precision(type, (size_t)12) < 0) goto error;
+ if(H5Tset_offset(type, (size_t)10) < 0) goto error;
if(H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE)) goto error;
if((size=H5Tget_size(type))==0) goto error;
if(H5Tset_order(type, H5T_ORDER_BE) < 0) goto error;
@@ -4660,11 +4676,6 @@ test_opaque(void)
* Programmer: Robb Matzke
* Thursday, May 20, 1999
*
- * Modifications:
- * Raymond Lu
- * June 2, 2004
- * Made tag for one opaque type optional.
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4679,10 +4690,10 @@ opaque_check(int tag_it)
saved = num_opaque_conversions_g = 0;
/* Build source and destination types */
- if ((st=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error;
+ if ((st=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) goto error;
if (H5Tset_tag(st, "opaque source type") < 0) goto error;
- if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error;
+ if ((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) goto error;
if (tag_it) {
if (H5Tset_tag(dt, "opaque destination type") < 0)
goto error;
@@ -4690,7 +4701,7 @@ opaque_check(int tag_it)
/* Make sure that we can't convert between the types yet */
H5E_BEGIN_TRY {
- status = H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
+ status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -4703,7 +4714,7 @@ opaque_check(int tag_it)
goto error;
/* Try the conversion again, this time it should work */
- if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (saved+1 != num_opaque_conversions_g) {
H5_FAILED();
printf(" unexpected number of opaque conversions\n");
@@ -4732,14 +4743,11 @@ opaque_check(int tag_it)
* Purpose: Test named (committed) opaque datatypes w/very long tags
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Quincey Koziol
* Tuesday, June 14, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4750,18 +4758,18 @@ opaque_long(void)
herr_t ret;
/* Build opaque type */
- if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
/* Create long tag */
- long_tag = HDmalloc(16384+1);
- HDmemset(long_tag, 'a', 16384);
+ if(NULL == (long_tag = (char *)HDmalloc((size_t)(16384 + 1)))) TEST_ERROR
+ HDmemset(long_tag, 'a', (size_t)16384);
long_tag[16384] = '\0';
/* Set opaque type's tag */
H5E_BEGIN_TRY {
ret = H5Tset_tag(dt, long_tag);
} H5E_END_TRY;
- if(ret!=FAIL) TEST_ERROR
+ if(ret != FAIL) TEST_ERROR
/* Close datatype */
if(H5Tclose(dt) < 0) TEST_ERROR
@@ -4771,9 +4779,11 @@ opaque_long(void)
return 0;
- error:
- if (dt>0) H5Tclose(dt);
- if (long_tag != NULL) HDfree(long_tag);
+error:
+ if(dt>0)
+ H5Tclose(dt);
+ if(long_tag)
+ HDfree(long_tag);
H5_FAILED();
return 1;
}
@@ -4808,13 +4818,13 @@ opaque_funcs(void)
herr_t ret;
/* Build opaque type */
- if ((type=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if ((type=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
if (H5Tset_tag(type, "opaque source type") < 0) TEST_ERROR
if ((size=H5Tget_size(type))==0) goto error;
H5E_BEGIN_TRY {
- ret=H5Tset_precision(type, 32);
+ ret=H5Tset_precision(type, (size_t)32);
} H5E_END_TRY;
if (ret>=0) {
printf("Operation not allowed for this type.\n");
@@ -4862,7 +4872,7 @@ opaque_funcs(void)
} /* end if */
H5E_BEGIN_TRY {
- ret=H5Tset_offset(type, 16);
+ ret=H5Tset_offset(type, (size_t)16);
} H5E_END_TRY;
if (ret>=0) {
printf("Operation not allowed for this type.\n");
@@ -5035,7 +5045,7 @@ test_encode(void)
} /* end if */
if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+ cmpd_buf = (unsigned char*)HDcalloc((size_t)1, cmpd_buf_size);
/* Try decoding bogus buffer */
H5E_BEGIN_TRY {
@@ -5085,7 +5095,7 @@ test_encode(void)
} /* end if */
if(enum_buf_size>0)
- enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+ enum_buf = (unsigned char*)HDcalloc((size_t)1, enum_buf_size);
if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
H5_FAILED();
@@ -5128,7 +5138,7 @@ test_encode(void)
} /* end if */
if(vlstr_buf_size>0)
- vlstr_buf = (unsigned char*)calloc(1, vlstr_buf_size);
+ vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
H5_FAILED();
@@ -5236,7 +5246,7 @@ test_encode(void)
} /* end if */
if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+ cmpd_buf = (unsigned char*)HDcalloc((size_t)1, cmpd_buf_size);
if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
H5_FAILED();
@@ -5275,7 +5285,7 @@ test_encode(void)
} /* end if */
if(enum_buf_size>0)
- enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+ enum_buf = (unsigned char*)HDcalloc((size_t)1, enum_buf_size);
if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
H5_FAILED();
@@ -5317,7 +5327,7 @@ test_encode(void)
} /* end if */
if(vlstr_buf_size>0)
- vlstr_buf = (unsigned char*)calloc(1, vlstr_buf_size);
+ vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
H5_FAILED();
@@ -5830,7 +5840,7 @@ test_set_order(void)
/* Fixed length string */
if ((dtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if (H5Tset_size(dtype, 5) < 0) TEST_ERROR
+ if (H5Tset_size(dtype, (size_t)5) < 0) TEST_ERROR
if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR;
if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
@@ -5857,7 +5867,7 @@ test_set_order(void)
if (H5Tclose(dtype) < 0) TEST_ERROR
/* Opaque - functions should fail */
- if ((dtype = H5Tcreate(H5T_OPAQUE, 96)) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_OPAQUE, (size_t)96)) < 0) TEST_ERROR
H5E_BEGIN_TRY
ret = H5Tset_order(dtype, H5T_ORDER_LE);
order = H5Tget_order(dtype);
@@ -5867,7 +5877,7 @@ test_set_order(void)
if (H5Tclose(dtype) < 0) TEST_ERROR
/* Compound - functions should fail */
- if ((dtype = H5Tcreate(H5T_COMPOUND, 48)) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)48)) < 0) TEST_ERROR
H5E_BEGIN_TRY
ret = H5Tset_order(dtype, H5T_ORDER_LE);
order = H5Tget_order(dtype);
@@ -5977,7 +5987,7 @@ test_named_indirect_reopen(hid_t fapl)
if((strtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
if(H5Tset_size(strtype, H5T_VARIABLE) < 0) TEST_ERROR
if((type = H5Tcreate(H5T_COMPOUND, sizeof(char *))) < 0) TEST_ERROR
- if(H5Tinsert(type, "vlstr", 0, strtype) < 0) TEST_ERROR
+ if(H5Tinsert(type, "vlstr", (size_t)0, strtype) < 0) TEST_ERROR
if(H5Tclose(strtype) < 0) TEST_ERROR
/* Get size of compound type */
@@ -6060,7 +6070,7 @@ test_named_indirect_reopen(hid_t fapl)
*/
/* Create opaque type */
- if((type = H5Tcreate(H5T_OPAQUE, 13)) < 0) TEST_ERROR
+ if((type = H5Tcreate(H5T_OPAQUE, (size_t)13)) < 0) TEST_ERROR
if(H5Tset_tag(type, tag) < 0) TEST_ERROR
/* Get size of opaque type */
@@ -6229,7 +6239,7 @@ test_deprec(hid_t fapl)
/* We should not be able to modify a type after it has been committed. */
H5E_BEGIN_TRY {
- status = H5Tset_precision(type, 256);
+ status = H5Tset_precision(type, (size_t)256);
} H5E_END_TRY;
if(status >= 0)
FAIL_PUTS_ERROR(" Committed type is not constant!")
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 8fb2e23..5f9a69b 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -289,10 +289,10 @@ test_genprop_iter1(hid_t id, const char *name, void *iter_data)
struct { /* Struct for iterations */
int iter_count;
const char **names;
- } *iter_struct=iter_data;
+ } *iter_struct = iter_data;
/* Shut compiler up */
- id=id;
+ id = id;
return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++]));
}
@@ -1473,18 +1473,26 @@ test_genprop_class_addprop(void)
sid = H5Screate(H5S_SCALAR);
CHECK(sid, FAIL, "H5Screate");
- /* Create a new class, dervied from the dataset creation property list class */
- cid = H5Pcreate_class(H5P_DATASET_CREATE,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ /* Create a new class, derived from the dataset creation property list class */
+ cid = H5Pcreate_class(H5P_DATASET_CREATE, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid, "H5Pcreate_class");
/* Check existence of an original property */
- ret = H5Pexist(cid,H5O_CRT_PIPELINE_NAME);
- VERIFY(ret, 0, "H5Pexist");
+ ret = H5Pexist(cid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
/* Insert first property into class (with no callbacks) */
ret = H5Pregister2(cid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
+ /* Check existence of an original property */
+ ret = H5Pexist(cid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of added property */
+ ret = H5Pexist(cid, PROP1_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
/* Create a derived dataset creation property list */
pid = H5Pcreate(cid);
CHECK(pid, FAIL, "H5Pcreate");
@@ -1502,6 +1510,34 @@ test_genprop_class_addprop(void)
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
+ /* Insert second property into class (with no callbacks) */
+ ret = H5Pregister2(cid, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pregister2");
+
+ /* Check existence of an original property (in class) */
+ ret = H5Pexist(cid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of first added property (in class) */
+ ret = H5Pexist(cid, PROP1_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of second added property (in class) */
+ ret = H5Pexist(cid, PROP2_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of an original property (in property list) */
+ ret = H5Pexist(pid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of first added property (in property list) */
+ ret = H5Pexist(pid, PROP1_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of second added property (in property list) (should not exist) */
+ ret = H5Pexist(pid, PROP2_NAME);
+ VERIFY(ret, 0, "H5Pexist");
+
/* Create a dataset */
did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");