diff options
Diffstat (limited to 'src/H5Adeprec.c')
-rw-r--r-- | src/H5Adeprec.c | 158 |
1 files changed, 73 insertions, 85 deletions
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index c4d8bb8..3589296 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -29,62 +29,53 @@ /* Module Setup */ /****************/ -#include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ - +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ -#include "H5VLprivate.h" /* Virtual object layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual object layer */ #include "H5VLnative_private.h" /* Native VOL connector */ - /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*-------------------------------------------------------------------------- NAME H5Acreate1 @@ -113,58 +104,57 @@ --------------------------------------------------------------------------*/ hid_t -H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, - hid_t acpl_id) +H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id) { - void *attr = NULL; /* attr object from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ - H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void * attr = NULL; /* attr object from VOL connector */ + H5VL_object_t * vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id); /* Check arguments */ - if(H5I_ATTR == H5I_get_type(loc_id)) + if (H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) + if (H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") /* Get correct property list */ - if(H5P_DEFAULT == acpl_id) + if (H5P_DEFAULT == acpl_id) acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = H5I_get_type(loc_id); + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, - H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == + (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, + H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Clean up on failure */ - if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5I_INVALID_HID == ret_value) + if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* end H5Acreate1() */ - /*-------------------------------------------------------------------------- NAME H5Aopen_name @@ -190,47 +180,46 @@ done: hid_t H5Aopen_name(hid_t loc_id, const char *name) { - void *attr = NULL; /* attr object from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + void * attr = NULL; /* attr object from VOL connector */ + H5VL_object_t * vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; - 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", "i*s", loc_id, name); /* Check arguments */ - if(H5I_ATTR == H5I_get_type(loc_id)) + if (H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = H5I_get_type(loc_id); + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ - if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5I_INVALID_HID == ret_value) + if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ - /*-------------------------------------------------------------------------- NAME H5Aopen_idx @@ -256,50 +245,49 @@ done: hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { - void *attr = NULL; /* attr object from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ - H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void * attr = NULL; /* attr object from VOL connector */ + H5VL_object_t * vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "iIu", loc_id, idx); /* Check arguments */ - if(H5I_ATTR == H5I_get_type(loc_id)) + if (H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_IDX; - loc_params.loc_data.loc_by_idx.name = "."; - loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_CRT_ORDER; - loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; - loc_params.loc_data.loc_by_idx.n = (hsize_t)idx; - loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; - loc_params.obj_type = H5I_get_type(loc_id); + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_CRT_ORDER; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = (hsize_t)idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ - if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5I_INVALID_HID == ret_value) + if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ - /*-------------------------------------------------------------------------- NAME H5Aget_num_attrs @@ -321,10 +309,10 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ - H5VL_loc_params_t loc_params; - H5O_info2_t oinfo; - int ret_value = -1; + H5VL_object_t * vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_info2_t oinfo; + int ret_value = -1; FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", loc_id); @@ -333,11 +321,12 @@ H5Aget_num_attrs(hid_t loc_id) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_NUM_ATTRS) < 0) + if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &oinfo, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); @@ -346,7 +335,6 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Aget_num_attrs() */ - /*-------------------------------------------------------------------------- NAME H5Aiterate1 @@ -387,26 +375,26 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5_ITER_ERROR) H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data); /* check arguments */ - if(H5I_ATTR == H5I_get_type(loc_id)) + if (H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute") /* Get the location object */ - if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ - if((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0) + if ((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0) HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_API(ret_value) } /* H5Aiterate1() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - |