diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-08-23 19:09:20 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-08-23 19:09:20 (GMT) |
commit | d20d355b79bf25d2685dc9e3967951b1532951bb (patch) | |
tree | c862028f2d6c7ea540c6ffd2ca34d6ac9b715686 /src/H5A.c | |
parent | c951ee8eded3cd63adfeaa87dcdd966ceb3e58c1 (diff) | |
download | hdf5-d20d355b79bf25d2685dc9e3967951b1532951bb.zip hdf5-d20d355b79bf25d2685dc9e3967951b1532951bb.tar.gz hdf5-d20d355b79bf25d2685dc9e3967951b1532951bb.tar.bz2 |
OESS-29 Update HD prefix and compare against develop
Diffstat (limited to 'src/H5A.c')
-rw-r--r-- | src/H5A.c | 107 |
1 files changed, 56 insertions, 51 deletions
@@ -16,22 +16,22 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspace functions */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspace functions */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ @@ -216,59 +216,64 @@ H5A_term_package(void) /*-------------------------------------------------------------------------- - NAME - H5Acreate2 - PURPOSE - Creates an attribute on an object - USAGE - hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, - aapl_id) - hid_t loc_id; IN: Object (dataset or group) to be attached to - const char *attr_name; IN: Name of attribute to locate and open - hid_t type_id; IN: ID of datatype for attribute - hid_t space_id; IN: ID of dataspace for attribute - hid_t acpl_id; IN: ID of creation property list (currently not used) - hid_t aapl_id; IN: Attribute access property list - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function creates an attribute which is attached to the object - specified with 'loc_id'. The name specified with 'attr_name' for - each attribute for an object must be unique for that object. The 'type_id' - and 'space_id' are created with the H5T and H5S interfaces respectively. - The 'aapl_id' property list is currently unused, but will be used in the - future for optional attribute access properties. The attribute ID returned - from this function must be released with H5Aclose or resource leaks will - develop. - ---------------------------------------------------------------------------*/ + * Function: H5Acreate2 + * + * Purpose: Creates an attribute on an object + * + * Usage: + * hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, + * aapl_id) + * + * Description: This function creates an attribute which is attached to the + * object specified with 'loc_id'. The name specified with + * 'attr_name' for each attribute for an object must be unique + * for that object. The 'type_id' and 'space_id' are created + * with the H5T and H5S interfaces respectively. The 'aapl_id' + * property list is currently unused, but will be used in the + * future for optional attribute access properties. The + * attribute ID returned from this function must be released + * with H5Aclose or resource leaks will develop. + * + * Parameters: + * hid_t loc_id; IN: Object (dataset or group) to be attached to + * const char *attr_name; IN: Name of attribute to locate and open + * hid_t type_id; IN: ID of datatype for attribute + * hid_t space_id; IN: ID of dataspace for attribute + * hid_t acpl_id; IN: ID of creation property list (currently not used) + * hid_t aapl_id; IN: Attribute access property list + * + * Return: Success: An ID for the created attribute + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute created */ + H5G_loc_t loc; /* Object location */ + H5T_t *type; /* Datatype to use for attribute */ + H5S_t *space; /* Dataspace to use for attribute */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) @@ -336,7 +341,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) |