mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-01 16:28:09 +08:00
Misc fixes highlighted by the checkposix script (#1499)
This commit is contained in:
parent
34442f3740
commit
96398e47af
@ -115,7 +115,7 @@ foreach $arg (@ARGV) {
|
|||||||
|
|
||||||
# These are really HDF5 functions/macros even though they don't
|
# These are really HDF5 functions/macros even though they don't
|
||||||
# start with `h' or `H'.
|
# start with `h' or `H'.
|
||||||
next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT|_NOPUSH)?(_NOFUNC|_TAG)?$/;
|
next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NAMECHECK_ONLY|_NOFS|_NOCLEAR|_NOINIT|_NOPUSH)?(_NOFUNC|_TAG)?$/;
|
||||||
next if $name =~ /^(BEGIN|END)_FUNC$/;
|
next if $name =~ /^(BEGIN|END)_FUNC$/;
|
||||||
next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/;
|
next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/;
|
||||||
next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/;
|
next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/;
|
||||||
@ -123,10 +123,13 @@ foreach $arg (@ARGV) {
|
|||||||
next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/;
|
next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/;
|
||||||
next if $name =~ /^(SIZE_OVERFLOW|UNIQUE_MEMBERS|S_ISDIR)$/;
|
next if $name =~ /^(SIZE_OVERFLOW|UNIQUE_MEMBERS|S_ISDIR)$/;
|
||||||
next if $name =~ /^addr_defined$/;
|
next if $name =~ /^addr_defined$/;
|
||||||
|
next if $name =~ /^TERMINATOR$/;
|
||||||
|
|
||||||
# These functions/macros are exempt.
|
# Ignore callback invocation
|
||||||
# op, cb, and OP are often spuriously flagged so ignore them.
|
next if $name =~ /^(op|cb|OP|iter_op|func)$/;
|
||||||
next if $name =~ /^(main|op|cb|OP)$/;
|
|
||||||
|
# Ignore main
|
||||||
|
next if $name =~ /^main$/;
|
||||||
|
|
||||||
# This often appears in preprocessor lines that span multiple lines
|
# This often appears in preprocessor lines that span multiple lines
|
||||||
next if $name =~ /^(defined)$/;
|
next if $name =~ /^(defined)$/;
|
||||||
|
@ -446,7 +446,7 @@ static FILE * debug_stream = NULL;
|
|||||||
do { \
|
do { \
|
||||||
if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \
|
if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \
|
||||||
HDfprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank); \
|
HDfprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank); \
|
||||||
fflush(debug_stream); \
|
HDfflush(debug_stream); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ static FILE * debug_stream = NULL;
|
|||||||
do { \
|
do { \
|
||||||
if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \
|
if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \
|
||||||
HDfprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank, __VA_ARGS__); \
|
HDfprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank, __VA_ARGS__); \
|
||||||
fflush(debug_stream); \
|
HDfflush(debug_stream); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ static FILE * debug_stream = NULL;
|
|||||||
\
|
\
|
||||||
if (trace_flag) { \
|
if (trace_flag) { \
|
||||||
H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_in_pre, __func__); \
|
H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_in_pre, __func__); \
|
||||||
debug_indent += (int)strlen(trace_in_pre); \
|
debug_indent += (int)HDstrlen(trace_in_pre); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ static FILE * debug_stream = NULL;
|
|||||||
hbool_t trace_flag = H5D_mpio_debug_flags_s[(int)'t']; \
|
hbool_t trace_flag = H5D_mpio_debug_flags_s[(int)'t']; \
|
||||||
\
|
\
|
||||||
if (trace_flag) { \
|
if (trace_flag) { \
|
||||||
debug_indent -= (int)strlen(trace_out_pre); \
|
debug_indent -= (int)HDstrlen(trace_out_pre); \
|
||||||
H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_out_pre, __func__); \
|
H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_out_pre, __func__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1141,8 +1141,8 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
|
|||||||
HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file")
|
HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file")
|
||||||
|
|
||||||
/* Print a short header for this I/O operation */
|
/* Print a short header for this I/O operation */
|
||||||
time_now = time(NULL);
|
time_now = HDtime(NULL);
|
||||||
HDfprintf(debug_log_file, "##### %s", asctime(localtime(&time_now)));
|
HDfprintf(debug_log_file, "##### %s", HDasctime(HDlocaltime(&time_now)));
|
||||||
|
|
||||||
debug_stream = debug_log_file;
|
debug_stream = debug_log_file;
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,9 @@ struct H5FD_t {
|
|||||||
hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */
|
hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* VFD initialization function */
|
||||||
|
typedef hid_t (*H5FD_init_t)(void);
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
/* Public Variables */
|
/* Public Variables */
|
||||||
/********************/
|
/********************/
|
||||||
@ -235,7 +238,7 @@ struct H5FD_t {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
H5_DLL hid_t H5FDperform_init(hid_t (*)(void));
|
H5_DLL hid_t H5FDperform_init(H5FD_init_t op);
|
||||||
H5_DLL hid_t H5FDregister(const H5FD_class_t *cls);
|
H5_DLL hid_t H5FDregister(const H5FD_class_t *cls);
|
||||||
H5_DLL htri_t H5FDis_driver_registered_by_name(const char *driver_name);
|
H5_DLL htri_t H5FDis_driver_registered_by_name(const char *driver_name);
|
||||||
H5_DLL htri_t H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value);
|
H5_DLL htri_t H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value);
|
||||||
|
@ -233,20 +233,20 @@ H5FD__family_get_default_printf_filename(const char *old_filename)
|
|||||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer")
|
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer")
|
||||||
|
|
||||||
/* Determine if filename contains a ".h5" extension. */
|
/* Determine if filename contains a ".h5" extension. */
|
||||||
if ((file_extension = strstr(old_filename, ".h5"))) {
|
if ((file_extension = HDstrstr(old_filename, ".h5"))) {
|
||||||
/* Insert the printf format between the filename and ".h5" extension. */
|
/* Insert the printf format between the filename and ".h5" extension. */
|
||||||
HDstrcpy(tmp_buffer, old_filename);
|
HDstrcpy(tmp_buffer, old_filename);
|
||||||
file_extension = strstr(tmp_buffer, ".h5");
|
file_extension = HDstrstr(tmp_buffer, ".h5");
|
||||||
HDsprintf(file_extension, "%s%s", suffix, ".h5");
|
HDsprintf(file_extension, "%s%s", suffix, ".h5");
|
||||||
}
|
}
|
||||||
else if ((file_extension = strrchr(old_filename, '.'))) {
|
else if ((file_extension = HDstrrchr(old_filename, '.'))) {
|
||||||
char *new_extension_loc = NULL;
|
char *new_extension_loc = NULL;
|
||||||
|
|
||||||
/* If the filename doesn't contain a ".h5" extension, but contains
|
/* If the filename doesn't contain a ".h5" extension, but contains
|
||||||
* AN extension, just insert the printf format before that extension.
|
* AN extension, just insert the printf format before that extension.
|
||||||
*/
|
*/
|
||||||
HDstrcpy(tmp_buffer, old_filename);
|
HDstrcpy(tmp_buffer, old_filename);
|
||||||
new_extension_loc = strrchr(tmp_buffer, '.');
|
new_extension_loc = HDstrrchr(tmp_buffer, '.');
|
||||||
HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -29,13 +29,14 @@
|
|||||||
* Function: H5FDperform_init
|
* Function: H5FDperform_init
|
||||||
*
|
*
|
||||||
* Purpose: Ensure that the library is initialized and then call
|
* Purpose: Ensure that the library is initialized and then call
|
||||||
* the provided VFD initializer.
|
* the provided VFD initializer
|
||||||
*
|
*
|
||||||
* Return: Success: identifier for the VFD just initialized
|
* Return: Success: Identifier for the VFD just initialized
|
||||||
* Failure: H5I_INVALID_HID
|
* Failure: H5I_INVALID_HID
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
hid_t H5FDperform_init(hid_t (*init)(void))
|
hid_t
|
||||||
|
H5FDperform_init(H5FD_init_t op)
|
||||||
{
|
{
|
||||||
hid_t ret_value = H5I_INVALID_HID; /* Return value */
|
hid_t ret_value = H5I_INVALID_HID; /* Return value */
|
||||||
|
|
||||||
@ -43,16 +44,16 @@ hid_t H5FDperform_init(hid_t (*init)(void))
|
|||||||
/*NO TRACE*/
|
/*NO TRACE*/
|
||||||
|
|
||||||
/* It is possible that an application will evaluate an
|
/* It is possible that an application will evaluate an
|
||||||
* `H5FD_*` symbol (`H5FD_FAMILY`, `H5FD_MULTI`, `H5FD_SEC2`, et
|
* `H5FD_*` symbol (`H5FD_FAMILY`, `H5FD_MULTI`, `H5FD_SEC2`, etc.
|
||||||
* cetera) before the library has had an opportunity to initialize.
|
* before the library has had an opportunity to initialize. Call
|
||||||
* Call H5_init_library() to make sure that the library has been
|
* H5_init_library() to make sure that the library has been initialized
|
||||||
* initialized before `init` is run.
|
* before `init` is run.
|
||||||
*/
|
*/
|
||||||
if (H5_init_library() < 0) {
|
if (H5_init_library() < 0)
|
||||||
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, H5I_INVALID_HID, "library initialization failed")
|
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, H5I_INVALID_HID, "library initialization failed")
|
||||||
}
|
|
||||||
|
|
||||||
ret_value = init();
|
ret_value = op();
|
||||||
|
|
||||||
done:
|
done:
|
||||||
FUNC_LEAVE_API_NOINIT(ret_value)
|
FUNC_LEAVE_API_NOINIT(ret_value)
|
||||||
}
|
}
|
||||||
|
@ -527,20 +527,20 @@ H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const ch
|
|||||||
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length")
|
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length")
|
||||||
|
|
||||||
/* Determine if filename contains a ".h5" extension. */
|
/* Determine if filename contains a ".h5" extension. */
|
||||||
if ((file_extension = strstr(base_filename, ".h5"))) {
|
if ((file_extension = HDstrstr(base_filename, ".h5"))) {
|
||||||
/* Insert the suffix between the filename and ".h5" extension. */
|
/* Insert the suffix between the filename and ".h5" extension. */
|
||||||
HDstrcpy(new_path, base_filename);
|
HDstrcpy(new_path, base_filename);
|
||||||
file_extension = strstr(new_path, ".h5");
|
file_extension = HDstrstr(new_path, ".h5");
|
||||||
HDsprintf(file_extension, "%s%s", suffix, ".h5");
|
HDsprintf(file_extension, "%s%s", suffix, ".h5");
|
||||||
}
|
}
|
||||||
else if ((file_extension = strrchr(base_filename, '.'))) {
|
else if ((file_extension = HDstrrchr(base_filename, '.'))) {
|
||||||
char *new_extension_loc = NULL;
|
char *new_extension_loc = NULL;
|
||||||
|
|
||||||
/* If the filename doesn't contain a ".h5" extension, but contains
|
/* If the filename doesn't contain a ".h5" extension, but contains
|
||||||
* AN extension, just insert the suffix before that extension.
|
* AN extension, just insert the suffix before that extension.
|
||||||
*/
|
*/
|
||||||
HDstrcpy(new_path, base_filename);
|
HDstrcpy(new_path, base_filename);
|
||||||
new_extension_loc = strrchr(new_path, '.');
|
new_extension_loc = HDstrrchr(new_path, '.');
|
||||||
HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1248,8 +1248,8 @@ H5P_set_driver_by_name(H5P_genplist_t *plist, const char *driver_name, const cha
|
|||||||
|
|
||||||
FUNC_ENTER_NOAPI(FAIL)
|
FUNC_ENTER_NOAPI(FAIL)
|
||||||
|
|
||||||
assert(plist);
|
HDassert(plist);
|
||||||
assert(driver_name);
|
HDassert(driver_name);
|
||||||
|
|
||||||
/* Register the driver */
|
/* Register the driver */
|
||||||
if ((new_driver_id = H5FD_register_driver_by_name(driver_name, app_ref)) < 0)
|
if ((new_driver_id = H5FD_register_driver_by_name(driver_name, app_ref)) < 0)
|
||||||
@ -1336,8 +1336,8 @@ H5P_set_driver_by_value(H5P_genplist_t *plist, H5FD_class_value_t driver_value,
|
|||||||
|
|
||||||
FUNC_ENTER_NOAPI(FAIL)
|
FUNC_ENTER_NOAPI(FAIL)
|
||||||
|
|
||||||
assert(plist);
|
HDassert(plist);
|
||||||
assert(driver_value >= 0);
|
HDassert(driver_value >= 0);
|
||||||
|
|
||||||
/* Register the driver */
|
/* Register the driver */
|
||||||
if ((new_driver_id = H5FD_register_driver_by_value(driver_value, app_ref)) < 0)
|
if ((new_driver_id = H5FD_register_driver_by_value(driver_value, app_ref)) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user