Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 18, 2021
1 parent 5b02832 commit baf7d6e
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 97 deletions.
8 changes: 4 additions & 4 deletions src/H5FDlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,11 @@ static H5FD_t *
H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
H5FD_log_t * file = NULL;
H5P_genplist_t * plist; /* Property list */
const H5FD_log_fapl_t *fa; /* File access property list information */
H5P_genplist_t * plist; /* Property list */
const H5FD_log_fapl_t *fa; /* File access property list information */
H5FD_log_fapl_t default_fa = H5FD_log_default_config_g;
int fd = -1; /* File descriptor */
int o_flags; /* Flags for open() call */
int fd = -1; /* File descriptor */
int o_flags; /* Flags for open() call */
#ifdef H5_HAVE_WIN32_API
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
#endif
Expand Down
29 changes: 16 additions & 13 deletions src/H5FDmulti.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);

if (H5FD_split_populate_config(meta_ext, meta_plist_id, raw_ext, raw_plist_id,
TRUE, &fa) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "can't setup split driver configuration", -1);
if (H5FD_split_populate_config(meta_ext, meta_plist_id, raw_ext, raw_plist_id, TRUE, &fa) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "can't setup split driver configuration",
-1);

return H5Pset_driver(fapl, H5FD_MULTI, &fa);
}
Expand Down Expand Up @@ -430,7 +430,8 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl
H5E_END_TRY;
if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id)) {
if (H5FD_multi_populate_config(NULL, NULL, NULL, NULL, TRUE, &default_fa) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup default driver configuration", -1);
H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup default driver configuration",
-1);
fa = &default_fa;
}

Expand Down Expand Up @@ -472,17 +473,19 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char *raw_ext,
hid_t raw_plist_id, hbool_t relax, H5FD_multi_fapl_t *fa_out)
H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id,
hbool_t relax, H5FD_multi_fapl_t *fa_out)
{
static const char *func = "H5FD_split_populate_config"; /* Function Name for error reporting */
static char meta_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store metadata member name */
static char raw_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store raw data member name */
const char *_memb_name[H5FD_MEM_NTYPES];
H5FD_mem_t _memb_map[H5FD_MEM_NTYPES];
hid_t _memb_fapl[H5FD_MEM_NTYPES];
haddr_t _memb_addr[H5FD_MEM_NTYPES];
herr_t ret_value = 0;
static char
meta_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store metadata member name */
static char
raw_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store raw data member name */
const char *_memb_name[H5FD_MEM_NTYPES];
H5FD_mem_t _memb_map[H5FD_MEM_NTYPES];
hid_t _memb_fapl[H5FD_MEM_NTYPES];
haddr_t _memb_addr[H5FD_MEM_NTYPES];
herr_t ret_value = 0;

assert(fa_out);

Expand Down
32 changes: 17 additions & 15 deletions src/H5FDsplitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr);
/* Prototypes */
static herr_t H5FD__splitter_term(void);
static herr_t H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config,
H5FD_splitter_fapl_t *fapl_out);
H5FD_splitter_fapl_t * fapl_out);
static herr_t H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len,
const char *base_filename);
static hsize_t H5FD__splitter_sb_size(H5FD_t *_file);
Expand Down Expand Up @@ -347,7 +347,7 @@ herr_t
H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
{
const H5FD_splitter_fapl_t *fapl_ptr = NULL;
H5FD_splitter_fapl_t *default_fapl = NULL;
H5FD_splitter_fapl_t * default_fapl = NULL;
H5P_genplist_t * plist_ptr = NULL;
herr_t ret_value = SUCCEED;

Expand Down Expand Up @@ -412,13 +412,12 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
*-------------------------------------------------------------------------
*/
static herr_t
H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config,
H5FD_splitter_fapl_t *fapl_out)
H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_splitter_fapl_t *fapl_out)
{
H5P_genplist_t *def_plist;
H5P_genplist_t *plist;
hbool_t free_config = FALSE;
herr_t ret_value = SUCCEED;
herr_t ret_value = SUCCEED;

FUNC_ENTER_STATIC

Expand All @@ -431,8 +430,8 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config,
if (NULL == vfd_config)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")

vfd_config->magic = H5FD_SPLITTER_MAGIC;
vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
vfd_config->magic = H5FD_SPLITTER_MAGIC;
vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
vfd_config->rw_fapl_id = H5P_DEFAULT;
vfd_config->wo_fapl_id = H5P_DEFAULT;

Expand Down Expand Up @@ -530,8 +529,7 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config,
*-------------------------------------------------------------------------
*/
static herr_t
H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len,
const char *base_filename)
H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const char *base_filename)
{
const char *suffix = "_wo";
size_t old_filename_len = 0;
Expand Down Expand Up @@ -805,7 +803,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
{
H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */
const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */
H5FD_splitter_fapl_t *default_fapl = NULL;
H5FD_splitter_fapl_t * default_fapl = NULL;
H5P_genplist_t * plist_ptr = NULL;
H5FD_t * ret_value = NULL;

Expand Down Expand Up @@ -842,7 +840,8 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha

/* If W/O path is not set, use base filename with '_wo' suffix */
if (*default_fapl->wo_path == '\0')
if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, name) < 0)
if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, name) <
0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't generate default filename for W/O channel")

fapl_ptr = default_fapl;
Expand Down Expand Up @@ -1453,7 +1452,7 @@ static herr_t
H5FD__splitter_delete(const char *filename, hid_t fapl_id)
{
const H5FD_splitter_fapl_t *fapl_ptr = NULL;
H5FD_splitter_fapl_t *default_fapl = NULL;
H5FD_splitter_fapl_t * default_fapl = NULL;
H5P_genplist_t * plist;
herr_t ret_value = SUCCEED;

Expand All @@ -1470,7 +1469,8 @@ H5FD__splitter_delete(const char *filename, hid_t fapl_id)

/* If W/O path is not set, use base filename with '_wo' suffix */
if (*default_fapl->wo_path == '\0')
if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, filename) < 0)
if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1,
filename) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel")

fapl_ptr = default_fapl;
Expand All @@ -1480,13 +1480,15 @@ H5FD__splitter_delete(const char *filename, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist))) {
if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL,
"unable to allocate file access property list struct")
if (H5FD__splitter_populate_config(NULL, default_fapl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info")

/* If W/O path is not set, use base filename with '_wo' suffix */
if (*default_fapl->wo_path == '\0')
if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, filename) < 0)
if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1,
filename) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel")

fapl_ptr = default_fapl;
Expand Down
2 changes: 1 addition & 1 deletion test/error_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ main(void)
hid_t fapl = -1;
hid_t estack_id = -1;
char filename[1024];
const char *env_h5_drvr; /* File driver value from environment */
const char *env_h5_drvr; /* File driver value from environment */
const char *FUNC_main = "main";
int i;

Expand Down
16 changes: 6 additions & 10 deletions test/h5test.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu
{
const char *prefix = NULL;
const char *driver_env_var = NULL; /* HDF5_DRIVER environment variable */
char * ptr, last = '\0';
const char *suffix = _suffix;
char * ptr, last = '\0';
const char *suffix = _suffix;
size_t i, j;
hid_t driver = -1;
int isppdriver = 0; /* if the driver is MPI parallel */
Expand Down Expand Up @@ -1182,15 +1182,14 @@ h5_get_file_size(const char *filename, hid_t fapl)
#ifdef H5_HAVE_DIRECT
driver == H5FD_DIRECT ||
#endif /* H5_HAVE_DIRECT */
driver == H5FD_LOG ||
driver == H5FD_SPLITTER) {
driver == H5FD_LOG || driver == H5FD_SPLITTER) {
/* Get the file's statistics */
if (0 == HDstat(filename, &sb))
return ((h5_stat_size_t)sb.st_size);
} /* end if */
else if (driver == H5FD_MULTI) {
H5FD_mem_t mt;
h5_stat_size_t tot_size = 0;
h5_stat_size_t tot_size = 0;
char * driver_env_var = NULL;

driver_env_var = HDgetenv("HDF5_DRIVER");
Expand Down Expand Up @@ -2249,9 +2248,7 @@ h5_driver_uses_modified_filename(void)
char * driver = HDgetenv("HDF5_DRIVER");

if (driver) {
ret_val = !HDstrcmp(driver, "multi") ||
!HDstrcmp(driver, "split") ||
!HDstrcmp(driver, "family") ||
ret_val = !HDstrcmp(driver, "multi") || !HDstrcmp(driver, "split") || !HDstrcmp(driver, "family") ||
!HDstrcmp(driver, "splitter");
}

Expand Down Expand Up @@ -2291,8 +2288,7 @@ h5_driver_uses_multiple_files(const char *drv_name, unsigned flags)

if (drv_name) {
if ((flags & H5_EXCLUDE_MULTIPART_DRIVERS) == 0) {
if (!HDstrcmp(drv_name, "split") || !HDstrcmp(drv_name, "multi") ||
!HDstrcmp(drv_name, "family"))
if (!HDstrcmp(drv_name, "split") || !HDstrcmp(drv_name, "multi") || !HDstrcmp(drv_name, "family"))
return TRUE;
}

Expand Down
2 changes: 1 addition & 1 deletion test/h5test.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define H5_FILEACCESS_LIBVER 0x01

/* Flags for h5_driver_uses_multiple_files() */
#define H5_EXCLUDE_MULTIPART_DRIVERS 0x01
#define H5_EXCLUDE_MULTIPART_DRIVERS 0x01
#define H5_EXCLUDE_NON_MULTIPART_DRIVERS 0x02

/* Macros to create and fill 2D arrays with a single heap allocation.
Expand Down
5 changes: 2 additions & 3 deletions test/links.c
Original file line number Diff line number Diff line change
Expand Up @@ -22641,12 +22641,12 @@ main(void)
if (efc) {
if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
TEST_ERROR
HDprintf("\n---Testing with external file cache---\n");
HDprintf("\n---Testing with external file cache---\n");
} /* end if */
else {
if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
TEST_ERROR
HDprintf("\n---Testing without external file cache---\n");
HDprintf("\n---Testing without external file cache---\n");
} /* end else */

nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
Expand Down Expand Up @@ -22711,7 +22711,6 @@ main(void)
nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
} /* with/without external file cache */

}

/* These tests assume that external links are a form of UD links,
Expand Down
2 changes: 1 addition & 1 deletion test/links_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ external_link_env(hid_t fapl, hbool_t new_format)
int
main(void)
{
const char *env_h5_drvr; /* File driver value from environment */
const char *env_h5_drvr; /* File driver value from environment */
hid_t fapl; /* File access property lists */
int nerrors = 0; /* Error from tests */

Expand Down
2 changes: 1 addition & 1 deletion test/objcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -17312,7 +17312,7 @@ main(void)
int configuration; /* Configuration of tests. */
int ExpressMode;
const char *env_h5_drvr; /* File Driver value from environment */
hbool_t same_file; /* Whether to run tests that only use one file */
hbool_t same_file; /* Whether to run tests that only use one file */

env_h5_drvr = HDgetenv("HDF5_DRIVER");
if (env_h5_drvr == NULL)
Expand Down
16 changes: 9 additions & 7 deletions test/set_extent.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,13 @@ do_ranks(hid_t fapl, hbool_t new_format)

if (!h5_using_parallel_driver(NULL)) {
/* VL test */
if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) <
0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length")
HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
? "btree"
: (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray"));
HDprintf(" Index: %s\n",
index_type == RANK4_INDEX_BTREE
? "btree"
: (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray"));
goto error;
} /* end if */
}
Expand All @@ -366,8 +368,8 @@ do_ranks(hid_t fapl, hbool_t new_format)
} /* end if */

if (!h5_using_parallel_driver(NULL)) {
if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) <
0) {
if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE,
index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation")
HDprintf(" Index: %s\n",
index_type == RANK4_INDEX_BTREE
Expand All @@ -376,7 +378,7 @@ do_ranks(hid_t fapl, hbool_t new_format)
goto error;
} /* end if */
}
} /* end if */
} /* end if */

/* Break out if using the old format */
if (!new_format)
Expand Down
29 changes: 15 additions & 14 deletions test/tfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,24 +1630,24 @@ test_file_perm2(void)
** H5Fis_accessible() API call.
**
*****************************************************************/
#define FILE_IS_ACCESSIBLE "tfile_is_accessible"
#define FILE_IS_ACCESSIBLE "tfile_is_accessible"
#define FILE_IS_ACCESSIBLE_NON_HDF5 "tfile_is_accessible_non_hdf5"
static void
test_file_is_accessible(const char *env_h5_drvr)
{
hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
int fd; /* POSIX file descriptor */
char filename[FILENAME_LEN]; /* Filename to use */
char non_hdf5_filename[FILENAME_LEN]; /* Base name of non-hdf5 file */
hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
int fd; /* POSIX file descriptor */
char filename[FILENAME_LEN]; /* Filename to use */
char non_hdf5_filename[FILENAME_LEN]; /* Base name of non-hdf5 file */
char non_hdf5_sb_filename[FILENAME_LEN]; /* Name of non-hdf5 superblock file */
ssize_t nbytes; /* Number of bytes written */
unsigned u; /* Local index variable */
unsigned char buf[1024]; /* Buffer of data to write */
htri_t is_hdf5; /* Whether a file is an HDF5 file */
int posix_ret; /* Return value from POSIX calls */
herr_t ret; /* Return value from HDF5 calls */
ssize_t nbytes; /* Number of bytes written */
unsigned u; /* Local index variable */
unsigned char buf[1024]; /* Buffer of data to write */
htri_t is_hdf5; /* Whether a file is an HDF5 file */
int posix_ret; /* Return value from POSIX calls */
herr_t ret; /* Return value from HDF5 calls */

/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files\n"));
Expand All @@ -1659,7 +1659,8 @@ test_file_is_accessible(const char *env_h5_drvr)
/* Fix up filenames */
h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename));
h5_fixname(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_filename, sizeof(non_hdf5_filename));
h5_fixname_superblock(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_sb_filename, sizeof(non_hdf5_sb_filename));
h5_fixname_superblock(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_sb_filename,
sizeof(non_hdf5_sb_filename));

/****************/
/* Normal usage */
Expand Down
Loading

0 comments on commit baf7d6e

Please sign in to comment.