summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-09-24 19:23:41 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-09-24 19:23:41 (GMT)
commita56b4db4ae25d30e6e7eb96f27d7b91e35148591 (patch)
tree7738d08a9734103fd12242eb5ff0244dd74c214d
parent37309c1bd98b3d810f09569c72ac375e75117a91 (diff)
downloadhdf5-a56b4db4ae25d30e6e7eb96f27d7b91e35148591.zip
hdf5-a56b4db4ae25d30e6e7eb96f27d7b91e35148591.tar.gz
hdf5-a56b4db4ae25d30e6e7eb96f27d7b91e35148591.tar.bz2
Remainder of vol_normalization changes (dataset, attribute, files, objects).
-rw-r--r--src/H5A.c532
-rw-r--r--src/H5Adense.c174
-rw-r--r--src/H5Adeprec.c131
-rw-r--r--src/H5Aint.c192
-rw-r--r--src/H5Apkg.h1
-rw-r--r--src/H5D.c544
-rw-r--r--src/H5Dbtree.c9
-rw-r--r--src/H5Dbtree2.c2
-rw-r--r--src/H5Dchunk.c73
-rw-r--r--src/H5Ddbg.c29
-rw-r--r--src/H5Ddeprec.c134
-rw-r--r--src/H5Dfill.c2
-rw-r--r--src/H5Dint.c134
-rw-r--r--src/H5Dio.c59
-rw-r--r--src/H5Dlayout.c4
-rw-r--r--src/H5Dmpio.c3
-rw-r--r--src/H5Doh.c10
-rw-r--r--src/H5Dpkg.h22
-rw-r--r--src/H5Dscatgath.c12
-rw-r--r--src/H5Dsingle.c8
-rw-r--r--src/H5Dvirtual.c8
-rw-r--r--src/H5F.c772
-rw-r--r--src/H5Fdeprec.c34
-rw-r--r--src/H5Fint.c638
-rw-r--r--src/H5Fio.c6
-rw-r--r--src/H5Fmount.c4
-rw-r--r--src/H5Fmpi.c12
-rw-r--r--src/H5Fpkg.h27
-rw-r--r--src/H5Fprivate.h5
-rw-r--r--src/H5Fsfile.c54
-rw-r--r--src/H5Fsuper.c115
-rw-r--r--src/H5Fsuper_cache.c1
-rw-r--r--src/H5G.c238
-rw-r--r--src/H5Gcompact.c33
-rw-r--r--src/H5Gdense.c5
-rw-r--r--src/H5Gdeprec.c157
-rw-r--r--src/H5Gint.c68
-rw-r--r--src/H5Gname.c2
-rw-r--r--src/H5Gpkg.h1
-rw-r--r--src/H5Gprivate.h6
-rw-r--r--src/H5Gtraverse.c50
-rw-r--r--src/H5L.c557
-rw-r--r--src/H5Lprivate.h15
-rw-r--r--src/H5O.c244
-rw-r--r--src/H5Oalloc.c134
-rw-r--r--src/H5Oattr.c110
-rw-r--r--src/H5Oattribute.c322
-rw-r--r--src/H5Obogus.c2
-rw-r--r--src/H5Ocache.c20
-rw-r--r--src/H5Ochunk.c58
-rw-r--r--src/H5Ocont.c38
-rw-r--r--src/H5Ocopy.c54
-rw-r--r--src/H5Odbg.c125
-rw-r--r--src/H5Odeprec.c40
-rw-r--r--src/H5Odtype.c14
-rw-r--r--src/H5Ofill.c6
-rw-r--r--src/H5Oflush.c137
-rw-r--r--src/H5Oginfo.c4
-rw-r--r--src/H5Oint.c166
-rw-r--r--src/H5Olinfo.c12
-rw-r--r--src/H5Omessage.c84
-rw-r--r--src/H5Omtime.c4
-rw-r--r--src/H5Opkg.h43
-rw-r--r--src/H5Oprivate.h12
-rw-r--r--src/H5Oshared.c107
-rw-r--r--src/H5Oshared.h24
-rw-r--r--src/H5Ostab.c44
-rw-r--r--src/H5Otest.c6
-rw-r--r--src/H5Ounknown.c6
-rw-r--r--tools/test/h5dump/errfiles/tattr-3.err2
-rw-r--r--tools/test/h5dump/errfiles/tqmarkfile.err4
-rw-r--r--tools/testfiles/tstarfile.ddl4
72 files changed, 3443 insertions, 3266 deletions
diff --git a/src/H5A.c b/src/H5A.c
index a0408c3..6f810be 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -16,22 +16,21 @@
/****************/
#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 */
/****************/
@@ -123,7 +122,7 @@ H5A__init_package(void)
* Create attribute ID type.
*/
if(H5I_register_type(H5I_ATTR_CLS) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Mark "top" of interface as initialized, too */
H5A_top_package_initialize_s = TRUE;
@@ -216,33 +215,38 @@ 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)
@@ -251,41 +255,44 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
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 */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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")
- if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file")
+ if(!attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL")
+ if(!*attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string")
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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Go do the real work for attaching the attribute to the object */
+ /* Create the attribute */
if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
+ 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0 && attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5A__close(attr) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate2() */
@@ -308,7 +315,7 @@ done:
hid_t aapl_id; IN: Attribute access property list
hid_t lapl_id; IN: Link access property list
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success/H5I_INVALID_HID on failure
DESCRIPTION
This function creates an attribute which is attached to the object
@@ -330,27 +337,27 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
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 */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
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")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "no write intent on file")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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)
@@ -358,22 +365,23 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
if(H5P_DEFAULT != lapl_id) {
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
H5CX_set_lapl(lapl_id);
- } /* end if */
+ }
- /* Create the attribute on the object */
+ /* Create the attribute */
if(NULL == (attr = H5A__create_by_name(&loc, obj_name, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
+ 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0 && attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5A__close(attr) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate_by_name() */
@@ -390,7 +398,7 @@ done:
const char *attr_name; IN: Name of attribute to locate and open
hid_t aapl_id; IN: Attribute access property list
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -403,36 +411,38 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, attr_name, 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, H5I_INVALID_HID, "location is not valid for an attribute")
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
+ if(!attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Read in attribute from object header */
+ /* Open the attribute */
if(NULL == (attr = H5A__open(&loc, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name)
/* Register the attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen() */
@@ -451,7 +461,7 @@ done:
hid_t aapl_id; IN: Attribute access property list
hid_t lapl_id; IN: Link access property list
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -465,47 +475,48 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, 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")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "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, H5I_INVALID_HID, "not a location")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* Set lapl_id and add to context */
if(H5P_DEFAULT != lapl_id) {
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
H5CX_set_lapl(lapl_id);
- } /* end if */
+ }
- /* Open the attribute on the object header */
+ /* Open the attribute */
if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute")
/* Register the attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
-} /* H5Aopen_by_name() */
+} /* end H5Aopen_by_name() */
/*--------------------------------------------------------------------------
@@ -524,7 +535,7 @@ done:
hid_t aapl_id; IN: Attribute access property list
hid_t lapl_id; IN: Link access property list
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -538,47 +549,48 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
{
H5A_t *attr = NULL; /* Attribute opened */
H5G_loc_t loc; /* Object location */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, 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")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "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, H5I_INVALID_HID, "not a location")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* Set lapl_id and add to context */
if(H5P_DEFAULT != lapl_id) {
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
H5CX_set_lapl(lapl_id);
- } /* end if */
+ }
- /* Open the attribute in the object header */
+ /* Open the attribute */
if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
+ 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_by_idx() */
@@ -603,26 +615,26 @@ done:
herr_t
H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
{
- H5A_t *attr; /* Attribute object for ID */
+ H5A_t *attr; /* Attribute object for ID */
H5T_t *mem_type; /* Memory datatype */
- herr_t ret_value; /* Return value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*x", attr_id, dtype_id, buf);
- /* check arguments */
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if(NULL == buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(attr_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Go write the actual data to the attribute */
+ /* Write the attribute data */
if((ret_value = H5A__write(attr, mem_type, buf)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
@@ -650,22 +662,22 @@ done:
herr_t
H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
{
- H5A_t *attr; /* Attribute object for ID */
+ H5A_t *attr; /* Attribute object for ID */
H5T_t *mem_type; /* Memory datatype */
- herr_t ret_value; /* Return value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*x", attr_id, dtype_id, buf);
- /* check arguments */
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if(NULL == buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
- /* Go write the actual data to the attribute */
+ /* Read the attribute data */
if((ret_value = H5A__read(attr, mem_type, buf)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
@@ -683,7 +695,7 @@ done:
hid_t H5Aget_space (attr_id)
hid_t attr_id; IN: Attribute to get dataspace of
RETURNS
- A dataspace ID on success, negative on failure
+ A dataspace ID on success, H5I_INVALID_HID on failure
DESCRIPTION
This function retrieves a copy of the dataspace for an attribute.
@@ -693,18 +705,20 @@ done:
hid_t
H5Aget_space(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- hid_t ret_value; /* Return value */
+ H5A_t *attr = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
- /* check arguments */
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Get the dataspace */
if((ret_value = H5A_get_space(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -719,7 +733,7 @@ done:
hid_t H5Aget_type (attr_id)
hid_t attr_id; IN: Attribute to get datatype of
RETURNS
- A datatype ID on success, negative on failure
+ A datatype ID on success, H5I_INVALID_HID on failure
DESCRIPTION
This function retrieves a copy of the datatype for an attribute.
@@ -729,18 +743,19 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- hid_t ret_value; /* Return value */
+ H5A_t *attr = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
- /* check arguments */
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Get the datatype */
if((ret_value = H5A__get_type(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
done:
FUNC_LEAVE_API(ret_value)
@@ -757,7 +772,7 @@ done:
hid_t attr_id; IN: Attribute to get name of
RETURNS
This function returns the ID of a copy of the attribute's creation
- property list, or negative on failure.
+ property list, or H5I_INVALID_HID on failure.
ERRORS
@@ -769,20 +784,21 @@ done:
hid_t
H5Aget_create_plist(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- hid_t ret_value;
+ H5A_t *attr = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1);
- /* Get attribute and default attribute creation property list*/
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Get the acpl */
if((ret_value = H5A__get_create_plist(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute")
done:
FUNC_LEAVE_API(ret_value)
@@ -813,21 +829,21 @@ done:
ssize_t
H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
{
- H5A_t *my_attr; /* Attribute object for ID */
- ssize_t ret_value;
+ H5A_t *attr = NULL; /* Attribute object for ID */
+ ssize_t ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf);
/* check arguments */
- if(NULL == (my_attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute")
if(!buf && buf_size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero")
- /* Call private function in turn */
- if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
+ /* Get the attribute name */
+ if((ret_value = H5A__get_name(attr, buf_size, buf)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
done:
FUNC_LEAVE_API(ret_value)
@@ -866,15 +882,15 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Check args */
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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -887,12 +903,12 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Get the length of the name */
ret_value = (ssize_t)HDstrlen(attr->shared->name);
- /* Copy the name into the user's buffer, if given */
+ /* Get the name and store in the user's buffer */
if(name) {
HDstrncpy(name, attr->shared->name, MIN((size_t)(ret_value + 1), size));
if((size_t)ret_value >= size)
name[size - 1]='\0';
- } /* end if */
+ }
done:
/* Release resources */
@@ -929,11 +945,11 @@ H5Aget_storage_size(hid_t attr_id)
FUNC_ENTER_API(0)
H5TRACE1("h", "i", attr_id);
- /* Check args */
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
- /* Set return value */
+ /* Get the storage size */
ret_value = attr->shared->data_size;
done:
@@ -963,13 +979,13 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", attr_id, ainfo);
- /* Check args */
+ /* Check arguments */
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Get the attribute information */
if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1002,13 +1018,13 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Check args */
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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
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 == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
@@ -1022,7 +1038,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Get the attribute information */
if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
/* Release resources */
@@ -1061,15 +1077,15 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Check args */
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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
@@ -1083,7 +1099,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Get the attribute information */
if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
/* Release resources */
@@ -1095,12 +1111,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Arename
+ * Function: H5Arename
*
* Purpose: Rename an attribute
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* October 23, 2002
@@ -1117,25 +1132,25 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
/* check arguments */
if(!old_name || !new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
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")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_name, new_name)) {
H5G_loc_t loc; /* Object location */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Set up collective metadata if appropriate */
- if(H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Call private attribute rename routine */
+ /* Rename the attribute */
if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
- } /* end if */
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -1143,12 +1158,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Arename_by_name
+ * Function: H5Arename_by_name
*
* Purpose: Rename an attribute
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* February 20, 2007
@@ -1167,13 +1181,13 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
/* 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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(!old_attr_name || !*old_attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name")
if(!new_attr_name || !*new_attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_attr_name, new_attr_name)) {
@@ -1183,13 +1197,14 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Get the location object */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Call private attribute rename routine */
+ /* Rename the attribute */
if(H5A__rename_by_name(loc, obj_name, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
- } /* end if */
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -1248,15 +1263,15 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
/* 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(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- /* Call attribute iteration routine */
+ /* Iterate over attributes */
if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
done:
FUNC_LEAVE_API(ret_value)
@@ -1312,7 +1327,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
hid_t lapl_id)
{
H5G_loc_t loc; /* Object location */
- herr_t ret_value; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op,
@@ -1320,23 +1335,23 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* 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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call attribute iteration by name routine */
+ /* Iterate over attributes */
if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed");
done:
FUNC_LEAVE_API(ret_value)
@@ -1361,24 +1376,26 @@ herr_t
H5Adelete(hid_t loc_id, const char *name)
{
H5G_loc_t loc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
- /* 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")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Delete the attribute from the location */
+ /* Delete the attribute */
if(H5O__attr_remove(loc.oloc, name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
@@ -1413,21 +1430,21 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, 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")
+ 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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
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")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Delete the attribute from the location */
+ /* Delete the attribute */
if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
@@ -1472,15 +1489,15 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* 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(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
@@ -1495,21 +1512,17 @@ done:
} /* H5Adelete_by_idx() */
-/*--------------------------------------------------------------------------
- NAME
- H5Aclose
- PURPOSE
- Close an attribute ID
- USAGE
- herr_t H5Aclose (attr_id)
- hid_t attr_id; IN: Attribute to release access to
- RETURNS
- Non-negative on success/Negative on failure
-
- DESCRIPTION
- This function releases an attribute from use. Further use of the
- attribute ID will result in undefined behavior.
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Aclose
+ *
+ * Purpose: Closes access to an attribute and releases resources used by
+ * it. It is illegal to subsequently use that same dataset
+ * ID in calls to other attribute functions.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Aclose(hid_t attr_id)
{
@@ -1518,7 +1531,7 @@ H5Aclose(hid_t attr_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", attr_id);
- /* check arguments */
+ /* Check arguments */
if(NULL == H5I_object_verify(attr_id, H5I_ATTR))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
@@ -1554,12 +1567,12 @@ H5Aexists(hid_t obj_id, const char *attr_name)
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "i*s", obj_id, attr_name);
- /* check arguments */
- if (H5I_ATTR == H5I_get_type(obj_id))
+ /* Check arguments */
+ if(H5I_ATTR == H5I_get_type(obj_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if (H5G_loc(obj_id, &loc) < 0)
+ if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if (!attr_name || !*attr_name)
+ if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Check if the attribute exists */
@@ -1595,20 +1608,21 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_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, FAIL, "location is not valid for an attribute")
- if (H5G_loc(loc_id, &loc) < 0)
+ if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if (!obj_name || !*obj_name)
+ if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if (!attr_name || !*attr_name)
+ if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- if ((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0)
+ /* Check existence of attribute */
+ if((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 3701022..5bed82d 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -164,11 +164,11 @@ typedef struct H5A_bt2_ud_rmbi_t {
/*-------------------------------------------------------------------------
- * Function: H5A__dense_create
+ * Function: H5A__dense_create
*
- * Purpose: Creates dense attribute storage structures for an object
+ * Purpose: Creates dense attribute storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -188,9 +188,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
@@ -286,11 +284,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_fnd_cb
+ * Function: H5A__dense_fnd_cb
*
- * Purpose: Callback when an attribute is located in an index
+ * Purpose: Callback when an attribute is located in an index
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -305,9 +303,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
FUNC_ENTER_STATIC_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(attr);
HDassert(user_attr);
@@ -320,11 +316,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
/*-------------------------------------------------------------------------
- * Function: H5A__dense_open
+ * Function: H5A__dense_open
*
- * Purpose: Open an attribute in dense storage structures for an object
+ * Purpose: Open an attribute in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -345,9 +341,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name);
@@ -411,11 +405,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_insert
+ * Function: H5A__dense_insert
*
- * Purpose: Insert an attribute into dense storage structures for an object
+ * Purpose: Insert an attribute into dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -439,9 +433,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(attr);
@@ -570,13 +562,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_write_bt2_cb2
+ * Function: H5A__dense_write_bt2_cb2
*
- * Purpose: v2 B-tree 'modify' callback to update the record for a creation
- * order index
+ * Purpose: v2 B-tree 'modify' callback to update the record for a creation
+ * order index
*
- * Return: Success: 0
- * Failure: 1
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, February 20, 2007
@@ -591,9 +582,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
FUNC_ENTER_STATIC_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(record);
HDassert(new_heap_id);
@@ -608,12 +597,11 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
/*-------------------------------------------------------------------------
- * Function: H5A__dense_write_bt2_cb
+ * Function: H5A__dense_write_bt2_cb
*
- * Purpose: v2 B-tree 'modify' callback to update the data for an attribute
+ * Purpose: v2 B-tree 'modify' callback to update the data for an attribute
*
- * Return: Success: 0
- * Failure: 1
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -632,9 +620,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(record);
HDassert(op_data);
@@ -722,11 +708,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_write
+ * Function: H5A__dense_write
*
- * Purpose: Modify an attribute in dense storage structures for an object
+ * Purpose: Modify an attribute in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -747,9 +733,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(H5F_addr_defined(ainfo->fheap_addr));
@@ -820,12 +804,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_copy_fh_cb
+ * Function: H5A__dense_copy_fh_cb
*
- * Purpose: Callback for fractal heap operator, to make copy of attribute
+ * Purpose: Callback for fractal heap operator, to make copy of attribute
* for calling routine
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -864,11 +848,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_rename
+ * Function: H5A__dense_rename
*
- * Purpose: Rename an attribute in dense storage structures for an object
+ * Purpose: Rename an attribute in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -892,9 +876,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(old_name);
@@ -996,7 +978,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
} /* end if */
else if(shared_mesg < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
+ HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
/* Delete old attribute from dense storage */
if(H5A__dense_remove(f, ainfo, old_name) < 0)
@@ -1018,11 +1000,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_iterate_bt2_cb
+ * Function: H5A__dense_iterate_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage iterator
+ * Purpose: v2 B-tree callback for dense attribute storage iterator
*
- * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP
+ * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1030,7 +1012,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static int
H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
{
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
@@ -1114,11 +1096,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_iterate
+ * Function: H5A__dense_iterate
*
- * Purpose: Iterate over attributes in dense storage structures for an object
+ * Purpose: Iterate over attributes in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1140,9 +1122,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(H5F_addr_defined(ainfo->fheap_addr));
@@ -1251,11 +1231,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove_bt2_cb
+ * Function: H5A__dense_remove_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage record removal
+ * Purpose: v2 B-tree callback for dense attribute storage record removal
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1315,11 +1295,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove
+ * Function: H5A__dense_remove
*
- * Purpose: Remove an attribute from the dense storage of an object
+ * Purpose: Remove an attribute from the dense storage of an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1340,9 +1320,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name && *name);
@@ -1398,18 +1376,18 @@ done:
if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
if(attr_copy)
- H5O__msg_free_real(H5O_MSG_ATTR, attr_copy);
+ H5O_msg_free_real(H5O_MSG_ATTR, attr_copy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove() */
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove_by_idx_bt2_cb
+ * Function: H5A__dense_remove_by_idx_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage record removal by index
+ * Purpose: v2 B-tree callback for dense attribute storage record removal by index
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1530,12 +1508,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove_by_idx
+ * Function: H5A__dense_remove_by_idx
*
- * Purpose: Remove an attribute from the dense storage of an object,
- * according to the order within an index
+ * Purpose: Remove an attribute from the dense storage of an object,
+ * according to the order within an index
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1556,9 +1534,7 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
@@ -1660,12 +1636,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_exists
+ * Function: H5A__dense_exists
*
- * Purpose: Check if an attribute exists in dense storage structures for
+ * Purpose: Check if an attribute exists in dense storage structures for
* an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1685,9 +1661,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name);
@@ -1749,11 +1723,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_delete_bt2_cb
+ * Function: H5A__dense_delete_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage deletion
+ * Purpose: v2 B-tree callback for dense attribute storage deletion
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1806,18 +1780,18 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata)
done:
/* Release resources */
if(attr)
- H5O__msg_free_real(H5O_MSG_ATTR, attr);
+ H5O_msg_free_real(H5O_MSG_ATTR, attr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_delete_bt2_cb() */
/*-------------------------------------------------------------------------
- * Function: H5A__dense_delete
+ * Function: H5A__dense_delete
*
- * Purpose: Delete all dense storage structures for attributes on an object
+ * Purpose: Delete all dense storage structures for attributes on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1834,9 +1808,7 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 99c1c0c..e88c8c3 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -36,13 +36,13 @@
/***********/
/* 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 "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 */
/****************/
@@ -95,7 +95,7 @@
hid_t space_id; IN: ID of dataspace for attribute
hid_t acpl_id; IN: ID of creation property list (currently not used)
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success/H5I_INVALID_HID on failure
DESCRIPTION
This function creates an attribute which is attached to the object
@@ -111,50 +111,51 @@
--------------------------------------------------------------------------*/
hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
- hid_t acpl_id)
+ hid_t acpl_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 */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "no write intent on file")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no 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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "not a dataspace")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read")
- /* Go do the real work for attaching the attribute to the dataset */
+ /* Create the attribute */
if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
+ 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
- /* Cleanup on failure */
- if(ret_value < 0 && attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ /* Clean up on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5A__close(attr) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
-} /* H5Acreate1() */
+} /* end H5Acreate1() */
/*--------------------------------------------------------------------------
@@ -167,7 +168,7 @@ done:
hid_t loc_id; IN: Object (dataset or group) to be attached to
const char *name; IN: Name of attribute to locate and open
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -184,32 +185,32 @@ H5Aopen_name(hid_t loc_id, const char *name)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
- /* 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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
- /* Open the attribute on the object header */
+ /* Open the attribute */
if(NULL == (attr = H5A__open_by_name(&loc, ".", name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute: '%s'", name)
/* Register the attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
- /* Cleanup on failure */
- if(ret_value < 0)
+ /* Clean up on failure */
+ if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_name() */
@@ -225,7 +226,7 @@ done:
hid_t loc_id; IN: Object that attribute is attached to
unsigned idx; IN: Index (0-based) attribute to open
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -242,30 +243,30 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "iIu", loc_id, idx);
- /* 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")
- /* Open the attribute in the object header */
+ /* Open the attribute */
if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx)))
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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
- /* Cleanup on failure */
- if(ret_value < 0)
+ /* Clean up on failure */
+ if(H5I_INVALID_HID == ret_value)
if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_idx() */
@@ -292,34 +293,34 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5O_loc_t *loc; /* Object location for attribute */
- void *obj;
- int ret_value;
+ H5O_loc_t *loc; /* Object location for attribute */
+ void *obj;
+ int ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", loc_id);
- /* check arguments */
if(H5I_BADID == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "bad location ID")
if(H5I_FILE == H5I_get_type(loc_id) || 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, (-1), "location is not valid for an attribute")
if(NULL == (obj = H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, (-1), "illegal object atom")
+
switch(H5I_get_type (loc_id)) {
case H5I_DATASET:
if(NULL == (loc = H5D_oloc((H5D_t*)obj)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object")
break;
case H5I_DATATYPE:
if(NULL == (loc = H5T_oloc((H5T_t*)obj)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "target datatype is not committed")
break;
case H5I_GROUP:
if(NULL == (loc = H5G_oloc((H5G_t*)obj)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object")
break;
case H5I_UNINIT:
@@ -336,12 +337,12 @@ H5Aget_num_attrs(hid_t loc_id)
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target")
- } /*lint !e788 All appropriate cases are covered */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "inappropriate attribute target")
+ }
/* Look up the # of attributes for the object */
if((ret_value = H5O__attr_count(loc)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, (-1), "can't get attribute count for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -388,14 +389,14 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
- herr_t ret_value; /* Return value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);
/* 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")
/* Call attribute iteration routine */
if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 4c7568a..8268a01 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -87,7 +87,6 @@ typedef struct {
/* Local Prototypes */
/********************/
-static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata);
@@ -137,7 +136,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*-------------------------------------------------------------------------
*/
H5A_t *
-H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
+H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
const H5S_t *space, hid_t acpl_id)
{
H5A_t *attr = NULL; /* Attribute created */
@@ -150,7 +149,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
/* Check args */
HDassert(loc);
- HDassert(name);
+ HDassert(attr_name);
HDassert(type);
HDassert(space);
@@ -159,7 +158,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* name, but it's going to be hard to unwind all the special cases on
* failure, so just check first, for now - QAK)
*/
- if((exists = H5O__attr_exists(loc->oloc, name)) < 0)
+ if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes")
else if(exists > 0)
HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists")
@@ -194,7 +193,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
} /* end else */
/* Copy the attribute name */
- attr->shared->name = H5MM_xstrdup(name);
+ attr->shared->name = H5MM_xstrdup(attr_name);
/* Copy datatype */
if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL)))
@@ -232,9 +231,9 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* SOHM table
*/
if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
/* Check whether datatype is committed & increment ref count
* (to maintain ref. count incr/decr similarity with "shared message"
@@ -365,12 +364,12 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -514,11 +513,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__open_by_name
+ * Function: H5A__open_by_name
*
- * Purpose: Open an attribute in an object header, according to it's name
+ * Purpose: Open an attribute in an object header, according to it's name
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 11, 2006
@@ -922,8 +921,9 @@ H5A__get_type(H5A_t *attr)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
done:
- if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0))
- HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
+ if(H5I_INVALID_HID == ret_value)
+ if(dt && H5T_close(dt) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_type() */
@@ -1017,21 +1017,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__copy
+ * Function: H5A__copy
*
- * Purpose: Copies attribute OLD_ATTR.
+ * Purpose: Copies attribute OLD_ATTR.
*
- * Return: Success: Pointer to a new copy of the OLD_ATTR argument.
+ * Return: Success: Pointer to a new copy of the OLD_ATTR argument.
*
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modification:Raymond Lu
- * 4 June 2008
- * Changed some attribute information to be shared.
- *
*-------------------------------------------------------------------------
*/
H5A_t *
@@ -1084,18 +1080,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__free
+ * Function: H5A__free
*
- * Purpose: Frees all memory associated with an attribute, but does not
+ * Purpose: Frees all memory associated with an attribute, but does not
* free the H5A_t structure (which should be done in H5T_close).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, November 15, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1114,12 +1108,12 @@ H5A__free(H5A_t *attr)
}
if(attr->shared->dt) {
if(H5T_close_real(attr->shared->dt) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
attr->shared->dt = NULL;
}
if(attr->shared->ds) {
if(H5S_close(attr->shared->ds) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
attr->shared->ds = NULL;
}
if(attr->shared->data)
@@ -1131,21 +1125,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__close_cb
+ * Function: H5A__close_cb
*
- * Purpose: Frees an attribute and all associated memory.
+ * Purpose: Called when the ref count reaches zero on the attribute's ID
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Sunday, February 18, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5A__close_cb(H5A_t *attr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1153,9 +1144,9 @@ H5A__close_cb(H5A_t *attr)
HDassert(attr);
HDassert(attr->shared);
- /* Call the actual close routine */
+ /* Close the attribute */
if(H5A__close(attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute")
+ HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1163,11 +1154,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__close
+ * Function: H5A__close
*
- * Purpose: Frees an attribute and all associated memory.
+ * Purpose: Frees an attribute and all associated memory.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, December 8, 1997
@@ -1310,12 +1301,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__exists_by_name
+ * Function: H5A__exists_by_name
*
- * Purpose: Private version of H5Aexists_by_name
+ * Purpose: Private version of H5Aexists_by_name
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 1, 2007
@@ -1423,11 +1413,10 @@ done:
* Purpose: Builds a table containing a sorted list of attributes for
* an object
*
- * Note: Used for building table of attributes in non-native iteration
+ * Note: Used for building table of attributes in non-native iteration
* order for an index
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 18, 2006
@@ -1526,17 +1515,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_build_table
+ * Function: H5A__dense_build_table
*
* Purpose: Builds a table containing a sorted list of attributes for
* an object
*
- * Note: Used for building table of attributes in non-native iteration
+ * Note: Used for building table of attributes in non-native iteration
* order for an index. Uses the "name" index to retrieve records,
- * but the 'idx_type' index for sorting them.
+ * but the 'idx_type' index for sorting them.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 11, 2006
@@ -1783,13 +1771,12 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
/*-------------------------------------------------------------------------
- * Function: H5A__attr_iterate_table
+ * Function: H5A__attr_iterate_table
*
* Purpose: Iterate over table containing a list of attributes for an object,
* making appropriate callbacks
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 18, 2006
@@ -1866,12 +1853,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__attr_release_table
+ * Function: H5A__attr_release_table
*
- * Purpose: Release table containing a list of attributes for an object
+ * Purpose: Release table containing a list of attributes for an object
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 11, 2006
@@ -1913,8 +1899,8 @@ done:
* Purpose: Retrieves the "attribute info" message for an object. Also
* sets the number of attributes correctly, if it isn't set up yet.
*
- * Return: Success: TRUE/FALSE whether message was found & retrieved
- * Failure: FAIL if error occurred
+ * Return: Success: TRUE/FALSE whether message was found & retrieved
+ * Failure: FAIL if error occurred
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1978,8 +1964,7 @@ done:
* Chooses the oldest version possible, unless the
* file's low bound indicates otherwise.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -2137,9 +2122,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
* committed or sharing is disabled.
*/
if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
/* Compute the sizes of the datatype and dataspace. This is their raw
* size unless they're shared.
@@ -2326,7 +2311,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@@ -2477,8 +2462,7 @@ done:
*
* Purpose: Copy all dense attributes from SRC to DST.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* xcao@hdfgroup.org
@@ -2521,12 +2505,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__rename_by_name
+ * Function: H5A__rename_by_name
*
* Purpose: Private version of H5Arename_by_name
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* February 20, 2007
@@ -2545,19 +2528,22 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na
FUNC_ENTER_PACKAGE
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
-
- /* Call attribute rename routine */
- if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ /* Avoid thrashing things if the names are the same */
+ if(HDstrcmp(old_attr_name, new_attr_name)) {
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location */
+ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
+ loc_found = TRUE;
+
+ /* Call attribute rename routine */
+ if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ } /* end if */
done:
/* Release resources */
@@ -2569,12 +2555,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__iterate_common
+ * Function: H5A__iterate_common
*
* Purpose: Internal common version of H5Aiterate
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2605,12 +2590,11 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
/*-------------------------------------------------------------------------
- * Function: H5A__iterate
+ * Function: H5A__iterate
*
* Purpose: Private version of H5Aiterate2
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2636,17 +2620,16 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A__iterate() */
+} /* end H5A__iterate() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5A__iterate_old
+ * Function: H5A__iterate_old
*
* Purpose: Private version of H5Aiterate1
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2689,8 +2672,7 @@ done:
*
* Purpose: Private version of H5Aiterate_by_name
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2722,12 +2704,12 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_
loc_found = TRUE;
/* Open the object */
- if((obj_loc_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
+ if((obj_loc_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* Build attribute operator info */
- attr_op.op_type = H5A_ATTR_OP_APP2;
- attr_op.u.app_op2 = op;
+ attr_op.op_type = H5A_ATTR_OP_APP2;
+ attr_op.u.app_op2 = op;
/* Call attribute iteration routine */
if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
@@ -2738,12 +2720,12 @@ done:
if(obj_loc_id > 0) {
if(H5I_dec_app_ref(obj_loc_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- } /* end if */
+ }
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A__iterate_by_name() */
+} /* end H5A__iterate_by_name() */
/*-------------------------------------------------------------------------
@@ -2751,8 +2733,7 @@ done:
*
* Purpose: Private version of H5Adelete_by_name
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2798,8 +2779,7 @@ done:
*
* Purpose: Private version of H5Adelete_by_idx
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 0bb6d8f..85f0254 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -191,6 +191,7 @@ H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name,
const char *attr_name);
H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr);
H5_DLL hid_t H5A__get_type(H5A_t *attr);
H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);
diff --git a/src/H5D.c b/src/H5D.c
index 0ea7e4a..af99a1f 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -21,12 +21,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -73,31 +73,28 @@ H5FL_BLK_EXTERN(type_conv);
/*-------------------------------------------------------------------------
- * Function: H5Dcreate2
+ * Function: H5Dcreate2
*
- * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
- * dataset for access, and associates with that dataset constant
- * and initial persistent properties including the type of each
- * datapoint as stored in the file (TYPE_ID), the size of the
- * dataset (SPACE_ID), and other initial miscellaneous
- * properties (DCPL_ID).
+ * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
+ * dataset for access, and associates with that dataset constant
+ * and initial persistent properties including the type of each
+ * datapoint as stored in the file (TYPE_ID), the size of the
+ * dataset (SPACE_ID), and other initial miscellaneous
+ * properties (DCPL_ID).
*
- * All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
- * parameters from the old ones and reuse them in calls to
- * create other datasets.
+ * All arguments are copied into the dataset, so the caller is
+ * allowed to derive new types, dataspaces, and creation
+ * parameters from the old ones and reuse them in calls to
+ * create other datasets.
*
- * Return: Success: The object ID of the new dataset. At this
- * point, the dataset is ready to receive its
- * raw data. Attempting to read raw data from
- * the dataset will probably return the fill
- * value. The dataset should be closed when the
- * caller is no longer interested in it.
+ * Return: Success: The object ID of the new dataset. At this
+ * point, the dataset is ready to receive its
+ * raw data. Attempting to read raw data from
+ * the dataset will probably return the fill
+ * value. The dataset should be closed when the
+ * caller is no longer interested in it.
*
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, April 5, 2007
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -105,88 +102,91 @@ hid_t
H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id)
{
- H5G_loc_t loc; /* Object location to insert dataset into */
- H5D_t *dset = NULL; /* New dataset's info */
- const H5S_t *space; /* Dataspace for dataset */
- hid_t ret_value; /* Return value */
+ H5D_t *dset = NULL; /* New dataset's info */
+ H5G_loc_t loc; /* Object location to insert dataset into */
+ const H5S_t *space; /* Dataspace for dataset */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id,
dapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID")
if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID")
- /* Get correct property list */
+ /* Get link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list")
- /* Get correct property list */
+ /* Get dataset creation property list */
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Create the new dataset & get its ID */
+ /* Create the dataset */
if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
+
+ /* Get an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate2() */
/*-------------------------------------------------------------------------
- * Function: H5Dcreate_anon
+ * Function: H5Dcreate_anon
*
- * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
- * dataset for access, and associates with that dataset constant
- * and initial persistent properties including the type of each
- * datapoint as stored in the file (TYPE_ID), the size of the
- * dataset (SPACE_ID), and other initial miscellaneous
- * properties (DCPL_ID).
+ * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
+ * dataset for access, and associates with that dataset constant
+ * and initial persistent properties including the type of each
+ * datapoint as stored in the file (TYPE_ID), the size of the
+ * dataset (SPACE_ID), and other initial miscellaneous
+ * properties (DCPL_ID).
*
- * All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
- * parameters from the old ones and reuse them in calls to
- * create other datasets.
+ * All arguments are copied into the dataset, so the caller is
+ * allowed to derive new types, dataspaces, and creation
+ * parameters from the old ones and reuse them in calls to
+ * create other datasets.
*
* The resulting ID should be linked into the file with
* H5Olink or it will be deleted when closed.
*
- * Return: Success: The object ID of the new dataset. At this
- * point, the dataset is ready to receive its
- * raw data. Attempting to read raw data from
- * the dataset will probably return the fill
- * value. The dataset should be linked into
- * the group hierarchy before being closed or
- * it will be deleted. The dataset should be
- * closed when the caller is no longer interested
- * in it.
- *
- * Failure: FAIL
+ * Return: Success: The object ID of the new dataset. At this
+ * point, the dataset is ready to receive its
+ * raw data. Attempting to read raw data from
+ * the dataset will probably return the fill
+ * value. The dataset should be linked into
+ * the group hierarchy before being closed or
+ * it will be deleted. The dataset should be
+ * closed when the caller is no longer interested
+ * in it.
*
- * Programmer: James Laird
- * Tuesday, January 24, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -197,35 +197,35 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
H5G_loc_t loc; /* Object location to insert dataset into */
H5D_t *dset = NULL; /* New dataset's info */
const H5S_t *space; /* Dataspace for dataset */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID")
if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID")
if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID")
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* build and open the new dataset */
+ /* Create the dataset */
if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
- /* Register the new dataset to get an ID for it */
+ /* Get an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
/* Release the dataset's object header, if it was created */
@@ -234,36 +234,34 @@ done:
/* Get the new dataset's object location */
if(NULL == (oloc = H5D_oloc(dset)))
- HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of dataset")
/* Decrement refcount on dataset's object header in memory */
if(H5O_dec_rc_by_loc(oloc) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object")
} /* end if */
/* Cleanup on failure */
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate_anon() */
/*-------------------------------------------------------------------------
- * Function: H5Dopen2
+ * Function: H5Dopen2
*
- * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
- * its ID. The dataset should be close when the caller is no
- * longer interested in it.
+ * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
+ * its ID. The dataset should be close when the caller is no
+ * longer interested in it.
*
* Takes a dataset access property list
*
- * Return: Success: A new dataset ID
- * Failure: FAIL
+ * Return: Success: Object ID of the dataset
*
- * Programmer: James Laird
- * Thursday, July 27, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -272,16 +270,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
{
H5D_t *dset = NULL;
H5G_loc_t loc; /* Object location of group */
- hid_t ret_value;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, dapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0)
@@ -289,17 +289,16 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
/* Open the dataset */
if(NULL == (dset = H5D__open_name(&loc, name, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
-
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen2() */
@@ -307,14 +306,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Dclose
*
- * Purpose: Closes access to a dataset (DATASET_ID) and releases
- * resources used by it. It is illegal to subsequently use that
- * same dataset ID in calls to other dataset functions.
+ * Purpose: Closes access to a dataset and releases resources used by
+ * it. It is illegal to subsequently use that same dataset
+ * ID in calls to other dataset functions.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -328,10 +324,9 @@ H5Dclose(hid_t dset_id)
/* Check args */
if(NULL == H5I_object_verify(dset_id, H5I_DATASET))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID")
- /*
- * Decrement the counter on the dataset. It will be freed if the count
+ /* Decrement the counter on the dataset. It will be freed if the count
* reaches zero.
*/
if(H5I_dec_app_ref_always_close(dset_id) < 0)
@@ -343,36 +338,34 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_space
- *
- * Purpose: Returns a copy of the file dataspace for a dataset.
+ * Function: H5Dget_space
*
- * Return: Success: ID for a copy of the dataspace. The data
- * space should be released by calling
- * H5Sclose().
+ * Purpose: Returns a copy of the file dataspace for a dataset.
*
- * Failure: FAIL
+ * Return: Success: ID for a copy of the dataspace. The data
+ * space should be released by calling
+ * H5Sclose().
*
- * Programmer: Robb Matzke
- * Wednesday, January 28, 1998
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Dget_space(hid_t dset_id)
{
- H5D_t *dset = NULL;
- hid_t ret_value;
+ H5D_t *dset = NULL; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Get the dataspace */
if((ret_value = H5D__get_space(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
done:
FUNC_LEAVE_API(ret_value)
@@ -380,35 +373,30 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_space_status
- *
- * Purpose: Returns the status of dataspace allocation.
+ * Function: H5Dget_space_status
*
- * Return:
- * Success: Non-negative
+ * Purpose: Returns the status of dataspace allocation.
*
- * Failture: Negative
- *
- * Programmer: Raymond Lu
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
{
- H5D_t *dset = NULL;
- herr_t ret_value = SUCCEED;
+ H5D_t *dset = NULL; /* Dataset structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Ds", dset_id, allocation);
- /* Check arguments */
+ /* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- /* Read dataspace address and return */
+ /* Get dataspace status */
if(H5D__get_space_status(dset, allocation) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
FUNC_LEAVE_API(ret_value)
@@ -416,36 +404,34 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_type
+ * Function: H5Dget_type
*
- * Purpose: Returns a copy of the file datatype for a dataset.
+ * Purpose: Returns a copy of the file datatype for a dataset.
*
- * Return: Success: ID for a copy of the datatype. The data
- * type should be released by calling
- * H5Tclose().
+ * Return: Success: ID for a copy of the datatype. The data
+ * type should be released by calling
+ * H5Tclose().
*
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Tuesday, February 3, 1998
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Dget_type(hid_t dset_id)
{
- H5D_t *dset; /* Dataset */
- hid_t ret_value; /* Return value */
+ H5D_t *dset; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* get the datatype */
if((ret_value = H5D__get_type(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
FUNC_LEAVE_API(ret_value)
@@ -453,15 +439,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_create_plist
+ * Function: H5Dget_create_plist
*
- * Purpose: Returns a copy of the dataset creation property list.
+ * Purpose: Returns a copy of the dataset creation property list.
*
- * Return: Success: ID for a copy of the dataset creation
- * property list. The template should be
- * released by calling H5P_close().
+ * Return: Success: ID for a copy of the dataset creation
+ * property list. The template should be
+ * released by calling H5P_close().
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Tuesday, February 3, 1998
@@ -472,17 +458,18 @@ hid_t
H5Dget_create_plist(hid_t dset_id)
{
H5D_t *dataset; /* Dataset structure */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Get the dataset creation property list */
if((ret_value = H5D_get_create_plist(dataset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
done:
FUNC_LEAVE_API(ret_value)
@@ -490,32 +477,32 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_access_plist
+ * Function: H5Dget_access_plist
*
- * Purpose: Returns a copy of the dataset creation property list.
+ * Purpose: Returns a copy of the dataset access property list.
*
* Description: H5Dget_access_plist returns the dataset access property
- * list identifier of the specified dataset.
+ * list identifier of the specified dataset.
*
- * The chunk cache parameters in the returned property lists will be
- * those used by the dataset. If the properties in the file access
- * property list were used to determine the dataset’s chunk cache
- * configuration, then those properties will be present in the
- * returned dataset access property list. If the dataset does not
- * use a chunked layout, then the chunk cache properties will be set
- * to the default. The chunk cache properties in the returned list
- * are considered to be “set”, and any use of this list will override
- * the corresponding properties in the file’s file access property
- * list.
+ * The chunk cache parameters in the returned property lists will be
+ * those used by the dataset. If the properties in the file access
+ * property list were used to determine the dataset’s chunk cache
+ * configuration, then those properties will be present in the
+ * returned dataset access property list. If the dataset does not
+ * use a chunked layout, then the chunk cache properties will be set
+ * to the default. The chunk cache properties in the returned list
+ * are considered to be “set”, and any use of this list will override
+ * the corresponding properties in the file’s file access property
+ * list.
*
- * All link access properties in the returned list will be set to the
- * default values.
+ * All link access properties in the returned list will be set to the
+ * default values.
*
- * Return: Success: ID for a copy of the dataset access
- * property list. The template should be
- * released by calling H5Pclose().
+ * Return: Success: ID for a copy of the dataset access
+ * property list. The template should be
+ * released by calling H5Pclose().
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Neil Fortner
* Wednesday, October 29, 2008
@@ -526,17 +513,18 @@ hid_t
H5Dget_access_plist(hid_t dset_id)
{
H5D_t *dset; /* Dataset structure */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Get the dataset access property list */
if((ret_value = H5D_get_access_plist(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
done:
FUNC_LEAVE_API(ret_value)
@@ -544,39 +532,36 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_storage_size
+ * Function: H5Dget_storage_size
*
- * Purpose: Returns the amount of storage that is required for the
- * dataset. For chunked datasets this is the number of allocated
- * chunks times the chunk size.
+ * Purpose: Returns the amount of storage that is required for the
+ * dataset. For chunked datasets this is the number of allocated
+ * chunks times the chunk size.
*
- * Return: Success: The amount of storage space allocated for the
- * dataset, not counting meta data. The return
- * value may be zero if no data has been stored.
+ * Return: Success: The amount of storage space allocated for the
+ * dataset, not counting meta data. The return
+ * value may be zero if no data has been stored.
*
- * Failure: Zero
- *
- * Programmer: Robb Matzke
- * Wednesday, April 21, 1999
+ * Failure: Zero
*
*-------------------------------------------------------------------------
*/
hsize_t
H5Dget_storage_size(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to query */
- hsize_t ret_value; /* Return value */
+ H5D_t *dset; /* Dataset for this operation */
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier")
- /* Set return value */
+ /* Get the storage size */
if(H5D__get_storage_size(dset, &ret_value) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
done:
FUNC_LEAVE_API(ret_value)
@@ -584,33 +569,30 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_offset
+ * Function: H5Dget_offset
*
- * Purpose: Returns the address of dataset in file.
+ * Purpose: Returns the address of dataset in file.
*
- * Return: Success: the address of dataset
+ * Return: Success: The address of dataset
*
- * Failure: HADDR_UNDEF
- *
- * Programmer: Raymond Lu
- * November 6, 2002
+ * Failure: HADDR_UNDEF (can also be a valid return value!)
*
*-------------------------------------------------------------------------
*/
haddr_t
H5Dget_offset(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to query */
- haddr_t ret_value; /* Return value */
+ H5D_t *dset; /* Dataset for this operation */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE1("a", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
- /* Set return value */
+ /* Get the offset */
ret_value = H5D__get_offset(dset);
done:
@@ -740,7 +722,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
/* Check args */
if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
if(!(H5S_has_extent(space)))
@@ -793,7 +775,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
hsize_t *size)
{
H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0};
- H5D_t *dset; /* Dataset for operation */
+ H5D_t *dset; /* Dataset for this operation */
H5S_t *fspace = NULL; /* Dataset's dataspace */
H5S_t *mspace = NULL; /* Memory dataspace */
char bogus; /* bogus value to pass to H5Diterate() */
@@ -810,7 +792,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
H5I_DATATYPE != H5I_get_type(type_id) || size == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (dset = (H5D_t *)H5I_object(dataset_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -820,16 +802,20 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
/* Save the dataset */
vlen_bufsize.dset = dset;
+ vlen_bufsize.fspace_id = H5I_INVALID_HID;
+ vlen_bufsize.mspace_id = H5I_INVALID_HID;
/* Get a copy of the dataset's dataspace */
if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace")
- vlen_bufsize.fspace = fspace;
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
+ if((vlen_bufsize.fspace_id = H5I_register(H5I_DATASPACE, fspace, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file dataspace")
/* Create a scalar for the memory dataspace */
if(NULL == (mspace = H5S_create(H5S_SCALAR)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
- vlen_bufsize.mspace = mspace;
+ if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register memory dataspace")
/* Grab the temporary buffers required */
if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1)))
@@ -845,9 +831,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
vlen_bufsize.size = 0;
/* Call H5S_select_iterate with args, etc. */
- dset_op.op_type = H5S_SEL_ITER_OP_APP;
- dset_op.u.app_op.op = H5D__vlen_get_buf_size;
- dset_op.u.app_op.type_id = type_id;
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = H5D__vlen_get_buf_size;
+ dset_op.u.app_op.type_id = type_id;
ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
@@ -856,10 +842,17 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
*size = vlen_bufsize.size;
done:
- if(fspace && H5S_close(fspace) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- if(mspace && H5S_close(mspace) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ if(ret_value < 0) {
+ if(fspace && H5S_close(fspace) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release file dataspace")
+ if(mspace && H5S_close(mspace) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release memory dataspace")
+ }
+
+ if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing file dataspace id")
+ if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing memory dataspace id")
if(vlen_bufsize.fl_tbuf != NULL)
vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf);
if(vlen_bufsize.vl_tbuf != NULL)
@@ -870,40 +863,37 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dset_extent
- *
- * Purpose: Modifies the dimensions of a dataset.
- * Can change to a smaller dimension.
+ * Function: H5Dset_extent
*
- * Return: Non-negative on success, negative on failure
+ * Purpose: Modifies the dimensions of a dataset.
+ * Can change to a smaller dimension.
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * April 9, 2002
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dset_extent(hid_t dset_id, const hsize_t size[])
{
- H5D_t *dset; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
if(!size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Private function */
+ /* Set the extent */
if(H5D__set_extent(dset, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
FUNC_LEAVE_API(ret_value)
@@ -915,25 +905,22 @@ done:
*
* Purpose: Flushes all buffers associated with a dataset.
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Mike McGreevy
- * May 19, 2010
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dflush(hid_t dset_id)
{
- H5D_t *dset; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(dset_id) < 0)
@@ -941,7 +928,7 @@ H5Dflush(hid_t dset_id)
/* Flush dataset information cached in memory */
if(H5D__flush(dset, dset_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
FUNC_LEAVE_API(ret_value)
@@ -953,31 +940,28 @@ done:
*
* Purpose: Refreshes all buffers associated with a dataset.
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Mike McGreevy
- * July 21, 2010
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Drefresh(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
-
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call private function to refresh the dataset object */
+ /* Refresh the dataset object */
if((H5D__refresh(dset_id, dset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
@@ -990,12 +974,13 @@ done:
* Function: H5Dformat_convert (Internal)
*
* Purpose: For chunked:
- * Convert the chunk indexing type to version 1 B-tree if not
- * For compact/contiguous:
- * Downgrade layout version to 3 if greater than 3
- * For virtual: no conversion
+ * Convert the chunk indexing type to version 1 B-tree if not
+ * For compact/contiguous:
+ * Downgrade layout version to 3 if greater than 3
+ * For virtual:
+ * No conversion
*
- * Return: Non-negative on success, negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* Feb 2015
@@ -1005,15 +990,15 @@ done:
herr_t
H5Dformat_convert(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(dset_id) < 0)
@@ -1065,17 +1050,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type)
+H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
{
- H5D_t *dset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
-
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Dk", did, idx_type);
+ H5TRACE2("e", "i*Dk", dset_id, idx_type);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
+ if(NULL == idx_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
/* Should be a chunked dataset */
if(dset->shared->layout.type != H5D_CHUNKED)
@@ -1095,7 +1082,10 @@ done:
*
* Purpose: Returns the size of an allocated chunk.
*
- * Return: Non-negative on success, negative on failure
+ * Intended for use with the H5D(O)read_chunk API call so
+ * the caller can construct an appropriate buffer.
+ *
+ * Return: SUCCEED/FAIL
*
* Programmer: Matthew Strong (GE Healthcare)
* 20 October 2016
@@ -1105,24 +1095,24 @@ done:
herr_t
H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes)
{
- H5D_t *dset = NULL;
- herr_t ret_value = SUCCEED;
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes);
/* Check arguments */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if( NULL == offset )
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
- if( NULL == chunk_nbytes )
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
+ if(NULL == offset)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL")
+ if(NULL == chunk_nbytes)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
if(H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
- /* Call private function */
+ /* Get the dataset creation property list */
if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 8abfe27..b61aed4 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -685,13 +685,12 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key
/* decode */
UINT32DECODE(raw, key->nbytes);
UINT32DECODE(raw, key->filter_mask);
- for(u = 0; u < layout->ndims; u++)
- {
- if (layout->dim[u] == 0)
+ for(u = 0; u < layout->ndims; u++) {
+ if(layout->dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Retrieve coordinate offset */
- UINT64DECODE(raw, tmp_offset);
+ UINT64DECODE(raw, tmp_offset);
HDassert(0 == (tmp_offset % layout->dim[u]));
/* Convert to a scaled offset */
@@ -943,7 +942,7 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info)
/* Create the v1 B-tree for the chunk index */
if(H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index d60e79e..b32f395 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -1547,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Close v2 B-tree */
- if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
+ if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
idx_info->storage->u.btree2.bt2 = NULL;
} /* end if */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 16d7530..30a9a3b 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -648,8 +648,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
- } /* end if */
+ }
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -1300,11 +1300,9 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
if(file_type && (H5T_close_real(file_type) < 0))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype")
- if(file_space_normalized == TRUE) {
- /* (Casting away const OK -QAK) */
- if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
+ if(file_space_normalized == TRUE)
+ if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init() */
@@ -1503,7 +1501,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection")
/* Move selection back to have correct offset in chunk */
- H5S_SELECT_ADJUST_U(fm->single_space, coords);
+ if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
#ifdef H5_HAVE_PARALLEL
/* store chunk selection information */
@@ -1615,7 +1614,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Move selection back to have correct offset in chunk */
- H5S_SELECT_ADJUST_U(tmp_fchunk, coords);
+ if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) {
+ (void)H5S_close(tmp_fchunk);
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
+ }
/* Add temporary chunk to the list of chunks */
@@ -1814,7 +1816,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
} /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */
+ if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
/* Get the next chunk node in the skip list */
@@ -3183,8 +3185,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent,
- hbool_t flush)
+H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -4199,13 +4200,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
while(!carry) {
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
- /* Look up this chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
+ /* Look up this chunk */
+ if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
- if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type)
- HDassert(!H5F_addr_defined(udata.chunk_block.offset));
+ if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) {
+ HDassert(!H5F_addr_defined(udata.chunk_block.offset));
+ }
/* Make sure the chunk is really in the dataset and outside the
* original dimensions */
@@ -4233,7 +4235,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Check to make sure the buffer is large enough. It is
* possible (though ill-advised) for the filter to shrink the
- * buffer. */
+ * buffer.
+ */
if(fb_info.fill_buf_size < orig_chunk_size) {
if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk")
@@ -4467,10 +4470,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
HGOTO_DONE(SUCCEED)
} /* end if */
- /*
- * Initialize structures needed to lock chunks into cache
- */
-
/* Set up chunked I/O info object, for operations on chunks (in callback).
* Note that we only need to set chunk_offset once, as the array's address
* will never change. */
@@ -6517,31 +6516,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded")
} /* end block */
- if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
- /* Sanity check */
+ if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
+ /* Sanity check */
HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset));
/* Check for chunk being same size */
- if(new_chunk->length != old_chunk->length) {
- /* Release previous chunk */
- /* Only free the old location if not doing SWMR writes - otherwise
+ if(new_chunk->length != old_chunk->length) {
+ /* Release previous chunk */
+ /* Only free the old location if not doing SWMR writes - otherwise
* we must keep the old chunk around in case a reader has an
* outdated version of the B-tree node
*/
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
- alloc_chunk = TRUE;
- } /* end if */
+ if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+ alloc_chunk = TRUE;
+ } /* end if */
else {
- /* Don't need to reallocate chunk, but send its address back up */
+ /* Don't need to reallocate chunk, but send its address back up */
if(!H5F_addr_defined(new_chunk->offset))
new_chunk->offset = old_chunk->offset;
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
- alloc_chunk = TRUE;
+ alloc_chunk = TRUE;
} /* end else */
} /* end if */
else {
@@ -6646,7 +6645,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
/* Read the non-filtered edge chunk */
- if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
+ if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Pass the chunk through the pipeline */
diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c
index 347e34c..7220868 100644
--- a/src/H5Ddbg.c
+++ b/src/H5Ddbg.c
@@ -21,11 +21,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -60,17 +60,12 @@
/*-------------------------------------------------------------------------
- * Function: H5Ddebug
+ * Function: H5Ddebug
*
- * Purpose: Prints various information about a dataset. This function is
- * not to be documented in the API at this time.
+ * Purpose: Prints various information about a dataset. This function is
+ * not to be documented in the API at this time.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, April 28, 1999
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -85,13 +80,13 @@ H5Ddebug(hid_t dset_id)
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Print B-tree information */
if(H5D_CHUNKED == dset->shared->layout.type)
- (void)H5D__chunk_dump_index(dset, stdout);
+ (void)H5D__chunk_dump_index(dset, stdout);
else if(H5D_CONTIGUOUS == dset->shared->layout.type)
- HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
+ HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 0f1bfee..ed520c4 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -80,28 +80,28 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5Dcreate1
+ * Function: H5Dcreate1
*
- * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
- * dataset for access, and associates with that dataset constant
- * and initial persistent properties including the type of each
- * datapoint as stored in the file (TYPE_ID), the size of the
- * dataset (SPACE_ID), and other initial miscellaneous
- * properties (DCPL_ID).
+ * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
+ * dataset for access, and associates with that dataset constant
+ * and initial persistent properties including the type of each
+ * datapoint as stored in the file (TYPE_ID), the size of the
+ * dataset (SPACE_ID), and other initial miscellaneous
+ * properties (DCPL_ID).
*
- * All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
- * parameters from the old ones and reuse them in calls to
- * create other datasets.
+ * All arguments are copied into the dataset, so the caller is
+ * allowed to derive new types, data spaces, and creation
+ * parameters from the old ones and reuse them in calls to
+ * create other datasets.
*
- * Return: Success: The object ID of the new dataset. At this
- * point, the dataset is ready to receive its
- * raw data. Attempting to read raw data from
- * the dataset will probably return the fill
- * value. The dataset should be closed when
- * the caller is no longer interested in it.
+ * Return: Success: The object ID of the new dataset. At this
+ * point, the dataset is ready to receive its
+ * raw data. Attempting to read raw data from
+ * the dataset will probably return the fill
+ * value. The dataset should be closed when
+ * the caller is no longer interested in it.
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, December 3, 1997
@@ -112,29 +112,31 @@ hid_t
H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t dcpl_id)
{
- H5G_loc_t loc; /* Object location to insert dataset into */
- H5D_t *dset = NULL; /* New dataset's info */
- const H5S_t *space; /* Dataspace for dataset */
- hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
- hid_t ret_value; /* Return value */
+ H5G_loc_t loc; /* Object location to insert dataset into */
+ H5D_t *dset = NULL; /* New dataset's info */
+ const H5S_t *space; /* Dataspace for dataset */
+ hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id);
/* Check arguments */
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID")
if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID")
if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID")
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
@@ -142,32 +144,32 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Build and open the new dataset */
if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
- /* Register the new dataset to get an ID for it */
+ /* Get an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
- if(ret_value < 0)
+ if (H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate1() */
/*-------------------------------------------------------------------------
- * Function: H5Dopen1
+ * Function: H5Dopen1
*
- * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
- * its ID. The dataset should be close when the caller is no
- * longer interested in it.
+ * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
+ * its ID. The dataset should be close when the caller is no
+ * longer interested in it.
*
- * Note: Deprecated in favor of H5Dopen2
+ * Note: Deprecated in favor of H5Dopen2
*
- * Return: Success: A new dataset ID
- * Failure: FAIL
+ * Return: Success: A new dataset ID
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@@ -179,44 +181,46 @@ H5Dopen1(hid_t loc_id, const char *name)
{
H5D_t *dset = NULL;
H5G_loc_t loc; /* Object location of group */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
/* Open the dataset */
if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
- /* Register an atom for the dataset */
+ /* Get an atom for the dataset */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen1() */
/*-------------------------------------------------------------------------
- * Function: H5Dextend
+ * Function: H5Dextend
*
- * Purpose: This function makes sure that the dataset is at least of size
- * SIZE. The dimensionality of SIZE is the same as the data
- * space of the dataset being changed.
+ * Purpose: This function makes sure that the dataset is at least of size
+ * SIZE. The dimensionality of SIZE is the same as the data
+ * space of the dataset being changed.
*
- * Note: Deprecated in favor of H5Dset_extent
+ * Note: Deprecated in favor of H5Dset_extent
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Friday, January 30, 1998
@@ -226,19 +230,19 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t size[])
{
- H5D_t *dset; /* Pointer to dataset to modify */
- hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset; /* Pointer to dataset to modify */
+ hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(!size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Make certain that the dataset dimensions don't decrease */
/* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */
@@ -254,7 +258,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
/* Increase size */
if(H5D__set_extent(dset, dset_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index e42e551..619f699 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -174,7 +174,7 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
- const H5T_t *buf_type, const H5S_t *space)
+ const H5T_t *buf_type, const H5S_t *space)
{
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 2d4985e..9af391e 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -22,8 +22,8 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
@@ -48,18 +48,17 @@
/* General stuff */
static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
-static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id,
- const H5T_t *type);
+static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id,
- const char *prefix_type, char **file_prefix);
+static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix);
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id);
static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
hsize_t old_dim[]);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__close_cb(H5D_t *dataset);
+static herr_t H5D__close_cb(H5D_t *dset);
+
/*********************/
/* Package Variables */
@@ -281,6 +280,37 @@ H5D_term_package(void)
/*-------------------------------------------------------------------------
+ * Function: H5D__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on the dataset's ID
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__close_cb(H5D_t *dset)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(dset);
+ HDassert(dset->oloc.file);
+ HDassert(dset->shared);
+ HDassert(dset->shared->fo_count > 0);
+
+ /* Close the dataset */
+ if(H5D_close(dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__close_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__create_named
*
* Purpose: Internal routine to create a new dataset.
@@ -505,7 +535,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
- location is different from the file location where the dataset will be created */
+ * location is different from the file location where the dataset will be created.
+ */
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
@@ -520,7 +551,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Get a datatype ID for the dataset's datatype */
if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
- } /* end if */
+ }
/* Not a custom datatype, just use it directly */
else {
if(H5I_inc_ref(type_id, FALSE) < 0)
@@ -529,7 +560,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Use existing datatype */
dset->shared->type_id = type_id;
dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -569,7 +600,7 @@ H5D__cache_dataspace_info(const H5D_t *dset)
if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) )
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
dset->shared->curr_power2up[u] = scaled_power2up;
- } /* end for */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -685,7 +716,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type")
fill_prop->fill_defined = TRUE;
- } /* end if */
+ }
else if(fill_status == H5D_FILL_VALUE_UNDEFINED)
fill_prop->fill_defined = FALSE;
else
@@ -848,7 +879,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
*/
if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0)
prefix = HDgetenv("HDF5_VDS_PREFIX");
- else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
+ else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
else
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible")
@@ -1300,7 +1331,7 @@ done:
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
- } /* end if */
+ }
H5O_loc_free(&(dataset->oloc));
H5G_name_free(&(dataset->path));
@@ -1561,36 +1592,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__close_cb
- *
- * Purpose: Callback routine for closing a dataset ID. Closes the dataset
- * object that was attached to the ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5D__close_cb(H5D_t *dataset)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* check args */
- HDassert(dataset && dataset->oloc.file && dataset->shared);
- HDassert(dataset->shared->fo_count > 0);
-
- /* Call actual dataset close routine */
- if(H5D_close(dataset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__close_cb() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D_close
*
* Purpose: Insures that all data has been saved to the file, closes the
@@ -1726,8 +1727,7 @@ H5D_close(H5D_t *dataset)
if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
- /*
- * Release datatype, dataspace and creation property list -- there isn't
+ /* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) ||
@@ -1761,6 +1761,7 @@ H5D_close(H5D_t *dataset)
*/
dataset->oloc.file = NULL;
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
+
} /* end if */
else {
/* Decrement the ref. count for this object in the top file */
@@ -1798,7 +1799,7 @@ done:
* Function: H5D_mult_refresh_close
*
* Purpose: Closing down the needed information when the dataset has
- * multiple opens. (From H5O_refresh_metadata_close())
+ * multiple opens. (From H5O__refresh_metadata_close())
*
* Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
@@ -2275,13 +2276,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_offset
+ * Function: H5D__get_offset
+ *
+ * Purpose: Private function for H5D__get_offset. Returns the address
+ * of dataset in file.
*
- * Purpose: Private function for H5D__get_offset. Returns the address
- * of dataset in file.
+ * Return: Success: The address of dataset
+ *
+ * Failure: HADDR_UNDEF (but also a valid value)
*
- * Return: Success: the address of dataset
- * Failure: HADDR_UNDEF
*-------------------------------------------------------------------------
*/
haddr_t
@@ -2301,7 +2304,8 @@ H5D__get_offset(const H5D_t *dset)
case H5D_CONTIGUOUS:
/* If dataspace hasn't been allocated or dataset is stored in
- * an external file, the value will be HADDR_UNDEF. */
+ * an external file, the value will be HADDR_UNDEF.
+ */
if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr))
/* Return the absolute dataset offset from the beginning of file. */
ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file);
@@ -2311,7 +2315,7 @@ H5D__get_offset(const H5D_t *dset)
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type")
- } /*lint !e788 All appropriate cases are covered */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2419,6 +2423,8 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
{
H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data;
H5T_t *dt; /* Datatype for operation */
+ H5S_t *mspace; /* Memory dataspace for operation */
+ H5S_t *fspace; /* File dataspace for operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2434,12 +2440,18 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt))))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf")
+ /* Get the memory dataspace from the ID */
+ if(NULL == (mspace = (H5S_t *)H5I_object_verify(vlen_bufsize->mspace_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
/* Select point to read in */
- if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
+ if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->fl_tbuf) < 0)
+ if(H5D__read(vlen_bufsize->dset, type_id, mspace, fspace, vlen_bufsize->fl_tbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
@@ -2509,11 +2521,11 @@ done:
herr_t
H5D__set_extent(H5D_t *dset, const hsize_t *size)
{
- hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
- htri_t changed; /* Whether the dataspace changed size */
- size_t u, v; /* Local index variable */
+ hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
+ htri_t changed; /* Whether the dataspace changed size */
+ size_t u, v; /* Local index variable */
unsigned dim_idx; /* Dimension index */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -2649,7 +2661,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
- } /* end if */
+ }
/*-------------------------------------------------------------------------
* Remove chunk information in the case of chunked datasets
* This removal takes place only in case we are shrinking the dateset
@@ -3255,7 +3267,7 @@ H5D_get_access_plist(const H5D_t *dset)
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
diff --git a/src/H5Dio.c b/src/H5Dio.c
index ed384ca..88a9e4b 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -21,14 +21,14 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Sprivate.h" /* Dataspace */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Sprivate.h" /* Dataspace */
#ifdef H5_HAVE_PARALLEL
/* Remove this if H5R_DATASET_REGION is no longer used in this file */
@@ -50,8 +50,7 @@
/* Local Prototypes */
/********************/
-static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset,
- hsize_t *offset_copy/*out*/);
+/* Setup/teardown routines */
static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
H5D_storage_t *store, H5D_io_info_t *io_info);
static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id,
@@ -83,14 +82,17 @@ H5FL_DEFINE(H5D_chunk_map_t);
/*-------------------------------------------------------------------------
* Function: H5D__get_offset_copy
*
- * Purpose: Gets a copy of the user's offset array that is guaraneteed
- * to be suitable for use by the library.
+ * Purpose: Copies an offset buffer and performs bounds checks on the
+ * values.
+ *
+ * This helper function ensures that the offset buffer given
+ * by the user is suitable for use with the rest of the library.
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
{
unsigned u;
@@ -102,7 +104,6 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_c
HDassert(offset);
HDassert(offset_copy);
-
/* The library's chunking code requires the offset to terminate with a zero.
* So transfer the offset array to an internal offset array that we
* can properly terminate (handled via the calloc call).
@@ -127,14 +128,13 @@ done:
} /* end H5D__get_offset_copy() */
-
/*-------------------------------------------------------------------------
- * Function: H5Dread
+ * Function: H5Dread
*
* Purpose: Reads (part of) a DSET from the file into application
* memory BUF. The part of the dataset to read is defined with
- * MEM_SPACE_ID and FILE_SPACE_ID. The data points are
+ * MEM_SPACE_ID and FILE_SPACE_ID. The data points are
* converted from their file type to the MEM_TYPE_ID specified.
* Additional miscellaneous data transfer properties can be
* passed to this function with the PLIST_ID argument.
@@ -152,7 +152,7 @@ done:
* The PLIST_ID can be the constant H5P_DEFAULT in which
* case the default data transfer properties are used.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@@ -194,7 +194,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Read raw data */
+ /* Read the data */
if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
@@ -219,9 +219,9 @@ herr_t
H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
void *buf)
{
- H5D_t *dset = NULL;
+ H5D_t *dset = NULL;
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
@@ -289,7 +289,7 @@ done:
* The PLIST_ID can be the constant H5P_DEFAULT in which
* case the default data transfer properties are used.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@@ -303,13 +303,13 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5D_t *dset = NULL;
const H5S_t *mem_space = NULL;
const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id,
dxpl_id, buf);
- /* Get dataset pointer and ensure it's associated with a file */
+ /* Get dataset pointer */
if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
if (NULL == dset->oloc.file)
@@ -356,10 +356,10 @@ herr_t
H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
size_t data_size, const void *buf)
{
- H5D_t *dset = NULL;
+ H5D_t *dset = NULL;
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf);
@@ -981,8 +981,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
type_info->dst_type_id = mem_type_id;
} /* end else */
- /*
- * Locate the type conversion function and dataspace conversion
+ /* Locate the type conversion function and dataspace conversion
* functions, and set up the element numbering information. If a data
* type conversion is necessary then register datatype atoms. Data type
* conversion is necessary if the user has set the `need_bkg' to a high
@@ -1249,7 +1248,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__ioinfo_adjust() */
-#endif /*H5_HAVE_PARALLEL*/
+#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index c8afb8e..494d2c8 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -25,7 +25,6 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5HLprivate.h" /* Local heaps */
-#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -506,7 +505,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
- } /* end if */
+ }
/* Update external storage message, if it's used */
if(dset->shared->dcpl_cache.efl.nused > 0) {
@@ -557,6 +556,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
+ /* Create layout message */
/* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index eb687d2..2c06800 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -479,8 +479,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
- /*
- * Determine the size of the end result array by collecting the number
+ /* Determine the size of the end result array by collecting the number
* of entries contributed by each processor into a single total.
*/
if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm)))
diff --git a/src/H5Doh.c b/src/H5Doh.c
index f8ce69f..38d0914 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -189,15 +189,15 @@ H5O__dset_isa(const H5O_t *oh)
/* Datatype */
if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(!exists)
- HGOTO_DONE(FALSE)
+ HGOTO_DONE(FALSE)
/* Layout */
if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(!exists)
- HGOTO_DONE(FALSE)
+ HGOTO_DONE(FALSE)
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -260,7 +260,7 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(dset && H5D_close(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 1217c48..591fcb1 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -510,12 +510,12 @@ typedef struct H5D_fill_buf_info_t {
/* Internal data structure for computing variable-length dataset's total size */
typedef struct {
- H5D_t *dset; /* Dataset for operation */
- H5S_t *fspace; /* Dataset's dataspace for operation */
- H5S_t *mspace; /* Memory dataspace for operation */
- void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
- void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
- hsize_t size; /* Accumulated number of bytes for the selection */
+ H5D_t *dset; /* Dataset for operation */
+ hid_t fspace_id; /* File dataspace ID of the dataset we are working on */
+ hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */
+ void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
+ void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
+ hsize_t size; /* Accumulated number of bytes for the selection */
} H5D_vlen_bufsize_t;
@@ -559,15 +559,12 @@ H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_
H5_DLL hid_t H5D__get_space(const H5D_t *dset);
H5_DLL hid_t H5D__get_type(const H5D_t *dset);
H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation);
-H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
- hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
-H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset,
- hsize_t *storage_size);
+H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
-H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim,
- const hsize_t *point, void *op_data);
+H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data);
H5_DLL herr_t H5D__check_filters(H5D_t *dataset);
H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
@@ -660,6 +657,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh,
H5O_layout_t *layout, hsize_t *btree_size);
H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream);
H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store);
+H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters,
hsize_t *offset, uint32_t data_size, const void *buf);
H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset,
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 5856ede..266f5f5 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -559,11 +559,9 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
- } /* end if */
+ }
- /*
- * Scatter the data into memory.
- */
+ /* Scatter the data into memory */
if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
@@ -691,9 +689,9 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
if(H5CX_get_data_transform(&data_transform) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
- if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
- } /* end if */
+ if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
+ }
/*
* Perform datatype conversion.
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index 321d258..4510a03 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
} /* end if */
if(dset)
- if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
- /* Mark the layout dirty so that the address of the single chunk will be flushed later */
- if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
+ if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
+ /* Mark the layout dirty so that the address of the single chunk will be flushed later */
+ if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 7f1ac86..8867492 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -2961,7 +2961,7 @@ done:
static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
- hid_t dset_id; /* Temporary dataset identifier */
+ hid_t temp_id; /* Temporary dataset identifier */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2970,15 +2970,15 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HDassert(dset && *dset);
/* Get a temporary identifier for this source dataset */
- if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
+ if((temp_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID")
/* Refresh source dataset */
- if(H5D__refresh(dset_id, *dset) < 0)
+ if(H5D__refresh(temp_id, *dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
- if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id)))
+ if(NULL == (*dset = (H5D_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
done:
diff --git a/src/H5F.c b/src/H5F.c
index 68bdfd3..97330e5 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -55,6 +55,8 @@
/* Local Prototypes */
/********************/
+static herr_t H5F__close_cb(H5F_t *f);
+
/*********************/
/* Package Variables */
@@ -157,6 +159,66 @@ H5F_term_package(void)
/*-------------------------------------------------------------------------
+ * Function: H5F__close_cb
+ *
+ * Purpose: Closes a file or causes the close operation to be pended.
+ * This function is called from the API and gets called
+ * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref()
+ * decrements the file ID reference count to zero. The file ID
+ * is removed from the H5I_FILE group by H5I_dec_ref() just
+ * before H5F__close_cb() is called. If there are open object
+ * headers then the close is pended by moving the file to the
+ * H5I_FILE_CLOSING ID group (the f->closing contains the ID
+ * assigned to file).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__close_cb(H5F_t *f)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */
+
+ /* Perform checks for "semi" file close degree here, since closing the
+ * file is not allowed if there are objects still open.
+ */
+ if(f->shared->fc_degree == H5F_CLOSE_SEMI) {
+ unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */
+ unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */
+
+ /* Get the number of open objects and open files on this file/mount hierarchy */
+ if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy")
+
+ /* If there are no other file IDs open on this file/mount hier., but
+ * there are still open objects, issue an error and bail out now,
+ * without decrementing the file ID's reference count and triggering
+ * a "real" attempt at closing the file.
+ */
+ if(nopen_files == 1 && nopen_objs > 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open")
+ } /* end if */
+
+ /* Reset the file ID for this file */
+ f->file_id = -1;
+
+ /* Attempt to close the file/mount hierarchy */
+ if(H5F_try_close(f, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__close_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Fget_create_plist
*
* Purpose: Get an atom for a copy of the file-creation property list for
@@ -236,36 +298,105 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_obj_count
+ * Function: H5F__get_all_count_cb
+ *
+ * Purpose: Get counter of all object types currently open.
*
- * Purpose: Public function returning the number of opened object IDs
- * (files, datasets, groups and datatypes) in the same file.
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ *
+ * Failure: H5_ITER_ERROR
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
+{
+ H5F_trav_obj_cnt_t *udata = (H5F_trav_obj_cnt_t *)key;
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ *(udata->obj_count) = *(udata->obj_count) + 1;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F_get_all_count_cb */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_obj_count
+ *
+ * Purpose: Public function returning the number of opened object IDs
+ * (files, datasets, groups and datatypes) in the same file.
+ *
+ * Return: Success: The number of opened object IDs
+ *
+ * Failure: -1
*
- * Return: Non-negative on success; negative on failure.
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_obj_count(hid_t file_id, unsigned types)
{
- H5F_t *f = NULL; /* File to query */
- size_t obj_count = 0; /* Number of opened objects */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = 0; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE2("Zs", "iIu", file_id, types);
/* Check arguments */
- if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id")
if(0 == (types & H5F_OBJ_ALL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type")
/* Perform the query */
- if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
-
- /* Set the return value */
- ret_value = (ssize_t)obj_count;
+ /* If the 'special' ID wasn't passed in, just make a normal call to
+ * count the IDs in the file.
+ */
+ if(file_id != (hid_t)H5F_OBJ_ALL) {
+ H5F_t *f = NULL;
+ size_t obj_count = 0;
+
+ /* Get the file object */
+ if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id")
+
+ /* Get the count */
+ if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)")
+
+ /* Set the return value */
+ ret_value = (ssize_t)obj_count;
+ }
+ /* If we passed in the 'special' ID, get the count for everything open in the
+ * library, iterating over all open files and getting the object count for each.
+ *
+ * XXX: Consider making this a helper function in H5I.
+ */
+ else {
+ H5F_trav_obj_cnt_t udata;
+
+ udata.obj_count = &ret_value;
+ udata.types = types | H5F_OBJ_LOCAL;
+
+ if(types & H5F_OBJ_FILE) {
+ if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed");
+ }
+ if(types & H5F_OBJ_DATASET) {
+ if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed");
+ }
+ if(types & H5F_OBJ_GROUP) {
+ if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed");
+ }
+ if(types & H5F_OBJ_DATATYPE) {
+ if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed");
+ }
+ if(types & H5F_OBJ_ATTR) {
+ if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed");
+ }
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -273,37 +404,118 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_object_ids
+ * Function: H5F__get_all_ids_cb
+ *
+ * Purpose: Get IDs of all currently open objects of a given type.
+ *
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
*
- * Purpose: Public function to return a list of opened object IDs.
+ * Failure: H5_ITER_ERROR
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key)
+{
+ H5F_trav_obj_ids_t *udata = (H5F_trav_obj_ids_t *)key;
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(*udata->obj_count >= udata->max_objs)
+ HGOTO_DONE(H5_ITER_STOP);
+
+ udata->oid_list[*udata->obj_count] = obj_id;
+ *(udata->obj_count) = *(udata->obj_count) + 1;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F__get_all_ids_cb */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_object_ids
+ *
+ * Purpose: Public function to return a list of opened object IDs.
+ *
+ * NOTE: Type mismatch - You can ask for more objects than can be
+ * returned.
+ *
+ * Return: Success: The number of IDs in oid_list
+ *
+ * Failure: -1
*
- * Return: Non-negative on success; negative on failure.
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
{
- H5F_t *f = NULL; /* File to query */
- size_t obj_id_count = 0; /* Number of open objects */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = 0; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list);
/* Check arguments */
- if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id")
if(0 == (types & H5F_OBJ_ALL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type")
if(!oid_list)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL")
/* Perform the query */
- if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
+ /* If the 'special' ID wasn't passed in, just make a normal VOL call to
+ * get the IDs from the file.
+ */
+ if(file_id != (hid_t)H5F_OBJ_ALL) {
+ H5F_t *file = NULL;
+ size_t obj_id_count = 0;
- /* Set the return value */
- ret_value = (ssize_t)obj_id_count;
+ /* get the file object */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+
+ /* Get the IDs */
+ if(H5F_get_obj_ids(file, types, max_objs, oid_list, TRUE, &obj_id_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)")
+
+ /* Set the return value */
+ ret_value = (ssize_t)obj_id_count;
+ }
+ /* If we passed in the 'special' ID, get the count for everything open in the
+ * library, iterating over all open files and getting the object count for each.
+ *
+ * XXX: Consider making this a helper function in H5I.
+ * XXX: Note that the RM states that passing in a negative value for max_objs
+ * gets you all the objects. This technically works, but is clearly wrong
+ * behavior since max_objs is an unsigned type.
+ */
+ else {
+ H5F_trav_obj_ids_t udata;
+
+ udata.max_objs = max_objs;
+ udata.oid_list = oid_list;
+ udata.obj_count = &ret_value;
+
+ if(types & H5F_OBJ_FILE) {
+ if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed");
+ }
+ if(types & H5F_OBJ_DATASET) {
+ if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed");
+ }
+ if(types & H5F_OBJ_GROUP) {
+ if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed");
+ }
+ if(types & H5F_OBJ_DATATYPE) {
+ if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed");
+ }
+ if(types & H5F_OBJ_ATTR) {
+ if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed");
+ }
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -482,7 +694,7 @@ done:
*
* Return: Success: A file ID
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -495,7 +707,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
- /* Check/fix arguments. */
+ /* Check arguments */
if(!filename || !*filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name")
/* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */
@@ -533,13 +745,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fflush
+ * Function: H5Fflush
+ *
+ * Purpose: Flushes all outstanding buffers of a file to disk but does
+ * not remove them from the cache. The OBJECT_ID can be a file,
+ * dataset, group, attribute, or named data type.
*
- * Purpose: Flushes all outstanding buffers of a file to disk but does
- * not remove them from the cache. The OBJECT_ID can be a file,
- * dataset, group, attribute, or named data type.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -547,7 +760,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
{
H5F_t *f = NULL; /* File to flush */
H5O_loc_t *oloc = NULL; /* Object location for ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iFs", object_id, scope);
@@ -654,17 +867,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fclose
+ * Function: H5Fclose
+ *
+ * Purpose: This function closes the file specified by FILE_ID by
+ * flushing all data to storage, and terminating access to the
+ * file through FILE_ID. If objects (e.g., datasets, groups,
+ * etc.) are open in the file then the underlying storage is not
+ * closed until those objects are closed; however, all data for
+ * the file and the open objects is flushed.
*
- * Purpose: This function closes the file specified by FILE_ID by
- * flushing all data to storage, and terminating access to the
- * file through FILE_ID. If objects (e.g., datasets, groups,
- * etc.) are open in the file then the underlying storage is not
- * closed until those objects are closed; however, all data for
- * the file and the open objects is flushed.
+ * Return: SUCCEED/FAIL
*
- * Return: Success: Non-negative
- * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -677,7 +890,7 @@ H5Fclose(hid_t file_id)
/* Check arguments */
if(H5I_FILE != H5I_get_type(file_id))
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID")
/* Close the file */
if(H5F__close(file_id) < 0)
@@ -689,63 +902,62 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Freopen
+ * Function: H5Freopen
*
- * Purpose: Reopen a file. The new file handle which is returned points
- * to the same file as the specified file handle. Both handles
- * share caches and other information. The only difference
- * between the handles is that the new handle is not mounted
- * anywhere and no files are mounted on it.
+ * Purpose: Reopen a file. The new file handle which is returned points
+ * to the same file as the specified file handle. Both handles
+ * share caches and other information. The only difference
+ * between the handles is that the new handle is not mounted
+ * anywhere and no files are mounted on it.
+ *
+ * Return: Success: New file ID
+ *
+ * Failure: H5I_INVALID_HID
*
- * Return: Success: New file ID
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5Freopen(hid_t file_id)
{
- H5F_t *old_file = NULL;
- H5F_t *new_file = NULL;
- hid_t ret_value;
+ H5F_t *old_file = NULL;
+ H5F_t *new_file = NULL;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", file_id);
- /* Check arguments */
+ /* Get the file object */
if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file")
- /* Get a new "top level" file struct, sharing the same "low level" file struct */
- if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
-
- /* Duplicate old file's names */
- new_file->open_name = H5MM_xstrdup(old_file->open_name);
- new_file->actual_name = H5MM_xstrdup(old_file->actual_name);
- new_file->extpath = H5MM_xstrdup(old_file->extpath);
+ /* Reopen the file */
+ if(NULL == (new_file = H5F__reopen(old_file)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
+ /* Get an atom for the file */
if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
/* Keep this ID in file object structure */
new_file->file_id = ret_value;
done:
- if(ret_value < 0 && new_file)
- if(H5F__dest(new_file, FALSE) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
+ if(H5I_INVALID_HID == ret_value)
+ if(new_file && H5F__dest(new_file, FALSE) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "can't close file")
FUNC_LEAVE_API(ret_value)
} /* end H5Freopen() */
/*-------------------------------------------------------------------------
- * Function: H5Fget_intent
+ * Function: H5Fget_intent
*
- * Purpose: Public API to retrieve the file's 'intent' flags passed
- * during H5Fopen()
+ * Purpose: Public API to retrieve the file's 'intent' flags passed
+ * during H5Fopen()
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -794,8 +1006,10 @@ done:
*
* Purpose: Retrieves the amount of free space in the file.
*
- * Return: Success: Amount of free space for type
- * Failure: Negative
+ * Return: Success: Amount of free space for type
+ *
+ * Failure: -1
+ *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -805,16 +1019,16 @@ H5Fget_freespace(hid_t file_id)
hsize_t tot_space; /* Amount of free space in the file */
hssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE1("Hs", "i", file_id);
- /* Check args */
+ /* Get the file object */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
- /* Go get the actual amount of free space in the file */
+ /* Get the amount of free space in the file */
if(H5MF_get_freespace(file, &tot_space, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
ret_value = (hssize_t)tot_space;
@@ -828,10 +1042,10 @@ done:
*
* Purpose: Retrieves the file size of the HDF5 file. This function
* is called after an existing file is opened in order
- * to learn the true size of the underlying file.
+ * to learn the true size of the underlying file.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: Non-negative
- * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -840,23 +1054,26 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
H5F_t *file; /* File object for file ID */
haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
haddr_t base_addr; /* Base address for the file */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", file_id, size);
/* Check args */
+ if(!size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL")
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- /* Go get the actual file size */
+ /* Get the actual file size */
if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
base_addr = H5FD_get_base_addr(file->shared->lf);
+ /* Convert relative base address for file to absolute address */
if(size)
- *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */
+ *size = (hsize_t)(max_eof_eoa + base_addr);
done:
FUNC_LEAVE_API(ret_value)
@@ -867,56 +1084,58 @@ done:
* Function: H5Fget_file_image
*
* Purpose: If a buffer is provided (via the buf_ptr argument) and is
- * big enough (size in buf_len argument), load *buf_ptr with
- * an image of the open file whose ID is provided in the
- * file_id parameter, and return the number of bytes copied
- * to the buffer.
+ * big enough (size in buf_len argument), load *buf_ptr with
+ * an image of the open file whose ID is provided in the
+ * file_id parameter, and return the number of bytes copied
+ * to the buffer.
*
- * If the buffer exists, but is too small to contain an image
- * of the indicated file, return a negative number.
+ * If the buffer exists, but is too small to contain an image
+ * of the indicated file, return a negative number.
*
- * Finally, if no buffer is provided, return the size of the
- * buffer needed. This value is simply the eoa of the target
- * file.
+ * Finally, if no buffer is provided, return the size of the
+ * buffer needed. This value is simply the eoa of the target
+ * file.
*
- * Note that any user block is skipped.
+ * Note that any user block is skipped.
*
- * Also note that the function may not be used on files
- * opened with either the split/multi file driver or the
- * family file driver.
+ * Also note that the function may not be used on files
+ * opened with either the split/multi file driver or the
+ * family file driver.
*
- * In the former case, the sparse address space makes the
- * get file image operation impractical, due to the size of
- * the image typically required.
+ * In the former case, the sparse address space makes the
+ * get file image operation impractical, due to the size of
+ * the image typically required.
*
- * In the case of the family file driver, the problem is
- * the driver message in the super block, which will prevent
- * the image being opened with any driver other than the
- * family file driver -- which negates the purpose of the
- * operation. This can be fixed, but no resources for
- * this now.
+ * In the case of the family file driver, the problem is
+ * the driver message in the super block, which will prevent
+ * the image being opened with any driver other than the
+ * family file driver -- which negates the purpose of the
+ * operation. This can be fixed, but no resources for
+ * this now.
+ *
+ * Return: Success: Bytes copied / number of bytes needed
+ *
+ * Failure: -1
*
- * Return: Success: Bytes copied / number of bytes needed.
- * Failure: negative value
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
{
- H5F_t *file; /* File object for file ID */
- ssize_t ret_value; /* Return value */
+ H5F_t *file; /* File object for file ID */
+ ssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len);
/* Check args */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
- /* call private get_file_image function */
+ /* Get the file image */
/* (Should not trigger raw data I/O - QAK, 2018/01/03) */
if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
FUNC_LEAVE_API(ret_value)
@@ -924,17 +1143,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_mdc_config
+ * Function: H5Fget_mdc_config
*
- * Purpose: Retrieves the current automatic cache resize configuration
- * from the metadata cache, and return it in *config_ptr.
+ * Purpose: Retrieves the current automatic cache resize configuration
+ * from the metadata cache, and return it in *config_ptr.
*
- * Note that the version field of *config_Ptr must be correctly
- * filled in by the caller. This allows us to adapt for
- * obsolete versions of the structure.
+ * Note that the version field of *config_Ptr must be correctly
+ * filled in by the caller. This allows us to adapt for
+ * obsolete versions of the structure.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -952,9 +1171,9 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
- /* Go get the resize configuration */
+ /* Get the metadata cache configuration */
if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
FUNC_LEAVE_API(ret_value)
@@ -965,11 +1184,11 @@ done:
* Function: H5Fset_mdc_config
*
* Purpose: Sets the current metadata cache automatic resize
- * configuration, using the contents of the instance of
- * H5AC_cache_config_t pointed to by config_ptr.
+ * configuration, using the contents of the instance of
+ * H5AC_cache_config_t pointed to by config_ptr.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -981,13 +1200,13 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, config_ptr);
- /* Check args */
+ /* Get the file object */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- /* set the resize configuration */
+ /* Set the metadata cache configuration */
if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
FUNC_LEAVE_API(ret_value)
@@ -998,12 +1217,12 @@ done:
* Function: H5Fget_mdc_hit_rate
*
* Purpose: Retrieves the current hit rate from the metadata cache.
- * This rate is the overall hit rate since the last time
- * the hit rate statistics were reset either manually or
- * automatically.
+ * This rate is the overall hit rate since the last time
+ * the hit rate statistics were reset either manually or
+ * automatically.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1022,9 +1241,9 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
if(NULL == hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
- /* Go get the current hit rate */
+ /* Get the current hit rate */
if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
FUNC_LEAVE_API(ret_value)
@@ -1035,13 +1254,13 @@ done:
* Function: H5Fget_mdc_size
*
* Purpose: Retrieves the maximum size, minimum clean size, current
- * size, and current number of entries from the metadata
- * cache associated with the specified file. If any of
- * the ptr parameters are NULL, the associated datum is
- * not returned.
+ * size, and current number of entries from the metadata
+ * cache associated with the specified file. If any of
+ * the ptr parameters are NULL, the associated datum is
+ * not returned.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1060,10 +1279,10 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- /* Go get the size data */
+ /* Get the size data */
if(H5AC_get_cache_size(file->shared->cache, max_size_ptr,
min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
if(cur_num_entries_ptr != NULL)
*cur_num_entries_ptr = (int)cur_num_entries;
@@ -1077,16 +1296,16 @@ done:
* Function: H5Freset_mdc_hit_rate_stats
*
* Purpose: Reset the hit rate statistic whose current value can
- * be obtained via the H5Fget_mdc_hit_rate() call. Note
- * that this statistic will also be reset once per epoch
- * by the automatic cache resize code if it is enabled.
+ * be obtained via the H5Fget_mdc_hit_rate() call. Note
+ * that this statistic will also be reset once per epoch
+ * by the automatic cache resize code if it is enabled.
+ *
+ * It is probably a bad idea to call this function unless
+ * you are controlling cache size from your program instead
+ * of using our cache size control code.
*
- * It is probably a bad idea to call this function unless
- * you are controlling cache size from your program instead
- * of using our cache size control code.
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1098,13 +1317,13 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
- /* Check args */
+ /* Get the file object */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the hit rate statistic */
if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
FUNC_LEAVE_API(ret_value)
@@ -1115,18 +1334,21 @@ done:
* Function: H5Fget_name
*
* Purpose: Gets the name of the file to which object OBJ_ID belongs.
- * If `name' is non-NULL then write up to `size' bytes into that
+ * If 'name' is non-NULL then write up to 'size' bytes into that
* buffer and always return the length of the entry name.
- * Otherwise `size' is ignored and the function does not store the name,
- * just returning the number of characters required to store the name.
- * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL)
- * is unchanged and the function returns a negative value.
+ * Otherwise `size' is ignored and the function does not store
+ * the name, just returning the number of characters required to
+ * store the name. If an error occurs then the buffer pointed to
+ * by 'name' (NULL or non-NULL) is unchanged and the function
+ * returns a negative value.
*
* Note: This routine returns the name that was used to open the file,
* not the actual name after resolving symlinks, etc.
*
- * Return: Success: The length of the file name
- * Failure: Negative
+ * Return: Success: The length of the file name
+ *
+ * Failure: -1
+ *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1134,9 +1356,9 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
{
H5F_t *f; /* Top file in mount hierarchy */
size_t len;
- ssize_t ret_value;
+ ssize_t ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, name, size);
/* For file IDs, get the file object directly */
@@ -1145,14 +1367,14 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
*/
if(H5I_get_type(obj_id) == H5I_FILE ) {
if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file")
} /* end if */
else {
H5G_loc_t loc; /* Object location */
/* Get symbol table entry */
if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a valid object ID")
f = loc.oloc->file;
} /* end else */
@@ -1181,42 +1403,48 @@ done:
* in the SOHM table if there is one.
* 3. The amount of free space tracked in the file.
*
- * Return: Success: non-negative on success
- * Failure: Negative
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
{
H5F_t *f; /* Top file in mount hierarchy */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_t type;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", obj_id, finfo);
/* Check args */
if(!finfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL")
- /* For file IDs, get the file object directly */
- /* (This prevents the H5G_loc() call from returning the file pointer for
- * the top file in a mount hierarchy)
- */
- if(H5I_get_type(obj_id) == H5I_FILE ) {
+ /* Check the type */
+ type = H5I_get_type(obj_id);
+ if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Get the file object */
+ if(type == H5I_FILE ) {
+ /* For file IDs, get the file object directly */
+ /* (This prevents the H5G_loc() call from returning the file pointer for
+ * the top file in a mount hierarchy)
+ */
if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
} /* end if */
else {
H5G_loc_t loc; /* Object location */
/* Get symbol table entry */
if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object identifier")
f = loc.oloc->file;
} /* end else */
- HDassert(f->shared);
- /* Get the file info */
+ /* Get the file information */
if(H5F__get_info(f, finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
@@ -1228,17 +1456,18 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fget_metadata_read_retry_info
*
- * Purpose: To retrieve the collection of read retries for metadata items with checksum.
+ * Purpose: To retrieve the collection of read retries for metadata
+ * items with checksum.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: non-negative on success
- * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
{
H5F_t *file; /* File object for file ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, info);
@@ -1252,7 +1481,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the retry info */
- if(H5F__get_metadata_read_retry_info(file, info) < 0)
+ if(H5F_get_metadata_read_retry_info(file, info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
done:
@@ -1261,36 +1490,38 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_free_sections
+ * Function: H5Fget_free_sections
+ *
+ * Purpose: To get free-space section information for free-space manager with
+ * TYPE that is associated with file FILE_ID.
+ * If SECT_INFO is null, this routine returns the total # of free-space
+ * sections.
+ *
+ * Return: Success: The total # of free space sections
*
- * Purpose: To get free-space section information for free-space manager with
- * TYPE that is associated with file FILE_ID.
- * If SECT_INFO is null, this routine returns the total # of free-space
- * sections.
+ * Failure: -1
*
- * Return: Success: non-negative, the total # of free space sections
- * Failure: negative
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
H5F_sect_info_t *sect_info/*out*/)
{
- H5F_t *file; /* Top file in mount hierarchy */
- ssize_t ret_value; /* Return value */
+ H5F_t *file;
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info);
/* Check args */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
if(sect_info && nsects == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
/* Get the free-space section information in the file */
if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
done:
FUNC_LEAVE_API(ret_value)
@@ -1304,15 +1535,15 @@ done:
* provided file, potentially closing any cached files
* unless they are held open from somewhere\ else.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fclear_elink_file_cache(hid_t file_id)
{
- H5F_t *file; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1335,9 +1566,34 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fstart_swmr_write
*
- * Purpose: To enable SWMR writing mode for the file
+ * Purpose: To enable SWMR writing mode for the file
+ *
+ * 1) Refresh opened objects: part 1
+ * 2) Flush & reset accumulator
+ * 3) Mark the file in SWMR writing mode
+ * 4) Set metadata read attempts and retries info
+ * 5) Disable accumulator
+ * 6) Evict all cache entries except the superblock
+ * 7) Refresh opened objects (part 2)
+ * 8) Unlock the file
+ *
+ * Pre-conditions:
+ *
+ * 1) The file being opened has v3 superblock
+ * 2) The file is opened with H5F_ACC_RDWR
+ * 3) The file is not already marked for SWMR writing
+ * 4) Current implementaion for opened objects:
+ * --only allow datasets and groups without attributes
+ * --disallow named datatype with/without attributes
+ * --disallow opened attributes attached to objects
+ *
+ * NOTE: Currently, only opened groups and datasets are allowed
+ * when enabling SWMR via H5Fstart_swmr_write().
+ * Will later implement a different approach--
+ * set up flush dependency/proxy even for file opened without
+ * SWMR to resolve issues with opened objects.
*
- * Return: Non-negative on success/negative on failure
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1345,22 +1601,22 @@ herr_t
H5Fstart_swmr_write(hid_t file_id)
{
H5F_t *file = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
- /* check args */
+ /* Check args */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the internal routine */
+ /* start SWMR writing */
if(H5F__start_swmr_write(file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format")
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
FUNC_LEAVE_API(ret_value)
@@ -1373,7 +1629,8 @@ done:
* Purpose: Start metadata cache logging operations for a file.
* - Logging must have been set up via the fapl.
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1405,7 +1662,8 @@ done:
* - Does not close the log file.
* - Logging must have been set up via the fapl.
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1437,7 +1695,8 @@ done:
* set up via the fapl. is_currently_logging determines if
* log messages are being recorded at this time.
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1471,14 +1730,15 @@ done:
* H5Fset_latest_format() starting release 1.10.2.
* See explanation for H5Fset_latest_format() in H5Fdeprec.c.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
- H5F_t *f; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *f; /* File */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFvFv", file_id, low, high);
@@ -1501,38 +1761,40 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fformat_convert
+ * Function: H5Fformat_convert (Internal)
+ *
+ * Purpose: Downgrade the superblock version to v2 and
+ * downgrade persistent file space to non-persistent
+ * for 1.8 library.
*
- * Purpose: Downgrade the superblock version to v2 and
- * downgrade persistent file space to non-persistent
- * for 1.8 library.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5Fformat_convert(hid_t fid)
+H5Fformat_convert(hid_t file_id)
{
- H5F_t *f; /* File to flush */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *f = NULL; /* File */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", fid);
+ H5TRACE1("e", "i", file_id);
- if(H5I_FILE != H5I_get_type(fid))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ /* Check args */
+ if(H5I_FILE != H5I_get_type(file_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier")
/* Get file object */
- if(NULL == (f = (H5F_t *)H5I_object(fid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ if(NULL == (f = (H5F_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(fid) < 0)
+ if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the internal routine */
+ /* Convert the format */
if(H5F__format_convert(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
FUNC_LEAVE_API(ret_value)
@@ -1544,15 +1806,15 @@ done:
*
* Purpose: Resets statistics for the page buffer layer.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Freset_page_buffering_stats(hid_t file_id)
{
- H5F_t *file; /* File to reset stats on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File to reset stats on */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1565,7 +1827,7 @@ H5Freset_page_buffering_stats(hid_t file_id)
/* Reset the statistics */
if(H5PB_reset_stats(file->shared->page_buf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
FUNC_LEAVE_API(ret_value)
@@ -1577,15 +1839,15 @@ done:
*
* Purpose: Retrieves statistics for the page buffer layer.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2],
unsigned misses[2], unsigned evictions[2], unsigned bypasses[2])
{
- H5F_t *file; /* File object for file ID */
+ H5F_t *file; /* File object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1618,8 +1880,8 @@ done:
* image_len: --size of the on disk metadata cache image
* --zero if no cache image
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1653,10 +1915,7 @@ done:
* allocated memory in the file.
* (See H5FDget_eoa() in H5FD.c)
*
- * Return: Success: First byte after allocated memory.
- * Failure: HADDR_UNDEF
- *
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1695,7 +1954,7 @@ done:
*
* Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1729,3 +1988,4 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment)
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fincrement_filesize() */
+
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 6417956..c91d0ea 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -35,12 +35,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5Iprivate.h" /* IDs */
-#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMprivate.h" /* Shared object header messages */
/****************/
@@ -84,16 +84,12 @@
* Function: H5Fget_info1
*
* Purpose: Gets general information about the file, including:
- * 1. Get storage size for superblock extension if there is one.
+ * 1. Get storage size for superblock extension if there is one.
* 2. Get the amount of btree and heap storage for entries
* in the SOHM table if there is one.
- * 3. The amount of free space tracked in the file.
+ * 3. The amount of free space tracked in the file.
*
- * Return: Success: non-negative on success
- * Failure: Negative
- *
- * Programmer: Vailin Choi
- * July 11, 2007
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -111,14 +107,15 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(!finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- /* For file IDs, get the file object directly */
- /* (This prevents the H5G_loc() call from returning the file pointer for
+ /* For file IDs, get the file object directly
+ *
+ * (This prevents the H5G_loc() call from returning the file pointer for
* the top file in a mount hierarchy)
*/
if(H5I_get_type(obj_id) == H5I_FILE ) {
if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- } /* end if */
+ }
else {
H5G_loc_t loc; /* Object location */
@@ -126,7 +123,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
f = loc.oloc->file;
- } /* end else */
+ }
HDassert(f->shared);
/* Get the current file info */
@@ -193,7 +190,8 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
/* 'low' and 'high' are both initialized to LATEST.
- If latest format is not expected, set 'low' to EARLIEST */
+ * If latest format is not expected, set 'low' to EARLIEST
+ */
if(!latest_format)
low = H5F_LIBVER_EARLIEST;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 432cd8e..39934d6 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -47,7 +47,7 @@
/* Local Typedefs */
/******************/
-/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */
+/* Struct only used by functions H5F__get_objects and H5F__get_objects_cb */
typedef struct H5F_olist_t {
H5I_type_t obj_type; /* Type of object to look for */
hid_t *obj_id_list; /* Pointer to the list of open IDs to return */
@@ -73,10 +73,11 @@ typedef struct H5F_olist_t {
/* Local Prototypes */
/********************/
-static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
+static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
+static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/);
static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/);
-static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name);
+static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name);
static herr_t H5F__flush_phase1(H5F_t *f);
static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing);
@@ -104,19 +105,19 @@ H5FL_DEFINE(H5F_file_t);
/*-------------------------------------------------------------------------
- * Function: H5F_get_access_plist
+ * Function: H5F_get_access_plist
*
- * Purpose: Returns a copy of the file access property list of the
- * specified file.
+ * Purpose: Returns a copy of the file access property list of the
+ * specified file.
*
* NOTE: Make sure that, if you are going to overwrite
* information in the copied property list that was
* previously opened and assigned to the property list, then
* you must close it before overwriting the values.
*
- * Return: Success: Object ID for a copy of the file access
- * property list.
- * Failure: FAIL
+ * Return: Success: Object ID for a copy of the file access
+ * property list.
+ * Failure: H5I_INVALID_HID
*-------------------------------------------------------------------------
*/
hid_t
@@ -127,71 +128,71 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */
unsigned efc_size = 0;
- hid_t ret_value = SUCCEED; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check args */
HDassert(f);
/* Make a copy of the default file access property list */
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Copy properties of the file access property list */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size")
if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks")
if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment threshold")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold")
if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment")
if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference")
if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache size")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size")
if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size")
if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag")
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback")
if(f->shared->efc)
efc_size = H5F__efc_max_nfiles(f->shared->efc);
if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
if(f->shared->page_buf != NULL) {
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set page buffer size")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum metadata fraction of page buffer")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum raw data fraction of page buffer")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer")
} /* end if */
#ifdef H5_HAVE_PARALLEL
if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
#endif /* H5_HAVE_PARALLEL */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
/* Prepare the driver property */
driver_prop.driver_id = f->shared->lf->driver_id;
@@ -200,18 +201,18 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
/* Set the driver property */
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info")
/* Set the file close degree appropriately */
if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
done:
/* Release the copy of the driver info, if it was set up */
if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info")
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_access_plist() */
@@ -237,8 +238,8 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i
HDassert(obj_id_count_ptr);
/* Perform the query */
- if((ret_value = H5F_get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed")
+ if((ret_value = H5F__get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -264,8 +265,8 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list
HDassert(obj_id_count_ptr);
/* Perform the query */
- if((ret_value = H5F_get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed")
+ if((ret_value = H5F__get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -273,23 +274,23 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5F_get_objects
+ * Function: H5F__get_objects
*
- * Purpose: This function is called by H5F_get_obj_count or
- * H5F_get_obj_ids to get number of object IDs and/or a
- * list of opened object IDs (in return value).
+ * Purpose: This function is called by H5F_get_obj_count or
+ * H5F_get_obj_ids to get number of object IDs and/or a
+ * list of opened object IDs (in return value).
*
- * Return: Non-negative on success; Can't fail.
+ * Return: SUCCEED/FAIL
*---------------------------------------------------------------------------
*/
-herr_t
-H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr)
+static herr_t
+H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr)
{
- size_t obj_id_count=0; /* Number of open IDs */
+ size_t obj_id_count = 0; /* Number of open IDs */
H5F_olist_t olist; /* Structure to hold search results */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(obj_id_count_ptr);
@@ -304,30 +305,30 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(types & H5F_OBJ_LOCAL) {
olist.file_info.local = TRUE;
olist.file_info.ptr.file = f;
- } /* end if */
+ }
else {
olist.file_info.local = FALSE;
olist.file_info.ptr.shared = f ? f->shared : NULL;
- } /* end else */
+ }
/* Iterate through file IDs to count the number, and put their
* IDs on the object list. */
if(types & H5F_OBJ_FILE) {
olist.obj_type = H5I_FILE;
- if(H5I_iterate(H5I_FILE, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)")
- } /* end if */
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
* search through dataset IDs to count number of datasets, and put their
* IDs on the object list */
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
- if (types & H5F_OBJ_DATASET) {
+ if(types & H5F_OBJ_DATASET) {
olist.obj_type = H5I_DATASET;
- if(H5I_iterate(H5I_DATASET, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
- } /* end if */
+ }
}
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
@@ -337,9 +338,9 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_GROUP) {
olist.obj_type = H5I_GROUP;
- if(H5I_iterate(H5I_GROUP, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
- } /* end if */
+ }
}
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
@@ -349,9 +350,9 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_DATATYPE) {
olist.obj_type = H5I_DATATYPE;
- if(H5I_iterate(H5I_DATATYPE, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
- } /* end if */
+ }
}
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
@@ -361,9 +362,9 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_ATTR) {
olist.obj_type = H5I_ATTR;
- if(H5I_iterate(H5I_ATTR, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
- } /* end if */
+ }
}
/* Set the number of objects currently open */
@@ -371,28 +372,28 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_objects() */
+} /* end H5F__get_objects() */
/*-------------------------------------------------------------------------
- * Function: H5F_get_objects_cb
+ * Function: H5F__get_objects_cb
*
- * Purpose: H5F_get_objects' callback function. It verifies if an
- * object is in the file, and either count it or put its ID
- * on the list.
+ * Purpose: H5F__get_objects' callback function. It verifies if an
+ * object is in the file, and either count it or put its ID
+ * on the list.
*
- * Return: H5_ITER_STOP if the array of object IDs is filled up.
- * H5_ITER_CONT otherwise.
+ * Return: H5_ITER_STOP if the array of object IDs is filled up.
+ * H5_ITER_CONT otherwise.
*-------------------------------------------------------------------------
*/
static int
-H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
+H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
{
H5F_olist_t *olist = (H5F_olist_t *)key; /* Alias for search info */
hbool_t add_obj = FALSE;
int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(obj_ptr);
HDassert(olist);
@@ -406,9 +407,9 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared ||
(olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- } /* end if */
- } /* end if */
- else { /* either count opened object IDs or put the IDs on the list */
+ }
+ }
+ else { /* Either count opened object IDs or put the IDs on the list */
H5O_loc_t *oloc; /* Group entry info for object */
switch(olist->obj_type) {
@@ -456,7 +457,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) ||
(oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- } /* end if */
+ }
} /* end else */
if(add_obj) {
@@ -464,7 +465,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
if(olist->obj_id_list) {
olist->obj_id_list[olist->list_index] = obj_id;
olist->list_index++;
- } /* end if */
+ }
/* Increment the number of open objects */
if(olist->obj_id_count)
@@ -473,14 +474,15 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Check if we've filled up the array. Return H5_ITER_STOP only if
* we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is
* preset to H5_ITER_CONT) because H5I_iterate needs the return value of
- * H5_ITER_CONT to continue the iteration. */
+ * H5_ITER_CONT to continue the iteration.
+ */
if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs)
HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */
- } /* end if */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_objects_cb() */
+} /* end H5F__get_objects_cb() */
/*--------------------------------------------------------------------------
@@ -489,7 +491,6 @@ done:
* Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME
*
* Return: SUCCEED/FAIL
- *
*--------------------------------------------------------------------------*/
static herr_t
H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/)
@@ -517,14 +518,14 @@ done:
/*--------------------------------------------------------------------------
- * Function: H5F__getenv_prefix_name
+ * Function: H5F__getenv_prefix_name
*
- * Purpose: Get the first pathname in the list of pathnames stored in env_prefix,
- * which is separated by the environment delimiter.
- * env_prefix is modified to point to the remaining pathnames
- * in the list.
+ * Purpose: Get the first pathname in the list of pathnames stored in env_prefix,
+ * which is separated by the environment delimiter.
+ * env_prefix is modified to point to the remaining pathnames
+ * in the list.
*
- * Return: A pointer to a pathname
+ * Return: A pointer to a pathname (can't fail but can return NULL)
--------------------------------------------------------------------------*/
static char *
H5F__getenv_prefix_name(char **env_prefix/*in,out*/)
@@ -666,6 +667,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
/* Leave if file was opened */
else
break;
+ H5E_clear_stack(NULL);
} /* end if */
} /* end while */
@@ -776,28 +778,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__is_hdf5
+ * Function: H5F__is_hdf5
*
- * Purpose: Check the file signature to detect an HDF5 file.
+ * Purpose: Check the file signature to detect an HDF5 file.
*
- * Bugs: This function is not robust: it only uses the default file
- * driver when attempting to open the file when in fact it
- * should use all known file drivers.
+ * Bugs: This function is not robust: it only uses the default file
+ * driver when attempting to open the file when in fact it
+ * should use all known file drivers.
*
- * Return: Success: TRUE/FALSE
- * * Failure: Negative
+ * Return: TRUE/FALSE/FAIL
*-------------------------------------------------------------------------
*/
htri_t
H5F__is_hdf5(const char *name)
{
- H5FD_t *file = NULL; /* Low-level file struct */
- haddr_t sig_addr; /* Addess of hdf5 file signature */
- htri_t ret_value = FAIL; /* Return value */
+ H5FD_t *file = NULL; /* Low-level file struct */
+ haddr_t sig_addr; /* Addess of hdf5 file signature */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
- /* Open the file at the virtual file layer */
+ /* Open the file */
if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF)))
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
@@ -809,7 +810,7 @@ H5F__is_hdf5(const char *name)
done:
/* Close the file */
if(file)
- if(H5FD_close(file) < 0 && ret_value >= 0)
+ if(H5FD_close(file) < 0 && TRUE == ret_value)
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1045,7 +1046,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
- if(H5F_sfile_add(f->shared) < 0)
+ if(H5F__sfile_add(f->shared) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files")
} /* end else */
@@ -1079,14 +1080,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__dest
+ * Function: H5F__dest
*
- * Purpose: Destroys a file structure. This function flushes the cache
- * but doesn't do any other cleanup other than freeing memory
- * for the file struct. The shared info for the file is freed
- * only when its reference count reaches zero.
+ * Purpose: Destroys a file structure. This function flushes the cache
+ * but doesn't do any other cleanup other than freeing memory
+ * for the file struct. The shared info for the file is freed
+ * only when its reference count reaches zero.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1240,7 +1241,7 @@ H5F__dest(H5F_t *f, hbool_t flush)
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
/* Remove shared file struct from list of open files */
- if(H5F_sfile_remove(f->shared) < 0)
+ if(H5F__sfile_remove(f->shared) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@@ -1490,7 +1491,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
} /* end if */
/* Is the file already open? */
- if((shared = H5F_sfile_search(lf)) != NULL) {
+ if((shared = H5F__sfile_search(lf)) != NULL) {
/*
* The file is already open, so use that one instead of the one we
* just opened. We only one one H5FD_t* per file so one doesn't
@@ -1622,7 +1623,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if(H5G_mkroot(file, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
} /* end if */
- else if (1 == shared->nrefs) {
+ else if(1 == shared->nrefs) {
/* Read the superblock if it hasn't been read before. */
if(H5F__super_read(file, a_plist, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
@@ -1687,7 +1688,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath")
/* Formulate the actual file name, after following symlinks, etc. */
- if(H5F_build_actual_name(file, a_plist, name, &file->actual_name) < 0)
+ if(H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name")
if(set_flag) {
@@ -1749,11 +1750,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_flush_phase1
+ * Function: H5F_flush_phase1
*
- * Purpose: First phase of flushing cached data.
+ * Purpose: First phase of flushing cached data.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1786,11 +1788,12 @@ H5F__flush_phase1(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F__flush_phase2
+ * Function: H5F__flush_phase2
*
- * Purpose: Second phase of flushing cached data.
+ * Purpose: Second phase of flushing cached data.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1809,13 +1812,14 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
/* Since we just returned from a call to H5AC_flush(), we just
* passed through a barrier. Hence we can skip the barrier on
* entry to the mpio file driver truncate call below, and the first
* barrier in the following call to flush the cache again.
*/
H5CX_set_mpi_file_flushing(TRUE);
+ }
#endif /* H5_HAVE_PARALLEL */
/* Truncate the file to the current allocated size */
@@ -1854,11 +1858,12 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
/*-------------------------------------------------------------------------
- * Function: H5F__flush
+ * Function: H5F__flush
+ *
+ * Purpose: Flushes cached data.
*
- * Purpose: Flushes cached data.
+ * Return: SUCCEED/FAIL
*
- * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1890,10 +1895,7 @@ H5F__flush(H5F_t *f)
*
* Purpose: Internal routine to close a file.
*
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * December 16, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1933,72 +1935,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__close_cb
- *
- * Purpose: Closes a file or causes the close operation to be pended.
- * This function is called from the API and gets called
- * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref()
- * decrements the file ID reference count to zero. The file ID
- * is removed from the H5I_FILE group by H5I_dec_ref() just
- * before H5F__close_cb() is called. If there are open object
- * headers then the close is pended by moving the file to the
- * H5I_FILE_CLOSING ID group (the f->closing contains the ID
- * assigned to file).
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F__close_cb(H5F_t *f)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */
-
- /* Perform checks for "semi" file close degree here, since closing the
- * file is not allowed if there are objects still open */
- if(f->shared->fc_degree == H5F_CLOSE_SEMI) {
- unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */
- unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */
-
- /* Get the number of open objects and open files on this file/mount hierarchy */
- if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy")
-
- /* If there are no other file IDs open on this file/mount hier., but
- * there are still open objects, issue an error and bail out now,
- * without decrementing the file ID's reference count and triggering
- * a "real" attempt at closing the file */
- if(nopen_files == 1 && nopen_objs > 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open")
- } /* end if */
-
- /* Reset the file ID for this file */
- f->file_id = -1;
-
- /* Attempt to close the file/mount hierarchy */
- if(H5F_try_close(f, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_try_close
+ * Function: H5F_try_close
*
- * Purpose: Attempts to close a file due to one of several actions:
- * - The reference count on the file ID dropped to zero
- * - The last open object was closed in the file
- * - The file was unmounted
+ * Purpose: Attempts to close a file due to one of several actions:
+ * - The reference count on the file ID dropped to zero
+ * - The last open object was closed in the file
+ * - The file was unmounted
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -2029,7 +1973,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
if(was_closed)
*was_closed = TRUE;
HGOTO_DONE(SUCCEED)
- } /* end if */
+ }
/* Get the number of open objects and open files on this file/mount hierarchy */
if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0)
@@ -2063,7 +2007,8 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
HGOTO_DONE(SUCCEED)
/* Sanity check: If close degree if "semi" and we have gotten this
- * far and there are objects left open, bail out now */
+ * far and there are objects left open, bail out now.
+ */
HDassert(nopen_files == 0 && nopen_objs == 0);
/* If we've gotten this far (ie. there are no open objects in the file), fall through to flush & close */
@@ -2104,9 +2049,9 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
for(u = 0; u < obj_count; u++)
if(H5I_dec_ref(objs[u]) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
- } /* end while */
+ }
if(result < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)")
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)")
/* Get the list of IDs of open named datatype objects */
/* (Do this separately from the dataset & attribute IDs, because
@@ -2120,7 +2065,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
for(u = 0; u < obj_count; u++)
if(H5I_dec_ref(objs[u]) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
- } /* end while */
+ }
if(result < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)")
} /* end if */
@@ -2139,17 +2084,18 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/* If there is more than one reference to the shared file struct and the
* file has an external file cache, we should see if it can be closed. This
- * can happen if a cycle is formed with external file caches */
+ * can happen if a cycle is formed with external file caches.
+ */
if(f->shared->efc && (f->shared->nrefs > 1))
if(H5F__efc_try_close(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC")
/* Delay flush until the shared file struct is closed, in H5F__dest. If the
* application called H5Fclose, it would have been flushed in that function
- * (unless it will have been flushed in H5F_dest anyways). */
+ * (unless it will have been flushed in H5F_dest anyways).
+ */
- /*
- * Destroy the H5F_t struct and decrement the reference count for the
+ /* Destroy the H5F_t struct and decrement the reference count for the
* shared H5F_file_t struct. If the reference count for the H5F_file_t
* struct reaches zero then destroy it also.
*/
@@ -2163,14 +2109,53 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_try_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F__reopen
+ *
+ * Purpose: Reopen a file. The new file handle which is returned points
+ * to the same file as the specified file handle. Both handles
+ * share caches and other information. The only difference
+ * between the handles is that the new handle is not mounted
+ * anywhere and no files are mounted on it.
+ *
+ * Return: Success: A pointer to a file struct
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_t *
+H5F__reopen(H5F_t *f)
+{
+ H5F_t *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get a new "top level" file struct, sharing the same "low level" file struct */
+ if(NULL == (ret_value = H5F__new(f->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to reopen file")
+
+ /* Duplicate old file's names */
+ ret_value->open_name = H5MM_xstrdup(f->open_name);
+ ret_value->actual_name = H5MM_xstrdup(f->actual_name);
+ ret_value->extpath = H5MM_xstrdup(f->extpath);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__reopen() */
+
/*-------------------------------------------------------------------------
- * Function: H5F_get_id
+ * Function: H5F_get_id
*
- * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
- * appropriate.
+ * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
+ * appropriate.
+ *
+ * Return: Success: An ID for a file
+ *
+ * Failure: H5I_INVALID_HID
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
hid_t
@@ -2185,13 +2170,13 @@ H5F_get_id(H5F_t *file, hbool_t app_ref)
if(file->file_id == -1) {
/* Get an atom for the file */
if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file")
}
else {
- /* Increment reference count on atom. */
+ /* Increment reference count on existing ID */
if(H5I_inc_ref(file->file_id, app_ref) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
- } /* end else */
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
+ }
ret_value = file->file_id;
@@ -2201,12 +2186,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_incr_nopen_objs
+ * Function: H5F_incr_nopen_objs
*
- * Purpose: Increment the number of open objects for a file.
+ * Purpose: Increment the number of open objects for a file.
*
- * Return: Success: The number of open objects, after the increment
- * Failure: (can't happen)
+ * Return: Success: The number of open objects, after the increment
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -2222,12 +2207,12 @@ H5F_incr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_decr_nopen_objs
+ * Function: H5F_decr_nopen_objs
*
- * Purpose: Decrement the number of open objects for a file.
+ * Purpose: Decrement the number of open objects for a file.
*
- * Return: Success: The number of open objects, after the decrement
- * Failure: (can't happen)
+ * Return: Success: The number of open objects, after the decrement
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -2243,28 +2228,27 @@ H5F_decr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_build_actual_name
+ * Function: H5F__build_actual_name
*
- * Purpose: Retrieve the name of a file, after following symlinks, etc.
+ * Purpose: Retrieve the name of a file, after following symlinks, etc.
*
- * Note: Currently only working for "POSIX I/O compatible" VFDs
+ * Note: Currently only working for "POSIX I/O compatible" VFDs
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
+H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
char **actual_name/*out*/)
{
- hid_t new_fapl_id = -1; /* ID for duplicated FAPL */
+ hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */
#ifdef H5_HAVE_SYMLINK
/* This has to be declared here to avoid unfreed resources on errors */
char *realname = NULL; /* Fully resolved path name of file */
#endif /* H5_HAVE_SYMLINK */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -2361,17 +2345,17 @@ done:
#endif /* H5_HAVE_SYMLINK */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_build_actual_name() */
+} /* H5F__build_actual_name() */
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode_len
+ * Function: H5F_addr_encode_len
*
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2402,13 +2386,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode
+ * Function: H5F_addr_encode
*
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2426,16 +2410,16 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode_len
+ * Function: H5F_addr_decode_len
*
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2490,16 +2474,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode
+ * Function: H5F_addr_decode
*
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2521,8 +2505,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
*
* Purpose: Set the grp_btree_shared field with a valid ref-count pointer.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2547,8 +2530,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc)
*
* Purpose: Set the sohm_addr field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2572,8 +2554,7 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr)
*
* Purpose: Set the sohm_vers field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2597,8 +2578,7 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers)
*
* Purpose: Set the sohm_nindexes field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2622,8 +2602,7 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes)
*
* Purpose: Set the store_msg_crt_idx field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2643,14 +2622,14 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
/*-------------------------------------------------------------------------
- * Function: H5F_set_libver_bounds()
+ * Function: H5F__set_libver_bounds()
*
* Purpose: Set the file's low and high bound to the input parameters
* 'low' and 'high' respectively.
* This is done only if the existing setting is different
* from the inputs.
*
- * Return: SUCCEED on success, and FAIL on failure.
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi; December 2017
*
@@ -2695,11 +2674,11 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high)
/* Set the new bounds */
f->shared->low_bound = low;
f->shared->high_bound = high;
- } /* end if */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_set_libver_bounds() */
+} /* H5F__set_libver_bounds() */
/*-------------------------------------------------------------------------
@@ -2708,7 +2687,7 @@ done:
* Purpose: Private version of H5Fget_file_image
*
* Return: Success: Bytes copied / number of bytes needed.
- * Failure: negative value
+ * Failure: -1
*-------------------------------------------------------------------------
*/
ssize_t
@@ -2722,10 +2701,10 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
/* Check args */
if(!file || !file->shared || !file->shared->lf)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "file_id yields invalid file pointer")
fd_ptr = file->shared->lf;
if(!fd_ptr->cls)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "fd_ptr yields invalid class pointer")
/* the address space used by the split and multi file drivers is not
* a good fit for this call. Since the plan is to depreciate these
@@ -2746,7 +2725,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* JRM -- 11/11/22
*/
if(HDstrcmp(fd_ptr->cls->name, "multi") == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "Not supported for multi file driver.")
/* While the family file driver is conceptually fully compatible
* with the get file image operation, it sets a file driver message
@@ -2768,11 +2747,11 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* JRM -- 12/21/11
*/
if(HDstrcmp(fd_ptr->cls->name, "family") == 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "Not supported for family file driver.")
/* Go get the actual file size */
if(HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file size")
/* set ret_value = to eoa -- will overwrite this if appropriate */
ret_value = (ssize_t)eoa;
@@ -2785,14 +2764,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
/* Check for buffer too small */
if((haddr_t)buf_len < eoa)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "supplied buffer too small")
space_needed = (size_t)eoa;
/* read in the file image */
/* (Note compensation for base address addition in internal routine) */
if(H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed")
/* Offset to "status_flags" in the superblock */
tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers);
@@ -2857,16 +2836,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_track_metadata_read_retries
+ * Function: H5F_track_metadata_read_retries
*
- * Purpose: To track the # of a "retries" (log10) for a metadata item.
- * This routine should be used only when:
- * "retries" > 0
- * f->shared->read_attempts > 1 (does not have retry when 1)
- * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts)
+ * Purpose: To track the # of a "retries" (log10) for a metadata item.
+ * This routine should be used only when:
+ * "retries" > 0
+ * f->shared->read_attempts > 1 (does not have retry when 1)
+ * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts)
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2905,14 +2883,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_set_retries
+ * Function: H5F_set_retries
*
- * Purpose: To initialize data structures for read retries:
- * --zero out "retries"
- * --set up "retries_nbins" based on read_attempts
+ * Purpose: To initialize data structures for read retries:
+ * --zero out "retries"
+ * --set up "retries_nbins" based on read_attempts
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3053,11 +3030,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__get_max_eof_eoa
+ * Function: H5F__get_max_eof_eoa
*
- * Purpose: Determine the maximum of (EOA, EOF) for the file
+ * Purpose: Determine the maximum of (EOA, EOF) for the file
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3096,8 +3073,7 @@ done:
*
* Purpose: Set the coll_md_read field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
void
@@ -3117,7 +3093,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
/*-------------------------------------------------------------------------
- * Function: H5F__get_metadata_read_retry_info
+ * Function: H5F_get_metadata_read_retry_info
*
* Purpose: Private function to retrieve the collection of read retries
* for metadata items with checksum.
@@ -3127,13 +3103,13 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
*-------------------------------------------------------------------------
*/
herr_t
-H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
+H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
{
unsigned i, j; /* Local index variable */
size_t tot_size; /* Size of each retries[i] */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(file);
@@ -3146,7 +3122,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
HDmemset(info->retries, 0, sizeof(info->retries));
/* Return if there are no bins -- no retries */
- if (!info->nbins)
+ if(!info->nbins)
HGOTO_DONE(SUCCEED);
/* Calculate size for each retries[i] */
@@ -3154,7 +3130,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
/* Map and copy information to info's retries for metadata items with tracking for read retries */
j = 0;
- for (i = 0; i < H5AC_NTYPES; i++) {
+ for(i = 0; i < H5AC_NTYPES; i++) {
switch (i) {
case H5AC_OHDR_ID:
case H5AC_OHDR_CHK_ID:
@@ -3178,13 +3154,13 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
case H5AC_FARRAY_DBLK_PAGE_ID:
case H5AC_SUPERBLOCK_ID:
HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES);
- if (file->shared->retries[i] != NULL) {
+ if(file->shared->retries[i] != NULL) {
/* Allocate memory for retries[i]
*
* This memory should be released by the user with
* the H5free_memory() call.
*/
- if (NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size)))
+ if(NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the information */
@@ -3202,8 +3178,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__get_metadata_read_retry_info() */
-
+} /* end H5F_get_metadata_read_retry_info() */
/*-------------------------------------------------------------------------
@@ -3230,14 +3205,14 @@ done:
* --disallow named datatype with/without attributes
* --disallow opened attributes attached to objects
*
- * Note: Currently, only opened groups and datasets are allowed
+ * NOTE: Currently, only opened groups and datasets are allowed
* when enabling SWMR via H5Fstart_swmr_write().
* Will later implement a different approach--
* set up flush dependency/proxy even for file opened without
* SWMR to resolve issues with opened objects.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3289,17 +3264,17 @@ H5F__start_swmr_write(H5F_t *f)
/* Flush data buffers */
if(H5F__flush(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Get the # of opened named datatypes and attributes */
if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
if(nt_attr_count)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file")
/* Get the # of opened datasets and groups */
if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
if(grp_dset_count) {
/* Allocate space for group and object locations */
@@ -3377,9 +3352,10 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information")
/* Refresh (reopen) the objects (groups & datasets) in the file */
- for(u = 0; u < grp_dset_count; u++)
+ for(u = 0; u < grp_dset_count; u++) {
if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], TRUE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object")
+ }
/* Unlock the file */
if(H5FD_unlock(f->shared->lf) < 0)
@@ -3387,7 +3363,6 @@ H5F__start_swmr_write(H5F_t *f)
done:
if(ret_value < 0 && setup) {
- HDassert(f);
/* Re-enable accumulator */
f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
@@ -3402,7 +3377,7 @@ done:
/* Un-set H5F_ACC_SWMR_WRITE in shared open flags */
f->shared->flags &= ~H5F_ACC_SWMR_WRITE;
- /* Unmark the f: not in SWMR writing mode */
+ /* Unmark the file: not in SWMR writing mode */
f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS);
/* Mark superblock as dirty */
@@ -3425,7 +3400,7 @@ done:
H5MM_xfree(obj_paths);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F__start_swmr_write() */
+} /* end H5F__start_swmr_write() */
/*-------------------------------------------------------------------------
@@ -3451,39 +3426,40 @@ H5F__format_convert(H5F_t *f)
/* Check if the superblock should be downgraded */
if(f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) {
- f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST;
- mark_dirty = TRUE;
- } /* end if */
+ f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST;
+ mark_dirty = TRUE;
+ }
/* Check for persistent freespace manager, which needs to be downgraded */
if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF &&
f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) {
- /* Check to remove free-space manager info message from superblock extension */
- if(H5F_addr_defined(f->shared->sblock->ext_addr))
- if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
-
- /* Close freespace manager */
- if(H5MF_try_close(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address")
-
- /* Set non-persistent freespace manager */
- f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
- f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
- f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
- f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
-
- /* Indicate that the superblock should be marked dirty */
- mark_dirty = TRUE;
+
+ /* Check to remove free-space manager info message from superblock extension */
+ if(H5F_addr_defined(f->shared->sblock->ext_addr))
+ if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
+
+ /* Close freespace manager */
+ if(H5MF_try_close(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address")
+
+ /* Set non-persistent freespace manager */
+ f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
+ f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
+ f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
+ f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
+
+ /* Indicate that the superblock should be marked dirty */
+ mark_dirty = TRUE;
} /* end if */
/* Check if we should mark the superblock dirty */
if(mark_dirty)
- /* Mark superblock as dirty */
- if(H5F_super_dirty(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
+ /* Mark superblock as dirty */
+ if(H5F_super_dirty(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 830b7ee..69e6bb2 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -92,8 +92,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- void *buf/*out*/)
+H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
@@ -138,8 +137,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- const void *buf)
+H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index b04bd3a..e6106a2 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -132,7 +132,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
*/
if(child->parent)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted")
- if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0)
+ if(H5G_loc_find(loc, name, &mp_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
/* If the mount location is holding its file open, that file will close
* and remove the mount as soon as we exit this function. Prevent the
@@ -462,7 +462,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
plist_id = H5P_FILE_MOUNT_DEFAULT;
else
if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index f854d3b..7620d95 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -320,11 +320,11 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
attached to the loc_id */
if(H5I_INVALID_HID != loc_id) {
H5G_loc_t loc;
- H5F_t *f;
+ H5F_t *f = NULL;
/* Retrieve the file structure */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
f = loc.oloc->file;
HDassert(f);
@@ -333,8 +333,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
/* retrieve the file communicator */
if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
- } /* end if */
- } /* end if */
+ }
+ }
/* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */
else {
H5P_genplist_t *plist; /* Property list pointer */
@@ -349,8 +349,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info")
*mpi_comm = fa->comm;
- } /* end if */
- } /* end else */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 3716c66..44344f0 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -325,7 +325,7 @@ struct H5F_file_t {
/* been used accessed for either */
/* allocation or deallocation */
/* since file open. */
- haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
+ haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
/* for self referential FSMs */
haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */
/* for self referential FSMs */
@@ -377,6 +377,19 @@ struct H5F_t {
#endif /* H5_HAVE_PARALLEL */
};
+/* User data for traversal routine to get ID counts */
+typedef struct {
+ ssize_t *obj_count; /* number of objects counted so far */
+ unsigned types; /* types of objects to be counted */
+} H5F_trav_obj_cnt_t;
+
+/* User data for traversal routine to get ID lists */
+typedef struct {
+ size_t max_objs;
+ hid_t *oid_list;
+ ssize_t *obj_count; /* number of objects counted so far */
+ unsigned types; /* types of objects to be counted */
+} H5F_trav_obj_ids_t;
/*****************************/
/* Package Private Variables */
@@ -394,18 +407,16 @@ H5FL_EXTERN(H5F_file_t);
/******************************/
/* General routines */
+H5_DLL H5F_t *H5F__reopen(H5F_t *f);
H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
H5_DLL htri_t H5F__is_hdf5(const char *name);
-H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
-H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
H5_DLL herr_t H5F__format_convert(H5F_t *f);
H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(hid_t file_id);
-H5_DLL herr_t H5F__close_cb(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
/* File mount related routines */
@@ -421,7 +432,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_
H5_DLL herr_t H5F__super_free(H5F_super_t *sblock);
/* Superblock extension related routines */
-H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
+H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags);
H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id);
H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created);
@@ -434,9 +445,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f);
H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush);
/* Shared file list related routines */
-H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared);
-H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf);
-H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared);
+H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared);
+H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf);
+H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared);
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 979ba7d..1ce9374 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -715,7 +715,6 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-H5_DLL herr_t H5F_start_swmr_write(H5F_t *file);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@@ -763,7 +762,6 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
H5_DLL double H5F_rdcc_w0(const H5F_t *f);
H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
-H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
@@ -799,7 +797,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si
/* Functions that flush or evict */
H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag);
-H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t * f, haddr_t tag);
+H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag);
/* Functions that verify a piece of metadata with checksum */
H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum);
@@ -807,6 +805,7 @@ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s
/* Routine to track the # of retries */
H5_DLL herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries);
H5_DLL herr_t H5F_set_retries(H5F_t *f);
+H5_DLL herr_t H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
/* Routine to invoke callback function upon object flush */
H5_DLL herr_t H5F_object_flush_cb(H5F_t *f, hid_t obj_id);
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index e0c830b..ebc2ab2 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -40,11 +40,11 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL;
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_assert_num
+ * Function: H5F_sfile_assert_num
*
- * Purpose: Sanity checking that shared file list is empty
+ * Purpose: Sanity checking that shared file list is empty
*
- * Return: none (void)
+ * Return: void
*
* Programmer: Quincey Koziol
* Monday, July 25, 2005
@@ -84,33 +84,31 @@ H5F_sfile_assert_num(unsigned n)
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_add
+ * Function: H5F__sfile_add
*
- * Purpose: Add a "shared" file struct to the list of open files
+ * Purpose: Add a "shared" file struct to the list of open files
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5F_sfile_add(H5F_file_t *shared)
+H5F__sfile_add(H5F_file_t *shared)
{
H5F_sfile_node_t *new_shared; /* New shared file node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
/* Allocate new shared file node */
if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set shared file value */
new_shared->shared = shared;
@@ -121,31 +119,29 @@ H5F_sfile_add(H5F_file_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_add() */
+} /* end H5F__sfile_add() */
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_search
+ * Function: H5F__sfile_search
*
- * Purpose: Search for a "shared" file with low-level file info that
+ * Purpose: Search for a "shared" file with low-level file info that
* matches
*
- * Return: Non-NULL on success / NULL on failure
+ * Return: Non-NULL on success / NULL on failure
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5F_file_t *
-H5F_sfile_search(H5FD_t *lf)
+H5F__sfile_search(H5FD_t *lf)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_file_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(lf);
@@ -154,7 +150,7 @@ H5F_sfile_search(H5FD_t *lf)
curr = H5F_sfile_head_g;
while(curr) {
/* Check for match */
- if(0==H5FD_cmp(curr->shared->lf, lf))
+ if(0 == H5FD_cmp(curr->shared->lf, lf))
HGOTO_DONE(curr->shared)
/* Advance to next shared file node */
@@ -163,31 +159,29 @@ H5F_sfile_search(H5FD_t *lf)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_search() */
+} /* end H5F__sfile_search() */
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_remove
+ * Function: H5F__sfile_remove
*
- * Purpose: Remove a "shared" file struct from the list of open files
+ * Purpose: Remove a "shared" file struct from the list of open files
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5F_sfile_remove(H5F_file_t *shared)
+H5F__sfile_remove(H5F_file_t *shared)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_sfile_node_t *last; /* Last shared file node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
@@ -203,7 +197,7 @@ H5F_sfile_remove(H5F_file_t *shared)
/* Indicate error if the node wasn't found */
if(curr == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
+ HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
/* Remove node found from list */
if(last != NULL)
@@ -219,5 +213,5 @@ H5F_sfile_remove(H5F_file_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_remove() */
+} /* end H5F__sfile_remove() */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 9339b3d..489cc21 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -134,7 +134,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_super_ext_open
+ * Function: H5F__super_ext_open
*
* Purpose: Open an existing superblock extension
*
@@ -146,11 +146,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
+H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -168,7 +168,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_super_ext_open() */
+} /* H5F__super_ext_open() */
/*-------------------------------------------------------------------------
@@ -398,7 +398,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
else {
- /* Locate the signature as per per the serial library */
+ /* Locate the signature as per per the serial library */
#endif /* H5_HAVE_PARALLEL */
if(H5FD_locate_signature(file, &super_addr) < 0)
@@ -705,7 +705,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
} /* end if */
/* Open the superblock extension */
- if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
+ if(H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
/* Check for the extension having a 'driver info' message */
@@ -836,7 +836,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(!skip_eof_check && !null_fsm_addr) {
HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF));
HDassert(!f->shared->first_alloc_dealloc);
- } /* end if */
+ }
/* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file
* with persistent free space managers, therefore, set
@@ -882,14 +882,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(null_fsm_addr) {
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
- } /* end if */
+ }
else {
if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension")
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
- } /* end else */
+ }
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
f->shared->sblock = NULL;
#endif /* JRM */
@@ -962,20 +962,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Write driver info information to the superblock extension */
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- /* KLUGE ALERT!!
- *
- * H5F__super_ext_write_msg() expects f->shared->sblock to
- * be set -- verify that it is NULL, and then set it.
- * Set it back to NULL when we are done.
- */
- HDassert(f->shared->sblock == NULL);
- f->shared->sblock = sblock;
+ /* KLUGE ALERT!!
+ *
+ * H5F__super_ext_write_msg() expects f->shared->sblock to
+ * be set -- verify that it is NULL, and then set it.
+ * Set it back to NULL when we are done.
+ */
+ HDassert(f->shared->sblock == NULL);
+ f->shared->sblock = sblock;
#endif /* JRM */
- if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
+ if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- f->shared->sblock = NULL;
+ f->shared->sblock = NULL;
#endif /* JRM */
} /* end if */
@@ -1320,10 +1320,11 @@ H5F__super_init(H5F_t *f)
/* Create the Shared Object Header Message table and register it with
* the metadata cache, if this file supports shared messages.
*/
- if(f->shared->sohm_nindexes > 0)
+ if(f->shared->sohm_nindexes > 0) {
/* Initialize the shared message code & write the SOHM message to the extension */
if(H5SM_init(f, plist, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table")
+ }
/* Check for non-default v1 B-tree 'K' values to store */
if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF ||
@@ -1503,9 +1504,10 @@ H5F_eoa_dirty(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty")
} /* end if */
/* If the driver info is stored as a message, update that instead */
- else if(f->shared->drvinfo_sb_msg_exists)
+ else if(f->shared->drvinfo_sb_msg_exists) {
if(H5F__update_super_ext_driver_msg(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty")
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1676,13 +1678,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Open/create the superblock extension object header */
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
- if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
} /* end if */
else {
HDassert(may_create);
- if(H5F__super_ext_create(f, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
+ if(H5F__super_ext_create(f, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
ext_created = TRUE;
} /* end else */
HDassert(H5F_addr_defined(ext_loc.addr));
@@ -1690,24 +1692,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Check if message with ID does not exist in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
/* Check for creating vs. writing */
if(may_create) {
if(status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist")
- /* Create the message with ID in the superblock extension */
- if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
+ /* Create the message with ID in the superblock extension */
+ if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
} /* end if */
else {
if(!status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist")
- /* Update the message with ID in the superblock extension */
- if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
+ /* Update the message with ID in the superblock extension */
+ if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
} /* end else */
done:
@@ -1757,35 +1759,36 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id)
H5AC_set_ring(H5AC_RING_SBE, &orig_ring);
/* Open superblock extension object header */
- if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
+ if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
ext_opened = TRUE;
/* Check if message with ID exists in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
- else if(status) { /* message exists */
- H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
-
- /* Remove the message */
- if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
-
- /* Get info for the superblock extension's object header */
- if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
-
- /* If the object header is an empty base chunk, remove superblock extension */
- if(hdr_info.nchunks == 1) {
- if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
- else if((unsigned)null_count == hdr_info.nmesgs) {
- HDassert(H5F_addr_defined(ext_loc.addr));
- if(H5O_delete(f, ext_loc.addr) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
- f->shared->sblock->ext_addr = HADDR_UNDEF;
- } /* end if */
- } /* end if */
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
+ else if(status) {
+ /* message exists */
+ H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
+
+ /* Remove the message */
+ if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
+
+ /* Get info for the superblock extension's object header */
+ if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+
+ /* If the object header is an empty base chunk, remove superblock extension */
+ if(hdr_info.nchunks == 1) {
+ if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ else if((unsigned)null_count == hdr_info.nmesgs) {
+ HDassert(H5F_addr_defined(ext_loc.addr));
+ if(H5O_delete(f, ext_loc.addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ f->shared->sblock->ext_addr = HADDR_UNDEF;
+ } /* end else-if */
+ } /* end if */
} /* end if */
done:
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 76866db..361f8a1 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -42,7 +42,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
/****************/
diff --git a/src/H5G.c b/src/H5G.c
index e54e5cd..361127f 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -128,10 +128,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Group ID class */
static const H5I_class_t H5I_GROUP_CLS[1] = {{
- H5I_GROUP, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */
+ H5I_GROUP, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
@@ -255,9 +255,9 @@ H5G_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Gcreate2
+ * Function: H5Gcreate2
*
- * Purpose: Creates a new group relative to LOC_ID, giving it the
+ * Purpose: Creates a new group relative to LOC_ID, giving it the
* specified creation property list GCPL_ID and access
* property list GAPL_ID. The link to the new group is
* created with the LCPL_ID.
@@ -269,14 +269,11 @@ H5G_term_package(void)
* hid_t gcpl_id; IN: Property list for group creation
* hid_t gapl_id; IN: Property list for group access
*
- * Return: Success: The object ID of a new, empty group open for
- * writing. Call H5Gclose() when finished with
- * the group.
+ * Return: Success: The object ID of a new, empty group open for
+ * writing. Call H5Gclose() when finished with
+ * the group.
*
- * Failure: H5I_INVALID_HID
- *
- * Programmer: Quincey Koziol
- * April 5, 2007
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -284,45 +281,49 @@ hid_t
H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
hid_t gapl_id)
{
- H5G_loc_t loc; /* Location to create group */
- H5G_t *grp = NULL; /* New group created */
- hid_t ret_value; /* Return value */
+ H5G_t *grp = NULL; /* Structure for new group */
+ H5G_loc_t loc; /* Location to create group */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
- /* Get correct property list */
+ /* Check link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link creation property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list")
/* Check group creation property list */
if(H5P_DEFAULT == gcpl_id)
gcpl_id = H5P_GROUP_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Create the new group & get its ID */
+ /* Create the group */
if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
+
+ /* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
@@ -331,9 +332,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gcreate_anon
+ * Function: H5Gcreate_anon
*
- * Purpose: Creates a new group relative to LOC_ID, giving it the
+ * Purpose: Creates a new group relative to LOC_ID, giving it the
* specified creation property list GCPL_ID and access
* property list GAPL_ID.
*
@@ -349,36 +350,33 @@ done:
* hid_t gcpl_id; IN: Property list for group creation
* hid_t gapl_id; IN: Property list for group access
*
- * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp"
+ * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp"
* hid_t create_id = H5Pcreate(H5P_GROUP_CREATE);
* int status = H5Pset_create_intermediate_group(create_id, TRUE);
* hid_t gid = H5Gcreate_anon(file_id, "/A/B01/grp", create_id, H5P_DEFAULT);
*
- * Return: Success: The object ID of a new, empty group open for
- * writing. Call H5Gclose() when finished with
- * the group.
- *
- * Failure: H5I_INVALID_HID
+ * Return: Success: The object ID of a new, empty group open for
+ * writing. Call H5Gclose() when finished with
+ * the group.
*
- * Programmer: Peter Cao
- * May 08, 2005
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
{
- H5G_loc_t loc;
- H5G_t *grp = NULL;
- H5G_obj_create_t gcrt_info; /* Information for group creation */
- hid_t ret_value;
+ H5G_t *grp = NULL; /* Structure for new group */
+ H5G_loc_t loc;
+ H5G_obj_create_t gcrt_info; /* Information for group creation */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
/* Check group creation property list */
if(H5P_DEFAULT == gcpl_id)
@@ -396,9 +394,11 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
gcrt_info.cache_type = H5G_NOTHING_CACHED;
HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
- /* Create the new group & get its ID */
+ /* Create the group */
if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info)))
HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group")
+
+ /* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
@@ -417,7 +417,7 @@ done:
} /* end if */
/* Cleanup on failure */
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
@@ -426,28 +426,26 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gopen2
+ * Function: H5Gopen2
*
- * Purpose: Opens an existing group for modification. When finished,
- * call H5Gclose() to close it and release resources.
+ * Purpose: Opens an existing group for modification. When finished,
+ * call H5Gclose() to close it and release resources.
*
* This function allows the user the pass in a Group Access
* Property List, which H5Gopen1() does not.
*
- * Return: Success: Object ID of the group.
- * Failure: H5I_INVALID_HID
+ * Return: Success: Object ID of the group
*
- * Programmer: James Laird
- * Thursday, July 27, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
{
- H5G_t *grp = NULL; /* Group opened */
+ H5G_t *grp = NULL; /* Group opened */
H5G_loc_t loc; /* Location of parent for group */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, gapl_id);
@@ -455,8 +453,10 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0)
@@ -471,7 +471,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
@@ -480,18 +480,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_create_plist
- *
- * Purpose: Returns a copy of the group creation property list.
+ * Function: H5Gget_create_plist
*
- * Return: Success: ID for a copy of the group creation
- * property list. The property list ID should be
- * released by calling H5Pclose().
+ * Purpose: Returns a copy of the group creation property list.
*
- * Failure: H5I_INVALID_HID
+ * Return: Success: ID for a copy of the group creation
+ * property list. The property list ID should be
+ * released by calling H5Pclose().
*
- * Programmer: Quincey Koziol
- * Tuesday, October 25, 2005
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -506,9 +503,9 @@ H5Gget_create_plist(hid_t group_id)
/* Check args */
if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID")
- /* Retrieve the GCPL */
+ /* Get the group creation property list for the group */
if((ret_value = H5G_get_create_plist(group)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
@@ -518,42 +515,38 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_info
+ * Function: H5Gget_info
*
- * Purpose: Retrieve information about a group.
+ * Purpose: Retrieve information about a group.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 27 2006
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Gget_info(hid_t grp_id, H5G_info_t *grp_info)
+H5Gget_info(hid_t loc_id, H5G_info_t *group_info)
{
H5I_type_t id_type; /* Type of ID */
H5G_loc_t loc; /* Location of group */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", grp_id, grp_info);
+ H5TRACE2("e", "i*x", loc_id, group_info);
/* Check args */
- id_type = H5I_get_type(grp_id);
+ id_type = H5I_get_type(loc_id);
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
- if(!grp_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID")
+ if(!group_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Get group location */
- if(H5G_loc(grp_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the group's information */
- if(H5G__obj_info(loc.oloc, grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ if(H5G__obj_info(loc.oloc, group_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
FUNC_LEAVE_API(ret_value)
@@ -561,42 +554,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_info_by_name
+ * Function: H5Gget_info_by_name
*
- * Purpose: Retrieve information about a group.
+ * Purpose: Retrieve information about a group, where the group is
+ * identified by name instead of ID.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 27 2006
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
+H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*s*xi", loc_id, name, grp_info, lapl_id);
+ H5TRACE4("e", "i*s*xi", loc_id, name, group_info, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(!grp_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
+ if(!group_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the group's information */
- if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0)
+ if(H5G__get_info_by_name(&loc, name, group_info/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -605,48 +597,46 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_info_by_idx
+ * Function: H5Gget_info_by_idx
*
- * Purpose: Retrieve information about a group, according to the order
+ * Purpose: Retrieve information about a group, according to the order
* of an index.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 27 2006
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, hid_t lapl_id)
+ H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, grp_info,
+ H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, group_info,
lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(!grp_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!group_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the group's information */
- if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0)
+ if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, group_info/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -655,15 +645,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gclose
- *
- * Purpose: Closes the specified group. The group ID will no longer be
- * valid for accessing the group.
+ * Function: H5Gclose
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Closes the specified group. The group ID will no longer be
+ * valid for accessing the group.
*
- * Programmer: Robb Matzke
- * Wednesday, December 31, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -679,8 +666,7 @@ H5Gclose(hid_t group_id)
if(NULL == H5I_object_verify(group_id,H5I_GROUP))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
- /*
- * Decrement the counter on the group atom. It will be freed if the count
+ /* Decrement the counter on the group atom. It will be freed if the count
* reaches zero.
*/
if(H5I_dec_app_ref(group_id) < 0)
@@ -714,7 +700,7 @@ H5Gflush(hid_t group_id)
/* Check args */
if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(group_id) < 0)
@@ -722,7 +708,7 @@ H5Gflush(hid_t group_id)
/* Flush metadata to file */
if(H5O_flush_common(&grp->oloc, group_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
FUNC_LEAVE_API(ret_value)
@@ -752,13 +738,13 @@ H5Grefresh(hid_t group_id)
/* Check args */
if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call private function to refresh group object */
+ /* Refresh group's metadata */
if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index aae5496..b32ce39 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -59,19 +59,20 @@ typedef struct {
/* Private macros */
/* PRIVATE PROTOTYPES */
-static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
+static herr_t H5G__compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
H5G_link_table_t *ltable);
+static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata);
/*-------------------------------------------------------------------------
- * Function: H5G_compact_build_table_cb
+ * Function: H5G__compact_build_table_cb
*
- * Purpose: Callback routine for searching 'link' messages for a particular
+ * Purpose: Callback routine for searching 'link' messages for a particular
* name.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -80,13 +81,13 @@ static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
+H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */
herr_t ret_value=H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(lnk);
@@ -102,7 +103,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_compact_build_table_cb() */
+} /* end H5G__compact_build_table_cb() */
/*-------------------------------------------------------------------------
@@ -151,7 +152,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
- op.u.app_op = H5G_compact_build_table_cb;
+ op.u.app_op = H5G__compact_build_table_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
@@ -432,12 +433,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_compact_lookup_cb
+ * Function: H5G__compact_lookup_cb
*
- * Purpose: Callback routine for searching 'link' messages for a particular
+ * Purpose: Callback routine for searching 'link' messages for a particular
* name & gettting object location for it
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -446,13 +447,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
+H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(lnk);
@@ -475,7 +476,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_compact_lookup_cb() */
+} /* end H5G__compact_lookup_cb() */
/*-------------------------------------------------------------------------
@@ -511,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk)
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
- op.u.app_op = H5G_compact_lookup_cb;
+ op.u.app_op = H5G__compact_lookup_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
@@ -604,7 +605,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo,
/* Check for going out of bounds */
if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 326561a..d2bcad1 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
/* Create serialized form of link */
if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
/* Open the fractal heap */
if(NULL == (fheap = H5HF_open(f, linfo->fheap_addr)))
@@ -966,8 +966,7 @@ done:
*/
herr_t
H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
- void *op_data)
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data)
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 57bbcd9..f8f668c 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -164,7 +164,7 @@ H5G_map_obj_type(H5O_type_t obj_type)
* writing. Call H5Gclose() when finished with
* the group.
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, September 24, 1997
@@ -176,65 +176,67 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
H5G_loc_t loc; /* Location to create group */
H5G_t *grp = NULL; /* New group created */
- hid_t tmp_gcpl = (-1); /* Temporary group creation property list */
- hid_t ret_value; /* Return value */
+ hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*sz", loc_id, name, size_hint);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
- H5P_genplist_t *gc_plist; /* Property list created */
H5O_ginfo_t ginfo; /* Group info property */
+ H5P_genplist_t *gc_plist; /* Property list created */
/* Get the default property list */
if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Make a copy of the default property list */
if((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list")
/* Get pointer to the copied property list */
if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Get the group info property */
if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info")
/* Set the non-default local heap size hint */
H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t);
if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
- } /* end if */
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info")
+ }
else
tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info")
- /* Create the new group & get its ID */
+ /* Create the group */
if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
+
+ /* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
- if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
+ if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
if(H5I_dec_ref(tmp_gcpl) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list")
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list")
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate1() */
@@ -250,7 +252,7 @@ done:
*
* Return: Success: Object ID of the group.
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, December 31, 1997
@@ -260,31 +262,31 @@ done:
hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
- H5G_t *grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of parent for group */
- hid_t ret_value; /* Return value */
+ H5G_t *grp = NULL; /* Group opened */
+ H5G_loc_t loc; /* Location of parent for group */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
/* Open the group */
if(NULL == (grp = H5G__open_name(&loc, name)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
- /* Register an atom for the group */
+ /* Get an atom for the group */
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(grp && H5G_close(grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gopen1() */
@@ -316,7 +318,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine to create link */
+ /* Create link */
if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
@@ -352,7 +354,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine to create link */
+ /* Create link */
if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
@@ -408,7 +410,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the link */
if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- } /* end if */
+ }
else if(type == H5L_TYPE_SOFT) {
/* Soft links only need one location, the new_loc_id, but it's possible
* that new_loc_id is H5L_SAME_LOC
@@ -423,9 +425,9 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the link */
if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- } /* end else if */
+ }
else
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -451,9 +453,9 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call common routine to move the link */
+ /* Move the link */
if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
FUNC_LEAVE_API(ret_value)
@@ -471,7 +473,7 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name);
@@ -484,9 +486,9 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5CX_set_loc(dst_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call common routine to move the link */
+ /* Move the link */
if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
@@ -565,17 +567,17 @@ H5Gunlink(hid_t loc_id, const char *name)
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call H5L routine... */
+ /* Delete the link */
if(H5L_delete(&loc, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
FUNC_LEAVE_API(ret_value)
@@ -609,9 +611,9 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the link routine which provides this capability */
+ /* Get the link value */
if(H5L_get_val(&loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
done:
FUNC_LEAVE_API(ret_value)
@@ -638,7 +640,7 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
- H5G_loc_t loc; /* Group's location */
+ H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -653,7 +655,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the common routine which provides this capability */
+ /* Set the comment */
if(H5G_loc_set_comment(&loc, name, comment) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
@@ -705,7 +707,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the common routine which provides this capability */
+ /* Get the comment */
if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
@@ -742,21 +744,24 @@ herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
void *op_data)
{
+ H5G_loc_t loc; /* Location of object */
H5G_link_iterate_t lnk_op; /* Link operator */
hsize_t last_obj; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
+ hsize_t idx; /* Internal location to hold index */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data);
/* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_p && *idx_p < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid index specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
if(!op)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no operator specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Set number of objects looked at to zero */
last_obj = 0;
@@ -766,8 +771,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_type = H5G_LINK_OP_OLD;
lnk_op.op_func.op_old = op;
- /* Call the common routine which provides this capability */
- if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
+ /* Call private function */
+ if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Set the index we stopped at */
@@ -798,23 +803,23 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
- H5G_loc_t loc; /* Location of object */
- H5G_info_t grp_info; /* Group information */
- H5O_type_t obj_type; /* Type of object at location */
- herr_t ret_value = SUCCEED;
+ H5G_loc_t loc; /* Location of object */
+ H5G_info_t grp_info; /* Group information */
+ H5O_type_t obj_type; /* Type of object at location */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", loc_id, num_objs);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(H5O_obj_type(loc.oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
if(!num_objs)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
/* Retrieve information about the group */
if(H5G__obj_info(loc.oloc, &grp_info) < 0)
@@ -849,17 +854,17 @@ herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
{
- H5G_loc_t loc; /* Group's location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Group's location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Get info */
if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0)
@@ -1054,13 +1059,13 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(H5O_obj_type(loc.oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
- /* Call common routine */
+ /* Call internal function */
if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
@@ -1087,8 +1092,8 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
- H5G_loc_t loc; /* Object location */
- H5G_obj_t ret_value;
+ H5G_loc_t loc; /* Object location */
+ H5G_obj_t ret_value;
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 51d3b91..7e2f279 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -449,38 +449,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__close_cb
- *
- * Purpose: Closes the specified group.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Sunday, February 18, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__close_cb(H5G_t *grp)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check args */
- HDassert(grp && grp->shared);
- HDassert(grp->shared->fo_count > 0);
-
- /* Call actual group close routine */
- if(H5G_close(grp) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__close_cb() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_close
*
* Purpose: Closes the specified group.
@@ -817,30 +785,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_iterate(hid_t loc_id, const char *group_name,
+H5G_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
const H5G_link_iterate_t *lnk_op, void *op_data)
{
- H5G_loc_t loc; /* Location of parent for group */
- hid_t gid = -1; /* ID of group to iterate over */
- H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */
- H5G_iter_appcall_ud_t udata; /* User data for callback */
- herr_t ret_value = FAIL; /* Return value */
+ hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */
+ H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */
+ H5G_iter_appcall_ud_t udata; /* User data for callback */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(loc);
HDassert(group_name);
HDassert(last_lnk);
HDassert(lnk_op && lnk_op->op_func.op_new);
- /*
- * Open the group on which to operate. We also create a group ID which
+ /* Open the group on which to operate. We also create a group ID which
* we can pass to the application-defined operator.
*/
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(NULL == (grp = H5G__open_name(&loc, group_name)))
+ if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
@@ -856,7 +821,7 @@ H5G_iterate(hid_t loc_id, const char *group_name,
done:
/* Release the group opened */
- if(gid > 0) {
+ if(gid != H5I_INVALID_HID) {
if(H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
}
@@ -1078,15 +1043,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, H5L_iterate_t op, void *op_data)
{
H5G_iter_visit_ud_t udata; /* User data for callback */
H5O_linfo_t linfo; /* Link info message */
htri_t linfo_exists; /* Whether the link info message exists */
- hid_t gid = (-1); /* Group ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
H5G_t *grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of group passed in */
H5G_loc_t start_loc; /* Location of starting group */
unsigned rc; /* Reference count of object */
herr_t ret_value = FAIL; /* Return value */
@@ -1097,11 +1061,11 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!loc)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL")
/* Open the group to begin visiting within */
- if(NULL == (grp = H5G__open_name(&loc, group_name)))
+ if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Register an ID for the starting group */
@@ -1184,7 +1148,7 @@ done:
H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL);
/* Release the group opened */
- if(gid > 0) {
+ if(gid != H5I_INVALID_HID) {
if(H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
}
@@ -1254,7 +1218,7 @@ H5G_get_create_plist(const H5G_t *grp)
/* Check for the group having a link info message */
if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header")
if(linfo_exists) {
/* Set the link info for the property list */
if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 8aa0b45..31ed0f1 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -1311,7 +1311,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
udata.path = NULL;
/* Visit all the links in the file */
- if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
+ if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name")
else if(status > 0)
found_obj = TRUE;
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index ae697ad..836213d 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -336,7 +336,6 @@ H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name,
H5G_info_t *grp_info);
H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info);
-H5_DLL herr_t H5G__close_cb(H5G_t *grp);
/*
* Group hierarchy traversal routines
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 95dfef5..c56b1c8 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -209,10 +209,10 @@ H5_DLL char *H5G_normalize(const char *name);
*/
H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
unsigned target, H5G_traverse_t op, void *op_data);
-H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
const H5G_link_iterate_t *lnk_op, void *op_data);
-H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data);
/*
@@ -262,7 +262,7 @@ H5_DLL herr_t H5G_name_free(H5G_name_t *name);
H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
hbool_t *cached);
H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc,
- char* name, size_t size);
+ char* name, size_t size);
H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name);
/*
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 37b6292..e412e7c 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -32,18 +32,17 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5Gpkg.h" /* Groups */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Ppublic.h" /* Property Lists */
-#include "H5WBprivate.h" /* Wrapped Buffers */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Ppublic.h" /* Property Lists */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
@@ -324,7 +323,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
/* Traverse the link */
if(H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
/* Pass back information about whether the object exists */
*obj_exists = udata.exists;
@@ -359,8 +358,7 @@ done:
*/
herr_t
H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
- unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc,
- hbool_t *obj_exists)
+ unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists)
{
size_t nlinks; /* # of soft / UD links left to traverse */
herr_t ret_value = SUCCEED; /* Return value */
@@ -372,13 +370,13 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
HDassert(lnk);
HDassert(obj_loc);
- /*
- * If we found a symbolic link then we should follow it. But if this
+ /* If we found a symbolic link then we should follow it. But if this
* is the last component of the name and the H5G_TARGET_SLINK bit of
* TARGET is set then we don't follow it.
*/
if(H5L_TYPE_SOFT == lnk->type &&
(0 == (target & H5G_TARGET_SLINK) || !last_comp)) {
+
/* Get the # of soft / UD links left to traverse */
if(H5CX_get_nlinks(&nlinks) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
@@ -403,6 +401,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
*/
if(lnk->type >= H5L_TYPE_UD_MIN &&
(0 == (target & H5G_TARGET_UDLINK) || !last_comp) ) {
+
/* Get the # of soft / UD links left to traverse */
if(H5CX_get_nlinks(&nlinks) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
@@ -830,20 +829,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver
if(!op)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided")
- /* Retrieve the original # of soft / UD links that are able to be traversed */
- /* (So that multiple calls to H5G_traverse don't incorrectly look
- * like they've traversed too many. Nested calls, like in H5L__move(),
+ /* Retrieve the original # of soft / UD links that are able to be traversed
+ * (So that multiple calls to H5G_traverse don't incorrectly look
+ * like they've traversed too many. Nested calls, like in H5L_move(),
* may need their own mechanism to set & reset the # of links to traverse)
*/
if(H5CX_get_nlinks(&orig_nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
/* Set up invalid tag. This is a precautionary step only. Setting an invalid
- tag here will ensure that no metadata accessed while doing the traversal
- is given an improper tag, unless another one is specifically set up
- first. This will ensure we're not accidentally tagging something we
- shouldn't be during the traversal. Note that for best tagging assertion
- coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */
+ * tag here will ensure that no metadata accessed while doing the traversal
+ * is given an improper tag, unless another one is specifically set up
+ * first. This will ensure we're not accidentally tagging something we
+ * shouldn't be during the traversal. Note that for best tagging assertion
+ * coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised.
+ */
H5_BEGIN_TAG(H5AC__INVALID_TAG);
/* Go perform "real" traversal */
diff --git a/src/H5L.c b/src/H5L.c
index 6967812..b659d42 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -21,18 +21,18 @@
/***********/
/* Headers */
/***********/
-#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 "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lpkg.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* File objects */
-#include "H5Pprivate.h" /* Property lists */
+#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 "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lpkg.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* File objects */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
@@ -63,7 +63,7 @@ typedef struct {
typedef struct {
const char *dst_name; /* Destination name for moving object */
H5T_cset_t cset; /* Char set for new name */
- const H5G_loc_t *dst_loc; /* Destination location for moving object */
+ const H5G_loc_t *dst_loc; /* Destination location for moving object */
unsigned dst_target_flags; /* Target flags for destination object */
hbool_t copy; /* TRUE if this is a copy operation */
size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */
@@ -109,17 +109,12 @@ static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- void *buf/*out*/, size_t size);
static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -132,25 +127,15 @@ static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static htri_t H5L__exists(const H5G_loc_t *loc, const char *name);
static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- H5L_info_t *linfo /*out*/);
static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/,
const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- char *name /*out*/, size_t size);
-static herr_t H5L__iterate(hid_t grp_id, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
- H5L_iterate_t op, void *op_data);
/*********************/
/* Package Variables */
@@ -267,16 +252,16 @@ H5L_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Lmove
+ * Function: H5Lmove
*
- * Purpose: Renames an object within an HDF5 file and moves it to a new
+ * Purpose: Renames an object within an HDF5 file and moves it to a new
* group. The original name SRC is unlinked from the group graph
* and then inserted with the new name DST (which can specify a
* new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
+ * are interpreted relative to SRC_LOC_ID and DST_LOC_ID,
+ * which are either file IDs or group ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Wednesday, March 29, 2006
@@ -289,7 +274,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
{
H5G_loc_t src_loc, *src_loc_p;
H5G_loc_t dst_loc, *dst_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id,
@@ -332,13 +317,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcopy
+ * Function: H5Lcopy
*
- * Purpose: Creates an identical copy of a link with the same creation
+ * Purpose: Creates an identical copy of a link with the same creation
* time and target. The new link can have a different name
* and be in a different location than the original.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Wednesday, March 29, 2006
@@ -351,7 +336,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
{
H5G_loc_t src_loc, *src_loc_p;
H5G_loc_t dst_loc, *dst_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id,
@@ -386,7 +371,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Copy the link */
if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link")
done:
FUNC_LEAVE_API(ret_value)
@@ -394,17 +379,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_soft
+ * Function: H5Lcreate_soft
*
- * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET.
+ * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET.
*
- * LINK_TARGET can be anything and is interpreted at lookup
+ * LINK_TARGET can be anything and is interpreted at lookup
* time relative to the group which contains the final component
* of LINK_NAME. For instance, if LINK_TARGET is `./foo' and
* LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar'
* then the actual object looked up is `./x/y/./foo'.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -416,7 +401,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
const char *link_name, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc; /* Group location for new link */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id);
@@ -424,10 +409,14 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
/* Check arguments */
if(H5G_loc(link_loc_id, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!link_target || !*link_target)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified")
- if(!link_name || !*link_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ if(!link_target)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL")
+ if(!*link_target)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string")
+ if(!link_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be NULL")
+ if(!*link_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be an empty string")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -437,7 +426,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
/* Create the link */
if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
FUNC_LEAVE_API(ret_value)
@@ -445,15 +434,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_hard
+ * Function: H5Lcreate_hard
*
- * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
+ * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
*
- * CUR_NAME must name an existing object. CUR_NAME and
+ * CUR_NAME must name an existing object. CUR_NAME and
* NEW_NAME are interpreted relative to CUR_LOC_ID and
* NEW_LOC_ID, which are either file IDs or group IDs.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -466,7 +455,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
{
H5G_loc_t cur_loc, *cur_loc_p;
H5G_loc_t new_loc, *new_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id,
@@ -476,13 +465,17 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
- if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ if(!cur_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL")
+ if(!*cur_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string")
+ if(!new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL")
+ if(!*new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -496,13 +489,13 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(cur_loc_id == H5L_SAME_LOC)
cur_loc_p = new_loc_p;
else if(new_loc_id == H5L_SAME_LOC)
- new_loc_p = cur_loc_p;
+ new_loc_p = cur_loc_p;
else if(cur_loc_p->oloc->file != new_loc_p->oloc->file)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
/* Create the link */
if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
FUNC_LEAVE_API(ret_value)
@@ -510,23 +503,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_ud
+ * Function: H5Lcreate_ud
*
- * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME
+ * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME
* with user-specified data UDATA.
*
- * The format of the information pointed to by UDATA is
+ * The format of the information pointed to by UDATA is
* defined by the user. UDATA_SIZE holds the size of this buffer.
*
- * LINK_NAME is interpreted relative to LINK_LOC_ID.
+ * LINK_NAME is interpreted relative to LINK_LOC_ID.
*
- * The property list specified by LCPL_ID holds properties used
+ * The property list specified by LCPL_ID holds properties used
* to create the link.
*
* The link class of the new link must already be registered
* with the library.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Tuesday, December 13, 2005
@@ -538,7 +531,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata,
@@ -548,7 +541,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(H5G_loc(link_loc_id, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!link_name || !*link_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
@@ -558,7 +551,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
/* Create external link */
if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -566,16 +559,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ldelete
+ * Function: H5Ldelete
*
- * Purpose: Removes the specified NAME from the group graph and
- * decrements the link count for the object to which NAME
- * points. If the link count reaches zero then all file-space
- * associated with the object will be reclaimed (but if the
- * object is open, then the reclamation of the file space is
- * delayed until all handles to the object are closed).
+ * Purpose: Removes the specified NAME from the group graph and
+ * decrements the link count for the object to which NAME
+ * points. If the link count reaches zero then all file-space
+ * associated with the object will be reclaimed (but if the
+ * object is open, then the reclamation of the file space is
+ * delayed until all handles to the object are closed).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -593,9 +586,9 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
/* Check arguments */
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(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
@@ -641,20 +634,20 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* Check arguments */
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(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Delete the link */
- if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0)
+ if(H5L_delete_by_idx(&loc, group_name, idx_type, order, n) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -695,7 +688,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
if(H5G_loc(loc_id, &loc))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -742,21 +735,21 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the link value */
- if(H5L__get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for")
+ if(H5L_get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value")
done:
FUNC_LEAVE_API(ret_value)
@@ -764,12 +757,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lexists
+ * Function: H5Lexists
*
- * Purpose: Checks if a link of a given name exists in a group
+ * Purpose: Checks if a link of a given name exists in a group
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: Success: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Friday, March 16, 2007
@@ -780,7 +772,7 @@ htri_t
H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
{
H5G_loc_t loc;
- htri_t ret_value; /* Return value */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
@@ -788,15 +780,17 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
/* Check arguments */
if(H5G_loc(loc_id, &loc))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Check for the existence of the link */
- if((ret_value = H5L__exists(&loc, name)) < 0)
+ if((ret_value = H5L_exists(&loc, name)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -830,9 +824,9 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
@@ -875,20 +869,20 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the link information */
- if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0)
+ if(H5L_get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -976,11 +970,11 @@ H5Lunregister(H5L_type_t id)
/* Check args */
if(id < 0 || id > H5L_TYPE_MAX)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
if(H5L_unregister(id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
done:
FUNC_LEAVE_API(ret_value)
@@ -988,14 +982,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lis_registered
+ * Function: H5Lis_registered
*
- * Purpose: Tests whether a user-defined link class has been registered
+ * Purpose: Tests whether a user-defined link class has been registered
* or not.
*
- * Return: Positive if the link class has been registered
- * Zero if it is unregistered
- * Negative on error (if the class is not a valid UD class ID)
+ * Return: TRUE if the link class has been registered
+ * FALSE if it is unregistered
+ * FAIL on error (if the class is not a valid UD class ID)
*
* Programmer: James Laird
* Monday, July 10, 2006
@@ -1017,7 +1011,7 @@ H5Lis_registered(H5L_type_t id)
/* Is the link class already registered? */
for(i = 0; i < H5L_table_used_g; i++)
- if(H5L_table_g[i].id == id) {
+ if(H5L_table_g[i].id == id) {
ret_value = TRUE;
break;
} /* end if */
@@ -1028,16 +1022,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lget_name_by_idx
+ * Function: H5Lget_name_by_idx
*
- * Purpose: Gets name for a link, according to the order within an
+ * Purpose: Gets name for a link, according to the order within an
* index.
*
* Same pattern of behavior as H5Iget_name.
*
- * Return: Success: Non-negative length of name, with information
- * in NAME buffer
- * Failure: Negative
+ * Return: Success: Non-negative length of name, with information
+ * in NAME buffer
+ *
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Saturday, November 11, 2006
@@ -1050,29 +1045,29 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
char *name /*out*/, size_t size, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size,
lapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info")
/* Get the link information */
- if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name")
+ if((ret_value = H5L_get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1098,17 +1093,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
+H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx_p, H5L_iterate_t op, void *op_data)
{
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data);
+ H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data);
/* Check arguments */
- id_type = H5I_get_type(grp_id);
+ if(H5G_loc(group_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ id_type = H5I_get_type(group_id);
if (!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -1119,7 +1117,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Iterate over the links */
- if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1128,20 +1126,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Literate_by_name
+ * Function: H5Literate_by_name
*
- * Purpose: Iterates over links in a group, with user callback routine,
+ * Purpose: Iterates over links in a group, with user callback routine,
* according to the order within an index.
*
* Same pattern of behavior as H5Giterate.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
*
* Programmer: Quincey Koziol
@@ -1154,28 +1152,33 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
H5L_iterate_t op, void *op_data, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op,
op_data, lapl_id);
/* Check arguments */
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Iterate over the links */
- if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5L_iterate(&loc, group_name, idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1184,9 +1187,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit
+ * Function: H5Lvisit
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1198,13 +1201,13 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@@ -1212,28 +1215,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
+H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate_t op, void *op_data)
{
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data);
+ H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data);
/* Check args */
- id_type = H5I_get_type(grp_id);
+ if(H5G_loc(group_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ id_type = H5I_get_type(group_id);
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- /* Call internal routine */
- if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0)
+ /* Iterate over the links */
+ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1242,9 +1248,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit_by_name
+ * Function: H5Lvisit_by_name
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1256,13 +1262,13 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 3 2007
@@ -1273,19 +1279,24 @@ herr_t
H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data,
lapl_id);
/* Check args */
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
@@ -1293,8 +1304,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal routine */
- if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0)
+ /* Visit the links */
+ if((ret_value = H5G_visit(&loc, group_name, idx_type, order, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1487,8 +1498,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc,
- hid_t lcpl_id)
+H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id)
{
H5O_link_t lnk; /* Link to insert */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1880,11 +1890,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_create_soft
+ * Function: H5L_create_soft
*
- * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
+ * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -2175,27 +2185,26 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_val_by_idx
+ * Function: H5L_get_val_by_idx
*
* Purpose: Internal routine to query a link value according to the
- * index within a group
+ * index within a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 27, 2017
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+herr_t
+H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size)
{
H5L_trav_gvbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(loc);
@@ -2214,7 +2223,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_val_by_idx() */
+} /* end H5L_get_val_by_idx() */
/*-------------------------------------------------------------------------
@@ -2255,7 +2264,7 @@ H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk
/* Remove the link from the group */
if(H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group")
done:
/* Indicate that this callback didn't take ownership of the group *
@@ -2347,29 +2356,28 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__delete_by_idx
+ * Function: H5L_delete_by_idx
*
* Purpose: Internal routine to delete a link according to its index
- * within a group.
+ * within a group.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 27, 2017
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+herr_t
+H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n)
{
H5L_trav_rmbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_NOAPI(FAIL)
- /* Check arguments */
+ /* Sanity check */
HDassert(loc);
HDassert(name && *name);
@@ -2384,7 +2392,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__delete_by_idx() */
+} /* end H5L_delete_by_idx() */
/*-------------------------------------------------------------------------
@@ -2558,7 +2566,7 @@ H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* Insert the link into its new location */
if(H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, &udata_out) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
/* If this is a move and not a copy operation, change the object's name and remove the old link */
if(!udata->copy) {
@@ -2686,7 +2694,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
/* Do the move */
if(H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2854,7 +2862,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__exists
+ * Function: H5L_exists
*
* Purpose: Returns whether a link exists in a group
*
@@ -2869,12 +2877,12 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5L__exists(const H5G_loc_t *loc, const char *name)
+H5L_exists(const H5G_loc_t *loc, const char *name)
{
H5L_trav_le_t udata; /* User data for traversal */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_NOAPI(FAIL)
/* A path of "/" will always exist in a file */
if(0 == HDstrcmp(name, "/"))
@@ -2890,7 +2898,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L__exists() */
+} /* H5L_exists() */
/*-------------------------------------------------------------------------
@@ -3015,27 +3023,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_info_by_idx
+ * Function: H5L_get_info_by_idx
*
* Purpose: Internal routine to retrieve link info according to an
* index's order.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+herr_t
+H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/)
{
H5L_trav_gibi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(loc);
@@ -3054,7 +3058,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_info_by_idx() */
+} /* end H5L_get_info_by_idx() */
/*-------------------------------------------------------------------------
@@ -3098,28 +3102,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_name_by_idx
+ * Function: H5L_get_name_by_idx
*
* Purpose: Internal routine to retrieve link name according to an
* index's order.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static ssize_t
-H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
+ssize_t
+H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/,
size_t size)
{
H5L_trav_gnbi_t udata; /* User data for callback */
ssize_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(loc);
@@ -3142,56 +3142,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_name_by_idx() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5L__iterate
- *
- * Purpose: Internal routine to iterate over links
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data)
-{
- H5G_link_iterate_t lnk_op; /* Link operator */
- hsize_t last_lnk; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check arguments */
- HDassert(group_name);
- HDassert(op);
-
- /* Set up iteration beginning/end info */
- idx = (idx_p == NULL ? 0 : *idx_p);
- last_lnk = 0;
-
- /* Build link operator info */
- lnk_op.op_type = H5G_LINK_OP_NEW;
- lnk_op.op_func.op_new = op;
-
- /* Iterate over the links */
- if((ret_value = H5G_iterate(grp_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
-
- /* Set the index we stopped at */
- if(idx_p)
- *idx_p = last_lnk;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__iterate() */
+} /* end H5L_get_name_by_idx() */
/*-------------------------------------------------------------------------
@@ -3324,3 +3275,49 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__link_copy_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_iterate
+ *
+ * Purpose: Iterates through links in a group
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data)
+{
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ hsize_t last_lnk; /* Index of last object looked at */
+ hsize_t idx; /* Internal location to hold index */
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity checks */
+ HDassert(loc);
+ HDassert(group_name);
+ HDassert(op);
+
+ /* Set up iteration beginning/end info */
+ idx = (idx_p == NULL ? 0 : *idx_p);
+ last_lnk = 0;
+
+ /* Build link operator info */
+ lnk_op.op_type = H5G_LINK_OP_NEW;
+ lnk_op.op_func.op_new = op;
+
+ /* Iterate over the links */
+ if((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+
+ /* Set the index we stopped at */
+ if(idx_p)
+ *idx_p = last_lnk;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_iterate() */
+
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 3bbb6b6..fa3c097 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -122,12 +122,27 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name,
const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag,
hid_t lcpl_id);
H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name);
+H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name,
H5L_info_t *linkbuf/*out*/);
H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name);
+H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ H5L_info_t *linfo /*out*/);
+H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ char *name /*out*/, size_t size);
H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/,
size_t size);
+H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ void *buf/*out*/, size_t size);
H5_DLL herr_t H5L_register_external(void);
+H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
+ H5L_iterate_t op, void *op_data);
/* User-defined link functions */
H5_DLL herr_t H5L_register(const H5L_class_t *cls);
diff --git a/src/H5O.c b/src/H5O.c
index 25c3d83..b33e6e2 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -75,9 +75,9 @@
/*-------------------------------------------------------------------------
- * Function: H5Oopen
+ * Function: H5Oopen
*
- * Purpose: Opens an object within an HDF5 file.
+ * Purpose: Opens an object within an HDF5 file.
*
* This function opens an object in the same way that H5Gopen2,
* H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require
@@ -88,8 +88,9 @@
* The opened object should be closed again with H5Oclose
* or H5Gclose, H5Tclose, or H5Dclose.
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: An open object identifier
+ *
+ * Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 14 2006
@@ -100,16 +101,18 @@ hid_t
H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
- hid_t ret_value = FAIL;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -117,7 +120,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
/* Open the object */
if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
@@ -140,7 +143,7 @@ done:
* or H5Gclose, H5Tclose, or H5Dclose.
*
* Return: Success: An open object identifier
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* November 20 2006
@@ -152,28 +155,28 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
- hid_t ret_value = FAIL;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Open the object */
- if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if((ret_value = H5O_open_by_idx(&loc, group_name, idx_type, order, n)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
@@ -208,7 +211,7 @@ done:
* map this to an address on disk for the filesystem.
*
* Return: Success: An open object identifier
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 14 2006
@@ -221,7 +224,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
H5G_loc_t loc; /* Location within file */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "ia", loc_id, addr);
/* Check args */
@@ -231,8 +234,8 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied")
/* Open the object */
- if((ret_value = H5O__open_by_addr(&loc, addr)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if((ret_value = H5O_open_by_addr(&loc, addr)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
@@ -332,13 +335,13 @@ H5Oincr_refcount(hid_t object_id)
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_loc(object_id)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Change the object's refcount */
+ /* Change the object's reference count */
if(H5O_link(oloc, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
@@ -378,13 +381,13 @@ H5Odecr_refcount(hid_t object_id)
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_loc(object_id)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Change the object's refcount */
+ /* Change the object's reference count */
if(H5O_link(oloc, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
@@ -394,12 +397,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oexists_by_name
+ * Function: H5Oexists_by_name
*
- * Purpose: Determine if a linked-to object exists
+ * Purpose: Determine if a linked-to object exists
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: Success: TRUE/FALSE
+ * Failure: FAIL
*
* Programmer: Quincey Koziol
* February 2 2010
@@ -418,8 +421,10 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -441,8 +446,7 @@ done:
*
* NOTE: Add a parameter "fields" to indicate selection of object info.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* July 7 2010
@@ -462,12 +466,12 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Retrieve the object's information */
- if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0)
+ if(H5G_loc_info(&loc, ".", oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -475,21 +479,20 @@ done:
} /* end H5Oget_info2() */
- /*-------------------------------------------------------------------------
- * Function: H5Oget_info_by_name2
- *
- * Purpose: Retrieve information about an object.
- *
- * NOTE: Add a parameter "fields" to indicate selection of object info.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Neil Fortner
- * July 7 2010
- *
- *-------------------------------------------------------------------------
- */
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_name2
+ *
+ * Purpose: Retrieve information about an object
+ *
+ * NOTE: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Neil Fortner
+ * July 7 2010
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
unsigned fields, hid_t lapl_id)
@@ -503,10 +506,12 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
@@ -578,16 +583,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oset_comment
+ * Function: H5Oset_comment
*
* Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
+ * should be a null terminated string. An object can have only
+ * one comment at a time. Passing NULL for the COMMENT argument
+ * will remove the comment property from the object.
*
- * Note: Deprecated in favor of using attributes on objects
+ * Note: Deprecated in favor of using attributes on objects
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -605,7 +610,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
/* Check args */
if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(obj_id) < 0)
@@ -621,16 +626,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oset_comment_by_name
+ * Function: H5Oset_comment_by_name
*
* Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
+ * should be a null terminated string. An object can have only
+ * one comment at a time. Passing NULL for the COMMENT argument
+ * will remove the comment property from the object.
*
- * Note: Deprecated in favor of using attributes on objects
+ * Note: Deprecated in favor of using attributes on objects
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -667,15 +672,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oget_comment
+ * Function: H5Oget_comment
*
- * Purpose: Retrieve comment for an object.
+ * Purpose: Retrieve comment for an object.
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
+ * Return: Success: Number of bytes in the comment excluding the
+ * null terminator. Zero if the object has no
+ * comment.
*
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -686,18 +691,18 @@ ssize_t
H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
{
H5G_loc_t loc; /* Location of group */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize);
/* Check args */
if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location")
/* Retrieve the object's comment */
if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -705,15 +710,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oget_comment_by_name
+ * Function: H5Oget_comment_by_name
*
- * Purpose: Retrieve comment for an object.
+ * Purpose: Retrieve comment for an object.
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
+ * Return: Success: Number of bytes in the comment excluding the
+ * null terminator. Zero if the object has no
+ * comment.
*
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -725,24 +730,24 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
hid_t lapl_id)
{
H5G_loc_t loc; /* Location of group */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info")
/* Retrieve the object's comment */
if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
@@ -750,9 +755,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ovisit2
+ * Function: H5Ovisit2
*
- * Purpose: Recursively visit an object and all the objects reachable
+ * Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
* linked to from that group will be visited. Links within
* each group are visited according to the order within the
@@ -772,12 +777,12 @@ done:
* object info to be retrieved to the callback "op".
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
* Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 25 2007
@@ -788,12 +793,15 @@ herr_t
H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate_t op, void *op_data, unsigned fields)
{
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields);
/* Check args */
+ if(H5G_loc(obj_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -803,9 +811,9 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ /* Visit the objects */
+ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -813,7 +821,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ovisit_by_name2
+ * Function: H5Ovisit_by_name2
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -835,12 +843,12 @@ done:
* object info to be retrieved to the callback "op".
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@@ -851,15 +859,20 @@ herr_t
H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data,
fields, lapl_id);
/* Check args */
- if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL")
+ if(!*obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -873,9 +886,9 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ /* Visit the objects */
+ if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -883,17 +896,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oclose
+ * Function: H5Oclose
*
- * Purpose: Close an open file object.
+ * Purpose: Close an open file object.
*
* This is the companion to H5Oopen. It is used to close any
* open object in an HDF5 file (but not IDs are that not file
* objects, such as property lists and dataspaces). It has
* the same effect as calling H5Gclose, H5Dclose, or H5Tclose.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* July 14 2006
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 570e16d..23dd928 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -57,9 +57,9 @@
/* Local Prototypes */
/********************/
-static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
+static herr_t H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size);
-static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
+static herr_t H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size);
static herr_t H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
const H5O_msg_class_t *new_type, void *new_native, size_t new_size);
@@ -70,10 +70,10 @@ static herr_t H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size
static herr_t H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size,
size_t *new_idx);
static herr_t H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx);
-static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u);
-static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh);
-static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh);
-static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh);
+static htri_t H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u);
+static htri_t H5O__move_msgs_forward(H5F_t *f, H5O_t *oh);
+static htri_t H5O__merge_null(H5F_t *f, H5O_t *oh);
+static htri_t H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh);
static herr_t H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno);
@@ -97,7 +97,7 @@ H5FL_EXTERN(H5O_cont_t);
/*-------------------------------------------------------------------------
- * Function: H5O_add_gap
+ * Function: H5O__add_gap
*
* Purpose: Add a gap to a chunk
*
@@ -110,14 +110,14 @@ H5FL_EXTERN(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
+H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
size_t idx, uint8_t *new_gap_loc, size_t new_gap_size)
{
hbool_t merged_with_null; /* Whether the gap was merged with a null message */
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -150,7 +150,7 @@ if(chunkno > 0) {
HDassert(oh->chunk[chunkno].gap == 0);
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0)
+ if(H5O__eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk")
/* Set flag to indicate that the gap was handled */
@@ -178,7 +178,7 @@ if(chunkno > 0) {
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Increment new gap size */
@@ -212,11 +212,11 @@ if(chunkno > 0) {
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_add_gap() */
+} /* H5O__add_gap() */
/*-------------------------------------------------------------------------
- * Function: H5O_eliminate_gap
+ * Function: H5O__eliminate_gap
*
* Purpose: Eliminate a gap in a chunk with a null message.
*
@@ -236,13 +236,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
+H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
uint8_t *gap_loc, size_t gap_size)
{
uint8_t *move_start, *move_end; /* Pointers to area of messages to move */
hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(oh);
@@ -319,7 +319,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
*chk_dirtied = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5O_eliminate_gap() */
+} /* H5O__eliminate_gap() */
/*-------------------------------------------------------------------------
@@ -369,7 +369,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
alloc_msg->raw_size = new_size;
/* Add the gap to the chunk */
- if(H5O_add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
+ if(H5O__add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
else {
@@ -378,7 +378,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */
@@ -402,7 +402,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &chk_dirtied, null_msg,
+ if(H5O__eliminate_gap(oh, &chk_dirtied, null_msg,
((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)),
oh->chunk[null_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -432,7 +432,7 @@ done:
/*-------------------------------------------------------------------------
*
- * Function: H5O_alloc_msgs
+ * Function: H5O__alloc_msgs
*
* Purpose: Allocate more messages for a header
*
@@ -445,14 +445,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_alloc_msgs(H5O_t *oh, size_t min_alloc)
+H5O__alloc_msgs(H5O_t *oh, size_t min_alloc)
{
size_t old_alloc; /* Old number of messages allocated */
size_t na; /* New number of messages allocated */
H5O_mesg_t *new_mesg; /* Pointer to new message array */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh);
@@ -474,7 +474,7 @@ H5O_alloc_msgs(H5O_t *oh, size_t min_alloc)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_alloc_msgs() */
+} /* H5O__alloc_msgs() */
/*-------------------------------------------------------------------------
@@ -590,7 +590,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Determine whether the chunk can be extended */
was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, oh->chunk[chunkno].addr, (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size));
@@ -618,7 +618,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
else {
/* Create a new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Set extension message */
@@ -690,7 +690,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
} /* end for */
/* Resize the chunk in the cache */
- if(H5O_chunk_resize(oh, chk_proxy) < 0)
+ if(H5O__chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
/* Set new message index */
@@ -958,7 +958,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
* that could be generated below.
*/
if(oh->nmesgs + 3 > oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)3) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)3) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Check if we need to move multiple messages, in order to make room for the new message */
@@ -1361,7 +1361,7 @@ done:
/*-------------------------------------------------------------------------
*
- * Function: H5O_release_mesg
+ * Function: H5O__release_mesg
*
* Purpose: Convert a message into a null message
*
@@ -1374,13 +1374,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
+H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -1395,7 +1395,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, mesg->chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
/* Free any native information */
H5O__msg_free_mesg(mesg);
@@ -1415,7 +1415,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
/* Check if chunk has a gap currently */
if(oh->chunk[mesg->chunkno].gap) {
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &chk_dirtied, mesg,
+ if(H5O__eliminate_gap(oh, &chk_dirtied, mesg,
((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)),
oh->chunk[mesg->chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -1427,11 +1427,11 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_release_mesg() */
+} /* H5O__release_mesg() */
/*-------------------------------------------------------------------------
- * Function: H5O_move_cont
+ * Function: H5O__move_cont
*
* Purpose: Check and move message(s) forward into a continuation message
*
@@ -1444,7 +1444,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
+H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that continuation message is in */
H5O_mesg_t *cont_msg; /* Pointer to the continuation message */
@@ -1452,7 +1452,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(f);
@@ -1500,7 +1500,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
/* Convert continuation message into a null message. Do not delete
* the target chunk yet, so we can still copy messages from it. */
- if(H5O_release_mesg(f, oh, cont_msg, FALSE) < 0)
+ if(H5O__release_mesg(f, oh, cont_msg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/* Protect chunk */
@@ -1549,7 +1549,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
/* Check if there is space that should be a gap */
if(gap_size > 0) {
/* Convert remnant into gap in chunk */
- if(H5O_add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0)
+ if(H5O__add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
@@ -1594,12 +1594,12 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_move_cont() */
+} /* H5O__move_cont() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_move_msgs_forward
+ * Function: H5O__move_msgs_forward
*
* Purpose: Move messages toward first chunk
*
@@ -1612,7 +1612,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
+H5O__move_msgs_forward(H5F_t *f, H5O_t *oh)
{
H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */
H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */
@@ -1623,7 +1623,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
hbool_t did_packing = FALSE; /* Whether any messages were packed */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -1706,7 +1706,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
if(H5O_CONT_ID == curr_msg->type->id) {
htri_t status; /* Status from moving messages */
- if((status = H5O_move_cont(f, oh, u)) < 0)
+ if((status = H5O__move_cont(f, oh, u)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message")
else if(status > 0) { /* Message(s) got moved into "continuation" message */
packed_msg = TRUE;
@@ -1818,7 +1818,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Check for gap in null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &null_chk_dirtied, null_msg,
+ if(H5O__eliminate_gap(oh, &null_chk_dirtied, null_msg,
((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)),
oh->chunk[old_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -1845,7 +1845,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
null_chk_dirtied = TRUE;
/* Add the gap to the chunk */
- if(H5O_add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0)
+ if(H5O__add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
/* Re-use message # for new null message taking place of non-null message */
@@ -1862,7 +1862,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Create new null message for previous location of non-null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */
@@ -1893,7 +1893,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Check for gap in new null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg],
+ if(H5O__eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg],
((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)),
oh->chunk[old_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -1945,12 +1945,12 @@ done:
HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_move_msgs_forward() */
+} /* H5O__move_msgs_forward() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_merge_null
+ * Function: H5O__merge_null
*
* Purpose: Merge neighboring null messages in an object header
*
@@ -1963,13 +1963,13 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_merge_null(H5F_t *f, H5O_t *oh)
+H5O__merge_null(H5F_t *f, H5O_t *oh)
{
hbool_t merged_msg; /* Flag to indicate that messages were merged */
hbool_t did_merging = FALSE; /* Whether any messages were merged */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh != NULL);
@@ -2051,7 +2051,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh)
oh->nmesgs--;
/* The merge null message might span the entire chunk: scan for empty chunk to remove */
- if((result = H5O_remove_empty_chunks(f, oh)) < 0)
+ if((result = H5O__remove_empty_chunks(f, oh)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
else if(result > 0)
/* Get out of loop */
@@ -2084,12 +2084,12 @@ H5O_merge_null(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_merge_null() */
+} /* H5O__merge_null() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_remove_empty_chunks
+ * Function: H5O__remove_empty_chunks
*
* Purpose: Attempt to eliminate empty chunks from object header.
*
@@ -2106,13 +2106,13 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
+H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh)
{
hbool_t deleted_chunk; /* Whether to a chunk was deleted */
hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh != NULL);
@@ -2173,7 +2173,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
deleted_chunkno = null_msg->chunkno;
/* Convert continuation message into a null message */
- if(H5O_release_mesg(f, oh, cont_msg, TRUE) < 0)
+ if(H5O__release_mesg(f, oh, cont_msg, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/*
@@ -2273,12 +2273,12 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_remove_empty_chunks() */
+} /* H5O__remove_empty_chunks() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_condense_header
+ * Function: H5O__condense_header
*
* Purpose: Attempt to eliminate empty chunks from object header.
*
@@ -2291,13 +2291,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_condense_header(H5F_t *f, H5O_t *oh)
+H5O__condense_header(H5F_t *f, H5O_t *oh)
{
hbool_t rescan_header; /* Whether to rescan header */
htri_t result; /* Result from packing/merging/etc */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh != NULL);
@@ -2308,33 +2308,33 @@ H5O_condense_header(H5F_t *f, H5O_t *oh)
rescan_header = FALSE;
/* Scan for messages that can be moved earlier in chunks */
- result = H5O_move_msgs_forward(f, oh);
+ result = H5O__move_msgs_forward(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward")
if(result > 0)
rescan_header = TRUE;
/* Scan for adjacent null messages & merge them */
- result = H5O_merge_null(f, oh);
+ result = H5O__merge_null(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages")
if(result > 0)
rescan_header = TRUE;
/* Scan for empty chunks to remove */
- result = H5O_remove_empty_chunks(f, oh);
+ result = H5O__remove_empty_chunks(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
if(result > 0)
rescan_header = TRUE;
} while(rescan_header);
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_condense_header() */
+} /* H5O__condense_header() */
/*-------------------------------------------------------------------------
@@ -2523,7 +2523,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno)
HDassert(new_size <= old_size);
/* Resize the chunk in the cache */
- if(H5O_chunk_resize(oh, chk_proxy) < 0)
+ if(H5O__chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
/* Free the unused space in the file */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index a62a3a3..c93bf32 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -44,48 +44,48 @@ static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream,
int indent, int fwidth);
/* Set up & include shared message "interface" info */
-#define H5O_SHARED_TYPE H5O_MSG_ATTR
-#define H5O_SHARED_DECODE H5O_attr_shared_decode
-#define H5O_SHARED_DECODE_REAL H5O_attr_decode
-#define H5O_SHARED_ENCODE H5O_attr_shared_encode
-#define H5O_SHARED_ENCODE_REAL H5O_attr_encode
-#define H5O_SHARED_SIZE H5O_attr_shared_size
-#define H5O_SHARED_SIZE_REAL H5O_attr_size
-#define H5O_SHARED_DELETE H5O__attr_shared_delete
-#define H5O_SHARED_DELETE_REAL H5O__attr_delete
-#define H5O_SHARED_LINK H5O__attr_shared_link
-#define H5O_SHARED_LINK_REAL H5O__attr_link
-#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file
-#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file
-#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file
-#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file
+#define H5O_SHARED_TYPE H5O_MSG_ATTR
+#define H5O_SHARED_DECODE H5O_attr_shared_decode
+#define H5O_SHARED_DECODE_REAL H5O_attr_decode
+#define H5O_SHARED_ENCODE H5O_attr_shared_encode
+#define H5O_SHARED_ENCODE_REAL H5O_attr_encode
+#define H5O_SHARED_SIZE H5O_attr_shared_size
+#define H5O_SHARED_SIZE_REAL H5O_attr_size
+#define H5O_SHARED_DELETE H5O__attr_shared_delete
+#define H5O_SHARED_DELETE_REAL H5O__attr_delete
+#define H5O_SHARED_LINK H5O__attr_shared_link
+#define H5O_SHARED_LINK_REAL H5O__attr_link
+#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file
+#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file
+#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file
+#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file
#undef H5O_SHARED_POST_COPY_FILE_UPD
-#define H5O_SHARED_DEBUG H5O_attr_shared_debug
-#define H5O_SHARED_DEBUG_REAL H5O__attr_debug
+#define H5O_SHARED_DEBUG H5O_attr_shared_debug
+#define H5O_SHARED_DEBUG_REAL H5O__attr_debug
#include "H5Oshared.h" /* Shared Object Header Message Callbacks */
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
- H5O_ATTR_ID, /* message id number */
- "attribute", /* message name for debugging */
- sizeof(H5A_t), /* native message size */
- H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
- H5O_attr_shared_decode, /* decode message */
- H5O_attr_shared_encode, /* encode message */
- H5O_attr_copy, /* copy the native value */
- H5O_attr_shared_size, /* size of raw message */
- H5O__attr_reset, /* reset method */
- H5O__attr_free, /* free method */
- H5O__attr_shared_delete, /* file delete method */
- H5O__attr_shared_link, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
- H5O_attr_pre_copy_file, /* pre copy native value to file */
- H5O__attr_shared_copy_file, /* copy native value to file */
- H5O_attr_shared_post_copy_file, /* post copy native value to file */
- H5O_attr_get_crt_index, /* get creation index */
- H5O_attr_set_crt_index, /* set creation index */
- H5O_attr_shared_debug /* debug the message */
+ H5O_ATTR_ID, /* message id number */
+ "attribute", /* message name for debugging */
+ sizeof(H5A_t), /* native message size */
+ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
+ H5O_attr_shared_decode, /* decode message */
+ H5O_attr_shared_encode, /* encode message */
+ H5O_attr_copy, /* copy the native value */
+ H5O_attr_shared_size, /* size of raw message */
+ H5O__attr_reset, /* reset method */
+ H5O__attr_free, /* free method */
+ H5O__attr_shared_delete, /* file delete method */
+ H5O__attr_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /* can share method */
+ H5O_attr_pre_copy_file, /* pre copy native value to file */
+ H5O__attr_shared_copy_file, /* copy native value to file */
+ H5O_attr_shared_post_copy_file, /* post copy native value to file */
+ H5O_attr_get_crt_index, /* get creation index */
+ H5O_attr_set_crt_index, /* set creation index */
+ H5O_attr_shared_debug /* debug the message */
}};
/* Flags for attribute flag encoding */
@@ -474,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg)
* Purpose: Frees resources within a attribute message, but doesn't free
* the message itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
@@ -491,11 +491,11 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg)
/*-------------------------------------------------------------------------
- * Function: H5O__attr_free
+ * Function: H5O__attr_free
*
- * Purpose: Frees the message
+ * Purpose: Frees the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 18, 2004
@@ -525,7 +525,7 @@ done:
*
* Purpose: Free file space referenced by message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -563,7 +563,7 @@ done:
* Purpose: Increment reference count on any objects referenced by
* message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -604,9 +604,7 @@ done:
* Purpose: Perform any necessary actions before copying message between
* files for attribute messages.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, June 26, 2006
@@ -628,7 +626,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
HDassert(cpy_info->file_dst);
/* Check to ensure that the version of the message to be copied does not exceed
- the message version allowed by the destination file's high bound */
+ * the message version allowed by the destination file's high bound.
+ */
if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
@@ -649,7 +648,6 @@ done:
* Purpose: Copies a message from _MESG to _DEST in file
*
* Return: Success: Ptr to _DEST
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -695,7 +693,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@@ -719,12 +717,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_get_crt_index
+ * Function: H5O_attr_get_crt_index
*
- * Purpose: Get creation index from the message
+ * Purpose: Get creation index from the message
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
@@ -749,12 +746,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/)
/*-------------------------------------------------------------------------
- * Function: H5O_attr_set_crt_index
+ * Function: H5O_attr_set_crt_index
*
- * Purpose: Set creation index from the message
+ * Purpose: Set creation index from the message
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 640d1c7..5183026 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Oattribute.c
- * Dec 11 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Oattribute.c
*
- * Purpose: Object header attribute routines.
+ * Purpose: Object header attribute routines.
*
*-------------------------------------------------------------------------
*/
@@ -26,21 +24,21 @@
/* Module Setup */
/****************/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5A_FRIEND /* Suppress error about including H5Apkg.h */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Fprivate.h" /* File */
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Fprivate.h" /* File */
/****************/
@@ -129,8 +127,24 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
-static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
+static herr_t H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static htri_t H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
const char* name_to_open);
+static herr_t H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
+ unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
+static herr_t H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr);
+static herr_t H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static herr_t H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
+static herr_t H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static herr_t H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo);
+static herr_t H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
/*********************/
/* Package Variables */
@@ -149,12 +163,12 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
/*-------------------------------------------------------------------------
- * Function: H5O_attr_to_dense_cb
+ * Function: H5O__attr_to_dense_cb
*
- * Purpose: Object header iterator callback routine to convert compact
+ * Purpose: Object header iterator callback routine to convert compact
* attributes to dense attributes
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -163,14 +177,14 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */
H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -186,7 +200,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Convert message into a null message in the header */
/* (don't delete attribute's space in the file though) */
- if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
@@ -194,15 +208,15 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_to_dense_cb() */
+} /* end H5O__attr_to_dense_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_create
+ * Function: H5O__attr_create
*
- * Purpose: Create a new attribute in the object header.
+ * Purpose: Create a new attribute in the object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, December 8, 2006
@@ -283,7 +297,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
/* Iterate over existing attributes, moving them to dense storage */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_to_dense_cb;
+ op.u.lib_op = H5O__attr_to_dense_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage")
} /* end if */
@@ -337,7 +351,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
/* Increment reference count for shared attribute object for the
* object handle created by the caller function H5A__create. The count
* for the cached object header has been incremented in the step above
- * (in H5O__msg_append_real). The dense storage doesn't need a count. */
+ * (in H5O__msg_append_real). The dense storage doesn't need a count.
+ */
attr->shared->nrefs += 1;
/* Was new attribute shared? */
@@ -392,12 +407,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_open_cb
+ * Function: H5O__attr_open_cb
*
- * Purpose: Object header iterator callback routine to open an
+ * Purpose: Object header iterator callback routine to open an
* attribute stored compactly.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -406,13 +421,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
+H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -437,15 +452,15 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_open_cb() */
+} /* end H5O__attr_open_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_open_by_name
+ * Function: H5O__attr_open_by_name
*
- * Purpose: Open an existing attribute in an object header.
+ * Purpose: Open an existing attribute in an object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -470,7 +485,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -483,7 +498,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* If found the attribute is already opened, make a copy of it to share the
* object information. If not, open attribute as a new object
*/
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0)
+ if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute")
else if(found_open_attr == TRUE) {
if(NULL == (opened_attr = H5A__copy(NULL, exist_attr)))
@@ -506,7 +521,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* Iterate over attributes, to locate correct one to open */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_open_cb;
+ op.u.lib_op = H5O__attr_open_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute")
@@ -541,12 +556,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_open_by_idx_cb
+ * Function: H5O__attr_open_by_idx_cb
*
- * Purpose: Callback routine opening an attribute by index
+ * Purpose: Callback routine opening an attribute by index
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -555,12 +569,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
+H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
{
H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */
herr_t ret_value = H5_ITER_STOP; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(attr);
@@ -572,16 +586,16 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_open_by_idx_cb() */
+} /* end H5O__attr_open_by_idx_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_open_by_idx
+ * Function: H5O__attr_open_by_idx
*
- * Purpose: Open an existing attribute in an object header according to
+ * Purpose: Open an existing attribute in an object header according to
* an index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 18, 2006
@@ -605,7 +619,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_LIB;
- attr_op.u.lib_op = H5O_attr_open_by_idx_cb;
+ attr_op.u.lib_op = H5O__attr_open_by_idx_cb;
/* Iterate over attributes to locate correct one */
if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0)
@@ -615,7 +629,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
* and make a copy of the already opened object to share the object info.
*/
if(opened_attr) {
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0)
+ if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute")
/* If found that the attribute is already opened, make a copy of it
@@ -647,12 +661,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_find_opened_attr
+ * Function: H5O__attr_find_opened_attr
*
- * Purpose: Find out whether an attribute has been opened by giving
+ * Purpose: Find out whether an attribute has been opened by giving
* the name. Return the pointer to the object if found.
*
- * Return: TRUE: found the already opened object
+ * Return: TRUE: found the already opened object
* FALSE: didn't find the opened object
* FAIL: function failed.
*
@@ -662,14 +676,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open)
+H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open)
{
hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */
unsigned long loc_fnum; /* File serial # for object */
size_t num_open_attr; /* Number of opened attributes */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Get file serial number for the location of attribute */
if(H5F_get_fileno(loc->file, &loc_fnum) < 0)
@@ -691,8 +705,8 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t
/* Retrieve the IDs of all opened attributes */
if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes")
- if(check_num_attr != num_open_attr)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch")
+ if(check_num_attr != num_open_attr)
+ HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch")
/* Iterate over the attributes */
for(u = 0; u < num_open_attr; u++) {
@@ -724,15 +738,15 @@ done:
H5MM_free(attr_id_list);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_find_opened_attr */
+} /* end H5O__attr_find_opened_attr() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_update_shared
+ * Function: H5O__attr_update_shared
*
- * Purpose: Update a shared attribute.
+ * Purpose: Update a shared attribute.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -802,25 +816,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_write_cb
+ * Function: H5O__attr_write_cb
*
- * Purpose: Object header iterator callback routine to update an
+ * Purpose: Object header iterator callback routine to update an
* attribute stored compactly.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Dec 4 2006
*
- * Modification:Raymond Lu
- * 4 June 2008
- * Took out the data copying part because the attribute data
- * is shared between attribute handle and object header.
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */
@@ -828,7 +838,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -885,15 +895,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_write_cb() */
+} /* end H5O__attr_write_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_write
+ * Function: H5O__attr_write
*
- * Purpose: Write a new value to an attribute.
+ * Purpose: Write a new value to an attribute.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 4, 2006
@@ -915,7 +925,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -942,7 +952,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
/* Iterate over attributes, to locate correct one to update */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_write_cb;
+ op.u.lib_op = H5O__attr_write_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@@ -964,12 +974,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_rename_chk_cb
+ * Function: H5O__attr_rename_chk_cb
*
- * Purpose: Object header iterator callback routine to check for
+ * Purpose: Object header iterator callback routine to check for
* duplicate name during rename
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -978,13 +988,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(oh);
@@ -1001,21 +1011,21 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_rename_chk_cb() */
+} /* end H5O__attr_rename_chk_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_rename_mod_cb
+ * Function: H5O__attr_rename_mod_cb
*
- * Purpose: Object header iterator callback routine to change name of
+ * Purpose: Object header iterator callback routine to change name of
* attribute during rename
*
- * Note: This routine doesn't currently allow an attribute to change
+ * Note: This routine doesn't currently allow an attribute to change
* its "shared" status, if the name change would cause a size
* difference that would put it into a different category.
* Something for later...
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1024,7 +1034,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
@@ -1032,7 +1042,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -1096,7 +1106,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* (doesn't decrement the link count on shared components because
* the "native" pointer has been reset)
*/
- if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute")
*oh_modified = H5O_MODIFY_CONDENSE;
@@ -1130,15 +1140,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_rename_mod_cb() */
+} /* end H5O__attr_rename_mod_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_rename
+ * Function: H5O__attr_rename
*
- * Purpose: Rename an attribute.
+ * Purpose: Rename an attribute.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -1162,7 +1172,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1190,7 +1200,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Iterate over attributes, to check if "new name" exists already */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_rename_chk_cb;
+ op.u.lib_op = H5O__attr_rename_chk_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@@ -1200,7 +1210,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Iterate over attributes again, to actually rename attribute with old name */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_rename_mod_cb;
+ op.u.lib_op = H5O__attr_rename_mod_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@@ -1218,15 +1228,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5O__attr_rename */
+} /* end H5O__attr_rename() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_iterate_real
+ * Function: H5O_attr_iterate_real
*
- * Purpose: Internal routine to iterate over attributes for an object.
+ * Purpose: Internal routine to iterate over attributes for an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -1309,11 +1319,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__attr_iterate
+ * Function: H5O__attr_iterate
*
- * Purpose: Iterate over attributes for an object.
+ * Purpose: Iterate over attributes for an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -1322,8 +1332,7 @@ done:
*/
herr_t
H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op,
- void *op_data)
+ hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data)
{
H5G_loc_t loc; /* Object location */
herr_t ret_value = FAIL; /* Return value */
@@ -1347,11 +1356,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_remove_update
+ * Function: H5O__attr_remove_update
*
- * Purpose: Check for reverting from dense to compact attribute storage
+ * Purpose: Check for reverting from dense to compact attribute storage
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, February 14, 2007
@@ -1367,12 +1376,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
+H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
{
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -1427,7 +1436,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Insert attribute message into object header (Will increment
reference count on shared attributes) */
/* Find out whether the attribute has been opened */
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
+ if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute")
/* If found the attribute is already opened, use the opened message to insert.
@@ -1450,7 +1459,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Update the message after removing the attribute */
/* This is particularly needed when removing the last attribute that is
- accessed via fractal heap/v2 B-tree (HDFFV-9277) */
+ * accessed via fractal heap/v2 B-tree (HDFFV-9277)
+ */
if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message")
@@ -1468,16 +1478,16 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_remove_update() */
+} /* end H5O__attr_remove_update() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_remove_cb
+ * Function: H5O__attr_remove_cb
*
- * Purpose: Object header iterator callback routine to remove an
+ * Purpose: Object header iterator callback routine to remove an
* attribute stored compactly.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1486,13 +1496,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -1502,7 +1512,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Check for correct attribute message to modify */
if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
/* Convert message into a null message (i.e. delete it) */
- if(H5O_release_mesg(udata->f, oh, mesg, TRUE) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
@@ -1517,15 +1527,15 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_remove_cb() */
+} /* end H5O__attr_remove_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_remove
+ * Function: H5O__attr_remove
*
- * Purpose: Delete an attribute on an object.
+ * Purpose: Delete an attribute on an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -1548,7 +1558,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1575,7 +1585,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_remove_cb;
+ op.u.lib_op = H5O__attr_remove_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
@@ -1586,7 +1596,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
- if(H5O_attr_remove_update(loc, oh, &ainfo) < 0)
+ if(H5O__attr_remove_update(loc, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info")
/* Update the modification time, if any */
@@ -1602,12 +1612,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__attr_remove_by_idx
+ * Function: H5O__attr_remove_by_idx
*
- * Purpose: Delete an attribute on an object, according to an order within
- * an index.
+ * Purpose: Delete an attribute on an object, according to an order within
+ * an index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, February 14, 2007
@@ -1631,7 +1641,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1666,7 +1676,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_remove_cb;
+ op.u.lib_op = H5O__attr_remove_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
@@ -1677,7 +1687,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
- if(H5O_attr_remove_update(loc, oh, &ainfo) < 0)
+ if(H5O__attr_remove_update(loc, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info")
/* Update the modification time, if any */
@@ -1695,11 +1705,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_count_real
+ * Function: H5O__attr_count_real
*
- * Purpose: Determine the # of attributes on an object
+ * Purpose: Determine the # of attributes on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, March 9, 2007
@@ -1707,11 +1717,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
+H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(oh->cache_info.addr)
+ FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr)
/* Check arguments */
HDassert(f);
@@ -1745,16 +1755,16 @@ H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5O_attr_count_real */
+} /* end H5O__attr_count_real */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_exists_cb
+ * Function: H5O__attr_exists_cb
*
- * Purpose: Object header iterator callback routine to check for an
+ * Purpose: Object header iterator callback routine to check for an
* attribute stored compactly, by name.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1763,13 +1773,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(mesg);
@@ -1785,15 +1795,15 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_exists_cb() */
+} /* end H5O__attr_exists_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_exists
+ * Function: H5O__attr_exists
*
- * Purpose: Determine if an attribute with a particular name exists on an object
+ * Purpose: Determine if an attribute with a particular name exists on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -1815,7 +1825,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1842,7 +1852,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name)
/* Iterate over existing attributes, checking for attribute with same name */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_exists_cb;
+ op.u.lib_op = H5O__attr_exists_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute")
@@ -1863,7 +1873,7 @@ done:
*
* Purpose: For 1.8 attribute, returns storage amount for btree and fractal heap
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* June 19, 2007
@@ -1943,11 +1953,11 @@ done:
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5O__attr_count
+ * Function: H5O__attr_count
*
- * Purpose: Determine the # of attributes on an object
+ * Purpose: Determine the # of attributes on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -1968,10 +1978,10 @@ H5O__attr_count(const H5O_loc_t *loc)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve # of attributes on object */
- if(H5O_attr_count_real(loc->file, oh, &nattrs) < 0)
+ if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Set return value */
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index 92fd218..fbf04f2 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -75,7 +75,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
0, /*native message size */
0, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
- H5O__bogus_encode, /*encode message */
+ H5O_bogus_encode, /*encode message */
NULL, /*copy the native value */
H5O_bogus_size, /*raw message size */
NULL, /*free internal memory */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 59e1705..e7cad83 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -437,7 +437,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
HDassert(oh->cache_info.type == H5AC_OHDR);
HDassert(oh->chunk[0].size == len);
#ifdef H5O_DEBUG
- H5O_assert(oh);
+ H5O__assert(oh);
#endif /* H5O_DEBUG */
/* Point to raw data 'image' for first chunk, which
@@ -1430,9 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for combining two adjacent 'null' messages */
if((udata->file_intent & H5F_ACC_RDWR) &&
- H5O_NULL_ID == id && oh->nmesgs > 0 &&
- H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
- oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
+ H5O_NULL_ID == id && oh->nmesgs > 0 &&
+ H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
+ oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
size_t mesgno; /* Current message to operate on */
@@ -1448,7 +1448,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check if we need to extend message table to hold the new message */
if(oh->nmesgs >= oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages")
/* Get pointer to message to set up */
@@ -1470,9 +1470,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* (Usually from future versions of the library) */
if(id >= H5O_UNKNOWN_ID ||
#ifdef H5O_ENABLE_BOGUS
- id == H5O_BOGUS_VALID_ID ||
+ id == H5O_BOGUS_VALID_ID ||
#endif
- NULL == H5O_msg_class_g[id]) {
+ NULL == H5O_msg_class_g[id]) {
H5O_unknown_t *unknown; /* Pointer to "unknown" message info */
@@ -1491,9 +1491,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for "fail if unknown" message flags */
if(((udata->file_intent & H5F_ACC_RDWR) &&
- (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE))
- || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS))
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found")
+ (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE))
+ || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found")
/* Check for "mark if unknown" message flag, etc. */
else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) &&
!(flags & H5O_MSG_FLAG_WAS_UNKNOWN) &&
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 205515a..94301b3 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -77,12 +77,11 @@ H5FL_DEFINE(H5O_chunk_proxy_t);
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_add
+ * Function: H5O__chunk_add
*
- * Purpose: Add new chunk for object header to metadata cache
+ * Purpose: Add new chunk for object header to metadata cache
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -107,7 +106,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno)
/* Allocate space for the object header data structure */
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Increment reference count on object header */
if(H5O__inc_rc(oh) < 0)
@@ -128,6 +127,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno)
/* Insert the chunk proxy into the cache */
if(H5AC_insert_entry(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
+
chk_proxy = NULL;
done:
@@ -146,12 +146,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_protect
+ * Function: H5O_chunk_protect
*
- * Purpose: Protect an object header chunk for modifications
+ * Purpose: Protect an object header chunk for modifications
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -221,12 +220,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_unprotect
+ * Function: H5O__chunk_unprotect
*
- * Purpose: Unprotect an object header chunk after modifications
+ * Purpose: Unprotect an object header chunk after modifications
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -273,12 +271,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_chunk_resize
+ * Function: H5O__chunk_resize
*
- * Purpose: Resize an object header chunk
+ * Purpose: Resize an object header chunk
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -287,11 +284,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
+H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh);
@@ -311,16 +308,15 @@ H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_chunk_resize() */
+} /* end H5O__chunk_resize() */
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_update_idx
+ * Function: H5O__chunk_update_idx
*
- * Purpose: Update the chunk index for a chunk proxy
+ * Purpose: Update the chunk index for a chunk proxy
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -367,12 +363,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_delete
+ * Function: H5O__chunk_delete
*
- * Purpose: Notify metadata cache that a chunk has been deleted
+ * Purpose: Notify metadata cache that a chunk has been deleted
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -413,12 +408,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_dest
+ * Function: H5O__chunk_dest
*
- * Purpose: Destroy a chunk proxy object
+ * Purpose: Destroy a chunk proxy object
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index 2eb27d6..ad54272 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -36,10 +36,10 @@
/* PRIVATE PROTOTYPES */
-static void *H5O_cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
+static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
unsigned *ioflags, size_t p_size, const uint8_t *p);
-static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
-static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
+static herr_t H5O__cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
+static size_t H5O__cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__cont_free(void *mesg);
static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static herr_t H5O__cont_debug(H5F_t *f, const void *_mesg, FILE * stream,
@@ -51,10 +51,10 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{
"hdr continuation", /*message name for debugging */
sizeof(H5O_cont_t), /*native message size */
0, /* messages are sharable? */
- H5O_cont_decode, /*decode message */
- H5O_cont_encode, /*encode message */
+ H5O__cont_decode, /*decode message */
+ H5O__cont_encode, /*encode message */
NULL, /*no copy method */
- H5O_cont_size, /*size of header continuation */
+ H5O__cont_size, /*size of header continuation */
NULL, /*reset method */
H5O__cont_free, /* free method */
H5O__cont_delete, /* file delete method */
@@ -74,7 +74,7 @@ H5FL_DEFINE(H5O_cont_t);
/*-------------------------------------------------------------------------
- * Function: H5O_cont_decode
+ * Function: H5O__cont_decode
*
* Purpose: Decode the raw header continuation message.
*
@@ -89,14 +89,14 @@ H5FL_DEFINE(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static void *
-H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
+H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_cont_t *cont = NULL;
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -116,11 +116,11 @@ H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_cont_decode() */
+} /* end H5O__cont_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_cont_encode
+ * Function: H5O__cont_encode
*
* Purpose: Encodes a continuation message.
*
@@ -133,11 +133,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_cont_t *cont = (const H5O_cont_t *) _mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@@ -151,11 +151,11 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
H5F_ENCODE_LENGTH(f, p, cont->size);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_cont_encode() */
+} /* end H5O__cont_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_cont_size
+ * Function: H5O__cont_size
*
* Purpose: Returns the size of the raw message in bytes not counting
* the message type or size fields, but only the data fields.
@@ -172,18 +172,18 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
*-------------------------------------------------------------------------
*/
static size_t
-H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
+H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
{
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Set return value */
ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */
H5F_SIZEOF_SIZE(f)); /* Continuation header length */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_cont_size() */
+} /* end H5O__cont_size() */
/*-------------------------------------------------------------------------
@@ -256,8 +256,6 @@ done:
* matzke@llnl.gov
* Aug 6 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 8a44902..1ba4901 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Ocopy.c
- * Nov 6 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Ocopy.c
*
- * Purpose: Object copying routines.
+ * Purpose: Object copying routines.
*
*-------------------------------------------------------------------------
*/
@@ -32,19 +30,19 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5HGprivate.h" /* Global Heaps */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Lprivate.h" /* Links */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5HGprivate.h" /* Global Heaps */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Lprivate.h" /* Links */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
/****************/
@@ -79,8 +77,6 @@ typedef struct H5O_copy_search_comm_dt_ud_t {
/* Local Prototypes */
/********************/
-static herr_t H5O__copy(const H5G_loc_t *loc, const char *src_name,
- H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
static herr_t H5O__copy_free_addrmap_cb(void *item, void *key, void *op_data);
static herr_t H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata);
@@ -240,7 +236,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Copy the object */
- if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0)
+ if(H5O_copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
@@ -249,7 +245,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__copy
+ * Function: H5O_copy
*
* Purpose: Private version of H5Ocopy
*
@@ -260,8 +256,8 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
+herr_t
+H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id)
{
H5G_loc_t src_loc; /* Source object group location */
@@ -272,7 +268,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
hbool_t obj_open = FALSE; /* Entry at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_NOAPI_NOINIT
/* Check arguments */
HDassert(loc);
@@ -312,7 +308,7 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__copy() */
+} /* end H5O_copy() */
/*-------------------------------------------------------------------------
@@ -431,7 +427,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
} /* end if */
/* Flush any dirty messages in source object header to update the header chunks */
- if(H5O_flush_msgs(oloc_src->file, oh_src) < 0)
+ if(H5O__flush_msgs(oloc_src->file, oh_src) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages")
/* Allocate the destination object header and fill in header fields */
@@ -766,7 +762,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Make sure we have enough space for new NULL message */
if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs)
- if(H5O_alloc_msgs(oh_dst, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh_dst, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Create null message for [rest of] space in new chunk */
@@ -1215,7 +1211,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name,
/* Insert the new object in the destination file's group */
if(H5L_link(dst_loc, dst_name, &new_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
entry_inserted = TRUE;
done:
@@ -1898,7 +1894,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src,
/* Traverse the destination file, adding committed datatypes to the skip
* list */
- if(H5G_visit(H5F_FILE_ID(oloc_dst->file), "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0)
+ if(H5G_visit(&dst_root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
cpy_info->dst_dt_list_complete = TRUE;
} /* end if */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 1fc95dd..b8190ae 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -76,12 +76,12 @@
#ifdef H5O_DEBUG
/*-------------------------------------------------------------------------
- * Function: H5O_assert
+ * Function: H5O__assert
*
- * Purpose: Sanity check the information for an object header data
+ * Purpose: Sanity check the information for an object header data
* structure.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED (Doesn't fail, just crashes)
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -90,7 +90,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5O_assert(const H5O_t *oh)
+H5O__assert(const H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message to examine */
H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */
@@ -101,7 +101,7 @@ H5O_assert(const H5O_t *oh)
size_t hdr_size; /* Size of header's chunks */
unsigned u, v; /* Local index variables */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Initialize the tracking variables */
hdr_size = 0;
@@ -223,7 +223,7 @@ H5O_assert(const H5O_t *oh)
HDassert(hdr_size == (free_space + meta_space + mesg_space));
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_assert() */
+} /* end H5O__assert() */
#endif /* H5O_DEBUG */
@@ -270,31 +270,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_debug_real
+ * Function: H5O__debug_real
*
- * Purpose: Prints debugging info about an object header.
+ * Purpose: Prints debugging info about an object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Aug 6 1997
*
- * Modifications:
- * Feb. 2009: Vailin Choi
- * Fixed bug in the accumulation of chunk_total
- * Used the appropriate flag when printing creation order tracked/indexed
*-------------------------------------------------------------------------
*/
herr_t
-H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth)
+H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth)
{
size_t mesg_total = 0, chunk_total = 0, gap_total = 0;
unsigned *sequence = NULL;
unsigned i; /* Local index variable */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -323,16 +319,16 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
/* Extra information for later versions */
if(oh->version > H5O_VERSION_1) {
/* Display object's status flags */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute creation order tracked:",
(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No");
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute creation order indexed:",
(oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No");
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute storage phase change values:",
(oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default");
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Timestamps:",
(oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled");
if(oh->flags & ~H5O_HDR_ALL_FLAGS)
@@ -385,14 +381,14 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
for(i = 0, chunk_total = 0; i < oh->nchunks; i++) {
size_t chunk_size;
- HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
+ HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
"Address:",
oh->chunk[i].addr);
/* Decrement chunk 0's size by the object header prefix size */
- if(0 == i) {
+ if(0 == i) {
if(H5F_addr_ne(oh->chunk[i].addr, addr))
HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n");
chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh);
@@ -401,54 +397,53 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
chunk_size = oh->chunk[i].size;
/* Accumulate chunk's size to total */
- chunk_total += chunk_size;
- gap_total += oh->chunk[i].gap;
+ chunk_total += chunk_size;
+ gap_total += oh->chunk[i].gap;
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Size in bytes:",
chunk_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Gap:",
oh->chunk[i].gap);
} /* end for */
/* debug each message */
if(NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0, mesg_total = 0; i < oh->nmesgs; i++) {
const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */
unsigned chunkno; /* Chunk for message */
/* Accumulate message's size to total */
- mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
+ mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
- /* For version 2 object header, add size of "OCHK" for continuation chunk */
- if (oh->mesg[i].type->id == H5O_CONT_ID)
- mesg_total += H5O_SIZEOF_CHKHDR_OH(oh);
+ /* For version 2 object header, add size of "OCHK" for continuation chunk */
+ if(oh->mesg[i].type->id == H5O_CONT_ID)
+ mesg_total += H5O_SIZEOF_CHKHDR_OH(oh);
- HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
+ HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
- /* check for bad message id */
- if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) {
- HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n",
- oh->mesg[i].type->id);
- continue;
- } /* end if */
+ /* check for bad message id */
+ if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) {
+ HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id);
+ continue;
+ } /* end if */
- /* message name and size */
- HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n",
+ /* message name and size */
+ HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n",
indent + 3, "", MAX(0, fwidth - 3),
"Message ID (sequence number):",
(unsigned) (oh->mesg[i].type->id),
oh->mesg[i].type->name,
sequence[oh->mesg[i].type->id]++);
- HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3),
"Dirty:",
oh->mesg[i].dirty);
HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3),
"Message flags:");
- if(oh->mesg[i].flags) {
+ if(oh->mesg[i].flags) {
hbool_t flag_printed = FALSE;
/* Sanity check that all flags in format are covered below */
@@ -497,39 +492,40 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
} /* end if */
else
HDfprintf(stream, "<none>\n");
- HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3),
+
+ HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3),
"Chunk number:",
oh->mesg[i].chunkno);
- chunkno = oh->mesg[i].chunkno;
- if(chunkno >= oh->nchunks)
- HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
- HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
+ chunkno = oh->mesg[i].chunkno;
+ if(chunkno >= oh->nchunks)
+ HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
+ HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
"Raw message data (offset, size) in chunk:",
(size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image),
oh->mesg[i].raw_size);
- /* check the size */
- if((oh->mesg[i].raw + oh->mesg[i].raw_size >
+ /* check the size */
+ if((oh->mesg[i].raw + oh->mesg[i].raw_size >
oh->chunk[chunkno].image + oh->chunk[chunkno].size) ||
(oh->mesg[i].raw < oh->chunk[chunkno].image))
- HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
+ HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
- /* decode the message */
- debug_type = oh->mesg[i].type;
- if(NULL == oh->mesg[i].native && debug_type->decode)
+ /* decode the message */
+ debug_type = oh->mesg[i].type;
+ if(NULL == oh->mesg[i].native && debug_type->decode)
H5O_LOAD_NATIVE(f, H5O_DECODEIO_NOCHANGE, oh, &oh->mesg[i], FAIL)
- /* print the message */
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ /* print the message */
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
"Message Information:");
- if(debug_type->debug && oh->mesg[i].native != NULL)
- (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6));
- else
- HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
+ if(debug_type->debug && oh->mesg[i].native != NULL)
+ (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6));
+ else
+ HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
} /* end for */
if((mesg_total + gap_total) != chunk_total)
- HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
+ HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
done:
/* Release resources */
@@ -537,7 +533,7 @@ done:
sequence = (unsigned *)H5MM_xfree(sequence);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_debug_real() */
+} /* end H5O__debug_real() */
/*-------------------------------------------------------------------------
@@ -575,14 +571,15 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
loc.holding_file = FALSE;
if(NULL == (oh = H5O_protect(&loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* debug */
- H5O_debug_real(f, oh, addr, stream, indent, fwidth);
+ if(H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed")
done:
if(oh && H5O_unprotect(&loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_debug() */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index c73529e..3441d8b 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -98,11 +98,11 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
/* Retrieve the object's information */
if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -131,12 +131,14 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
- /* Verify access property list and set up collective metadata if appropriate */
+ /* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
@@ -169,8 +171,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
{
H5G_loc_t loc; /* Location of group */
H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
@@ -243,12 +243,15 @@ herr_t
H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate_t op, void *op_data)
{
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data);
/* Check args */
+ if(H5G_loc(obj_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -256,8 +259,8 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ /* Visit the objects */
+ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -301,15 +304,20 @@ herr_t
H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data,
lapl_id);
/* Check args */
- if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL")
+ if(!*obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -321,8 +329,8 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ /* Visit the objects */
+ if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index b8eb4a7..28970d1 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -15,13 +15,13 @@
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Gprivate.h" /* Groups */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5Tpkg.h" /* Datatypes */
#include "H5VMprivate.h" /* Vectors and arrays */
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 8a6004d..c131c76 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -754,8 +754,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
} /* end if */
fill->size = 0;
if(fill->type) {
- (void)H5T_close_real(fill->type);
- fill->type = NULL;
+ (void)H5T_close_real(fill->type);
+ fill->type = NULL;
} /* end if */
done:
@@ -1008,7 +1008,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed)
* Can we convert between source and destination data types?
*/
if(NULL == (tpath = H5T_path_find(fill->type, dset_type)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index d8c9530..2302d4c 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -41,11 +41,9 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Objects */
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5O__flush(hid_t obj_id);
static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag);
static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
H5G_loc_t *obj_loc);
@@ -58,11 +56,11 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
/*-------------------------------------------------------------------------
- * Function: H5Oflush
+ * Function: H5Oflush
*
- * Purpose: Flushes all buffers associated with an object to disk.
+ * Purpose: Flushes all buffers associated with an object to disk.
*
- * Return: Non-negative on success, negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Mike McGreevy
* May 19, 2010
@@ -72,17 +70,22 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
herr_t
H5Oflush(hid_t obj_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", obj_id);
+ /* Check args */
+ if(NULL == (oloc = H5O_get_loc(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(obj_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal routine */
- if(H5O__flush(obj_id) < 0)
+ /* Flush the object */
+ if(H5O_flush(oloc, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
done:
@@ -91,88 +94,83 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_flush_common
+ * Function: H5O_flush
*
- * Purpose: Flushes the object's metadata
- * Invokes the user-defined callback if there is one.
+ * Purpose: Internal routine to flush an object
*
- * Return: Non-negative on success, negative on failure
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi; Dec 2013
+ * Programmer: Quincey Koziol
+ * December 29, 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id)
+H5O_flush(H5O_loc_t *oloc, hid_t obj_id)
{
- haddr_t tag = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ void *obj_ptr; /* Pointer to object */
+ const H5O_obj_class_t *obj_class; /* Class of object */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Retrieve tag for object */
- if(H5O__oh_tag(oloc, &tag) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata")
+ /* Get the object pointer */
+ if(NULL == (obj_ptr = H5I_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- /* Flush metadata based on tag value of the object */
- if(H5F_flush_tagged_metadata(oloc->file, tag) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
+ /* Get the object class */
+ if(NULL == (obj_class = H5O__obj_class(oloc)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class")
- /* Check to invoke callback */
- if(H5F_object_flush_cb(oloc->file, obj_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback")
+ /* Flush the object of this class */
+ if(obj_class->flush && obj_class->flush(obj_ptr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
+
+ /* Flush the object metadata and invoke flush callback */
+ if(H5O_flush_common(oloc, obj_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_flush_common() */
+} /* end H5O_flush() */
/*-------------------------------------------------------------------------
- * Function: H5O__flush
+ * Function: H5O_flush_common
*
- * Purpose: Internal routine to flush an object
+ * Purpose: Flushes the object's metadata
+ * Invokes the user-defined callback if there is one.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Non-negative on success, negative on failure
*
- * Programmer: Quincey Koziol
- * December 29, 2017
+ * Programmer: Vailin Choi; Dec 2013
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5O__flush(hid_t obj_id)
+herr_t
+H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id)
{
- H5O_loc_t *oloc; /* Object location */
- void *obj_ptr; /* Pointer to object */
- const H5O_obj_class_t *obj_class; /* Class of object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check args */
- if(NULL == (oloc = H5O_get_loc(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
+ haddr_t tag = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Get the object pointer */
- if(NULL == (obj_ptr = H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ FUNC_ENTER_NOAPI(FAIL)
- /* Get the object class */
- if(NULL == (obj_class = H5O__obj_class(oloc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class")
+ /* Retrieve tag for object */
+ if(H5O__oh_tag(oloc, &tag) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata")
- /* Flush the object of this class */
- if(obj_class->flush && obj_class->flush(obj_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
+ /* Flush metadata based on tag value of the object */
+ if(H5F_flush_tagged_metadata(oloc->file, tag) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
- /* Flush the object metadata and invoke flush callback */
- if(H5O_flush_common(oloc, obj_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
+ /* Check to invoke callback */
+ if(H5F_object_flush_cb(oloc->file, obj_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__flush() */
+} /* end H5O_flush_common() */
/*-------------------------------------------------------------------------
@@ -219,9 +217,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Orefresh
*
- * Purpose: Refreshes all buffers associated with an object.
+ * Purpose: Refreshes all buffers associated with an object.
*
- * Return: Non-negative on success, negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Mike McGreevy
* July 28, 2010
@@ -239,13 +237,13 @@ H5Orefresh(hid_t oid)
/* Check args */
if(NULL == (oloc = H5O_get_loc(oid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(oid) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal routine */
+ /* Refresh the object */
if(H5O_refresh_metadata(oid, *oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
@@ -354,8 +352,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
/* Get object's type */
if(H5I_get_type(oid) == H5I_DATASET)
- if(H5D_mult_refresh_close(oid) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
+ if(H5D_mult_refresh_close(oid) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
/* Retrieve tag for object */
if(H5O__oh_tag(&oloc, &tag) < 0)
@@ -379,8 +377,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
/* Re-cork object with tag */
if(corked)
- if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object")
+ if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object")
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -404,12 +402,15 @@ done:
herr_t
H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
{
- void *object = NULL; /* Dataset for this operation */
+ void *object = NULL; /* Object for this operation */
H5I_type_t type; /* Type of object for the ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
+ /* Sanity check */
+ HDassert(obj_loc);
+
/* Get object's type */
type = H5I_get_type(oid);
@@ -455,7 +456,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
/* Re-register ID for the object */
if((H5I_register_with_id(type, object, TRUE, oid)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object atom")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh")
done:
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index b75a9c5..4b34a52 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -113,7 +113,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* Allocate space for message */
if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the flags for the group */
flags = *p++;
@@ -231,7 +231,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(ginfo);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_ginfo_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
*dest = *ginfo;
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 49d7835..44809e1 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -42,7 +42,6 @@
#include "H5MMprivate.h" /* Memory management */
#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared object header messages */
/****************/
@@ -514,12 +513,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_open_name
+ * Function: H5O_open_name
*
- * Purpose: Opens an object within an HDF5 file.
+ * Purpose: Opens an object within an HDF5 file.
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: Open object identifier
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* March 5 2007
@@ -552,7 +551,7 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref)
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O__open_by_loc(&obj_loc, app_ref)) < 0)
+ if((ret_value = H5O_open_by_loc(&obj_loc, app_ref)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
@@ -565,12 +564,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__open_by_idx
+ * Function: H5O_open_by_idx
*
* Purpose: Internal routine to open an object by index within group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Open object identifier
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* December 28, 2017
@@ -578,7 +577,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n)
{
H5G_loc_t obj_loc; /* Location used to open group */
@@ -587,7 +586,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
hbool_t loc_found = FALSE; /* Entry at 'name' found */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check arguments */
HDassert(loc);
@@ -603,7 +602,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
+ if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
@@ -613,16 +612,16 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__open_by_idx() */
+} /* end H5O_open_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5O__open_by_addr
+ * Function: H5O_open_by_addr
*
* Purpose: Internal routine to open an object by its address
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Open object identifier
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* December 28, 2017
@@ -630,14 +629,14 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
+H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr)
{
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check arguments */
HDassert(loc);
@@ -651,21 +650,21 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */
/* Open the object */
- if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
+ if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__open_by_addr() */
+} /* end H5O_open_by_addr() */
/*-------------------------------------------------------------------------
- * Function: H5O__open_by_loc
+ * Function: H5O_open_by_loc
*
- * Purpose: Opens an object and returns an ID given its group loction.
+ * Purpose: Opens an object and returns an ID given its group loction.
*
- * Return: Success: Open object identifier
- * Failure: Negative
+ * Return: Success: Open object identifier
+ * Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 25 2006
@@ -673,12 +672,12 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
+H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
{
const H5O_obj_class_t *obj_class; /* Class of object for location */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
HDassert(obj_loc);
@@ -693,7 +692,7 @@ H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__open_by_loc() */
+} /* end H5O_open_by_loc() */
/*-------------------------------------------------------------------------
@@ -735,10 +734,9 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
#ifdef H5O_DEBUG
if(H5DEBUG(O)) {
if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
- HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
- loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
- else
- HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
+ HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
+ else
+ HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
}
#endif
@@ -761,14 +759,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__link_oh
+ * Function: H5O__link_oh
*
- * Purpose: Adjust the link count for an open object header by adding
- * ADJUST to the link count.
+ * Purpose: Adjust the link count for an open object header by adding
+ * ADJUST to the link count.
*
- * Return: Success: New link count
+ * Return: Success: New link count
*
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Robb Matzke
* matzke@llnl.gov
@@ -794,14 +792,14 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(adjust < 0) {
/* Check for too large of an adjustment */
if((unsigned)(-adjust) > oh->nlink)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative")
/* Adjust the link count for the object header */
oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty")
/* Check if the object should be deleted */
if(oh->nlink == 0) {
@@ -809,7 +807,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(H5FO_opened(f, addr) != NULL) {
/* Flag the object to be deleted when it's closed */
if(H5FO_mark(f, addr, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion")
} /* end if */
else {
/* Mark the object header for deletion */
@@ -824,7 +822,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(H5FO_marked(f, addr)) {
/* Remove "delete me" flag on the object */
if(H5FO_mark(f, addr, FALSE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion")
} /* end if */
} /* end if */
@@ -833,7 +831,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty")
} /* end if */
/* Check for operations on refcount message */
@@ -843,7 +841,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
/* Check for removing refcount message */
if(oh->nlink <= 1) {
if(H5O__msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message")
oh->has_refcount_msg = FALSE;
} /* end if */
/* Update refcount message with new link count */
@@ -851,7 +849,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
H5O_refcount_t refcount = oh->nlink;
if(H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message")
} /* end else */
} /* end if */
else {
@@ -860,7 +858,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
H5O_refcount_t refcount = oh->nlink;
if(H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message")
oh->has_refcount_msg = TRUE;
} /* end if */
} /* end else */
@@ -1061,7 +1059,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks)
} /* end if */
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
/* Pin the other chunks also when requested, so that the object header
@@ -1325,8 +1323,9 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
chk_dirtied = TRUE;
} /* end if */
else {
- /* XXX: For now, update access time & change fields in the object header */
- /* (will need to add some code to update modification time appropriately) */
+ /* XXX: For now, update access time & change fields in the object header
+ * (will need to add some code to update modification time appropriately)
+ */
oh->atime = oh->ctime = now;
/* Mark object header as dirty in cache */
@@ -1426,25 +1425,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
H5O_bogus_t *bogus; /* Pointer to the bogus information */
/* Allocate the native message in memory */
- if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
+ if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
/* Update the native value */
bogus->u = H5O_BOGUS_VALUE;
- if(bogus_id == H5O_BOGUS_VALID_ID)
- type = H5O_MSG_BOGUS_VALID;
- else if(bogus_id == H5O_BOGUS_INVALID_ID)
- type = H5O_MSG_BOGUS_INVALID;
- else
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
+ if(bogus_id == H5O_BOGUS_VALID_ID)
+ type = H5O_MSG_BOGUS_VALID;
+ else if(bogus_id == H5O_BOGUS_INVALID_ID)
+ type = H5O_MSG_BOGUS_INVALID;
+ else
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
/* Allocate space in the object header for bogus message */
- if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
+ if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
/* Point to "bogus" information (take it over) */
- oh->mesg[idx].native = bogus;
+ oh->mesg[idx].native = bogus;
/* Set the appropriate flags for the message */
oh->mesg[idx].flags = mesg_flags;
@@ -1634,23 +1633,23 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type)
/* Set type to "unknown" */
*obj_type = H5O_TYPE_UNKNOWN;
- } /* end if */
+ }
else {
/* Set object type */
*obj_type = obj_class->type;
- } /* end else */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__obj_type_real() */
/*-------------------------------------------------------------------------
- * Function: H5O__obj_class
+ * Function: H5O__obj_class
*
- * Purpose: Returns the class of object pointed to by `loc'.
+ * Purpose: Returns the class of object pointed to by 'loc'.
*
- * Return: Success: An object class
- * Failure: NULL
+ * Return: Success: An object class
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, November 6, 2006
@@ -1663,7 +1662,7 @@ H5O__obj_class(const H5O_loc_t *loc)
H5O_t *oh = NULL; /* Object header for location */
const H5O_obj_class_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC_TAG(loc->addr)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Load the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
@@ -1675,7 +1674,7 @@ H5O__obj_class(const H5O_loc_t *loc)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__obj_class() */
@@ -1714,7 +1713,7 @@ H5O__obj_class_real(const H5O_t *oh)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
else if(isa)
HGOTO_DONE(H5O_obj_class_g[i - 1])
- } /* end for */
+ }
if(0 == i)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
@@ -2164,7 +2163,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
/* Retrieve # of attributes */
if(fields & H5O_INFO_NUM_ATTRS)
- if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
+ if(H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Get B-tree & heap metadata storage size, if requested */
@@ -2580,7 +2579,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__visit
+ * Function: H5O__visit
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -2601,12 +2600,12 @@ done:
* Note: Add a parameter "fields" to indicate selection of object info.
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
* Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@@ -2614,17 +2613,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields)
{
H5O_iter_visit_ud_t udata; /* User data for callback */
- H5G_loc_t loc; /* Location of reference object */
H5G_loc_t obj_loc; /* Location used to open object */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
H5O_info_t oinfo; /* Object info struct */
- hid_t obj_id = (-1); /* ID of object */
+ hid_t obj_id = H5I_INVALID_HID; /* ID of object */
herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2633,8 +2631,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HDmemset(&udata, 0, sizeof(udata));
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HDassert(loc);
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -2642,7 +2639,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
+ if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
@@ -2652,7 +2649,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Open the object */
/* (Takes ownership of the obj_loc information) */
- if((obj_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
+ if((obj_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* Make callback for starting object */
@@ -2698,20 +2695,21 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Add to list of visited objects */
if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list")
- } /* end if */
+ }
/* Call internal group visitation routine */
- if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
+ if((ret_value = H5G_visit(&start_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end if */
done:
- if(obj_id > 0) {
+ if(obj_id != H5I_INVALID_HID) {
if(H5I_dec_app_ref(obj_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
- } /* end if */
+ }
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+
if(udata.visited)
H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL);
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 4903d9f..9827b6a 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -44,13 +44,13 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void
static herr_t H5O__linfo_free(void *_mesg);
static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src,
- H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
- H5O_copy_t *cpy_info, void *udata);
+ H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
+ H5O_copy_t *cpy_info, void *udata);
static herr_t H5O__linfo_post_copy_file(const H5O_loc_t *parent_src_oloc,
- const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
- unsigned *mesg_flags, H5O_copy_t *cpy_info);
-static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg,
- FILE * stream, int indent, int fwidth);
+ const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
+ unsigned *mesg_flags, H5O_copy_t *cpy_info);
+static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, FILE * stream,
+ int indent, int fwidth);
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index e156dcd..d6e3dce 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -127,11 +127,11 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Go append message to object header */
if(H5O_msg_append_oh(loc->file, oh, type_id, mesg_flags, update_flags, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
done:
if(oh && H5O_unpin(oh) < 0)
@@ -225,7 +225,7 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message")
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
@@ -276,7 +276,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" modify routine */
if(H5O__msg_write_real(loc->file, oh, type, mesg_flags, update_flags, mesg) < 0)
@@ -384,7 +384,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
/* Check for modifying a constant message */
if(!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT))
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
/* This message is shared, but it's being modified. */
else if((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) {
htri_t status; /* Status of "try share" call */
@@ -427,7 +427,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
@@ -474,15 +474,15 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
/* Call the "real" read routine */
if(NULL == (ret_value = H5O_msg_read_oh(loc->file, oh, type_id, mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message")
+ HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message")
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_msg_read() */
@@ -616,12 +616,12 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native)
HDassert(type);
if(native) {
- if(type->reset) {
- if((type->reset)(native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
- } /* end if */
+ if(type->reset) {
+ if((type->reset)(native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
+ } /* end if */
else
- HDmemset(native, 0, type->native_size);
+ HDmemset(native, 0, type->native_size);
} /* end if */
done:
@@ -658,7 +658,7 @@ H5O_msg_free(unsigned type_id, void *mesg)
HDassert(type);
/* Call the "real" free routine */
- ret_value = H5O__msg_free_real(type, mesg);
+ ret_value = H5O_msg_free_real(type, mesg);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_free() */
@@ -667,7 +667,7 @@ H5O_msg_free(unsigned type_id, void *mesg)
/*-------------------------------------------------------------------------
* Function: H5O__msg_free_mesg
*
- * Purpose: Call H5O__msg_free_real() on a message.
+ * Purpose: Call H5O_msg_free_real() on a message.
*
* Return: Non-negative on success/Negative on failure
*
@@ -685,14 +685,14 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg)
HDassert(mesg);
/* Free any native information */
- mesg->native = H5O__msg_free_real(mesg->type, mesg->native);
+ mesg->native = H5O_msg_free_real(mesg->type, mesg->native);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__msg_free_mesg() */
/*-------------------------------------------------------------------------
- * Function: H5O__msg_free_real
+ * Function: H5O_msg_free_real
*
* Purpose: Similar to H5O_msg_reset() except it also frees the message
* pointer.
@@ -706,9 +706,9 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg)
*-------------------------------------------------------------------------
*/
void *
-H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native)
+H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native)
{
- FUNC_ENTER_PACKAGE_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
HDassert(type);
@@ -722,7 +722,7 @@ H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native)
} /* end if */
FUNC_LEAVE_NOAPI(NULL)
-} /* end H5O__msg_free_real() */
+} /* end H5O_msg_free_real() */
/*-------------------------------------------------------------------------
@@ -798,22 +798,22 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id)
/* Load the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Count the messages of the correct type */
- msg_count = H5O_msg_count_real(oh, type);
+ msg_count = H5O__msg_count_real(oh, type);
H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned);
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_count() */
/*-------------------------------------------------------------------------
- * Function: H5O_msg_count_real
+ * Function: H5O__msg_count_real
*
* Purpose: Counts the number of messages in an object header which are a
* certain type.
@@ -828,12 +828,12 @@ done:
*-------------------------------------------------------------------------
*/
unsigned
-H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
+H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
{
unsigned u; /* Local index variable */
unsigned ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(oh);
@@ -841,11 +841,11 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
/* Loop over all messages, counting the ones of the type looked for */
for(u = ret_value = 0; u < oh->nmesgs; u++)
- if(oh->mesg[u].type == type)
+ if(oh->mesg[u].type == type)
ret_value++;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_msg_count_real() */
+} /* end H5O__msg_count_real() */
/*-------------------------------------------------------------------------
@@ -976,11 +976,11 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" remove routine */
if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
done:
if(oh && H5O_unpin(oh) < 0)
@@ -1028,11 +1028,11 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" remove routine */
if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
done:
if(oh && H5O_unpin(oh) < 0)
@@ -1090,7 +1090,7 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
* (OK to remove constant messages - QAK)
*/
/* Convert message into a null message */
- if(H5O_release_mesg(udata->f, oh, mesg, udata->adj_link) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, udata->adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message")
/* Indicate that the object header was modified */
@@ -1315,8 +1315,8 @@ done:
* message removal)
*/
if(oh_modified & H5O_MODIFY_CONDENSE)
- if(H5O_condense_header(f, oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
+ if(H5O__condense_header(f, oh) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
/* Mark object header as changed */
if(H5O_touch_oh(f, oh, FALSE) < 0)
@@ -1973,7 +1973,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type,
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx_msg->chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
/* Reset existing native information for the header's message */
H5O__msg_reset_real(type, idx_msg->native);
@@ -1991,7 +1991,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type,
/* Release chunk */
if(H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
chk_proxy = NULL;
/* Update the modification time, if requested */
@@ -2197,7 +2197,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_flush_msgs
+ * Function: H5O__flush_msgs
*
* Purpose: Flushes messages for object header.
*
@@ -2210,13 +2210,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_flush_msgs(H5F_t *f, H5O_t *oh)
+H5O__flush_msgs(H5F_t *f, H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -2240,7 +2240,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_flush_msgs() */
+} /* end H5O__flush_msgs() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index db1d8d7..172f9ab 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -442,8 +442,6 @@ H5O__mtime_free(void *mesg)
* matzke@llnl.gov
* Jul 24 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -454,7 +452,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream,
struct tm *tm;
char buf[128];
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 059b46a..ea654d2 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -63,7 +63,7 @@
)
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
-#define H5O_ALIGN_F(F, X) \
+#define H5O_ALIGN_F(F, X) \
H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X)
/* Size of checksum (on disk) */
@@ -555,15 +555,11 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
/* Package-local function prototypes */
-H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr);
-H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref);
H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc);
H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted);
H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields);
-H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields);
H5_DLL herr_t H5O__inc_rc(H5O_t *oh);
H5_DLL herr_t H5O__dec_rc(H5O_t *oh);
@@ -576,9 +572,8 @@ H5_DLL herr_t H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
unsigned mesg_flags, unsigned update_flags, void *mesg);
-H5_DLL void *H5O__msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL herr_t H5O__msg_free_mesg(H5O_mesg_t *mesg);
-H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
+H5_DLL unsigned H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
H5_DLL herr_t H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link);
H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
@@ -586,17 +581,15 @@ H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata);
H5_DLL herr_t H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
const H5O_mesg_operator_t *op, void *op_data);
-H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
-H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
+H5_DLL herr_t H5O__flush_msgs(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O__delete_mesg(H5F_t *f, H5O_t *open_oh, H5O_mesg_t *mesg);
/* Object header chunk routines */
H5_DLL herr_t H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno);
H5_DLL H5O_chunk_proxy_t *H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx);
-H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy,
- hbool_t chk_dirtied);
+H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied);
H5_DLL herr_t H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx);
-H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
+H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
@@ -604,20 +597,20 @@ H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info);
/* Object header allocation routines */
-H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc);
+H5_DLL herr_t H5O__alloc_msgs(H5O_t *oh, size_t min_alloc);
H5_DLL herr_t H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size,
size_t found_null, const H5O_msg_alloc_info_t *found_msg, size_t *new_idx);
H5_DLL herr_t H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
const void *mesg, size_t *mesg_idx);
-H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh);
-H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg,
+H5_DLL herr_t H5O__condense_header(H5F_t *f, H5O_t *oh);
+H5_DLL herr_t H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg,
hbool_t adj_link);
/* Shared object operators */
-H5_DLL void * H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
+H5_DLL void * H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const uint8_t *buf, const H5O_msg_class_t *type);
-H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
-H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
+H5_DLL herr_t H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
+H5_DLL size_t H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh,
const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_link(H5F_t *f, H5O_t *open_oh,
@@ -629,17 +622,18 @@ H5_DLL herr_t H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
H5_DLL herr_t H5O__shared_post_copy_file (H5F_t *f,
const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src,
H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info);
-H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream,
+H5_DLL herr_t H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream,
int indent, int fwidth);
/* Attribute message operators */
H5_DLL herr_t H5O__attr_reset(void *_mesg);
H5_DLL herr_t H5O__attr_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
H5_DLL herr_t H5O__attr_link(H5F_t *f, H5O_t *open_oh, void *_mesg);
-H5_DLL herr_t H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs);
+H5_DLL herr_t H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs);
/* Arrays of versions for:
- Object header, Attribute/Fill value/Filter pipeline messages */
+ * Object header, Attribute/Fill value/Filter pipeline messages
+ */
/* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */
H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
@@ -661,10 +655,9 @@ H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type);
/* Object header debugging routines */
#ifdef H5O_DEBUG
-H5_DLL herr_t H5O_assert(const H5O_t *oh);
+H5_DLL herr_t H5O__assert(const H5O_t *oh);
#endif /* H5O_DEBUG */
-H5_DLL herr_t H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream,
- int indent, int fwidth);
+H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth);
#endif /* _H5Opkg_H */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 10063d5..4a401b5 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -866,10 +866,13 @@ H5_DLL herr_t H5O_init(void);
H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc,
hid_t ocpl_id, H5O_loc_t *loc/*out*/);
H5_DLL herr_t H5O_open(H5O_loc_t *loc);
+H5_DLL hid_t H5O_open_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL hid_t H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr);
+H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref);
H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/);
H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust);
-H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags,
- hbool_t pin_all_chunks);
+H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks);
H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc);
H5_DLL herr_t H5O_unpin(H5O_t *oh);
H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc);
@@ -900,10 +903,12 @@ H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id,
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id,
unsigned mesg_flags, unsigned update_flags, void *mesg);
+H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg);
H5_DLL void *H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg);
H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native);
H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg);
+H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id);
H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id);
@@ -937,6 +942,7 @@ H5_DLL herr_t H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id,
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags);
/* Object metadata flush/refresh routines */
+H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id);
H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id);
H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc);
H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr);
@@ -948,6 +954,8 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst
H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref,
H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
H5O_copy_t *cpy_info);
+H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name,
+ H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
/* Debugging routines */
H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth);
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 328ba4b..4fc0488 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -69,6 +69,10 @@
/********************/
/* Local Prototypes */
/********************/
+static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
+ const H5O_shared_t *shared, const H5O_msg_class_t *type);
+static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh,
+ const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust);
/*********************/
@@ -88,14 +92,14 @@
/*-------------------------------------------------------------------------
- * Function: H5O_shared_read
+ * Function: H5O__shared_read
*
- * Purpose: Reads a message referred to by a shared message.
+ * Purpose: Reads a message referred to by a shared message.
*
- * Return: Success: Ptr to message in native format. The message
- * should be freed by calling H5O_msg_reset().
+ * Return: Success: Ptr to message in native format. The message
+ * should be freed by calling H5O_msg_reset().
*
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -104,7 +108,7 @@
*-------------------------------------------------------------------------
*/
static void *
-H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
+H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const H5O_shared_t *shared, const H5O_msg_class_t *type)
{
H5HF_t *fheap = NULL;
@@ -112,7 +116,7 @@ H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -194,13 +198,13 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_read() */
+} /* end H5O__shared_read() */
/*-------------------------------------------------------------------------
- * Function: H5O__shared_link_adj
+ * Function: H5O__shared_link_adj
*
- * Purpose: Changes the link count for the object referenced by a shared
+ * Purpose: Changes the link count for the object referenced by a shared
* message.
*
* This function changes the object header link count and is
@@ -209,8 +213,7 @@ done:
* reference count is stored in the file-wide shared message
* index and is changed in a different place in the code.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -294,11 +297,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_shared_decode
+ * Function: H5O__shared_decode
*
- * Purpose: Decodes a shared object message
+ * Purpose: Decodes a shared object message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: A buffer containing the decoded shared object
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, January 22, 2007
@@ -306,14 +310,14 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
+H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
const H5O_msg_class_t *type)
{
H5O_shared_t sh_mesg; /* Shared message info */
unsigned version; /* Shared message version */
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(f);
@@ -373,20 +377,20 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu
sh_mesg.msg_type_id = type->id;
/* Retrieve actual message, through decoded shared message info */
- if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type)))
+ if(NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_decode() */
+} /* end H5O__shared_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_shared_encode
+ * Function: H5O__shared_encode
*
- * Purpose: Encodes message _MESG into buffer BUF.
+ * Purpose: Encodes message _MESG into buffer BUF.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, April 2, 1998
@@ -394,11 +398,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
+H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
{
unsigned version;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(f);
@@ -427,15 +431,15 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me
H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_shared_encode() */
+} /* end H5O__shared_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_set_shared
+ * Function: H5O_set_shared
*
- * Purpose: Sets the shared component for a message.
+ * Purpose: Sets the shared component for a message.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -460,12 +464,12 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
/*-------------------------------------------------------------------------
- * Function: H5O_shared_size
+ * Function: H5O__shared_size
*
- * Purpose: Returns the length of a shared object message.
+ * Purpose: Returns the length of a shared object message.
*
- * Return: Success: Length
- * Failure: 0
+ * Return: Success: Length
+ * Failure: 0
*
* Programmer: Robb Matzke
* Thursday, April 2, 1998
@@ -473,26 +477,26 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
*-------------------------------------------------------------------------
*/
size_t
-H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
+H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
{
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) {
- ret_value = (size_t)1 + /*version */
- (size_t)1 + /*the type field */
- (size_t)H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */
+ ret_value = (size_t)1 + /* Version */
+ (size_t)1 + /* Type field */
+ (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */
} /* end if */
else {
HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM);
- ret_value = 1 + /*version */
- 1 + /*the type field */
- H5O_FHEAP_ID_LEN; /* Shared in the heap */
+ ret_value = 1 + /* Version */
+ 1 + /* Type field */
+ H5O_FHEAP_ID_LEN; /* Shared in the heap */
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_size() */
+} /* end H5O__shared_size() */
/*-------------------------------------------------------------------------
@@ -500,7 +504,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
*
* Purpose: Free file space referenced by message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -521,7 +525,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
/*
* Committed datatypes increment the OH of the original message when they
- * are written (in H5O__shared_link) and decrement it here.
+ * are written (in H5O_shared_link) and decrement it here.
* SOHMs in the heap behave differently; their refcount is incremented
* during H5SM_share when they are going to be written (in H5O_msg_append
* or H5O_msg_write). Their refcount in the SOHM indexes still needs to
@@ -543,7 +547,7 @@ done:
* Purpose: Increment reference count on any objects referenced by
* message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -558,7 +562,7 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
FUNC_ENTER_PACKAGE
- /* check args */
+ /* Check args */
HDassert(f);
HDassert(sh_mesg);
@@ -576,8 +580,7 @@ done:
*
* Purpose: Copies a message from _MESG to _DEST in file
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* January 22, 2007
@@ -647,7 +650,7 @@ done:
* to complish that is to delete the old message and write the
* new message with the correct values.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* xcao@hdfgroup.org
@@ -696,7 +699,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_shared_debug
+ * Function: H5O__shared_debug
*
* Purpose: Prints debugging info for the message
*
@@ -708,9 +711,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
+H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(mesg);
@@ -756,5 +759,5 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_shared_debug() */
+} /* end H5O__shared_debug() */
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 2960fef..8040a6a 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
/* Check for shared message */
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Retrieve native message info indirectly through shared message */
- if(NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE)))
+ if(NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* We currently do not support automatically fixing shared messages */
@@ -129,13 +129,13 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Encode shared message into buffer */
- if(H5O_shared_encode(f, p, sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
+ if(H5O__shared_encode(f, p, sh_mesg) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
} /* end if */
else {
/* Encode native message directly */
if(H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message")
} /* end else */
done:
@@ -181,13 +181,13 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Retrieve encoded size of shared message */
- if(0 == (ret_value = H5O_shared_size(f, sh_mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
+ if(0 == (ret_value = H5O__shared_size(f, sh_mesg)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
} /* end if */
else {
/* Retrieve size of native message directly */
if(0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message")
} /* end else */
done:
@@ -232,13 +232,13 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Decrement the reference count on the shared message/object */
if(H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_DELETE_REAL
else {
/* Decrement the reference count on the native message directly */
if(H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
} /* end else */
#endif /* H5O_SHARED_DELETE_REAL */
@@ -284,13 +284,13 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Increment the reference count on the shared message/object */
if(H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_LINK_REAL
else {
/* Increment the reference count on the native message directly */
if(H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
} /* end else */
#endif /* H5O_SHARED_LINK_REAL */
@@ -473,7 +473,7 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent,
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type)) {
/* Print shared message information */
- if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0)
+ if(H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info")
} /* end if */
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 87fb771..0f14a4b 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -37,9 +37,9 @@
/* PRIVATE PROTOTYPES */
static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
unsigned *ioflags, size_t p_size, const uint8_t *p);
-static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
-static void *H5O_stab_copy(const void *_mesg, void *_dest);
-static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
+static herr_t H5O__stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
+static void *H5O__stab_copy(const void *_mesg, void *_dest);
+static size_t H5O__stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__stab_free(void *_mesg);
static herr_t H5O__stab_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static void *H5O__stab_copy_file(H5F_t *file_src, void *native_src,
@@ -58,9 +58,9 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{
sizeof(H5O_stab_t), /*native message size */
0, /* messages are sharable? */
H5O__stab_decode, /*decode message */
- H5O_stab_encode, /*encode message */
- H5O_stab_copy, /*copy the native value */
- H5O_stab_size, /*size of symbol table entry */
+ H5O__stab_encode, /*encode message */
+ H5O__stab_copy, /*copy the native value */
+ H5O__stab_size, /*size of symbol table entry */
NULL, /*default reset method */
H5O__stab_free, /* free method */
H5O__stab_delete, /* file delete method */
@@ -111,7 +111,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* decode */
if(NULL == (stab = H5FL_CALLOC(H5O_stab_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
H5F_addr_decode(f, &p, &(stab->btree_addr));
H5F_addr_decode(f, &p, &(stab->heap_addr));
@@ -129,7 +129,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_stab_encode
+ * Function: H5O__stab_encode
*
* Purpose: Encodes a symbol table message.
*
@@ -142,11 +142,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@@ -158,11 +158,11 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
H5F_addr_encode(f, &p, stab->heap_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5O__stab_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_stab_copy
+ * Function: H5O__stab_copy
*
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
* necessary.
@@ -178,18 +178,18 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
*-------------------------------------------------------------------------
*/
static void *
-H5O_stab_copy(const void *_mesg, void *_dest)
+H5O__stab_copy(const void *_mesg, void *_dest)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
H5O_stab_t *dest = (H5O_stab_t *) _dest;
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(stab);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
/* copy */
*dest = *stab;
@@ -199,11 +199,11 @@ H5O_stab_copy(const void *_mesg, void *_dest)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_stab_copy() */
+} /* end H5O__stab_copy() */
/*-------------------------------------------------------------------------
- * Function: H5O_stab_size
+ * Function: H5O__stab_size
*
* Purpose: Returns the size of the raw message in bytes not counting
* the message type or size fields, but only the data fields.
@@ -220,17 +220,17 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
+H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
{
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Set return value */
ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f));
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_stab_size() */
+} /* end H5O__stab_size() */
/*-------------------------------------------------------------------------
@@ -327,14 +327,14 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
/* Get the old local heap's size and use that as the hint for the new heap */
if(H5HL_get_size(file_src, stab_src->heap_addr, &size_hint) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
/* Set copy metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Create components of symbol table message */
if(H5G__stab_create_components(file_dst, stab_dst, size_hint) < 0)
- HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
+ HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
/* Reset metadata tag */
H5_END_TAG
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 7cb7b3d..df08ff7 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -127,7 +127,7 @@ H5O__is_attr_dense_test(hid_t oid)
/* Check if dense storage is being used */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Check for any messages in object header */
- HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0);
+ HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0);
ret_value = TRUE;
} /* end if */
@@ -197,7 +197,7 @@ H5O__is_attr_empty_test(hid_t oid)
} /* end if */
/* Retrieve the number of attribute messages in header */
- nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR);
+ nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR);
/* Check for later version of object header format & attribute info available */
if(oh->version > H5O_VERSION_1) {
@@ -299,7 +299,7 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs)
} /* end if */
/* Retrieve the number of attribute messages in header */
- obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR);
+ obj_nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR);
/* Check for later version of object header format */
if(oh->version > H5O_VERSION_1) {
diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c
index dbab28c..89c00ad 100644
--- a/src/H5Ounknown.c
+++ b/src/H5Ounknown.c
@@ -63,11 +63,11 @@ H5FL_DEFINE(H5O_unknown_t);
/*-------------------------------------------------------------------------
- * Function: H5O__unknown_free
+ * Function: H5O__unknown_free
*
- * Purpose: Frees the message
+ * Purpose: Frees the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, May 1, 2007
diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err
index 3a34314..a6aae76 100644
--- a/tools/test/h5dump/errfiles/tattr-3.err
+++ b/tools/test/h5dump/errfiles/tattr-3.err
@@ -1,5 +1,5 @@
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr'
+ #000: (file name) line (number) in H5Aopen(): unable to open attribute: 'attr'
major: Attribute
minor: Can't open object
#001: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr'
diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err
index 06519fb..2c4f1ff 100644
--- a/tools/test/h5dump/errfiles/tqmarkfile.err
+++ b/tools/test/h5dump/errfiles/tqmarkfile.err
@@ -8,7 +8,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist
@@ -24,7 +24,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist
diff --git a/tools/testfiles/tstarfile.ddl b/tools/testfiles/tstarfile.ddl
index 77b80e0..87c3f87 100644
--- a/tools/testfiles/tstarfile.ddl
+++ b/tools/testfiles/tstarfile.ddl
@@ -64,7 +64,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist
@@ -80,7 +80,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist