diff options
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_cache.c | 2 | ||||
-rw-r--r-- | testpar/t_cache_image.c | 14 | ||||
-rw-r--r-- | testpar/t_dset.c | 12 | ||||
-rw-r--r-- | testpar/t_file.c | 16 | ||||
-rw-r--r-- | testpar/t_pflush1.c | 8 | ||||
-rw-r--r-- | testpar/t_pflush2.c | 8 | ||||
-rw-r--r-- | testpar/t_prop.c | 2 |
7 files changed, 33 insertions, 29 deletions
diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 8c96756..df34560 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -6488,7 +6488,7 @@ trace_file_check(int metadata_write_strategy) } /* end if */ if (nerrors == 0) { - HDsprintf(trace_file_name, "t_cache_trace.txt.%d", (int)file_mpi_rank); + HDsnprintf(trace_file_name, sizeof(trace_file_name), "t_cache_trace.txt.%d", (int)file_mpi_rank); if ((trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL) { diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index feb4325..4229a77 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -477,7 +477,7 @@ create_data_sets(hid_t file_id, int min_dset, int max_dset) /* create the dataset */ if (pass) { - HDsprintf(dset_name, "/dset%03d", i); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); @@ -766,7 +766,7 @@ delete_data_sets(hid_t file_id, int min_dset, int max_dset) while ( ( pass ) && ( i <= max_dset ) ) { - HDsprintf(dset_name, "/dset%03d", i); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i); if ( H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) { @@ -1334,7 +1334,7 @@ par_create_dataset(int dset_num, hid_t file_id, int mpi_rank, int mpi_size) show_progress = (show_progress && (mpi_rank == 0)); verbose = (verbose && (mpi_rank == 0)); - HDsprintf(dset_name, "/dset%03d", dset_num); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", dset_num); if (show_progress) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -1707,7 +1707,7 @@ par_delete_dataset(int dset_num, hid_t file_id, int mpi_rank) show_progress = (show_progress && (mpi_rank == 0)); - HDsprintf(dset_name, "/dset%03d", dset_num); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", dset_num); if (show_progress) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -1840,7 +1840,7 @@ par_verify_dataset(int dset_num, hid_t file_id, int mpi_rank) show_progress = (show_progress && (mpi_rank == 0)); verbose = (verbose && (mpi_rank == 0)); - HDsprintf(dset_name, "/dset%03d", dset_num); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", dset_num); if (show_progress) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -2208,7 +2208,7 @@ serial_verify_dataset(int dset_num, hid_t file_id, int mpi_size) hid_t dset_id = -1; hid_t filespace_id = -1; - HDsprintf(dset_name, "/dset%03d", dset_num); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", dset_num); if (show_progress) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -2460,7 +2460,7 @@ verify_data_sets(hid_t file_id, int min_dset, int max_dset) /* open the dataset */ if (pass) { - HDsprintf(dset_name, "/dset%03d", i); + HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i); dataset_ids[i] = H5Dopen2(file_id, dset_name, H5P_DEFAULT); if (dataset_ids[i] < 0) { diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 9f922e3..2aade32 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3699,10 +3699,12 @@ test_no_collective_cause_mode(int selection_mode) /* Test values */ HDmemset(message, 0, sizeof(message)); - HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), + "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name); VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message); HDmemset(message, 0, sizeof(message)); - HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), + "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message); /* Release some resources */ @@ -3939,10 +3941,12 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Test values */ HDmemset(message, 0, sizeof(message)); - HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), + "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name); VRFY((no_collective_cause_local_read == (uint32_t)no_collective_cause_local_expected), message); HDmemset(message, 0, sizeof(message)); - HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), + "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); VRFY((no_collective_cause_global_read == (uint32_t)no_collective_cause_global_expected), message); /* Release some resources */ diff --git a/testpar/t_file.c b/testpar/t_file.c index 6c6ac69..229fd6c 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -514,25 +514,25 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str VRFY((mem_dataspace >= 0), ""); for (k = 0; k < NUM_DSETS; k++) { - HDsprintf(dset_name, "D1dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "D1dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); ret = H5Dclose(dset_id); VRFY((ret == 0), ""); - HDsprintf(dset_name, "D2dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "D2dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); ret = H5Dclose(dset_id); VRFY((ret == 0), ""); - HDsprintf(dset_name, "D3dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "D3dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); ret = H5Dclose(dset_id); VRFY((ret == 0), ""); - HDsprintf(dset_name, "dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); @@ -555,13 +555,13 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str for (i = 0; i < num_elements; i++) VRFY((data_array[i] == mpi_rank + 1), "Dataset Verify failed"); - HDsprintf(dset_name, "D1dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "D1dset%d", k); ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT); VRFY((ret == 0), ""); - HDsprintf(dset_name, "D2dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "D2dset%d", k); ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT); VRFY((ret == 0), ""); - HDsprintf(dset_name, "D3dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "D3dset%d", k); ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT); VRFY((ret == 0), ""); } @@ -667,7 +667,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t VRFY((mem_dataspace >= 0), ""); for (k = 0; k < NUM_DSETS; k++) { - HDsprintf(dset_name, "dset%d", k); + HDsnprintf(dset_name, sizeof(dset_name), "dset%d", k); dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT); VRFY((dset_id >= 0), ""); diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index cc569f6..0500a2d 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -43,7 +43,7 @@ static int data_g[100][100]; *------------------------------------------------------------------------- */ static hid_t -create_test_file(char *name, hid_t fapl_id) +create_test_file(char *name, size_t name_length, hid_t fapl_id) { hid_t fid = H5I_INVALID_HID; hid_t dcpl_id = H5I_INVALID_HID; @@ -86,7 +86,7 @@ create_test_file(char *name, hid_t fapl_id) if ((top_level_gid = H5Gcreate2(fid, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for (i = 0; i < N_GROUPS; i++) { - HDsprintf(name, "grp%02u", (unsigned)i); + HDsnprintf(name, name_length, "grp%02u", (unsigned)i); if ((gid = H5Gcreate2(top_level_gid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if (H5Gclose(gid) < 0) @@ -153,7 +153,7 @@ main(int argc, char *argv[]) /* Create the file */ h5_fixname(FILENAME[0], fapl_id, name, sizeof(name)); - if ((fid1 = create_test_file(name, fapl_id)) < 0) + if ((fid1 = create_test_file(name, sizeof(name), fapl_id)) < 0) goto error; /* Flush and exit without closing the library */ if (H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0) @@ -161,7 +161,7 @@ main(int argc, char *argv[]) /* Create the other file which will not be flushed */ h5_fixname(FILENAME[1], fapl_id, name, sizeof(name)); - if ((fid2 = create_test_file(name, fapl_id)) < 0) + if ((fid2 = create_test_file(name, sizeof(name), fapl_id)) < 0) goto error; if (mpi_rank == 0) diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index e782f8a..8cf40d0 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -43,7 +43,7 @@ static int data_g[100][100]; *------------------------------------------------------------------------- */ static herr_t -check_test_file(char *name, hid_t fapl_id) +check_test_file(char *name, size_t name_length, hid_t fapl_id) { hid_t fid = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; @@ -89,7 +89,7 @@ check_test_file(char *name, hid_t fapl_id) if ((top_level_gid = H5Gopen2(fid, "some_groups", H5P_DEFAULT)) < 0) goto error; for (i = 0; i < N_GROUPS; i++) { - HDsprintf(name, "grp%02u", (unsigned)i); + HDsnprintf(name, name_length, "grp%02u", (unsigned)i); if ((gid = H5Gopen2(top_level_gid, name, H5P_DEFAULT)) < 0) goto error; if (H5Gclose(gid) < 0) @@ -182,7 +182,7 @@ main(int argc, char *argv[]) /* Check the case where the file was flushed */ h5_fixname(FILENAME[0], fapl_id1, name, sizeof(name)); - if (check_test_file(name, fapl_id1)) { + if (check_test_file(name, sizeof(name), fapl_id1)) { H5_FAILED() goto error; } @@ -199,7 +199,7 @@ main(int argc, char *argv[]) H5Eset_auto2(H5E_DEFAULT, NULL, NULL); h5_fixname(FILENAME[1], fapl_id2, name, sizeof(name)); - if (check_test_file(name, fapl_id2)) { + if (check_test_file(name, sizeof(name), fapl_id2)) { if (mpi_rank == 0) PASSED(); } diff --git a/testpar/t_prop.c b/testpar/t_prop.c index 5979c5d..606e100 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -556,7 +556,7 @@ external_links(void) /* test opening a group that is to an external link, the external linked file should inherit the source file's access properties */ - HDsprintf(link_path, "%s%s%s", group_path, "/", link_name); + HDsnprintf(link_path, sizeof(link_path), "%s%s%s", group_path, "/", link_name); group = H5Gopen2(fid, link_path, H5P_DEFAULT); VRFY((group >= 0), "H5Gopen succeeded"); ret = H5Gclose(group); |