summaryrefslogtreecommitdiffstats
path: root/src/H5Eint.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
commitfeb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch)
treee15d7e751af4e3c42e77ea955d91db4cf27a71cf /src/H5Eint.c
parentbdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff)
downloadhdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'src/H5Eint.c')
-rw-r--r--src/H5Eint.c406
1 files changed, 191 insertions, 215 deletions
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 2371a5f..0be05f7 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -26,52 +26,44 @@
/* Module Setup */
/****************/
-#include "H5Emodule.h" /* This source code file is part of the H5E module */
-
+#include "H5Emodule.h" /* This source code file is part of the H5E module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Epkg.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5TSprivate.h" /* Thread stuff */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Epkg.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5TSprivate.h" /* Thread stuff */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* Printing information */
typedef struct H5E_print_t {
- FILE *stream;
- H5E_cls_t cls;
+ FILE * stream;
+ H5E_cls_t cls;
} H5E_print_t;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
#ifndef H5_NO_DEPRECATED_SYMBOLS
-static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc,
- void *client_data);
+static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc,
- void *client_data);
+static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data);
static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries);
-
/*********************/
/* Package Variables */
/*********************/
@@ -83,7 +75,6 @@ static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries);
H5E_t H5E_stack_g[1];
#endif /* H5_HAVE_THREADSAFE */
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -98,7 +89,6 @@ hid_t H5E_ERR_CLS_g = FAIL;
/* Include the automatically generated error code definitions */
#include "H5Edefin.h"
-
/*******************/
/* Local Variables */
/*******************/
@@ -107,12 +97,10 @@ hid_t H5E_ERR_CLS_g = FAIL;
/*
* variables used for MPI error reporting
*/
-char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
-int H5E_mpi_error_str_len;
+char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
+int H5E_mpi_error_str_len;
#endif /* H5_HAVE_PARALLEL */
-
-
/*-------------------------------------------------------------------------
* Function: H5E__get_msg
*
@@ -129,7 +117,7 @@ int H5E_mpi_error_str_len;
ssize_t
H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
{
- ssize_t len = -1; /* Length of error message */
+ ssize_t len = -1; /* Length of error message */
FUNC_ENTER_PACKAGE_NOERR
@@ -140,14 +128,14 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
len = (ssize_t)HDstrlen(msg->msg);
/* Copy the message into the user's buffer, if given */
- if(msg_str) {
- HDstrncpy(msg_str, msg->msg, MIN((size_t)(len+1), size));
- if((size_t)len >= size)
- msg_str[size - 1] = '\0';
+ if (msg_str) {
+ HDstrncpy(msg_str, msg->msg, MIN((size_t)(len + 1), size));
+ if ((size_t)len >= size)
+ msg_str[size - 1] = '\0';
} /* end if */
/* Give the message type, if asked */
- if(type)
+ if (type)
*type = msg->type;
/* Set the return value to the full length of the message */
@@ -155,7 +143,7 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
} /* end H5E__get_msg() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: H5E__walk1_cb
*
@@ -192,15 +180,15 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
static herr_t
H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
{
- H5E_print_t *eprint = (H5E_print_t *)client_data;
- FILE *stream; /* I/O stream to print output to */
- H5E_cls_t *cls_ptr; /* Pointer to error class */
- H5E_msg_t *maj_ptr; /* Pointer to major error info */
- H5E_msg_t *min_ptr; /* Pointer to minor error info */
- const char *maj_str = "No major description"; /* Major error description */
- const char *min_str = "No minor description"; /* Minor error description */
- unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
- herr_t ret_value = SUCCEED;
+ H5E_print_t *eprint = (H5E_print_t *)client_data;
+ FILE * stream; /* I/O stream to print output to */
+ H5E_cls_t * cls_ptr; /* Pointer to error class */
+ H5E_msg_t * maj_ptr; /* Pointer to major error info */
+ H5E_msg_t * min_ptr; /* Pointer to minor error info */
+ const char * maj_str = "No major description"; /* Major error description */
+ const char * min_str = "No minor description"; /* Minor error description */
+ unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC_NOERR
@@ -208,7 +196,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
HDassert(err_desc);
/* If no client data was passed, output to stderr */
- if(!client_data)
+ if (!client_data)
stream = stderr;
else
stream = eprint->stream;
@@ -218,31 +206,31 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG);
/* Check for bad pointer(s), but can't issue error, just leave */
- if(!maj_ptr || !min_ptr)
+ if (!maj_ptr || !min_ptr)
HGOTO_DONE(FAIL)
- if(maj_ptr->msg)
+ if (maj_ptr->msg)
maj_str = maj_ptr->msg;
- if(min_ptr->msg)
+ if (min_ptr->msg)
min_str = min_ptr->msg;
/* Get error class info */
cls_ptr = maj_ptr->cls;
/* Print error class header if new class */
- if(eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
+ if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
/* update to the new class information */
- if(cls_ptr->cls_name)
+ if (cls_ptr->cls_name)
eprint->cls.cls_name = cls_ptr->cls_name;
- if(cls_ptr->lib_name)
+ if (cls_ptr->lib_name)
eprint->cls.lib_name = cls_ptr->lib_name;
- if(cls_ptr->lib_vers)
+ if (cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
- (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
- (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
- (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
+ (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
+ (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
+ (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
/* try show the process or thread id in multiple processes cases*/
#ifdef H5_HAVE_PARALLEL
@@ -252,7 +240,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
- if(mpi_initialized && !mpi_finalized) {
+ if (mpi_initialized && !mpi_finalized) {
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
HDfprintf(stream, "MPI-process %d", mpi_rank);
} /* end if */
@@ -266,14 +254,13 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
} /* end if */
/* Check for "real" error description - used to format output more nicely */
- if(err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0)
- have_desc=0;
+ if (err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0)
+ have_desc = 0;
/* Print error message */
- HDfprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n",
- H5E_INDENT, "", n, err_desc->file_name, err_desc->line,
- err_desc->func_name, (have_desc ? ": " : ""),
- (have_desc ? err_desc->desc : ""));
+ HDfprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name,
+ err_desc->line, err_desc->func_name, (have_desc ? ": " : ""),
+ (have_desc ? err_desc->desc : ""));
HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
@@ -282,7 +269,6 @@ done:
} /* end H5E__walk1_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: H5E__walk2_cb
*
@@ -317,15 +303,15 @@ done:
static herr_t
H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
{
- H5E_print_t *eprint = (H5E_print_t *)client_data;
- FILE *stream; /* I/O stream to print output to */
- H5E_cls_t *cls_ptr; /* Pointer to error class */
- H5E_msg_t *maj_ptr; /* Pointer to major error info */
- H5E_msg_t *min_ptr; /* Pointer to minor error info */
- const char *maj_str = "No major description"; /* Major error description */
- const char *min_str = "No minor description"; /* Minor error description */
- unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
- herr_t ret_value = SUCCEED;
+ H5E_print_t *eprint = (H5E_print_t *)client_data;
+ FILE * stream; /* I/O stream to print output to */
+ H5E_cls_t * cls_ptr; /* Pointer to error class */
+ H5E_msg_t * maj_ptr; /* Pointer to major error info */
+ H5E_msg_t * min_ptr; /* Pointer to minor error info */
+ const char * maj_str = "No major description"; /* Major error description */
+ const char * min_str = "No minor description"; /* Minor error description */
+ unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC_NOERR
@@ -333,7 +319,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
HDassert(err_desc);
/* If no client data was passed, output to stderr */
- if(!client_data)
+ if (!client_data)
stream = stderr;
else
stream = eprint->stream;
@@ -343,12 +329,12 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG);
/* Check for bad pointer(s), but can't issue error, just leave */
- if(!maj_ptr || !min_ptr)
+ if (!maj_ptr || !min_ptr)
HGOTO_DONE(FAIL)
- if(maj_ptr->msg)
+ if (maj_ptr->msg)
maj_str = maj_ptr->msg;
- if(min_ptr->msg)
+ if (min_ptr->msg)
min_str = min_ptr->msg;
/* Get error class info. Don't use the class of the major or minor error because
@@ -356,23 +342,23 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
cls_ptr = (H5E_cls_t *)H5I_object_verify(err_desc->cls_id, H5I_ERROR_CLASS);
/* Check for bad pointer(s), but can't issue error, just leave */
- if(!cls_ptr)
+ if (!cls_ptr)
HGOTO_DONE(FAIL)
/* Print error class header if new class */
- if(eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
+ if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
/* update to the new class information */
- if(cls_ptr->cls_name)
+ if (cls_ptr->cls_name)
eprint->cls.cls_name = cls_ptr->cls_name;
- if(cls_ptr->lib_name)
+ if (cls_ptr->lib_name)
eprint->cls.lib_name = cls_ptr->lib_name;
- if(cls_ptr->lib_vers)
+ if (cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
- (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
- (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
- (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
+ (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
+ (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
+ (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
/* try show the process or thread id in multiple processes cases*/
#ifdef H5_HAVE_PARALLEL
@@ -382,7 +368,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
- if(mpi_initialized && !mpi_finalized) {
+ if (mpi_initialized && !mpi_finalized) {
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
HDfprintf(stream, "MPI-process %d", mpi_rank);
} /* end if */
@@ -396,14 +382,13 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
} /* end if */
/* Check for "real" error description - used to format output more nicely */
- if(err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0)
+ if (err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0)
have_desc = 0;
/* Print error message */
- HDfprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n",
- H5E_INDENT, "", n, err_desc->file_name, err_desc->line,
- err_desc->func_name, (have_desc ? ": " : ""),
- (have_desc ? err_desc->desc : ""));
+ HDfprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name,
+ err_desc->line, err_desc->func_name, (have_desc ? ": " : ""),
+ (have_desc ? err_desc->desc : ""));
HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
@@ -411,7 +396,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__walk2_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5E__print
*
@@ -431,9 +415,9 @@ done:
herr_t
H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
{
- H5E_print_t eprint; /* Callback information to pass to H5E_walk() */
- H5E_walk_op_t walk_op; /* Error stack walking callback */
- herr_t ret_value = SUCCEED;
+ H5E_print_t eprint; /* Callback information to pass to H5E_walk() */
+ H5E_walk_op_t walk_op; /* Error stack walking callback */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -441,7 +425,7 @@ H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
HDassert(estack);
/* If no stream was given, use stderr */
- if(!stream)
+ if (!stream)
eprint.stream = stderr;
else
eprint.stream = stream;
@@ -450,20 +434,20 @@ H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
HDmemset(&eprint.cls, 0, sizeof(H5E_cls_t));
/* Walk the error stack */
- if(bk_compatible) {
+ if (bk_compatible) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
- walk_op.vers = 1;
+ walk_op.vers = 1;
walk_op.u.func1 = H5E__walk1_cb;
- if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
+ if (H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void *)&eprint) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+#else /* H5_NO_DEPRECATED_SYMBOLS */
HDassert(0 && "version 1 error stack print without deprecated symbols!");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- } /* end if */
+ } /* end if */
else {
- walk_op.vers = 2;
+ walk_op.vers = 2;
walk_op.u.func2 = H5E__walk2_cb;
- if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
+ if (H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void *)&eprint) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
} /* end else */
@@ -471,7 +455,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__print() */
-
/*-------------------------------------------------------------------------
* Function: H5E__walk
*
@@ -503,11 +486,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op,
- void *client_data)
+H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data)
{
- int i; /* Local index variable */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ int i; /* Local index variable */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -516,74 +498,74 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o
HDassert(op);
/* check args, but rather than failing use some default value */
- if(direction != H5E_WALK_UPWARD && direction != H5E_WALK_DOWNWARD)
- direction = H5E_WALK_UPWARD;
+ if (direction != H5E_WALK_UPWARD && direction != H5E_WALK_DOWNWARD)
+ direction = H5E_WALK_UPWARD;
/* Walk the stack if a callback function was given */
- if(op->vers == 1) {
+ if (op->vers == 1) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
- if(op->u.func1) {
+ if (op->u.func1) {
H5E_error1_t old_err;
ret_value = SUCCEED;
- if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) {
+ if (H5E_WALK_UPWARD == direction) {
+ for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) {
/* Point to each error record on the stack and pass it to callback function.*/
- old_err.maj_num = estack->slot[i].maj_num;
- old_err.min_num = estack->slot[i].min_num;
+ old_err.maj_num = estack->slot[i].maj_num;
+ old_err.min_num = estack->slot[i].min_num;
old_err.func_name = estack->slot[i].func_name;
old_err.file_name = estack->slot[i].file_name;
- old_err.desc = estack->slot[i].desc;
- old_err.line = estack->slot[i].line;
+ old_err.desc = estack->slot[i].desc;
+ old_err.line = estack->slot[i].line;
ret_value = (op->u.func1)(i, &old_err, client_data);
} /* end for */
- } /* end if */
+ } /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) {
+ for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) {
/* Point to each error record on the stack and pass it to callback function.*/
- old_err.maj_num = estack->slot[i].maj_num;
- old_err.min_num = estack->slot[i].min_num;
+ old_err.maj_num = estack->slot[i].maj_num;
+ old_err.min_num = estack->slot[i].min_num;
old_err.func_name = estack->slot[i].func_name;
old_err.file_name = estack->slot[i].file_name;
- old_err.desc = estack->slot[i].desc;
- old_err.line = estack->slot[i].line;
+ old_err.desc = estack->slot[i].desc;
+ old_err.line = estack->slot[i].line;
ret_value = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
} /* end for */
- } /* end else */
+ } /* end else */
- if(ret_value < 0)
+ if (ret_value < 0)
HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
} /* end if */
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+#else /* H5_NO_DEPRECATED_SYMBOLS */
HDassert(0 && "version 1 error stack walk without deprecated symbols!");
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- } /* end if */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ } /* end if */
else {
HDassert(op->vers == 2);
- if(op->u.func2) {
+ if (op->u.func2) {
ret_value = SUCCEED;
- if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++)
+ if (H5E_WALK_UPWARD == direction) {
+ for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++)
ret_value = (op->u.func2)((unsigned)i, estack->slot + i, client_data);
} /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--)
- ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data);
+ for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--)
+ ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i,
+ client_data);
} /* end else */
- if(ret_value < 0)
+ if (ret_value < 0)
HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
} /* end if */
- } /* end else */
+ } /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__walk() */
-
/*-------------------------------------------------------------------------
* Function: H5E__get_auto
*
@@ -607,15 +589,14 @@ H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data)
HDassert(estack);
/* Retrieve the requested information */
- if(op)
+ if (op)
*op = estack->auto_op;
- if(client_data)
+ if (client_data)
*client_data = estack->auto_data;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E__get_auto() */
-
/*-------------------------------------------------------------------------
* Function: H5E__set_auto
*
@@ -647,13 +628,12 @@ H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data)
HDassert(estack);
/* Set the automatic error reporting info */
- estack->auto_op = *op;
+ estack->auto_op = *op;
estack->auto_data = client_data;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E__set_auto() */
-
/*-------------------------------------------------------------------------
* Function: H5E_printf_stack
*
@@ -667,17 +647,17 @@ H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line,
- hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...)
+H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id,
+ hid_t min_id, const char *fmt, ...)
{
- va_list ap; /* Varargs info */
+ va_list ap; /* Varargs info */
#ifndef H5_HAVE_VASPRINTF
- int tmp_len; /* Current size of description buffer */
- int desc_len; /* Actual length of description when formatted */
-#endif /* H5_HAVE_VASPRINTF */
- char *tmp = NULL; /* Buffer to place formatted description in */
- hbool_t va_started = FALSE; /* Whether the variable argument list is open */
- herr_t ret_value = SUCCEED; /* Return value */
+ int tmp_len; /* Current size of description buffer */
+ int desc_len; /* Actual length of description when formatted */
+#endif /* H5_HAVE_VASPRINTF */
+ char * tmp = NULL; /* Buffer to place formatted description in */
+ hbool_t va_started = FALSE; /* Whether the variable argument list is open */
+ herr_t ret_value = SUCCEED; /* Return value */
/*
* WARNING: We cannot call HERROR() from within this function or else we
@@ -694,10 +674,10 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
HDassert(min_id > 0);
HDassert(fmt);
-/* Note that the variable-argument parsing for the format is identical in
- * the H5Epush2() routine - correct errors and make changes in both
- * places. -QAK
- */
+ /* Note that the variable-argument parsing for the format is identical in
+ * the H5Epush2() routine - correct errors and make changes in both
+ * places. -QAK
+ */
/* Start the variable-argument parsing */
HDva_start(ap, fmt);
@@ -705,16 +685,16 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
#ifdef H5_HAVE_VASPRINTF
/* Use the vasprintf() routine, since it does what we're trying to do below */
- if(HDvasprintf(&tmp, fmt, ap) < 0)
+ if (HDvasprintf(&tmp, fmt, ap) < 0)
HGOTO_DONE(FAIL)
-#else /* H5_HAVE_VASPRINTF */
+#else /* H5_HAVE_VASPRINTF */
/* Allocate space for the formatted description buffer */
tmp_len = 128;
- if(NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
+ if (NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
HGOTO_DONE(FAIL)
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
- while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
+ while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
HDva_end(ap);
HDva_start(ap, fmt);
@@ -724,33 +704,32 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
/* Allocate a description of the appropriate length */
tmp_len = desc_len + 1;
- if(NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
+ if (NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
HGOTO_DONE(FAIL)
} /* end while */
#endif /* H5_HAVE_VASPRINTF */
/* Push the error on the stack */
- if(H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
+ if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
HGOTO_DONE(FAIL)
done:
- if(va_started)
+ if (va_started)
HDva_end(ap);
#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
*/
- if(tmp)
+ if (tmp)
HDfree(tmp);
-#else /* H5_HAVE_VASPRINTF */
- if(tmp)
+#else /* H5_HAVE_VASPRINTF */
+ if (tmp)
H5MM_xfree(tmp);
#endif /* H5_HAVE_VASPRINTF */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_printf_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5E__push_stack
*
@@ -772,10 +751,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line,
- hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc)
+H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id,
+ hid_t min_id, const char *desc)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
/*
* WARNING: We cannot call HERROR() from within this function or else we
@@ -792,19 +771,20 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line
HDassert(min_id > 0);
/* Check for 'default' error stack */
- if(estack == NULL)
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (estack == NULL)
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_DONE(FAIL)
/*
* Don't fail if arguments are bad. Instead, substitute some default
* value.
*/
- if(!func)
+ if (!func)
func = "Unknown_Function";
- if(!file)
+ if (!file)
file = "Unknown_File";
- if(!desc)
+ if (!desc)
desc = "No description given";
/*
@@ -812,32 +792,31 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line
*/
HDassert(estack);
- if(estack->nused < H5E_NSLOTS) {
+ if (estack->nused < H5E_NSLOTS) {
/* Increment the IDs to indicate that they are used in this stack */
- if(H5I_inc_ref(cls_id, FALSE) < 0)
+ if (H5I_inc_ref(cls_id, FALSE) < 0)
HGOTO_DONE(FAIL)
- estack->slot[estack->nused].cls_id = cls_id;
- if(H5I_inc_ref(maj_id, FALSE) < 0)
+ estack->slot[estack->nused].cls_id = cls_id;
+ if (H5I_inc_ref(maj_id, FALSE) < 0)
HGOTO_DONE(FAIL)
- estack->slot[estack->nused].maj_num = maj_id;
- if(H5I_inc_ref(min_id, FALSE) < 0)
+ estack->slot[estack->nused].maj_num = maj_id;
+ if (H5I_inc_ref(min_id, FALSE) < 0)
HGOTO_DONE(FAIL)
- estack->slot[estack->nused].min_num = min_id;
- if(NULL == (estack->slot[estack->nused].func_name = H5MM_xstrdup(func)))
+ estack->slot[estack->nused].min_num = min_id;
+ if (NULL == (estack->slot[estack->nused].func_name = H5MM_xstrdup(func)))
HGOTO_DONE(FAIL)
- if(NULL == (estack->slot[estack->nused].file_name = H5MM_xstrdup(file)))
+ if (NULL == (estack->slot[estack->nused].file_name = H5MM_xstrdup(file)))
HGOTO_DONE(FAIL)
- estack->slot[estack->nused].line = line;
- if(NULL == (estack->slot[estack->nused].desc = H5MM_xstrdup(desc)))
+ estack->slot[estack->nused].line = line;
+ if (NULL == (estack->slot[estack->nused].desc = H5MM_xstrdup(desc)))
HGOTO_DONE(FAIL)
- estack->nused++;
+ estack->nused++;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__push_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5E__clear_entries
*
@@ -854,9 +833,9 @@ done:
static herr_t
H5E__clear_entries(H5E_t *estack, size_t nentries)
{
- H5E_error2_t *error; /* Pointer to error stack entry to clear */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_error2_t *error; /* Pointer to error stack entry to clear */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -865,25 +844,25 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
HDassert(estack->nused >= nentries);
/* Empty the error stack from the top down */
- for(u = 0; nentries > 0; nentries--, u++) {
+ for (u = 0; nentries > 0; nentries--, u++) {
error = &(estack->slot[estack->nused - (u + 1)]);
/* Decrement the IDs to indicate that they are no longer used by this stack */
/* (In reverse order that they were incremented, so that reference counts work well) */
- if(H5I_dec_ref(error->min_num) < 0)
+ if (H5I_dec_ref(error->min_num) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message")
- if(H5I_dec_ref(error->maj_num) < 0)
+ if (H5I_dec_ref(error->maj_num) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message")
- if(H5I_dec_ref(error->cls_id) < 0)
+ if (H5I_dec_ref(error->cls_id) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
/* Release strings */
- if(error->func_name)
- error->func_name = (const char *) H5MM_xfree_const(error->func_name);
- if(error->file_name)
- error->file_name = (const char *) H5MM_xfree_const(error->file_name);
- if(error->desc)
- error->desc = (const char *) H5MM_xfree_const(error->desc);
+ if (error->func_name)
+ error->func_name = (const char *)H5MM_xfree_const(error->func_name);
+ if (error->file_name)
+ error->file_name = (const char *)H5MM_xfree_const(error->file_name);
+ if (error->desc)
+ error->desc = (const char *)H5MM_xfree_const(error->desc);
}
/* Decrement number of errors on stack */
@@ -893,7 +872,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__clear_entries() */
-
/*-------------------------------------------------------------------------
* Function: H5E_clear_stack
*
@@ -910,26 +888,26 @@ done:
herr_t
H5E_clear_stack(H5E_t *estack)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check for 'default' error stack */
- if(estack == NULL)
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (estack == NULL)
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Empty the error stack */
HDassert(estack);
- if(estack->nused)
- if(H5E__clear_entries(estack, estack->nused) < 0)
+ if (estack->nused)
+ if (H5E__clear_entries(estack, estack->nused) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_clear_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5E__pop
*
@@ -946,7 +924,7 @@ done:
herr_t
H5E__pop(H5E_t *estack, size_t count)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -955,14 +933,13 @@ H5E__pop(H5E_t *estack, size_t count)
HDassert(estack->nused >= count);
/* Remove the entries from the error stack */
- if(H5E__clear_entries(estack, count) < 0)
+ if (H5E__clear_entries(estack, count) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__pop() */
-
/*-------------------------------------------------------------------------
* Function: H5E_dump_api_stack
*
@@ -980,32 +957,31 @@ done:
herr_t
H5E_dump_api_stack(hbool_t is_api)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Only dump the error stack during an API call */
- if(is_api) {
+ if (is_api) {
H5E_t *estack = H5E__get_my_stack();
HDassert(estack);
#ifdef H5_NO_DEPRECATED_SYMBOLS
- if(estack->auto_op.func2)
- (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
-#else /* H5_NO_DEPRECATED_SYMBOLS */
- if(estack->auto_op.vers == 1) {
- if(estack->auto_op.func1)
+ if (estack->auto_op.func2)
+ (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ if (estack->auto_op.vers == 1) {
+ if (estack->auto_op.func1)
(void)((estack->auto_op.func1)(estack->auto_data));
} /* end if */
else {
- if(estack->auto_op.func2)
+ if (estack->auto_op.func2)
(void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
} /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_dump_api_stack() */
-