summaryrefslogtreecommitdiffstats
path: root/test/API/tmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/API/tmisc.c')
-rw-r--r--test/API/tmisc.c140
1 files changed, 70 insertions, 70 deletions
diff --git a/test/API/tmisc.c b/test/API/tmisc.c
index 791d22b..4c87425 100644
--- a/test/API/tmisc.c
+++ b/test/API/tmisc.c
@@ -488,8 +488,8 @@ test_misc2_write_attribute(void)
hid_t type;
herr_t ret;
misc2_struct data, data_check;
- char *string_att1 = HDstrdup("string attribute in file one");
- char *string_att2 = HDstrdup("string attribute in file two");
+ char *string_att1 = strdup("string attribute in file one");
+ char *string_att2 = strdup("string attribute in file two");
memset(&data, 0, sizeof(data));
memset(&data_check, 0, sizeof(data_check));
@@ -1131,7 +1131,7 @@ test_misc6(void)
/* Loop through adding attributes to each dataset */
for (u = 0; u < MISC6_NUMATTR; u++) {
/* Create name for attribute */
- HDsnprintf(attr_name, sizeof(attr_name), "Attr#%u", u);
+ snprintf(attr_name, sizeof(attr_name), "Attr#%u", u);
/* Open the file */
loc_id = H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -1848,7 +1848,7 @@ test_misc10(void)
hid_t dcpl; /* Dataset creation property list */
hid_t space, type; /* Old dataset's dataspace & datatype */
const char *testfile = H5_get_srcdir_filename(MISC10_FILE_OLD); /* Corrected test file name */
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
herr_t ret;
/* Output message about test being performed */
@@ -1934,7 +1934,7 @@ test_misc11(void)
#endif
H5F_fspace_strategy_t strategy; /* File space strategy */
hsize_t threshold; /* Free-space section threshold */
- hbool_t persist; /* To persist free-space or not */
+ bool persist; /* To persist free-space or not */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1995,7 +1995,7 @@ test_misc11(void)
ret = H5Pset_shared_mesg_nindexes(fcpl, MISC11_NINDEXES);
CHECK(ret, FAIL, "H5Pset_shared_mesg");
- ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, false, (hsize_t)1);
CHECK(ret, FAIL, "H5Pset_file_space");
/* Creating a file with the non-default file creation property list should
@@ -2062,7 +2062,7 @@ test_misc11(void)
ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
CHECK(ret, FAIL, "H5Pget_file_space_strategy");
VERIFY(strategy, 3, "H5Pget_file_space_strategy");
- VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(persist, false, "H5Pget_file_space_strategy");
VERIFY(threshold, 1, "H5Pget_file_space_strategy");
/* Close file */
@@ -2166,11 +2166,11 @@ test_misc12(void)
CHECK(ret, FAIL, "H5Dread");
for (i = 0; i < MISC12_SPACE1_DIM1; i++)
- if (HDstrcmp(wdata[i], rdata[i]) != 0)
+ if (strcmp(wdata[i], rdata[i]) != 0)
TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n", __LINE__, i, wdata[i], i,
rdata[i]);
for (; i < (MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE); i++)
- if (HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]) != 0)
+ if (strcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]) != 0)
TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n", __LINE__, i - MISC12_SPACE1_DIM1,
wdata1[i - MISC12_SPACE1_DIM1], i, rdata[i]);
@@ -2208,16 +2208,16 @@ misc13_init_data(unsigned *original_data)
original_data[u] = u;
}
-static hbool_t
+static bool
misc13_verify_data_match(const unsigned *original_data, const unsigned *read_data)
{
unsigned u;
for (u = 0; u < MISC13_DIM1; u++)
if (original_data[u] != read_data[u])
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static void
@@ -2389,7 +2389,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
CHECK_PTR(user_block, "calloc");
/* Copy in the user block data */
- memcpy(user_block, str, HDstrlen(str));
+ memcpy(user_block, str, strlen(str));
/* Open the new file */
new_fp = fopen(new_name, "wb");
@@ -2432,7 +2432,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
static void
misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_size,
- hbool_t check_for_new_dataset)
+ bool check_for_new_dataset)
{
hid_t fid = -1; /* File ID */
hid_t gid1 = -1; /* Group IDs */
@@ -2476,7 +2476,7 @@ misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_siz
CHECK(tid, FAIL, "H5Topen2");
/* Verify the type is correct */
- VERIFY(H5Tequal(tid, H5T_NATIVE_INT), TRUE, "H5Tequal");
+ VERIFY(H5Tequal(tid, H5T_NATIVE_INT), true, "H5Tequal");
/* Close named datatype */
ret = H5Tclose(tid);
@@ -2497,7 +2497,7 @@ misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_siz
CHECK(tid, FAIL, "H5Topen2");
/* Verify the type is correct */
- VERIFY(H5Tequal(tid, H5T_NATIVE_INT), TRUE, "H5Tequal");
+ VERIFY(H5Tequal(tid, H5T_NATIVE_INT), true, "H5Tequal");
/* Close named datatype */
ret = H5Tclose(tid);
@@ -2551,7 +2551,7 @@ test_misc13(void)
{
unsigned *data = NULL; /* Data to write to dataset */
hsize_t userblock_size; /* Correct size of userblock */
- hbool_t check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */
+ bool check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */
/* Create a data buffer for the datasets */
data = (unsigned *)calloc(MISC13_DIM1, sizeof(unsigned));
@@ -2565,7 +2565,7 @@ test_misc13(void)
/* Verify file contents are correct */
userblock_size = 0;
- check_for_new_dataset = FALSE;
+ check_for_new_dataset = false;
misc13_verify_file(MISC13_FILE_1, data, userblock_size, check_for_new_dataset);
/* Create a new file by inserting a user block in front of the first file */
@@ -2573,7 +2573,7 @@ test_misc13(void)
/* Verify file contents are still correct */
userblock_size = MISC13_USERBLOCK_SIZE;
- check_for_new_dataset = FALSE;
+ check_for_new_dataset = false;
misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset);
/* Make certain we can modify the new file */
@@ -2581,7 +2581,7 @@ test_misc13(void)
/* Verify file contents are still correct */
userblock_size = MISC13_USERBLOCK_SIZE;
- check_for_new_dataset = TRUE;
+ check_for_new_dataset = true;
misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset);
/* Free the dataset buffer */
@@ -2925,13 +2925,13 @@ test_misc16(void)
/* Compare data read in */
for (i = 0; i < MISC16_SPACE_DIM; i++) {
- if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ if (strlen(wdata[i]) != strlen(rdata[i])) {
TestErrPrintf(
"Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
+ (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
continue;
} /* end if */
- if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ if (strcmp(wdata[i], rdata[i]) != 0) {
TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
(unsigned)__LINE__, (int)i, wdata[i], (int)i, rdata[i]);
continue;
@@ -3013,13 +3013,13 @@ test_misc17(void)
/* Compare data in the way of strings. */
for (i = 0; i < MISC17_SPACE_DIM1; i++) {
- if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ if (strlen(wdata[i]) != strlen(rdata[i])) {
TestErrPrintf(
"Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
+ (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
continue;
} /* end if */
- if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ if (strcmp(wdata[i], rdata[i]) != 0) {
TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
(unsigned)__LINE__, (int)i, wdata[i], (int)i, rdata[i]);
continue;
@@ -3133,7 +3133,7 @@ test_misc18(void)
/* Loop creating attributes on each dataset, flushing them to the file each time */
for (u = 0; u < 10; u++) {
/* Set up attribute name */
- HDsnprintf(attr_name, sizeof(attr_name), "Attr %u", u);
+ snprintf(attr_name, sizeof(attr_name), "Attr %u", u);
/* Create & close attribute on first dataset */
aid = H5Acreate2(did1, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -3777,7 +3777,7 @@ test_misc20(void)
unsigned version; /* Version of storage layout info */
hsize_t contig_size; /* Size of contiguous storage size from layout into */
const char *testfile = H5_get_srcdir_filename(MISC20_FILE_OLD); /* Corrected test file name */
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -4255,7 +4255,7 @@ test_misc23(void)
CHECK(create_id, FAIL, "H5Pcreate");
/* Set flag for intermediate group creation */
- status = H5Pset_create_intermediate_group(create_id, TRUE);
+ status = H5Pset_create_intermediate_group(create_id, true);
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
tmp_id = H5Gcreate2(file_id, "/A/B01/grp", create_id, H5P_DEFAULT, access_id);
@@ -4316,7 +4316,7 @@ test_misc23(void)
CHECK(create_id, FAIL, "H5Pcreate");
/* Set flag for intermediate group creation */
- status = H5Pset_create_intermediate_group(create_id, TRUE);
+ status = H5Pset_create_intermediate_group(create_id, true);
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
tmp_id = H5Dcreate2(file_id, "/A/B06/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -4367,7 +4367,7 @@ test_misc23(void)
CHECK(create_id, FAIL, "H5Pcreate");
/* Set flag for intermediate group creation */
- status = H5Pset_create_intermediate_group(create_id, TRUE);
+ status = H5Pset_create_intermediate_group(create_id, true);
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
tmp_id = H5Tcopy(H5T_NATIVE_INT16);
@@ -4427,17 +4427,17 @@ test_misc23(void)
CHECK(create_id, FAIL, "H5Pcreate");
/* Set flag for intermediate group creation */
- status = H5Pset_create_intermediate_group(create_id, TRUE);
+ status = H5Pset_create_intermediate_group(create_id, true);
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
status = H5Lcopy(file_id, "/A/B01/grp", file_id, "/A/B16/grp", create_id, access_id);
CHECK(status, FAIL, "H5Lcopy");
tri_status = H5Lexists(file_id, "/A/B16/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
tri_status = H5Lexists(file_id, "/A/B01/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
/**********************************************************************
* test H5Lmove()
@@ -4447,10 +4447,10 @@ test_misc23(void)
CHECK(status, FAIL, "H5Lmove");
tri_status = H5Lexists(file_id, "/A/B17/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
tri_status = H5Lexists(file_id, "/A/B16/grp", access_id);
- VERIFY(tri_status, FALSE, "H5Lexists");
+ VERIFY(tri_status, false, "H5Lexists");
/**********************************************************************
* test H5Lcreate_hard()
@@ -4460,7 +4460,7 @@ test_misc23(void)
CHECK(status, FAIL, "H5Lcreate_hard");
tri_status = H5Lexists(file_id, "/A/B18/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
/**********************************************************************
* test H5Lcreate_soft()
@@ -4470,7 +4470,7 @@ test_misc23(void)
CHECK(status, FAIL, "H5Lcreate_soft");
tri_status = H5Lexists(file_id, "/A/B19/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
/**********************************************************************
* test H5Lcreate_external()
@@ -4482,7 +4482,7 @@ test_misc23(void)
CHECK(status, FAIL, "H5Lcreate_external");
tri_status = H5Lexists(file_id, "/A/B20/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
}
/**********************************************************************
@@ -4495,7 +4495,7 @@ test_misc23(void)
CHECK(status, FAIL, "H5Lcreate_ud");
tri_status = H5Lexists(file_id, "/A/B21/grp", access_id);
- VERIFY(tri_status, TRUE, "H5Lexists");
+ VERIFY(tri_status, true, "H5Lexists");
}
/**********************************************************************
@@ -5084,7 +5084,7 @@ test_misc25b(void)
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
const char *testfile = H5_get_srcdir_filename(MISC25B_FILE); /* Corrected test file name */
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -5347,7 +5347,7 @@ test_misc27(void)
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
const char *testfile = H5_get_srcdir_filename(MISC27_FILE); /* Corrected test file name */
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -5574,7 +5574,7 @@ test_misc28(void)
static void
test_misc29(void)
{
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
hid_t fid; /* File ID */
herr_t ret; /* Generic return value */
@@ -5641,7 +5641,7 @@ test_misc30(void)
/* Output message about test being performed */
MESSAGE(5, ("Local heap dropping free block info\n"));
- for (get_info = FALSE; get_info <= TRUE; get_info++) {
+ for (get_info = false; get_info <= true; get_info++) {
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
int i; /* Local index counter */
@@ -5668,7 +5668,7 @@ test_misc30(void)
CHECK(ret, FAIL, "test_misc30_get_info");
}
- HDsnprintf(gname, sizeof(gname), "/g0/group%d", i);
+ snprintf(gname, sizeof(gname), "/g0/group%d", i);
gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, FAIL, "H5Gcreate2");
@@ -5824,15 +5824,15 @@ test_misc32(void)
/* Size zero returns NULL.
* Also checks that a size of zero and setting the buffer clear flag
- * to TRUE can be used together.
+ * to true can be used together.
*
* Note that we have asserts in the code, so only check when NDEBUG
* is defined.
*/
#ifdef NDEBUG
- buffer = H5allocate_memory(0, FALSE);
+ buffer = H5allocate_memory(0, false);
CHECK_PTR_NULL(buffer, "H5allocate_memory"); /*BAD*/
- buffer = H5allocate_memory(0, TRUE);
+ buffer = H5allocate_memory(0, true);
CHECK_PTR_NULL(buffer, "H5allocate_memory"); /*BAD*/
#endif /* NDEBUG */
@@ -5840,7 +5840,7 @@ test_misc32(void)
/* Size zero returns NULL. Valgrind will confirm buffer is freed. */
size = 1024;
- buffer = H5allocate_memory(size, TRUE);
+ buffer = H5allocate_memory(size, true);
resized = H5resize_memory(buffer, 0);
CHECK_PTR_NULL(resized, "H5resize_memory");
@@ -5874,7 +5874,7 @@ test_misc33(void)
hid_t fid = -1; /* File ID */
const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */
H5O_info2_t oinfo; /* Structure for object metadata information */
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -6057,15 +6057,15 @@ static int test_misc36_context;
static void
test_misc36_cb1(void *_ctx)
{
- int *ctx = (int *)_ctx; /* Set up context pointer */
- hbool_t is_terminating; /* Flag indicating the library is terminating */
- herr_t ret; /* Return value */
+ int *ctx = (int *)_ctx; /* Set up context pointer */
+ bool is_terminating; /* Flag indicating the library is terminating */
+ herr_t ret; /* Return value */
/* Check whether the library thinks it's terminating */
- is_terminating = FALSE;
+ is_terminating = false;
ret = H5is_library_terminating(&is_terminating);
CHECK(ret, FAIL, "H5is_library_terminating");
- VERIFY(is_terminating, TRUE, "H5is_library_terminating");
+ VERIFY(is_terminating, true, "H5is_library_terminating");
/* Verify correct ordering for 'atclose' callbacks */
if (0 != *ctx)
@@ -6078,15 +6078,15 @@ test_misc36_cb1(void *_ctx)
static void
test_misc36_cb2(void *_ctx)
{
- int *ctx = (int *)_ctx; /* Set up context pointer */
- hbool_t is_terminating; /* Flag indicating the library is terminating */
- herr_t ret; /* Return value */
+ int *ctx = (int *)_ctx; /* Set up context pointer */
+ bool is_terminating; /* Flag indicating the library is terminating */
+ herr_t ret; /* Return value */
/* Check whether the library thinks it's terminating */
- is_terminating = FALSE;
+ is_terminating = false;
ret = H5is_library_terminating(&is_terminating);
CHECK(ret, FAIL, "H5is_library_terminating");
- VERIFY(is_terminating, TRUE, "H5is_library_terminating");
+ VERIFY(is_terminating, true, "H5is_library_terminating");
/* Verify correct ordering for 'atclose' callbacks */
if (1 != *ctx)
@@ -6104,27 +6104,27 @@ test_misc36_cb2(void *_ctx)
static void
test_misc36(void)
{
- hbool_t is_terminating; /* Flag indicating the library is terminating */
- herr_t ret; /* Return value */
+ bool is_terminating; /* Flag indicating the library is terminating */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("H5atclose and H5is_library_terminating API calls"));
/* Check whether the library thinks it's terminating */
- is_terminating = TRUE;
+ is_terminating = true;
ret = H5is_library_terminating(&is_terminating);
CHECK(ret, FAIL, "H5is_library_terminating");
- VERIFY(is_terminating, FALSE, "H5is_library_terminating");
+ VERIFY(is_terminating, false, "H5is_library_terminating");
/* Shut the library down */
test_misc36_context = 0;
H5close();
/* Check whether the library thinks it's terminating */
- is_terminating = TRUE;
+ is_terminating = true;
ret = H5is_library_terminating(&is_terminating);
CHECK(ret, FAIL, "H5is_library_terminating");
- VERIFY(is_terminating, FALSE, "H5is_library_terminating");
+ VERIFY(is_terminating, false, "H5is_library_terminating");
/* Check the close context was not changed */
VERIFY(test_misc36_context, 0, "H5atclose");
@@ -6133,10 +6133,10 @@ test_misc36(void)
H5open();
/* Check whether the library thinks it's terminating */
- is_terminating = TRUE;
+ is_terminating = true;
ret = H5is_library_terminating(&is_terminating);
CHECK(ret, FAIL, "H5is_library_terminating");
- VERIFY(is_terminating, FALSE, "H5is_library_terminating");
+ VERIFY(is_terminating, false, "H5is_library_terminating");
/* Register the 'atclose' callbacks */
/* (Note that these will be called in reverse order, which is checked) */
@@ -6176,7 +6176,7 @@ static void
test_misc37(void)
{
const char *testfile = H5_get_srcdir_filename(CVE_2020_10812_FILENAME);
- hbool_t driver_is_default_compatible;
+ bool driver_is_default_compatible;
hid_t fid;
herr_t ret;
@@ -6214,7 +6214,7 @@ test_misc37(void)
void
test_misc(void)
{
- hbool_t default_driver = h5_using_default_driver(NULL);
+ bool default_driver = h5_using_default_driver(NULL);
/* Output message about test being performed */
MESSAGE(5, ("Testing Miscellaneous Routines\n"));