summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5.c65
-rw-r--r--src/H5A.c62
-rw-r--r--src/H5Aint.c69
-rw-r--r--src/H5Aprivate.h4
-rw-r--r--src/H5Dio.c15
-rw-r--r--src/H5Dpkg.h2
-rw-r--r--src/H5F.c167
-rw-r--r--src/H5FD.c18
-rw-r--r--src/H5Fint.c64
-rw-r--r--src/H5I.c76
-rw-r--r--src/H5Oflush.c2
-rw-r--r--src/H5Pfapl.c24
-rw-r--r--src/H5Tcommit.c17
-rw-r--r--src/H5Tprivate.h6
-rw-r--r--src/H5private.h181
-rw-r--r--src/H5public.h1
-rw-r--r--src/H5trace.c30
17 files changed, 355 insertions, 448 deletions
diff --git a/src/H5.c b/src/H5.c
index 59984dc..965c2e1 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -80,9 +80,9 @@ hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */
hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */
#endif
-char H5_lib_vers_info_g[] = H5_VERS_INFO;
+char H5_lib_vers_info_g[] = H5_VERS_INFO;
static hbool_t H5_dont_atexit_g = FALSE;
-H5_debug_t H5_debug_g; /*debugging info */
+H5_debug_t H5_debug_g; /* debugging info */
/*******************/
@@ -243,11 +243,6 @@ done:
*
* Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 20, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -281,11 +276,11 @@ H5_term_library(void)
*/
#define DOWN(F) \
(((n = H5##F##_term_package()) && (at + 8) < sizeof loop)? \
- (sprintf(loop + at, "%s%s", (at ? "," : ""), #F), \
+ (HDsprintf(loop + at, "%s%s", (at ? "," : ""), #F), \
at += HDstrlen(loop + at), \
n): \
((n > 0 && (at + 5) < sizeof loop) ? \
- (sprintf(loop + at, "..."), \
+ (HDsprintf(loop + at, "..."), \
at += HDstrlen(loop + at), \
n) : n))
@@ -364,8 +359,8 @@ H5_term_library(void)
if(pending) {
/* Only display the error message if the user is interested in them. */
if(func) {
- fprintf(stderr, "HDF5: infinite loop closing library\n");
- fprintf(stderr, " %s\n", loop);
+ HDfprintf(stderr, "HDF5: infinite loop closing library\n");
+ HDfprintf(stderr, " %s\n", loop);
#ifndef NDEBUG
HDabort();
#endif /* NDEBUG */
@@ -440,11 +435,6 @@ done:
* Failure: negative if this function is called more than
* once or if it is called too late.
*
- * Programmer: Robb Matzke
- * Friday, November 20, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -479,11 +469,6 @@ H5dont_atexit(void)
*
* Failure: negative
*
- * Programmer: Quincey Koziol
- * Saturday, March 11, 2000
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -528,13 +513,6 @@ done:
*
* Failure: negative
*
- * Programmer: Quincey Koziol
- * Wednesday, August 2, 2000
- *
- * Modifications: Neil Fortner
- * Wednesday, April 8, 2009
- * Added support for factory free lists
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -578,9 +556,6 @@ done:
*
* Return: void
*
- * Programmer: Robb Matzke
- * Wednesday, August 19, 1998
- *
*-------------------------------------------------------------------------
*/
static void
@@ -632,7 +607,7 @@ H5_debug_mask(const char *s)
} /* end if */
} /* end for */
if (i>=(size_t)H5_NPKGS)
- fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
+ HDfprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
} /* end if-else */
} else if (HDisdigit(*s)) {
@@ -672,8 +647,6 @@ H5_debug_mask(const char *s)
*
* Return: MPI_SUCCESS
*
- * Programmer: Mohamad Chaarawi, February 2015
- *
*-------------------------------------------------------------------------
*/
static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val, int H5_ATTR_UNUSED *flag)
@@ -698,13 +671,6 @@ static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED key
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Unknown
- *
- * Modifications:
- * Robb Matzke, 4 Mar 1998
- * Now use "normal" data types for the interface. Any of the arguments
- * may be null pointers
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -738,13 +704,6 @@ done:
*
* Failure: abort()
*
- * Programmer: Robb Matzke
- * Tuesday, April 21, 1998
- *
- * Modifications:
- * Albert Cheng, May 12, 2001
- * Added verification of H5_VERS_INFO.
- *
*-------------------------------------------------------------------------
*/
#define VERSION_MISMATCH_WARNING \
@@ -869,11 +828,6 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -896,11 +850,6 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, January 30, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5A.c b/src/H5A.c
index cf48232..1b80612 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -717,8 +717,7 @@ hid_t
H5Aget_space(hid_t attr_id)
{
H5A_t *attr; /* Attribute object for ID */
- H5S_t *ds = NULL;
- hid_t ret_value;
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", attr_id);
@@ -727,19 +726,9 @@ H5Aget_space(hid_t attr_id)
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(NULL == (ds = H5A_get_space(attr)))
+ if((ret_value = H5A_get_space(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
-
- /* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
-
done:
- if(ret_value < 0) {
- if(ds && (H5S_close(ds) < 0))
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- } /* end if */
-
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -764,7 +753,6 @@ hid_t
H5Aget_type(hid_t attr_id)
{
H5A_t *attr; /* Attribute object for ID */
- H5T_t *dt = NULL;
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -774,19 +762,9 @@ H5Aget_type(hid_t attr_id)
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(NULL == (dt = H5A_get_type(attr)))
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
-
- /* Create an atom */
- if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
-
+ if((ret_value = H5A_get_type(attr)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
done:
- if(ret_value < 0) {
- if(dt && (H5T_close(dt) < 0))
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
- } /* end if */
-
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
@@ -1685,12 +1663,12 @@ H5Aexists(hid_t obj_id, const char *attr_name)
H5TRACE2("t", "i*s", obj_id, attr_name);
/* 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)
- 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")
+ 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)
+ 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")
/* Check if the attribute exists */
if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_read_dxpl_id)) < 0)
@@ -1726,20 +1704,20 @@ 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))
- 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(!obj_name || !*obj_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")
+ 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)
+ 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")
+ if (!attr_name || !*attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Verify access property list and get correct dxpl */
- if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ if (H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
- if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0)
+ if ((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 160c7fb..a661a89 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -735,86 +735,89 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
/*-------------------------------------------------------------------------
- * Function: H5A_get_space
+ * Function: H5A_get_space
*
- * Purpose: Returns dataspace of the attribute.
+ * Purpose: Returns dataspace of the attribute.
*
- * Return: Success: dataspace
+ * Return: Success: A valid ID for the dataspace of an attribute
*
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
+ * Failure: H5I_INVALID_ID
*
*-------------------------------------------------------------------------
*/
-H5S_t *
+hid_t
H5A_get_space(H5A_t *attr)
{
- H5S_t *ret_value = NULL;
+ H5S_t *ds = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI_NOINIT
HDassert(attr);
/* Copy the attribute's dataspace */
- if(NULL == (ret_value = H5S_copy(attr->shared->ds, FALSE, TRUE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy dataspace")
+ if (NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace")
+
+ /* Atomize */
+ if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
done:
+ if (H5I_INVALID_HID == ret_value && ds && H5S_close(ds) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_get_space() */
/*-------------------------------------------------------------------------
- * Function: H5A_get_type
+ * Function: H5A_get_type
*
- * Purpose: Returns datatype of the dataset.
+ * Purpose: Returns an ID for the datatype of an attribute
*
- * Return: Success: datatype
+ * Return: Success: A valid ID for the datatype of an attribute
*
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
-H5T_t *
+hid_t
H5A_get_type(H5A_t *attr)
{
H5T_t *dt = NULL;
- H5T_t *ret_value = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI_NOINIT
HDassert(attr);
/* Patch the datatype's "top level" file pointer */
- if(H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to patch datatype's file pointer")
+ if (H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to patch datatype's file pointer")
- /*
- * Copy the attribute's datatype. If the type is a named type then
+ /* Copy the attribute's datatype. If the type is a named type then
* reopen the type before returning it to the user. Make the type
* read-only.
*/
- if(NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy datatype")
+ if (NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
- if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
+ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "invalid datatype location")
/* Lock copied type */
- if(H5T_lock(dt, FALSE) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to lock transient datatype")
+ if (H5T_lock(dt, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype")
- ret_value = dt;
+ /* Atomize */
+ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
done:
- if(!ret_value && dt && (H5T_close(dt) < 0))
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
+ if (H5I_INVALID_HID == ret_value && 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() */
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index b285920..9826859 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -76,8 +76,8 @@ typedef struct H5A_attr_iter_op_t {
H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr);
H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr);
H5_DLL H5T_t *H5A_type(const H5A_t *attr);
-H5_DLL H5T_t *H5A_get_type(H5A_t *attr);
-H5_DLL H5S_t *H5A_get_space(H5A_t *attr);
+H5_DLL hid_t H5A_get_type(H5A_t *attr);
+H5_DLL hid_t H5A_get_space(H5A_t *attr);
H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc,
hid_t dxpl_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);
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 280d602..4ab0b37 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -49,10 +49,6 @@
/* Local Prototypes */
/********************/
-/* Internal I/O routines */
-static herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
- const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf);
-
/* Setup/teardown routines */
static herr_t H5D__ioinfo_init(H5D_t *dset,
#ifndef H5_HAVE_PARALLEL
@@ -324,18 +320,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__pre_write
- *
- * Purpose: Preparation for writing data.
+ * Function: H5D__pre_write
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Preparation for writing data.
*
- * Programmer: Raymond Lu
- * 2 November 2012
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
const H5S_t *mem_space, const H5S_t *file_space,
hid_t dxpl_id, const void *buf)
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index beb1089..542abd0 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -598,6 +598,8 @@ H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id);
H5_DLL herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id);
/* Internal I/O routines */
+H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
+ const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf);
H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id,
const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist,
void *buf/*out*/);
diff --git a/src/H5F.c b/src/H5F.c
index 4b40248..f435502 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -21,20 +21,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5Tprivate.h" /* Datatypes */
/****************/
@@ -377,83 +377,82 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fcreate
*
- * Purpose: This is the primary function for creating HDF5 files . The
- * flags parameter determines whether an existing file will be
- * overwritten or not. All newly created files are opened for
- * both reading and writing. All flags may be combined with the
- * bit-wise OR operator (`|') to change the behavior of the file
- * create call.
+ * Purpose: This is the primary function for creating HDF5 files . The
+ * flags parameter determines whether an existing file will be
+ * overwritten or not. All newly created files are opened for
+ * both reading and writing. All flags may be combined with the
+ * bit-wise OR operator (`|') to change the behavior of the file
+ * create call.
*
- * The more complex behaviors of a file's creation and access
- * are controlled through the file-creation and file-access
- * property lists. The value of H5P_DEFAULT for a template
- * value indicates that the library should use the default
- * values for the appropriate template.
+ * The more complex behaviors of a file's creation and access
+ * are controlled through the file-creation and file-access
+ * property lists. The value of H5P_DEFAULT for a template
+ * value indicates that the library should use the default
+ * values for the appropriate template.
*
* See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for
- * the list of file creation and file access properties.
+ * the list of file creation and file access properties.
*
- * Return: Success: A file ID
- * Failure: FAIL
+ * Return: Success: A file ID
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
- H5F_t *new_file = NULL; /*file struct for new file */
- hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */
- hid_t ret_value; /*return value */
+ H5F_t *new_file = NULL; /* file struct for new file */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id;/* dxpl used by library */
+ hid_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id);
/* Check/fix arguments */
- if(!filename || !*filename)
+ if (!filename || !*filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name")
+
/* In this routine, we only accept the following flags:
* H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE
*/
- if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE))
+ if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
+
/* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */
- if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC))
+ if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation")
/* Check file creation property list */
- if(H5P_DEFAULT == fcpl_id)
+ if (H5P_DEFAULT == fcpl_id)
fcpl_id = H5P_FILE_CREATE_DEFAULT;
else
- if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE))
+ if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list")
/* Verify access property list and get correct dxpl */
- if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0)
+ if (H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
- /*
- * Adjust bit flags by turning on the creation bit and making sure that
+ /* Adjust bit flags by turning on the creation bit and making sure that
* the EXCL or TRUNC bit is set. All newly-created files are opened for
* reading and writing.
*/
- if (0==(flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)))
- flags |= H5F_ACC_EXCL; /*default*/
+ if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC)))
+ flags |= H5F_ACC_EXCL; /*default*/
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
- /*
- * Create a new file or truncate an existing file.
- */
- if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id)))
+ /* Create a new file or truncate an existing file. */
+ if (NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* Get an atom for the file */
- if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
/* Keep this ID in file object structure */
new_file->file_id = ret_value;
done:
- if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0)
+ if (ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
@@ -463,46 +462,28 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fopen
*
- * Purpose: This is the primary function for accessing existing HDF5
- * files. The FLAGS argument determines whether writing to an
- * existing file will be allowed or not. All flags may be
- * combined with the bit-wise OR operator (`|') to change the
- * behavior of the file open call. The more complex behaviors
- * of a file's access are controlled through the file-access
- * property list.
- *
- * See Also: H5Fpublic.h for a list of possible values for FLAGS.
- *
- * Return: Success: A file ID
- * Failure: FAIL
- *
- * Modifications:
- * Robb Matzke, 1997-07-18
- * File struct creation and destruction is through H5F_new() and
- * H5F__dest(). Reading the root symbol table entry is done with
- * H5G_decode().
- *
- * Robb Matzke, 1997-09-23
- * Most of the work is now done by H5F_open() since H5Fcreate()
- * and H5Fopen() originally contained almost identical code.
- *
- * Robb Matzke, 1998-02-18
- * Added better error checking for the flags and the file access
- * property list. It used to be possible to make the library
- * dump core by passing an object ID that was not a file access
- * property list.
- *
- * Robb Matzke, 1999-08-02
- * The file access property list is passed to the H5F_open() as
- * object IDs.
+ * Purpose: This is the primary function for accessing existing HDF5
+ * files. The FLAGS argument determines whether writing to an
+ * existing file will be allowed or not. All flags may be
+ * combined with the bit-wise OR operator (`|') to change the
+ * behavior of the file open call. The more complex behaviors
+ * of a file's access are controlled through the file-access
+ * property list.
+ *
+ * See Also: H5Fpublic.h for a list of possible values for FLAGS.
+ *
+ * Return: Success: A file ID
+ *
+ * Failure: FAIL
+ *
*-------------------------------------------------------------------------
*/
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
- H5F_t *new_file = NULL; /* file struct for new file */
- hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
- hid_t ret_value; /* return value */
+ H5F_t *new_file = NULL; /* file struct for new file */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
+ hid_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
@@ -685,28 +666,28 @@ H5Fclose(hid_t file_id)
H5TRACE1("e", "i", file_id);
/* Check/fix arguments. */
- if(H5I_FILE != H5I_get_type(file_id))
+ if (H5I_FILE != H5I_get_type(file_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID")
/* Flush file if this is the last reference to this id and we have write
* intent, unless it will be flushed by the "shared" file being closed.
* This is only necessary to replicate previous behaviour, and could be
- * disabled by an option/property to improve performance. */
- if(NULL == (f = (H5F_t *)H5I_object(file_id)))
+ * disabled by an option/property to improve performance.
+ */
+ if (NULL == (f = (H5F_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
- if((nref = H5I_get_ref(file_id, FALSE)) < 0)
+ if ((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
+ if ((nref = H5I_get_ref(file_id, FALSE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count")
- if(nref == 1)
- if(H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0)
+ if (nref == 1)
+ if (H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
- } /* end if */
+ }
- /*
- * Decrement reference count on atom. When it reaches zero the file will
+ /* Decrement reference count on atom. When it reaches zero the file will
* be closed.
*/
- if(H5I_dec_app_ref(file_id) < 0)
+ if (H5I_dec_app_ref(file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
diff --git a/src/H5FD.c b/src/H5FD.c
index 9f62065..405e2d8 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -119,7 +119,7 @@ H5FD__init_package(void)
FUNC_ENTER_PACKAGE
if(H5I_register_type(H5I_VFL_CLS) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
H5FD_file_serial_no_g = 0;
@@ -151,18 +151,18 @@ H5FD_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_PKG_INIT_VAR) {
- if(H5I_nmembers(H5I_VFL) > 0) {
- (void)H5I_clear_type(H5I_VFL, FALSE, FALSE);
+ if(H5I_nmembers(H5I_VFL) > 0) {
+ (void)H5I_clear_type(H5I_VFL, FALSE, FALSE);
n++; /*H5I*/
- } /* end if */
+ } /* end if */
else {
- /* Destroy the VFL driver id group */
- n += (H5I_dec_type_ref(H5I_VFL) > 0);
+ /* Destroy the VFL driver ID group */
+ n += (H5I_dec_type_ref(H5I_VFL) > 0);
- /* Mark closed */
+ /* Mark closed */
if(0 == n)
H5_PKG_INIT_VAR = FALSE;
- } /* end else */
+ } /* end else */
} /* end if */
FUNC_LEAVE_NOAPI(n)
@@ -247,7 +247,7 @@ H5FDregister(const H5FD_class_t *cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
/* Create the new class ID */
- if((ret_value=H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0)
+ if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
done:
diff --git a/src/H5Fint.c b/src/H5Fint.c
index a48e41c..0eb1ea9 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -409,39 +409,39 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
H5O_loc_t *oloc; /* Group entry info for object */
switch(olist->obj_type) {
- case H5I_ATTR:
- oloc = H5A_oloc((H5A_t *)obj_ptr);
- break;
-
- case H5I_GROUP:
- oloc = H5G_oloc((H5G_t *)obj_ptr);
- break;
-
- case H5I_DATASET:
- oloc = H5D_oloc((H5D_t *)obj_ptr);
- break;
-
- case H5I_DATATYPE:
- if(H5T_is_named((H5T_t*)obj_ptr)==TRUE)
- oloc = H5T_oloc((H5T_t*)obj_ptr);
- else
- oloc = NULL;
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_FILE:
- case H5I_DATASPACE:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
+ case H5I_ATTR:
+ oloc = H5A_oloc((H5A_t *)obj_ptr);
+ break;
+
+ case H5I_GROUP:
+ oloc = H5G_oloc((H5G_t *)obj_ptr);
+ break;
+
+ case H5I_DATASET:
+ oloc = H5D_oloc((H5D_t *)obj_ptr);
+ break;
+
+ case H5I_DATATYPE:
+ if(H5T_is_named((H5T_t*)obj_ptr)==TRUE)
+ oloc = H5T_oloc((H5T_t*)obj_ptr);
+ else
+ oloc = NULL;
+ break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown data object")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object")
} /* end switch */
if((olist->file_info.local &&
diff --git a/src/H5I.c b/src/H5I.c
index b8e47a2..3bd9c4d 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -12,25 +12,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * FILE: H5I.c - Internal storage routines for handling "IDs"
+ * FILE: H5I.c - Internal storage routines for handling "IDs"
*
- * REMARKS: ID's which allow objects (void *'s currently) to be bundled
- * into "types" for more general storage.
+ * REMARKS: IDs which allow objects (void * currently) to be bundled
+ * into "types" for more general storage.
*
- * DESIGN: The types are stored in an array of pointers to store each
- * type in an element. Each "type" node contains a link to a
- * hash table to manage the IDs in each type. Allowed types are
- * values within the range 1 to H5I_MAX_NUM_TYPES and are given out
- * at run-time. Types used by the library are stored in global
- * variables defined in H5Ipublic.h.
- *
- * AUTHOR: Quincey Koziol
- *
- * MODIFICATIONS:
- * 1/3/96 - Starting writing specs & coding prototype
- * 1/7/96 - Finished coding prototype
- * 6/10/97 - Moved into HDF5 library
- * 5/18/04 - Expanded to allow registration of new types at run-time
+ * DESIGN: The types are stored in an array of pointers to store each
+ * type in an element. Each "type" node contains a link to a
+ * hash table to manage the IDs in each type. Allowed types are
+ * values within the range 1 to H5I_MAX_NUM_TYPES and are given out
+ * at run-time. Types used by the library are stored in global
+ * variables defined in H5Ipublic.h.
*/
#include "H5Imodule.h" /* This source code file is part of the H5I module */
@@ -724,58 +716,54 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_register
- *
- * Purpose: Registers an OBJECT in a TYPE and returns an ID for it.
- * This routine does _not_ check for unique-ness of the objects,
- * if you register an object twice, you will get two different
- * IDs for it. This routine does make certain that each ID in a
- * type is unique. IDs are created by getting a unique number
- * for the type the ID is in and incorporating the type into
- * the ID which is returned to the user.
+ * Function: H5I_register
*
- * Return: Success: New object id.
- * Failure: Negative
+ * Purpose: Registers an OBJECT in a TYPE and returns an ID for it.
+ * This routine does _not_ check for unique-ness of the objects,
+ * if you register an object twice, you will get two different
+ * IDs for it. This routine does make certain that each ID in a
+ * type is unique. IDs are created by getting a unique number
+ * for the type the ID is in and incorporating the type into
+ * the ID which is returned to the user.
*
- * Programmer: Unknown
+ * Return: Success: New object id
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
hid_t
H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
{
- H5I_id_type_t *type_ptr; /*ptr to the type */
- H5I_id_info_t *id_ptr; /*ptr to the new ID information */
- hid_t new_id; /*new ID */
- hid_t ret_value = SUCCEED; /*return value */
+ H5I_id_type_t *type_ptr = NULL; /* ptr to the type */
+ H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */
+ hid_t new_id = -1; /* new ID */
+ hid_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
- if(type <= H5I_BADID || type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+ if (type <= H5I_BADID || type >= H5I_next_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
type_ptr = H5I_id_type_list_g[type];
- if(NULL == type_ptr || type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
- if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t)))
+ if ((NULL == type_ptr) || (type_ptr->init_count <= 0))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
+ if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t)))
HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Create the struct & it's ID */
+ /* Create the struct & its ID */
new_id = H5I_MAKE(type, type_ptr->nextid);
id_ptr->id = new_id;
- id_ptr->count = 1; /*initial reference count*/
+ id_ptr->count = 1; /* initial reference count */
id_ptr->app_count = !!app_ref;
id_ptr->obj_ptr = object;
/* Insert into the type */
- if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
+ if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list")
type_ptr->id_count++;
type_ptr->nextid++;
- /*
- * Sanity check for the 'nextid' getting too large and wrapping around.
- */
+ /* Sanity check for the 'nextid' getting too large and wrapping around */
HDassert(type_ptr->nextid <= ID_MASK);
/* Set return value */
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 9764f56..b1592dd 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -405,7 +405,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
break;
} /* end switch */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 1b0a4b9..6beee6f 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -14,8 +14,6 @@
/*-------------------------------------------------------------------------
*
* Created: H5Pfapl.c
- * February 26 1998
- * Robb Matzke <matzke@llnl.gov>
*
* Purpose: File access property list class routines
*
@@ -32,21 +30,21 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory Management */
-#include "H5Ppkg.h" /* Property lists */
+#include "H5Ppkg.h" /* Property lists */
/* Includes needed to set as default file driver */
-#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
-#include "H5FDstdio.h" /* Standard C buffered I/O */
+#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
+#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
-#include "H5FDwindows.h" /* Windows buffered I/O */
+#include "H5FDwindows.h" /* Win32 I/O */
#endif
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index c28b508..30fbeeb 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -26,14 +26,15 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tpkg.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory Management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tpkg.h" /* Datatypes */
/****************/
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 17cdc49..9171e1e 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -27,9 +27,9 @@ typedef struct H5T_t H5T_t;
#include "H5MMpublic.h" /* Memory management */
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Rprivate.h" /* References */
+#include "H5private.h" /* Generic Functions */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Rprivate.h" /* References */
/* Macro for size of temporary buffers to contain a single element */
#define H5T_ELEM_BUF_SIZE 256
diff --git a/src/H5private.h b/src/H5private.h
index ca4ebcf..2f33cff 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -53,7 +53,6 @@
# include <limits.h>
# include <math.h>
# include <signal.h>
-# include <stdarg.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
@@ -1688,25 +1687,25 @@ extern char *strdup(const char *s);
* information about the package in H5_init_library().
*/
typedef enum {
- H5_PKG_A, /*Attributes */
- H5_PKG_AC, /*Meta data cache */
- H5_PKG_B, /*B-trees */
- H5_PKG_D, /*Datasets */
- H5_PKG_E, /*Error handling */
- H5_PKG_F, /*Files */
- H5_PKG_G, /*Groups */
- H5_PKG_HG, /*Global heap */
- H5_PKG_HL, /*Local heap */
- H5_PKG_I, /*Interface */
- H5_PKG_MF, /*File memory management */
- H5_PKG_MM, /*Core memory management */
- H5_PKG_O, /*Object headers */
- H5_PKG_P, /*Property lists */
- H5_PKG_S, /*Data spaces */
- H5_PKG_T, /*Data types */
- H5_PKG_V, /*Vector functions */
- H5_PKG_Z, /*Raw data filters */
- H5_NPKGS /*Must be last */
+ H5_PKG_A, /* Attributes */
+ H5_PKG_AC, /* Metadata cache */
+ H5_PKG_B, /* B-trees */
+ H5_PKG_D, /* Datasets */
+ H5_PKG_E, /* Error handling */
+ H5_PKG_F, /* Files */
+ H5_PKG_G, /* Groups */
+ H5_PKG_HG, /* Global heaps */
+ H5_PKG_HL, /* Local heaps */
+ H5_PKG_I, /* IDs */
+ H5_PKG_MF, /* File memory management */
+ H5_PKG_MM, /* Core memory management */
+ H5_PKG_O, /* Object headers */
+ H5_PKG_P, /* Property lists */
+ H5_PKG_S, /* Dataspaces */
+ H5_PKG_T, /* Datatypes */
+ H5_PKG_V, /* Vector functions */
+ H5_PKG_Z, /* Raw data filters */
+ H5_NPKGS /* Must be last */
} H5_pkg_t;
typedef struct H5_debug_open_stream_t {
@@ -1735,76 +1734,90 @@ extern H5_debug_t H5_debug_g;
extern char H5libhdf5_settings[]; /* embedded library information */
/*-------------------------------------------------------------------------
- * Purpose: These macros are inserted automatically just after the
- * FUNC_ENTER() macro of API functions and are used to trace
- * application program execution. Unless H5_DEBUG_API has been
- * defined they are no-ops.
+ * Purpose: These macros are inserted automatically just after the
+ * FUNC_ENTER() macro of API functions and are used to trace
+ * application program execution. Unless H5_DEBUG_API has been
+ * defined they are no-ops.
*
- * Arguments: R - Return type encoded as a string
- * T - Argument types encoded as a string
- * A0-An - Arguments. The number at the end of the macro name
- * indicates the number of arguments.
+ * Arguments: R - Return type encoded as a string
+ * T - Argument types encoded as a string
+ * A0-An - Arguments. The number at the end of the macro name
+ * indicates the number of arguments.
*
- * Programmer: Robb Matzke
- *
- * Modifications:
*-------------------------------------------------------------------------
*/
#ifdef H5_DEBUG_API
-#define H5TRACE_DECL const char *RTYPE=NULL; \
- double CALLTIME;
-#define H5TRACE0(R,T) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T)
-#define H5TRACE1(R,T,A0) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0)
-#define H5TRACE2(R,T,A0,A1) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1)
-#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2)
-#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3)
-#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4)
-#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5)
-#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6)
-#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7)
-#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8)
-#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9)
-#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \
- #A10,A10)
-#define H5TRACE_RETURN(V) if (RTYPE) { \
- H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \
- RTYPE=NULL; \
- }
+
+#define H5TRACE_DECL \
+ const char *RTYPE = NULL; \
+ double CALLTIME;
+
+#define H5TRACE0(R,T) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T)
+#define H5TRACE1(R,T,A0) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0)
+#define H5TRACE2(R,T,A0,A1) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1)
+#define H5TRACE3(R,T,A0,A1,A2) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2)
+#define H5TRACE4(R,T,A0,A1,A2,A3) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3)
+#define H5TRACE5(R,T,A0,A1,A2,A3,A4) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4)
+#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5)
+#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6)
+#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7)
+#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8)
+#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8,#A9,A9)
+#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8,#A9,A9,#A10,A10)
+#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8,#A9,A9,#A10,A10,#A11,A11)
+
+#define H5TRACE_RETURN(V) \
+ if (RTYPE) { \
+ H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \
+ RTYPE = NULL; \
+ }
#else
-#define H5TRACE_DECL /*void*/
-#define H5TRACE0(R,T) /*void*/
-#define H5TRACE1(R,T,A0) /*void*/
-#define H5TRACE2(R,T,A0,A1) /*void*/
-#define H5TRACE3(R,T,A0,A1,A2) /*void*/
-#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/
-#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/
-#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/
-#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/
-#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/
-#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/
-#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/
-#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/
-#define H5TRACE_RETURN(V) /*void*/
-#endif
+#define H5TRACE_DECL /*void*/
+#define H5TRACE0(R,T) /*void*/
+#define H5TRACE1(R,T,A0) /*void*/
+#define H5TRACE2(R,T,A0,A1) /*void*/
+#define H5TRACE3(R,T,A0,A1,A2) /*void*/
+#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/
+#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/
+#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/
+#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/
+#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/
+#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/
+#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/
+#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/
+#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) /*void*/
+#define H5TRACE_RETURN(V) /*void*/
+#endif /* H5_DEBUG_API */
H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...);
diff --git a/src/H5public.h b/src/H5public.h
index 40e6e6e..58d0cd1 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -39,6 +39,7 @@
#endif
#ifdef H5_STDC_HEADERS
# include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */
+# include <stdarg.h> /*for variadic functions in H5VLpublic.h */
#endif
#ifndef __cplusplus
# ifdef H5_HAVE_STDINT_H
diff --git a/src/H5trace.c b/src/H5trace.c
index 930002f..7bc2724 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -226,9 +226,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
* name is the null pointer then don't print the argument or the
* following `='. This is used for return values.
*/
- argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */
+ argname = va_arg(ap, char *);
if(argname) {
- unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */
+ unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3);
if(!HDstrcmp(argname + n, "_id")) {
HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n));
@@ -242,7 +242,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* The value */
if(ptr)
- vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */
+ vp = va_arg(ap, void *);
switch(type[0]) {
case 'a':
if(ptr) {
@@ -252,7 +252,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
+ haddr_t addr = va_arg(ap, haddr_t);
HDfprintf(out, "%a", addr);
} /* end else */
@@ -807,7 +807,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- H5E_error2_t *error = va_arg(ap, H5E_error2_t *); /*lint !e64 Type mismatch not really occuring */
+ H5E_error2_t *error = va_arg(ap, H5E_error2_t *);
fprintf(out, "0x%lx", (unsigned long)error);
} /* end else */
@@ -1093,7 +1093,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
+ H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*);
fprintf(out, "0x%lx", (unsigned long)statbuf);
}
@@ -1127,7 +1127,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- hsize_t hsize = va_arg(ap, hsize_t); /*lint !e732 Loss of sign not really occuring */
+ hsize_t hsize = va_arg(ap, hsize_t);
if(H5S_UNLIMITED == hsize)
HDfprintf(out, "H5S_UNLIMITED");
@@ -1553,7 +1553,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- unsigned iu = va_arg(ap, unsigned); /*lint !e732 Loss of sign not really occuring */
+ unsigned iu = va_arg(ap, unsigned);
fprintf(out, "%u", iu);
asize[argno] = iu;
@@ -1797,7 +1797,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- hobj_ref_t ref = va_arg(ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */
+ hobj_ref_t ref = va_arg(ap, hobj_ref_t);
HDfprintf(out, "Reference Object=%a", ref);
} /* end else */
@@ -1995,7 +1995,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- const char *str = va_arg(ap, const char *); /*lint !e64 Type mismatch not really occuring */
+ const char *str = va_arg(ap, const char *);
fprintf(out, "\"%s\"", str);
} /* end else */
@@ -2422,7 +2422,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- unsigned long iul = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
+ unsigned long iul = va_arg(ap, unsigned long);
fprintf(out, "%lu", iul);
asize[argno] = (hssize_t)iul;
@@ -2446,7 +2446,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- unsigned long long iull = va_arg(ap, unsigned long long); /*lint !e732 Loss of sign not really occuring */
+ unsigned long long iull = va_arg(ap, unsigned long long);
fprintf(out, "%llu", iull);
asize[argno] = (hssize_t)iull;
@@ -2480,7 +2480,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- vp = va_arg (ap, void *); /*lint !e64 Type mismatch not really occuring */
+ vp = va_arg (ap, void *);
if(vp)
fprintf(out, "0x%lx", (unsigned long)vp);
@@ -2506,7 +2506,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- size_t size = va_arg(ap, size_t); /*lint !e732 Loss of sign not really occuring */
+ size_t size = va_arg(ap, size_t);
HDfprintf(out, "%Zu", size);
asize[argno] = (hssize_t)size;
@@ -2553,7 +2553,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
- H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*); /*lint !e64 Type mismatch not really occuring */
+ H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*);
fprintf(out, "0x%lx", (unsigned long)filter);
} /* end else */