diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2021-11-10 18:09:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 18:09:38 (GMT) |
commit | a777e3075ef51adb15d2618c6d2fa4687444a098 (patch) | |
tree | c0b8e1940784026a66d575cee3a5d8732a733c87 | |
parent | b488eb4ecc5397876d43f49a6892aa848ad45bdf (diff) | |
download | hdf5-a777e3075ef51adb15d2618c6d2fa4687444a098.zip hdf5-a777e3075ef51adb15d2618c6d2fa4687444a098.tar.gz hdf5-a777e3075ef51adb15d2618c6d2fa4687444a098.tar.bz2 |
Fix H5DS warnings related to new H5DSwith_new_ref and H5VLobject_is_native APIs (#1184)
-rw-r--r-- | hl/src/H5DS.c | 36 | ||||
-rw-r--r-- | hl/src/H5DSpublic.h | 2 | ||||
-rw-r--r-- | src/H5VL.c | 18 | ||||
-rw-r--r-- | src/H5VLpublic.h | 8 |
4 files changed, 34 insertions, 30 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 7d93de4..c947d16 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -22,31 +22,35 @@ static herr_t H5DS_is_reserved(hid_t did); /*------------------------------------------------------------------------- * Function: H5DSwith_new_ref * - * Purpose: Detremines if new references are used with dimension scales. + * Purpose: Determines if new references are used with dimension scales. * The function H5DSwith_new_ref takes any object identifier and checks - * if new references are used for dimenison scales. Currently, + * if new references are used for dimension scales. Currently, * new references are used when non-native VOL connector is used or when * H5_DIMENSION_SCALES_WITH_NEW_REF is set up via configure option. * - * Return: Success: TRUE/FALSE, Failure: FAIL + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ -hbool_t -H5DSwith_new_ref(hid_t obj_id) +herr_t +H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref) { - hbool_t ret_value = FALSE; hbool_t config_flag = FALSE; hbool_t native = FALSE; - native = H5VLobject_is_native(obj_id); - if (native < 0) + if (!with_new_ref) + return FAIL; + + if (H5VLobject_is_native(obj_id, &native) < 0) return FAIL; + #ifdef H5_DIMENSION_SCALES_WITH_NEW_REF config_flag = TRUE; #endif - ret_value = (config_flag || !native); - return ret_value; + + *with_new_ref = (config_flag || !native); + + return SUCCEED; } /*------------------------------------------------------------------------- @@ -205,8 +209,7 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx) *------------------------------------------------------------------------- */ - is_new_ref = H5DSwith_new_ref(did); - if (is_new_ref < 0) + if (H5DSwith_new_ref(did, &is_new_ref) < 0) return FAIL; /* get ID type */ @@ -793,8 +796,7 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx) * determine if old or new references should be used *------------------------------------------------------------------------- */ - is_new_ref = H5DSwith_new_ref(did); - if (is_new_ref < 0) + if (H5DSwith_new_ref(did, &is_new_ref) < 0) return FAIL; /*------------------------------------------------------------------------- @@ -1283,8 +1285,7 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx) *------------------------------------------------------------------------- */ - is_new_ref = H5DSwith_new_ref(did); - if (is_new_ref < 0) + if (H5DSwith_new_ref(did, &is_new_ref) < 0) return FAIL; /* get ID type */ @@ -1629,8 +1630,7 @@ H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx, H5DS_iterate_t visi *------------------------------------------------------------------------- */ - is_new_ref = H5DSwith_new_ref(did); - if (is_new_ref < 0) + if (H5DSwith_new_ref(did, &is_new_ref) < 0) return FAIL; /* get the number of scales assotiated with this DIM */ diff --git a/hl/src/H5DSpublic.h b/hl/src/H5DSpublic.h index 9aabb98..979a173 100644 --- a/hl/src/H5DSpublic.h +++ b/hl/src/H5DSpublic.h @@ -25,7 +25,7 @@ typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *vi extern "C" { #endif -H5_HLDLL hbool_t H5DSwith_new_ref(hid_t obj_id); +H5_HLDLL herr_t H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref); H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx); @@ -661,25 +661,27 @@ done: * Purpose: Determines whether an object ID represents a native VOL * connector object. * - * Return: Success: TRUE/FALSE - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * *--------------------------------------------------------------------------- */ -hbool_t -H5VLobject_is_native(hid_t obj_id) +herr_t +H5VLobject_is_native(hid_t obj_id, hbool_t *is_native) { H5VL_object_t *vol_obj = NULL; - hbool_t ret_value = FALSE; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", obj_id, is_native); - FUNC_ENTER_API(FALSE) - H5TRACE1("b", "i", obj_id); + if (!is_native) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`is_native` argument is NULL") /* Get the location object for the ID */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - if (H5VL_object_is_native(vol_obj, &ret_value) < 0) + if (H5VL_object_is_native(vol_obj, is_native) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if object is a native connector object") done: diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index ac68cc4..543c3c8 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -362,11 +362,13 @@ H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_t * VOL connector object. * * \param[in] obj_id Object identifier - * \return \hbool_t + * \param[in] is_native Boolean determining whether object is a native + * VOL connector object + * \return \herr_t * - * \since 1.12.1 + * \since 1.13.0 */ -H5_DLL hbool_t H5VLobject_is_native(hid_t obj_id); +H5_DLL herr_t H5VLobject_is_native(hid_t obj_id, hbool_t *is_native); #ifdef __cplusplus } |