Skip to content

Commit

Permalink
Remove TRUE and FALSE from H5private.h (#4969)
Browse files Browse the repository at this point in the history
* Remove TRUE and FALSE from H5private.h

* Replace hbool_t with bool in test code
  • Loading branch information
derobins authored Oct 18, 2024
1 parent 29c84e0 commit 1c23395
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 129 deletions.
2 changes: 1 addition & 1 deletion c++/test/tattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ test_attr(const void *params)

// Loop over using new group format
unsigned new_format;
for (new_format = FALSE; new_format <= TRUE; new_format++) {
for (new_format = false; new_format <= true; new_format++) {
FileAccPropList curr_fapl;

// Set the file access proplist for the type of format
Expand Down
6 changes: 3 additions & 3 deletions c++/test/tfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ test_file_info()
SUBTEST("File general information");

hsize_t out_threshold = 0; // Free space section threshold to get
hbool_t out_persist = FALSE; // Persist free-space read
hbool_t out_persist = false; // Persist free-space read
// File space handling strategy
H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;

Expand All @@ -869,7 +869,7 @@ test_file_info()
// Verify file space information.
verify_val(static_cast<long>(out_strategy), static_cast<long>(H5F_FSPACE_STRATEGY_FSM_AGGR),
"H5File::getFileInfo", __LINE__, __FILE__);
verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__);
verify_val(out_persist, false, "H5File::getFileInfo", __LINE__, __FILE__);
verify_val(static_cast<long>(out_threshold), 1, "H5File::getFileInfo", __LINE__, __FILE__);

/* Retrieve file space page size */
Expand All @@ -884,7 +884,7 @@ test_file_info()
fcpl.setIstorek(F2_ISTORE);

hsize_t threshold = 5; // Free space section threshold to set
hbool_t persist = TRUE; // Persist free-space to set
hbool_t persist = true; // Persist free-space to set
H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;

fcpl.setFileSpaceStrategy(strategy, persist, threshold);
Expand Down
14 changes: 7 additions & 7 deletions c++/test/tlinks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ test_basic_links(hid_t fapl_id, hbool_t new_format)
H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);

// Verify link existence
if (file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE)
if (file.nameExists("dset1", LinkAccPropList::DEFAULT) != true)
throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist");
if (file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
if (file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != true)
throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist");
// Deprecated
if (file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
if (file.exists("dset1", LinkAccPropList::DEFAULT) != true)
throw InvalidActionException("H5File::exists", "dset1 doesn't exist");
if (file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
if (file.exists("grp1/soft", LinkAccPropList::DEFAULT) != true)
throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");

// Verify link values
Expand Down Expand Up @@ -290,7 +290,7 @@ test_move(hid_t fapl_id, hbool_t new_format)

// Move a soft link across files, should succeed
grp_2.moveLink("soft", file_b, "soft_new_name");
if (file_b.exists("soft_new_name") != TRUE)
if (file_b.exists("soft_new_name") != true)
throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");

// Move a group across groups in the same file while renaming it
Expand Down Expand Up @@ -429,7 +429,7 @@ test_copy(hid_t fapl_id, hbool_t new_format)

// Copy a soft link across files, should succeed
grp_2.copyLink("soft", file_b, "soft_new_name");
if (file_b.exists("soft_new_name") != TRUE)
if (file_b.exists("soft_new_name") != true)
throw InvalidActionException("H5File::exists", "soft_new_name doesn't exist");

// Move a group across groups in the same file while renaming it
Expand Down Expand Up @@ -730,7 +730,7 @@ test_links(const void *params)
throw Exception("test_links", "H5Pset_libver_bounds failed");

/* Loop over using new group format */
for (new_format = FALSE; new_format <= TRUE; new_format++) {
for (new_format = false; new_format <= true; new_format++) {
hid_t my_fapl_id;

/* Check for FAPL to use */
Expand Down
32 changes: 16 additions & 16 deletions c++/test/tobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,54 +169,54 @@ test_existance()

// Check if GROUP1 exists in the file
bool exists = file.nameExists(GROUP1);
verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__);
verify_val(exists, true, "Group::nameExists GROUP1_1", __LINE__, __FILE__);
// Deprecated
exists = file.exists(GROUP1);
verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__);
verify_val(exists, true, "Group::exists GROUP1_1", __LINE__, __FILE__);

// Open GROUP1
Group grp1 = file.openGroup(GROUP1);

// Check if GROUP1_1 and GROUP1_2 exist in GROUP1
exists = grp1.nameExists(GROUP1_1);
verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__);
verify_val(exists, true, "Group::nameExists GROUP1_1", __LINE__, __FILE__);
exists = grp1.nameExists(GROUP1_2);
verify_val(exists, TRUE, "Group::nameExists GROUP1_2", __LINE__, __FILE__);
verify_val(exists, true, "Group::nameExists GROUP1_2", __LINE__, __FILE__);
// Deprecated
exists = grp1.exists(GROUP1_1);
verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__);
verify_val(exists, true, "Group::exists GROUP1_1", __LINE__, __FILE__);
exists = grp1.exists(GROUP1_2);
verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__);
verify_val(exists, true, "Group::exists GROUP1_2", __LINE__, __FILE__);

// Check if DSET_IN_GRP1 exists in GROUP1
exists = grp1.nameExists(DSET_IN_GRP1);
verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__);
verify_val(exists, true, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__);
// Deprecated
exists = grp1.exists(DSET_IN_GRP1);
verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);
verify_val(exists, true, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);

// Open GROUP1_2
Group grp1_2 = grp1.openGroup(GROUP1_2);

// Check if DSET_IN_GRP1_2 exists in GROUP1_2
exists = grp1_2.nameExists(DSET_IN_GRP1_2);
verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__);
verify_val(exists, true, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__);
// Deprecated
exists = grp1_2.exists(DSET_IN_GRP1_2);
verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__);
verify_val(exists, true, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__);

// Check if a dataset exists given dataset as location with full path name
DataSet dset1 = file.openDataSet(DSET_IN_FILE);
exists = dset1.nameExists("/Top Group/Dataset_in_Group_1");
verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__);
verify_val(exists, true, "Group::nameExists given dataset with full path name", __LINE__, __FILE__);

exists = grp1_2.nameExists(DSET_IN_GRP1);
verify_val(exists, FALSE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__);
verify_val(exists, false, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__);
// Deprecated
exists = dset1.exists("/Top Group/Dataset_in_Group_1");
verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__);
verify_val(exists, true, "Group::exists given dataset with full path name", __LINE__, __FILE__);
exists = grp1_2.exists(DSET_IN_GRP1);
verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);
verify_val(exists, false, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);

// Everything will be closed as they go out of scope

Expand Down Expand Up @@ -647,7 +647,7 @@ test_intermediate_groups()
} // Failure is ignored

// Create GROUP14NAME with the flag to create missing groups set
// to FALSE, should fail because group GROUP13NAME is missing
// to false, should fail because group GROUP13NAME is missing

// Reset flag to not create missing groups
lcpl.setCreateIntermediateGroup(false);
Expand All @@ -662,7 +662,7 @@ test_intermediate_groups()
catch (FileIException &expected2) {
} // Failure is ignored

// Set the flag to create missing groups set to TRUE
// Set the flag to create missing groups set to true
lcpl.setCreateIntermediateGroup(true);
crt_int_grps = lcpl.getCreateIntermediateGroup();
verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__);
Expand Down
72 changes: 36 additions & 36 deletions hl/test/test_lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -2134,54 +2134,54 @@ test_valid_path(void)
* CHECK ABSOLUTE PATHS
**************************************/

if ((path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) {
if ((path_valid = H5LTpath_valid(file_id, "/", true)) != true) {
goto out;
}

if ((path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) {
if ((path_valid = H5LTpath_valid(file_id, "/", false)) != true) {
goto out;
}

if ((path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) {
if ((path_valid = H5LTpath_valid(file_id, "/G1", true)) != true) {
goto out;
}

if ((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/DS1", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/DS3", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/DS3", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", false)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G2", true)) != true)
goto out;

/* check soft link points to a valid object*/
if ((path_valid = H5LTpath_valid(file_id, "/G2/DS4", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G2/DS4", true)) != true)
goto out;

/* check if path exist, but not the object */
if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", false)) != true)
goto out;
/* check if path exist and if the object exists. It should fail
* since it is a dangling soft link
*/
if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", TRUE)) == TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", true)) == true)
goto out;

/* check soft links */
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", true)) != true)
goto out;

/**************************************
Expand All @@ -2191,11 +2191,11 @@ test_valid_path(void)
if ((group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0)
goto out;

if ((path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) {
if ((path_valid = H5LTpath_valid(group, "/", true)) != true) {
goto out;
}

if ((path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) {
if ((path_valid = H5LTpath_valid(group, "/", false)) != true) {
goto out;
}

Expand All @@ -2207,39 +2207,39 @@ test_valid_path(void)

/* The identifier (file id) is the object itself, i.e. "." */

if ((path_valid = H5LTpath_valid(file_id, ".", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, ".", false)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, ".", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, ".", true)) != true)
goto out;

/* The identifier (group id) is the object itself, i.e. "." */

if ((path_valid = H5LTpath_valid(group, ".", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(group, ".", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(group, "DS3", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(group, "DS3", false)) != true)
goto out;

if ((path_valid = H5LTpath_valid(group, "DS3", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(group, "DS3", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(group, "G2/G5", true)) != true)
goto out;

/* Check the "./" case */
if ((path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(group, "./DS3", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(group, "./G2/G5", true)) != true)
goto out;

/* Should fail, does not exist */
if ((path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE)
if ((path_valid = H5LTpath_valid(group, "./G2/G20", false)) == true)
goto out;

/* Should fail, does not exist */
if ((path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE)
if ((path_valid = H5LTpath_valid(group, "./G2/G20", true)) == true)
goto out;

if (H5Gclose(group) < 0)
Expand All @@ -2250,36 +2250,36 @@ test_valid_path(void)
*****************************/

/* The dangled external link path is valid */
if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", false)) != true)
goto out;

/* The file however does not exists, so the link dangles -> should return false */
if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", TRUE)) == TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", true)) == true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", false)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", false)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", true)) != true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", FALSE)) != TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", false)) != true)
goto out;

/* Should fail, does not exist */
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", TRUE)) == TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", true)) == true)
goto out;

if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", TRUE)) == TRUE)
if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", true)) == true)
goto out;

if (H5Fclose(file_id) < 0)
Expand Down
4 changes: 2 additions & 2 deletions src/H5Eint.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ static const H5E_stack_t H5E_err_stack_def = {
/* H5E_auto_op_t */
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifdef H5_USE_16_API_DEFAULT
{1, TRUE, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1,
{1, true, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1,
(H5E_auto2_t)H5E__print2},
#else /* H5_USE_16_API */
{2, TRUE, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1,
{2, true, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1,
(H5E_auto2_t)H5E__print2},
#endif /* H5_USE_16_API_DEFAULT */
#else /* H5_NO_DEPRECATED_SYMBOLS */
Expand Down
6 changes: 3 additions & 3 deletions src/H5TSmutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ H5TS_mutex_init(H5TS_mutex_t *mutex, int type)
/*-------------------------------------------------------------------------
* Function: H5TS_mutex_trylock
*
* Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to TRUE if so
* Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to true if so
*
* Return: Non-negative on success / Negative on failure
*
Expand Down Expand Up @@ -157,7 +157,7 @@ H5TS_mutex_init(H5TS_mutex_t *mutex, int H5_ATTR_UNUSED type)
/*-------------------------------------------------------------------------
* Function: H5TS_mutex_trylock
*
* Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to TRUE if so
* Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to true if so
*
* Return: Non-negative on success / Negative on failure
*
Expand Down Expand Up @@ -242,7 +242,7 @@ H5TS_mutex_init(H5TS_mutex_t *mutex, int type)
/*-------------------------------------------------------------------------
* Function: H5TS_mutex_trylock
*
* Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to TRUE if so
* Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to true if so
*
* Return: Non-negative on success / Negative on failure
*
Expand Down
2 changes: 1 addition & 1 deletion src/H5TSwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static herr_t H5TS__win32_thread_exit(void);
*
* Purpose: Per-process setup on Windows when using Win32 threads.
*
* Returns: TRUE on success, FALSE on failure
* Returns: true on success, FALSE on failure
*
*--------------------------------------------------------------------------
*/
Expand Down
Loading

0 comments on commit 1c23395

Please sign in to comment.