mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
Sanity checks for H5Xcreate_anon functions to make sure the IDs passed in are valid (#1967)
* Sanity checks for H5Xcreate_anon functions to make sure the IDs passed in are valid. * Removed unnecessary sanity checks. Co-authored-by: songyulu <songyulu@jelly.ad.hdfgroup.org>
This commit is contained in:
parent
bf07e0f2c9
commit
54f116b42d
@ -285,6 +285,11 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t
|
||||
else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
|
||||
|
||||
if (H5P_DEFAULT == dapl_id)
|
||||
dapl_id = H5P_DATASET_ACCESS_DEFAULT;
|
||||
else if (TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset access property list ID")
|
||||
|
||||
/* Set the DCPL for the API context */
|
||||
H5CX_set_dcpl(dcpl_id);
|
||||
|
||||
|
@ -325,12 +325,17 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id);
|
||||
|
||||
/* Check group creation property list */
|
||||
/* Check group property list */
|
||||
if (H5P_DEFAULT == gcpl_id)
|
||||
gcpl_id = H5P_GROUP_CREATE_DEFAULT;
|
||||
else if (TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list")
|
||||
|
||||
if (H5P_DEFAULT == gapl_id)
|
||||
gapl_id = H5P_GROUP_ACCESS_DEFAULT;
|
||||
else if (TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list")
|
||||
|
||||
/* Verify access property list and set up collective metadata if appropriate */
|
||||
if (H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
|
||||
|
@ -349,6 +349,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
|
||||
else if (TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list")
|
||||
|
||||
if (H5P_DEFAULT == tapl_id)
|
||||
tapl_id = H5P_DATATYPE_ACCESS_DEFAULT;
|
||||
else if (TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list")
|
||||
|
||||
/* Verify access property list and set up collective metadata if appropriate */
|
||||
if (H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
|
||||
|
Loading…
x
Reference in New Issue
Block a user