diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
commit | feb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch) | |
tree | e15d7e751af4e3c42e77ea955d91db4cf27a71cf /src/H5I.c | |
parent | bdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff) | |
download | hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2 |
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 764 |
1 files changed, 354 insertions, 410 deletions
@@ -25,83 +25,80 @@ * variables defined in H5Ipublic.h. */ -#include "H5Imodule.h" /* This source code file is part of the H5I module */ -#define H5T_FRIEND /* Suppress error about including H5Tpkg */ - - -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip Lists */ -#include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* Virtual Object Layer */ - +#include "H5Imodule.h" /* This source code file is part of the H5I module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Local Macros */ /* Combine a Type number and an atom index into an atom */ -#define H5I_MAKE(g,i) ((((hid_t)(g) & TYPE_MASK) << ID_BITS) | \ - ((hid_t)(i) & ID_MASK)) +#define H5I_MAKE(g, i) ((((hid_t)(g)&TYPE_MASK) << ID_BITS) | ((hid_t)(i)&ID_MASK)) /* Local typedefs */ /* Atom information structure used */ typedef struct H5I_id_info_t { - hid_t id; /* ID for this info */ - unsigned count; /* ref. count for this atom */ - unsigned app_count; /* ref. count of application visible atoms */ - const void *obj_ptr; /* pointer associated with the atom */ + hid_t id; /* ID for this info */ + unsigned count; /* ref. count for this atom */ + unsigned app_count; /* ref. count of application visible atoms */ + const void *obj_ptr; /* pointer associated with the atom */ } H5I_id_info_t; /* ID type structure used */ typedef struct { - const H5I_class_t *cls; /* Pointer to ID class */ - unsigned init_count; /* # of times this type has been initialized*/ - uint64_t id_count; /* Current number of IDs held */ - uint64_t nextid; /* ID to use for the next atom */ - H5I_id_info_t *last_info; /* Info for most recent ID looked up */ - H5SL_t *ids; /* Pointer to skip list that stores IDs */ + const H5I_class_t *cls; /* Pointer to ID class */ + unsigned init_count; /* # of times this type has been initialized*/ + uint64_t id_count; /* Current number of IDs held */ + uint64_t nextid; /* ID to use for the next atom */ + H5I_id_info_t * last_info; /* Info for most recent ID looked up */ + H5SL_t * ids; /* Pointer to skip list that stores IDs */ } H5I_id_type_t; typedef struct { - H5I_search_func_t app_cb; /* Application's callback routine */ - void *app_key; /* Application's "key" (user data) */ - void *ret_obj; /* Object to return */ + H5I_search_func_t app_cb; /* Application's callback routine */ + void * app_key; /* Application's "key" (user data) */ + void * ret_obj; /* Object to return */ } H5I_search_ud_t; typedef struct { - H5I_iterate_func_t op; /* Application's callback routine */ - void *op_data; /* Application's user data */ + H5I_iterate_func_t op; /* Application's callback routine */ + void * op_data; /* Application's user data */ } H5I_iterate_pub_ud_t; /* User data for iterator callback for retrieving an ID corresponding to an object pointer */ typedef struct { - const void *object; /* object pointer to search for */ - H5I_type_t obj_type; /* type of object we are searching for */ - hid_t ret_id; /* ID returned */ + const void *object; /* object pointer to search for */ + H5I_type_t obj_type; /* type of object we are searching for */ + hid_t ret_id; /* ID returned */ } H5I_get_id_ud_t; /* User data for iterator callback for ID iteration */ typedef struct { - H5I_search_func_t user_func; /* 'User' function to invoke */ - void *user_udata; /* User data to pass to 'user' function */ - hbool_t app_ref; /* Whether this is an appl. ref. call */ - H5I_type_t obj_type; /* Type of object we are iterating over */ + H5I_search_func_t user_func; /* 'User' function to invoke */ + void * user_udata; /* User data to pass to 'user' function */ + hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_type_t obj_type; /* Type of object we are iterating over */ } H5I_iterate_ud_t; /* User data for H5I__clear_type_cb */ typedef struct { - H5I_id_type_t *type_ptr; /* Pointer to the type being cleard */ - hbool_t force; /* Whether to always remove the id */ - hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_id_type_t *type_ptr; /* Pointer to the type being cleard */ + hbool_t force; /* Whether to always remove the id */ + hbool_t app_ref; /* Whether this is an appl. ref. call */ } H5I_clear_type_ud_t; /* Package initialization variable */ @@ -132,20 +129,19 @@ H5FL_DEFINE_STATIC(H5I_class_t); H5FL_EXTERN(H5VL_object_t); /*--------------------- Local function prototypes ---------------------------*/ -static void *H5I__unwrap(void *obj_ptr, H5I_type_t type); -static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); -static int H5I__destroy_type(H5I_type_t type); -static void *H5I__remove_verify(hid_t id, H5I_type_t id_type); -static void *H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id); -static int H5I__inc_type_ref(H5I_type_t type); -static int H5I__get_type_ref(H5I_type_t type); -static int H5I__search_cb(void *obj, hid_t id, void *_udata); +static void * H5I__unwrap(void *obj_ptr, H5I_type_t type); +static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); +static int H5I__destroy_type(H5I_type_t type); +static void * H5I__remove_verify(hid_t id, H5I_type_t id_type); +static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id); +static int H5I__inc_type_ref(H5I_type_t type); +static int H5I__get_type_ref(H5I_type_t type); +static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); -static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -static int H5I__find_id_cb(void *_item, void *_key, void *_udata); -static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); +static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); +static int H5I__find_id_cb(void *_item, void *_key, void *_udata); +static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); - /*------------------------------------------------------------------------- * Function: H5I_term_package * @@ -163,41 +159,40 @@ static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); int H5I_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_PKG_INIT_VAR) { - H5I_id_type_t *type_ptr; /* Pointer to ID type */ - int type; /* Type of ID */ + if (H5_PKG_INIT_VAR) { + H5I_id_type_t *type_ptr; /* Pointer to ID type */ + int type; /* Type of ID */ /* How many types are still being used? */ - for(type = 0; type < H5I_next_type; type++) - if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) + for (type = 0; type < H5I_next_type; type++) + if ((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; /* If no types are used then clean up */ - if(0 == n) { - for(type = 0; type < H5I_next_type; type++) { + if (0 == n) { + for (type = 0; type < H5I_next_type; type++) { type_ptr = H5I_id_type_list_g[type]; - if(type_ptr) { + if (type_ptr) { HDassert(NULL == type_ptr->ids); - type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); + type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; n++; } /* end if */ - } /* end for */ + } /* end for */ /* Mark interface closed */ - if(0 == n) + if (0 == n) H5_PKG_INIT_VAR = FALSE; } /* end if */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(n) } /* end H5I_term_package() */ - /*------------------------------------------------------------------------- * Function: H5Iregister_type * @@ -216,12 +211,11 @@ H5I_term_package(void) *------------------------------------------------------------------------- */ H5I_type_t -H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, - H5I_free_t free_func) +H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I_free_t free_func) { H5I_class_t *cls = NULL; /* New ID class */ - H5I_type_t new_type; /* New ID type value */ - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t new_type; /* New ID type value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE3("It", "zIux", hash_size, reserved, free_func); @@ -229,41 +223,41 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, /* Generate a new H5I_type_t value */ /* Increment the number of types */ - if(H5I_next_type < H5I_MAX_NUM_TYPES) { + if (H5I_next_type < H5I_MAX_NUM_TYPES) { new_type = (H5I_type_t)H5I_next_type; H5I_next_type++; } /* end if */ else { - hbool_t done; /* Indicate that search was successful */ - int i; /* Local index variable */ + hbool_t done; /* Indicate that search was successful */ + int i; /* Local index variable */ /* Look for a free type to give out */ done = FALSE; - for(i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == FALSE; i++) { - if(NULL == H5I_id_type_list_g[i]) { + for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == FALSE; i++) { + if (NULL == H5I_id_type_list_g[i]) { /* Found a free type ID */ new_type = (H5I_type_t)i; - done = TRUE; + done = TRUE; } /* end if */ - } /* end for */ + } /* end for */ /* Verify that we found a type to give out */ - if(done == FALSE) + if (done == FALSE) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") } /* end else */ /* Allocate new ID class */ - if(NULL == (cls = H5FL_CALLOC(H5I_class_t))) + if (NULL == (cls = H5FL_CALLOC(H5I_class_t))) HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed") /* Initialize class fields */ - cls->type_id = new_type; - cls->flags = H5I_CLASS_IS_APPLICATION; - cls->reserved = reserved; + cls->type_id = new_type; + cls->flags = H5I_CLASS_IS_APPLICATION; + cls->reserved = reserved; cls->free_func = free_func; /* Register the new ID class */ - if(H5I_register_type(cls) < 0) + if (H5I_register_type(cls) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_BADID, "can't initialize ID class") /* Set return value */ @@ -271,14 +265,13 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, done: /* Clean up on error */ - if(ret_value < 0) - if(cls) + if (ret_value < 0) + if (cls) cls = H5FL_FREE(H5I_class_t, cls); FUNC_LEAVE_API(ret_value) } /* end H5Iregister_type() */ - /*------------------------------------------------------------------------- * Function: H5I_register_type * @@ -293,8 +286,8 @@ done: herr_t H5I_register_type(const H5I_class_t *cls) { - H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -303,9 +296,9 @@ H5I_register_type(const H5I_class_t *cls) HDassert(cls->type_id > 0 && (int)cls->type_id < H5I_MAX_NUM_TYPES); /* Initialize the type */ - if(NULL == H5I_id_type_list_g[cls->type_id]) { + if (NULL == H5I_id_type_list_g[cls->type_id]) { /* Allocate the type information for new type */ - if(NULL == (type_ptr = (H5I_id_type_t *)H5FL_CALLOC(H5I_id_type_t))) + if (NULL == (type_ptr = (H5I_id_type_t *)H5FL_CALLOC(H5I_id_type_t))) HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "ID type allocation failed") H5I_id_type_list_g[cls->type_id] = type_ptr; } /* end if */ @@ -315,12 +308,12 @@ H5I_register_type(const H5I_class_t *cls) } /* end else */ /* Initialize the ID type structure for new types */ - if(type_ptr->init_count == 0) { - type_ptr->cls = cls; - type_ptr->id_count = 0; - type_ptr->nextid = cls->reserved; + if (type_ptr->init_count == 0) { + type_ptr->cls = cls; + type_ptr->id_count = 0; + type_ptr->nextid = cls->reserved; type_ptr->last_info = NULL; - if(NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL))) + if (NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL))) HGOTO_ERROR(H5E_ATOM, H5E_CANTCREATE, FAIL, "skip list creation failed") } /* end if */ @@ -328,18 +321,17 @@ H5I_register_type(const H5I_class_t *cls) type_ptr->init_count++; done: - if(ret_value < 0) { /* Clean up on error */ - if(type_ptr) { - if(type_ptr->ids) + if (ret_value < 0) { /* Clean up on error */ + if (type_ptr) { + if (type_ptr->ids) H5SL_close(type_ptr->ids); (void)H5FL_FREE(H5I_id_type_t, type_ptr); } /* end if */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register_type() */ - /*------------------------------------------------------------------------- * Function: H5Itype_exists * @@ -353,25 +345,24 @@ done: htri_t H5Itype_exists(H5I_type_t type) { - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); /* Validate parameter */ - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: FUNC_LEAVE_API(ret_value) } /* end H5Itype_exists() */ - /*------------------------------------------------------------------------- * Function: H5Inmembers * @@ -391,27 +382,27 @@ done: herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members) { - int ret_value = SUCCEED; /* Return value */ + int ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "It*h", type, num_members); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Validate parameters. This needs to be done here, instead of letting * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_id_type_list_g[type]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") - if(num_members) { + if (num_members) { int64_t members; - if((members = H5I_nmembers(type)) < 0) + if ((members = H5I_nmembers(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members") H5_CHECKED_ASSIGN(*num_members, hsize_t, members, int64_t); @@ -421,7 +412,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Inmembers() */ - /*------------------------------------------------------------------------- * Function: H5I_nmembers * @@ -440,15 +430,15 @@ done: int64_t H5I_nmembers(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - int64_t ret_value = 0; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + int64_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Validate parameter */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) + if (NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) HGOTO_DONE(0); /* Set return value */ @@ -458,7 +448,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_nmembers() */ - /*------------------------------------------------------------------------- * Function: H5I__unwrap * @@ -475,7 +464,7 @@ done: static void * H5I__unwrap(void *obj_ptr, H5I_type_t type) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -485,13 +474,13 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ - if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { const H5VL_object_t *vol_obj; - vol_obj = (const H5VL_object_t *)obj_ptr; + vol_obj = (const H5VL_object_t *)obj_ptr; ret_value = H5VL_object_data(vol_obj); } /* end if */ - else if(H5I_DATATYPE == type) { + else if (H5I_DATATYPE == type) { H5T_t *dt = (H5T_t *)obj_ptr; ret_value = (void *)H5T_get_actual_type(dt); @@ -502,7 +491,6 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__unwrap() */ - /*------------------------------------------------------------------------- * Function: H5Iclear_type * @@ -521,12 +509,12 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) herr_t H5Iclear_type(H5I_type_t type, hbool_t force) { - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "Itb", type, force); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_clear_type(type, force, TRUE); @@ -535,7 +523,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iclear_type() */ - /*------------------------------------------------------------------------- * Function: H5I_clear_type * @@ -552,32 +539,31 @@ done: herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) { - H5I_clear_type_ud_t udata; /* udata struct for callback */ - int ret_value = SUCCEED; /* Return value */ + H5I_clear_type_ud_t udata; /* udata struct for callback */ + int ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Validate parameters */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") udata.type_ptr = H5I_id_type_list_g[type]; - if(udata.type_ptr == NULL || udata.type_ptr->init_count <= 0) + if (udata.type_ptr == NULL || udata.type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Finish constructing udata */ - udata.force = force; + udata.force = force; udata.app_ref = app_ref; /* Attempt to free all ids in the type */ - if(H5SL_try_free_safe(udata.type_ptr->ids, H5I__clear_type_cb, &udata) < 0) + if (H5SL_try_free_safe(udata.type_ptr->ids, H5I__clear_type_cb, &udata) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't free ids in type") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_clear_type() */ - /*------------------------------------------------------------------------- * Function: H5I__clear_type_cb * @@ -594,9 +580,9 @@ done: static htri_t H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) { - H5I_id_info_t *id = (H5I_id_info_t *)_id; /* Current ID being worked with */ - H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ - htri_t ret_value = FALSE; /* Return value */ + H5I_id_info_t * id = (H5I_id_info_t *)_id; /* Current ID being worked with */ + H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -608,42 +594,42 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) /* Do nothing to the object if the reference count is larger than * one and forcing is off. */ - if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { + if (udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ - if(udata->force) { + if (udata->type_ptr->cls->free_func && + (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ + if (udata->force) { #ifdef H5I_DEBUG - if(H5DEBUG(I)) { - HDfprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " - "failure ignored\n", - (int)udata->type_ptr->cls->type_id, - (unsigned long)(id->obj_ptr)); + if (H5DEBUG(I)) { + HDfprintf(H5DEBUG(I), + "H5I: free type=%d obj=0x%08lx " + "failure ignored\n", + (int)udata->type_ptr->cls->type_id, (unsigned long)(id->obj_ptr)); } /* end if */ -#endif /*H5I_DEBUG*/ +#endif /*H5I_DEBUG*/ /* Indicate node should be removed from list */ ret_value = TRUE; } /* end if */ - } /* end if */ + } /* end if */ else { /* Indicate node should be removed from list */ ret_value = TRUE; } /* end else */ /* Remove ID if requested */ - if(ret_value) { + if (ret_value) { /* Free ID info */ id = H5FL_FREE(H5I_id_info_t, id); /* Decrement the number of IDs in the type */ udata->type_ptr->id_count--; } /* end if */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__clear_type_cb() */ - /*------------------------------------------------------------------------- * Function: H5Idestroy_type * @@ -663,12 +649,12 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) herr_t H5Idestroy_type(H5I_type_t type) { - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "It", type); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I__destroy_type(type); @@ -677,7 +663,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Idestroy_type() */ - /*------------------------------------------------------------------------- * Function: H5I__destroy_type * @@ -696,40 +681,41 @@ done: static herr_t H5I__destroy_type(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* ptr to the atomic type */ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_id_type_t *type_ptr; /* ptr to the atomic type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Validate parameter */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) + if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Close/clear/destroy all IDs for this type */ - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5I_clear_type(type, TRUE, FALSE); - } H5E_END_TRY /*don't care about errors*/ + } + H5E_END_TRY /*don't care about errors*/ - /* Check if we should release the ID class */ - if(type_ptr->cls->flags & H5I_CLASS_IS_APPLICATION) - type_ptr->cls = H5FL_FREE(H5I_class_t, (void *)type_ptr->cls); + /* Check if we should release the ID class */ + if (type_ptr->cls->flags & H5I_CLASS_IS_APPLICATION) + type_ptr->cls = H5FL_FREE(H5I_class_t, (void *)type_ptr->cls); - if(H5SL_close(type_ptr->ids) < 0) + if (H5SL_close(type_ptr->ids) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") type_ptr->ids = NULL; - type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); + type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__destroy_type() */ - /*------------------------------------------------------------------------- * Function: H5Iregister * @@ -743,12 +729,12 @@ done: hid_t H5Iregister(H5I_type_t type, const void *object) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "It*x", type, object); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_register(type, object, TRUE); @@ -757,7 +743,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iregister() */ - /*------------------------------------------------------------------------- * Function: H5I_register * @@ -777,10 +762,10 @@ done: hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) { - H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ - H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ - hid_t new_id = -1; /* new ID */ - hid_t ret_value = H5I_INVALID_HID; /* return value */ + H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ + hid_t new_id = -1; /* new ID */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -794,11 +779,11 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Create the struct & its ID */ - new_id = H5I_MAKE(type, type_ptr->nextid); - id_ptr->id = new_id; - id_ptr->count = 1; /* initial reference count */ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + new_id = H5I_MAKE(type, type_ptr->nextid); + id_ptr->id = new_id; + id_ptr->count = 1; /* initial reference count */ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -819,7 +804,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register() */ - /*------------------------------------------------------------------------- * Function: H5I_register_using_existing_id * @@ -841,9 +825,9 @@ done: herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) { - H5I_id_type_t *type_ptr; /* ptr to the type */ - H5I_id_info_t *id_ptr; /* ptr to the new ID information */ - herr_t ret_value = SUCCEED; /* return value */ + H5I_id_type_t *type_ptr; /* ptr to the type */ + H5I_id_info_t *id_ptr; /* ptr to the new ID information */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -851,35 +835,35 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h HDassert(object); /* Make sure ID is not already in use */ - if(NULL != (id_ptr = H5I__find_id(existing_id))) + if (NULL != (id_ptr = H5I__find_id(existing_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") /* Get type pointer from list of types */ type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->init_count <= 0) + if (NULL == type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Make sure requested ID belongs to object's type */ - if(H5I_TYPE(existing_id) != type) + if (H5I_TYPE(existing_id) != type) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID") /* Allocate new structure to house this ID */ - if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) + if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the struct & insert requested ID */ - id_ptr->id = existing_id; - id_ptr->count = 1; /* initial reference count*/ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + id_ptr->id = existing_id; + id_ptr->count = 1; /* initial reference count*/ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ - if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) + if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") type_ptr->id_count++; @@ -890,7 +874,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register_using_existing_id() */ - /*------------------------------------------------------------------------- * Function: H5I_subst * @@ -908,17 +891,17 @@ done: void * H5I_subst(hid_t id, const void *new_object) { - H5I_id_info_t *id_ptr; /* Pointer to the atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(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 */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ /* Set the new object pointer for the ID */ id_ptr->obj_ptr = new_object; @@ -927,7 +910,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_subst() */ - /*------------------------------------------------------------------------- * Function: H5I_object * @@ -943,21 +925,20 @@ done: void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR /* General lookup of the ID */ - if(NULL != (id_ptr = H5I__find_id(id))) { + if (NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ } FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_object() */ - /*------------------------------------------------------------------------- * Function: H5Iobject_verify * @@ -974,15 +955,15 @@ H5I_object(hid_t id) void * H5Iobject_verify(hid_t id, H5I_type_t id_type) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); /* Validate parameters */ - if(H5I_IS_LIB_TYPE(id_type)) + if (H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - if(id_type < 1 || (int)id_type >= H5I_next_type) + if (id_type < 1 || (int)id_type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") ret_value = H5I_object_verify(id, id_type); @@ -991,7 +972,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iobject_verify() */ - /*------------------------------------------------------------------------- * Function: H5I_object_verify * @@ -1010,23 +990,22 @@ done: void * H5I_object_verify(hid_t id, H5I_type_t id_type) { - H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR HDassert(id_type >= 1 && (int)id_type < H5I_next_type); /* Verify that the type of the ID is correct & lookup the ID */ - if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { + if (id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ } FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ - /*------------------------------------------------------------------------- * Function: H5I_get_type * @@ -1048,11 +1027,11 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) H5I_type_t H5I_get_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_NOAPI_NOERR - if(id > 0) + if (id > 0) ret_value = H5I_TYPE(id); HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type); @@ -1060,7 +1039,6 @@ H5I_get_type(hid_t id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ - /*------------------------------------------------------------------------- * Function: H5Iget_type * @@ -1079,21 +1057,20 @@ H5I_get_type(hid_t id) H5I_type_t H5Iget_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE1("It", "i", id); ret_value = H5I_get_type(id); - if(ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) + if (ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) HGOTO_DONE(H5I_BADID); done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_type() */ - /*------------------------------------------------------------------------- * Function: H5I_is_file_object * @@ -1112,8 +1089,8 @@ done: htri_t H5I_is_file_object(hid_t id) { - H5I_type_t id_type = H5I_get_type(id); - htri_t ret_value = FAIL; + H5I_type_t id_type = H5I_get_type(id); + htri_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL); @@ -1131,7 +1108,7 @@ H5I_is_file_object(hid_t id) H5T_t *dt = NULL; - if(NULL == (dt = (H5T_t *)H5I_object(id))) + if (NULL == (dt = (H5T_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct"); ret_value = H5T_is_named(dt); @@ -1144,7 +1121,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5I_is_file_object() */ - /*------------------------------------------------------------------------- * Function: H5Iremove_verify * @@ -1165,12 +1141,12 @@ done: void * H5Iremove_verify(hid_t id, H5I_type_t id_type) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); - if(H5I_IS_LIB_TYPE(id_type)) + if (H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Remove the id */ @@ -1180,7 +1156,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iremove_verify() */ - /*------------------------------------------------------------------------- * Function: H5I__remove_verify * @@ -1200,20 +1175,19 @@ done: static void * H5I__remove_verify(hid_t id, H5I_type_t id_type) { - void * ret_value = NULL; /*return value */ + void *ret_value = NULL; /*return value */ FUNC_ENTER_STATIC_NOERR /* Argument checking will be performed by H5I_remove() */ /* Verify that the type of the ID is correct */ - if(id_type == H5I_TYPE(id)) + if (id_type == H5I_TYPE(id)) ret_value = H5I_remove(id); FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__remove_verify() */ - /*------------------------------------------------------------------------- * Function: H5I__remove_common * @@ -1232,8 +1206,8 @@ H5I__remove_verify(hid_t id, H5I_type_t id_type) static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) { - H5I_id_info_t *curr_id; /* Pointer to the current atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *curr_id; /* Pointer to the current atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1241,15 +1215,15 @@ H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) HDassert(type_ptr); /* Get the ID node for the ID */ - if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) + if (NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") /* Check if this ID was the last one accessed */ - if(type_ptr->last_info == curr_id) + if (type_ptr->last_info == curr_id) type_ptr->last_info = NULL; - ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ - curr_id = H5FL_FREE(H5I_id_info_t, curr_id); + ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ + curr_id = H5FL_FREE(H5I_id_info_t, curr_id); /* Decrement the number of IDs in the type */ (type_ptr->id_count)--; @@ -1258,7 +1232,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__remove_common() */ - /*------------------------------------------------------------------------- * Function: H5I_remove * @@ -1276,29 +1249,28 @@ done: void * H5I_remove(hid_t id) { - H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ - H5I_type_t type; /* Atom's atomic type */ - void * ret_value = NULL; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ + H5I_type_t type; /* Atom's atomic type */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) + if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") /* Remove the node from the type */ - if(NULL == (ret_value = H5I__remove_common(type_ptr, id))) + if (NULL == (ret_value = H5I__remove_common(type_ptr, id))) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_remove() */ - /*------------------------------------------------------------------------- * Function: H5Idec_ref * @@ -1317,24 +1289,23 @@ done: int H5Idec_ref(hid_t id) { - int ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ - if(id < 0) + if (id < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") /* Do actual decrement operation */ - if((ret_value = H5I_dec_app_ref(id)) < 0) + if ((ret_value = H5I_dec_app_ref(id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Idec_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_ref * @@ -1353,8 +1324,8 @@ done: int H5I_dec_ref(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1362,7 +1333,7 @@ H5I_dec_ref(hid_t id) HDassert(id >= 0); /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) + if (NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* If this is the last reference to the object then invoke the type's @@ -1379,16 +1350,16 @@ H5I_dec_ref(hid_t id) * write when a dataset is closed and the chunk cache is flushed to the * file. We have to close the dataset anyway. (SLU - 2010/9/7) */ - if(1 == id_ptr->count) { - H5I_id_type_t *type_ptr; /*ptr to the type */ + if (1 == id_ptr->count) { + H5I_id_type_t *type_ptr; /*ptr to the type */ /* Get the ID's type */ type_ptr = H5I_id_type_list_g[H5I_TYPE(id)]; /* (Casting away const OK -QAK) */ - if(!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) { + if (!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) { /* Remove the node from the type */ - if(NULL == H5I__remove_common(type_ptr, id)) + if (NULL == H5I__remove_common(type_ptr, id)) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node") ret_value = 0; } /* end if */ @@ -1404,7 +1375,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_app_ref * @@ -1422,8 +1392,8 @@ done: int H5I_dec_app_ref(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1431,13 +1401,13 @@ H5I_dec_app_ref(hid_t id) HDassert(id >= 0); /* Call regular decrement reference count routine */ - if((ret_value = H5I_dec_ref(id)) < 0) + if ((ret_value = H5I_dec_ref(id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") /* Check if the ID still exists */ - if(ret_value > 0) { + if (ret_value > 0) { /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) + if (NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* Adjust app_ref */ @@ -1452,7 +1422,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_app_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_app_ref_always_close * @@ -1467,7 +1436,7 @@ done: int H5I_dec_app_ref_always_close(hid_t id) { - int ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1494,7 +1463,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_app_ref_always_close() */ - /*------------------------------------------------------------------------- * Function: H5Iinc_ref * @@ -1508,7 +1476,7 @@ done: int H5Iinc_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); @@ -1525,7 +1493,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_inc_ref * @@ -1539,8 +1506,8 @@ done: int H5I_inc_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /* Pointer to the ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1563,7 +1530,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_inc_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iget_ref * @@ -1577,7 +1543,7 @@ done: int H5Iget_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); @@ -1594,7 +1560,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_get_ref * @@ -1608,8 +1573,8 @@ done: int H5I_get_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /* Pointer to the ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1627,7 +1592,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iinc_type_ref * @@ -1641,26 +1605,25 @@ done: int H5Iinc_type_ref(H5I_type_t type) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || (int)type >= H5I_next_type) + if (type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual increment operation */ - if((ret_value = H5I__inc_type_ref(type)) < 0) + if ((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ - /*------------------------------------------------------------------------- * Function: H5I__inc_type_ref * @@ -1674,8 +1637,8 @@ done: static int H5I__inc_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - int ret_value = -1; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1684,7 +1647,7 @@ H5I__inc_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr) + if (NULL == type_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Set return value */ @@ -1694,7 +1657,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__inc_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5Idec_type_ref * @@ -1722,7 +1684,7 @@ done: herr_t H5Idec_type_ref(H5I_type_t type) { - herr_t ret_value = 0; /* Return value */ + herr_t ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("e", "It", type); @@ -1736,7 +1698,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Idec_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_type_ref * @@ -1759,16 +1720,16 @@ done: int H5I_dec_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - herr_t ret_value = 0; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + herr_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) + if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Decrement the number of users of the atomic type. If this is the @@ -1776,7 +1737,7 @@ H5I_dec_type_ref(H5I_type_t type) * free all memory it used. The free function is invoked for each atom * being freed. */ - if(1 == type_ptr->init_count) { + if (1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; } /* end if */ @@ -1789,7 +1750,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iget_type_ref * @@ -1803,26 +1763,25 @@ done: int H5Iget_type_ref(H5I_type_t type) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || (int)type >= H5I_next_type) + if (type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual retrieve operation */ - if((ret_value = H5I__get_type_ref(type)) < 0) + if ((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ - /*------------------------------------------------------------------------- * Function: H5I__get_type_ref * @@ -1837,8 +1796,8 @@ done: static int H5I__get_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - int ret_value = -1; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1857,7 +1816,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__get_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iis_valid * @@ -1871,8 +1829,8 @@ done: htri_t H5Iis_valid(hid_t id) { - H5I_id_info_t *id_ptr; /* ptr to the ID */ - htri_t ret_value = TRUE; /* Return value */ + H5I_id_info_t *id_ptr; /* ptr to the ID */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "i", id); @@ -1887,7 +1845,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iis_valid() */ - /*------------------------------------------------------------------------- * Function: H5I__search_cb * @@ -1903,26 +1860,25 @@ done: static int H5I__search_cb(void *obj, hid_t id, void *_udata) { - H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ - herr_t cb_ret_val; /* User callback return value */ - int ret_value = H5_ITER_ERROR; /* Callback return value */ + H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ FUNC_ENTER_STATIC_NOERR cb_ret_val = (*udata->app_cb)(obj, id, udata->app_key); /* Set the return value based on the callback's return value */ - if(cb_ret_val > 0) { - ret_value = H5_ITER_STOP; /* terminate iteration early */ - udata->ret_obj = obj; /* also set out parameter */ + if (cb_ret_val > 0) { + ret_value = H5_ITER_STOP; /* terminate iteration early */ + udata->ret_obj = obj; /* also set out parameter */ } - else if(cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__search_cb() */ - /*------------------------------------------------------------------------- * Function: H5Isearch * @@ -1946,8 +1902,8 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) void * H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) { - H5I_search_ud_t udata; /* Context for iteration */ - void *ret_value; /* Return value */ + H5I_search_ud_t udata; /* Context for iteration */ + void * ret_value; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE3("*x", "Itx*x", type, func, key); @@ -1957,7 +1913,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Set up udata struct */ - udata.app_cb = func; + udata.app_cb = func; udata.app_key = key; udata.ret_obj = NULL; @@ -1973,7 +1929,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Isearch() */ - /*------------------------------------------------------------------------- * Function: H5I__iterate_pub_cb * @@ -1993,9 +1948,9 @@ done: static int H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) { - H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ - herr_t cb_ret_val; /* User callback return value */ - int ret_value = H5_ITER_ERROR; /* Callback return value */ + H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -2003,17 +1958,16 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) cb_ret_val = (*udata->op)(id, udata->op_data); /* Set the return value based on the callback's return value */ - if(cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ - else if(cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + if (cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ else ret_value = H5_ITER_CONT; /* continue iteration */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_pub_cb() */ - /*------------------------------------------------------------------------- * Function: H5Iiterate * @@ -2040,15 +1994,15 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) { - H5I_iterate_pub_ud_t int_udata; /* Internal user data */ - herr_t ret_value; /* Return value */ + H5I_iterate_pub_ud_t int_udata; /* Internal user data */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "Itx*x", type, op, op_data); /* Set up udata struct */ - int_udata.op = op; - int_udata.op_data = op_data; + int_udata.op = op; + int_udata.op_data = op_data; /* Note that H5I_iterate returns an error code. We ignore it * here, as we can't do anything with it without revising the API. @@ -2060,7 +2014,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iiterate() */ - /*------------------------------------------------------------------------- * Function: H5I__iterate_cb * @@ -2076,19 +2029,19 @@ done: static int H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ - int ret_value = H5_ITER_CONT; /* Callback return value */ + H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ + int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR /* Only invoke the callback function if this ID is visible externally and * its reference count is positive. */ - if((!udata->app_ref) || (item->app_count > 0)) { - H5I_type_t type = udata->obj_type; - void *obj_ptr; - herr_t cb_ret_val; + if ((!udata->app_ref) || (item->app_count > 0)) { + H5I_type_t type = udata->obj_type; + void * obj_ptr; + herr_t cb_ret_val; /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). @@ -2096,19 +2049,19 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) obj_ptr = H5I__unwrap((void *)item->obj_ptr, type); /* Invoke callback function */ - cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ + cb_ret_val = + (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ /* Set the return value based on the callback's return value */ - if(cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ - else if(cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } /* end if */ + if (cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_cb() */ - /*------------------------------------------------------------------------- * Function: H5I_iterate * @@ -2138,28 +2091,28 @@ herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) { H5I_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ - if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { - H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ - herr_t iter_status; /* Iteration status */ + if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ + herr_t iter_status; /* Iteration status */ /* Set up iterator user data */ - iter_udata.user_func = func; - iter_udata.user_udata = udata; - iter_udata.app_ref = app_ref; - iter_udata.obj_type = type; + iter_udata.user_func = func; + iter_udata.user_udata = udata; + iter_udata.app_ref = app_ref; + iter_udata.obj_type = type; /* Iterate over IDs */ - if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") } /* end if */ @@ -2167,7 +2120,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_iterate() */ - /*------------------------------------------------------------------------- * Function: H5I__find_id * @@ -2183,22 +2135,22 @@ done: static H5I_id_info_t * H5I__find_id(hid_t id) { - H5I_type_t type; /*ID's type */ - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *ret_value = NULL; /* Return value */ + H5I_type_t type; /*ID's type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_DONE(NULL) type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->init_count <= 0) + if (!type_ptr || type_ptr->init_count <= 0) HGOTO_DONE(NULL) /* Check for same ID as we have looked up last time */ - if(type_ptr->last_info && type_ptr->last_info->id == id) + if (type_ptr->last_info && type_ptr->last_info->id == id) ret_value = type_ptr->last_info; else { /* Locate the ID node for the ID */ @@ -2212,7 +2164,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id() */ - /*------------------------------------------------------------------------- * Function: H5Iget_name * @@ -2238,32 +2189,32 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Iget_name(hid_t id, char *name/*out*/, size_t size) +H5Iget_name(hid_t id, char *name /*out*/, size_t size) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t ret_value; /* Return value */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_vol_object(id))) + if (NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = H5I_get_type(id); + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); /* Retrieve object's name */ - if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) + if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &ret_value, name, size) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ - /*------------------------------------------------------------------------- * Function: H5Iget_file_id * @@ -2279,8 +2230,8 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); @@ -2289,15 +2240,16 @@ H5Iget_file_id(hid_t obj_id) type = H5I_TYPE(obj_id); /* Call internal function */ - if(H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - H5VL_object_t *vol_obj; /* Object of obj_id */ + if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || + H5I_ATTR == type) { + H5VL_object_t *vol_obj; /* Object of obj_id */ /* Get the VOL object */ - if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file ID */ - if((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) + if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else @@ -2307,7 +2259,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_file_id() */ - /*------------------------------------------------------------------------- * Function: H5I__find_id_cb * @@ -2321,11 +2272,11 @@ done: static int H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ - H5I_type_t type = udata->obj_type; - const void *obj_ptr = NULL; - int ret_value = H5_ITER_CONT; /* Return value */ + H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ + H5I_type_t type = udata->obj_type; + const void * obj_ptr = NULL; + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -2339,13 +2290,12 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* Check for a match */ if (obj_ptr == udata->object) { udata->ret_id = item->id; - ret_value = H5_ITER_STOP; + ret_value = H5_ITER_STOP; } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id_cb() */ - /*------------------------------------------------------------------------- * Function: H5I_find_id * @@ -2360,8 +2310,8 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2375,13 +2325,13 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) /* Only iterate through ID list if it is initialized and there are IDs in type */ if (type_ptr->init_count > 0 && type_ptr->id_count > 0) { - H5I_get_id_ud_t udata; /* User data */ - herr_t iter_status; /* Iteration status */ + H5I_get_id_ud_t udata; /* User data */ + herr_t iter_status; /* Iteration status */ /* Set up iterator user data */ - udata.object = object; - udata.obj_type = type; - udata.ret_id = H5I_INVALID_HID; + udata.object = object; + udata.obj_type = type; + udata.ret_id = H5I_INVALID_HID; /* Iterate over IDs for the ID type */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0) @@ -2394,7 +2344,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_find_id() */ - /*------------------------------------------------------------------------- * Function: H5I__id_dump_cb * @@ -2407,10 +2356,10 @@ done: static int H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ - H5G_name_t *path = NULL; /* Path to file object */ - const void *obj_ptr = NULL; /* Pointer to VOL connector object */ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ + H5G_name_t * path = NULL; /* Path to file object */ + const void * obj_ptr = NULL; /* Pointer to VOL connector object */ FUNC_ENTER_STATIC_NOERR @@ -2420,32 +2369,29 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* Get the group location, so we get get the name */ switch (type) { - case H5I_GROUP: - { + case H5I_GROUP: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + if (H5_VOL_NATIVE == vol_obj->connector->cls->value) path = H5G_nameof((const H5G_t *)obj_ptr); break; } - case H5I_DATASET: - { + case H5I_DATASET: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + if (H5_VOL_NATIVE == vol_obj->connector->cls->value) path = H5D_nameof((const H5D_t *)obj_ptr); break; } - case H5I_DATATYPE: - { + case H5I_DATATYPE: { const H5T_t *dt = (const H5T_t *)item->obj_ptr; obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ - path = H5T_nameof((const H5T_t *)obj_ptr); + path = H5T_nameof((const H5T_t *)obj_ptr); break; } @@ -2469,7 +2415,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: - break; /* Other types of IDs are not stored in files */ + break; /* Other types of IDs are not stored in files */ } if (path) { @@ -2482,7 +2428,6 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_LEAVE_NOAPI(H5_ITER_CONT) } /* end H5I__id_dump_cb() */ - /*------------------------------------------------------------------------- * Function: H5I_dump_ids_for_type * @@ -2495,14 +2440,14 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) herr_t H5I_dump_ids_for_type(H5I_type_t type) { - H5I_id_type_t *type_ptr = NULL; + H5I_id_type_t *type_ptr = NULL; FUNC_ENTER_NOAPI_NOERR HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; - if(type_ptr) { + if (type_ptr) { /* Header */ HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); @@ -2511,7 +2456,7 @@ H5I_dump_ids_for_type(H5I_type_t type) HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); /* List */ - if(type_ptr->id_count > 0) { + if (type_ptr->id_count > 0) { HDfprintf(stderr, " List:\n"); H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); } @@ -2521,4 +2466,3 @@ H5I_dump_ids_for_type(H5I_type_t type) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5I_dump_ids_for_type() */ - |