summaryrefslogtreecommitdiffstats
path: root/testpar/testphdf5.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-01 20:54:41 (GMT)
committerGitHub <noreply@github.com>2022-05-01 20:54:41 (GMT)
commit2ba7a01bfff451b043e2ec00811c0aad78921545 (patch)
tree31dc785e35a95578ea9fbb491fbc931e62234302 /testpar/testphdf5.c
parent5eba258d90aa89c3d1d58f1b5ef93c1cf9821c29 (diff)
downloadhdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.zip
hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.gz
hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.bz2
Fix some const cast and stack/static object size warnings (#1700)
* Fix various warnings * Move HDfree_const to H5private.h for wider use * Print output from all ranks in parallel tests on allocation failure * Move const pointer freeing macro to h5test.h for now
Diffstat (limited to 'testpar/testphdf5.c')
-rw-r--r--testpar/testphdf5.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 1ead1b8..d7b5305 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -43,7 +43,7 @@ int dxfer_coll_type = DXFER_COLLECTIVE_IO;
#define NFILENAME 2
#define PARATESTFILE filenames[0]
const char *FILENAME[NFILENAME] = {"ParaTest", NULL};
-char filenames[NFILENAME][PATH_MAX];
+char * filenames[NFILENAME];
hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
@@ -231,7 +231,7 @@ parse_options(int argc, char **argv)
n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */
for (i = 0; i < n; i++)
- if (h5_fixname(FILENAME[i], fapl, filenames[i], sizeof(filenames[i])) == NULL) {
+ if (h5_fixname(FILENAME[i], fapl, filenames[i], PATH_MAX) == NULL) {
HDprintf("h5_fixname failed\n");
nerrors++;
return (1);
@@ -336,6 +336,14 @@ main(int argc, char **argv)
H5open();
h5_show_hostname();
+ HDmemset(filenames, 0, sizeof(filenames));
+ for (int i = 0; i < NFILENAME; i++) {
+ if (NULL == (filenames[i] = HDmalloc(PATH_MAX))) {
+ HDprintf("couldn't allocate filename array\n");
+ MPI_Abort(MPI_COMM_WORLD, -1);
+ }
+ }
+
/* Initialize testing framework */
TestInit(argv[0], usage, parse_options);
@@ -544,6 +552,11 @@ main(int argc, char **argv)
HDprintf("===================================\n");
}
+ for (int i = 0; i < NFILENAME; i++) {
+ HDfree(filenames[i]);
+ filenames[i] = NULL;
+ }
+
/* close HDF5 library */
H5close();