summaryrefslogtreecommitdiffstats
path: root/test/efc.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-07-31 18:58:46 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-07-31 18:58:46 (GMT)
commitbfe04875838d8c3baea58c3fbfb16d9ee88d3beb (patch)
treef21d4753e48dad48367633f5a55a23e72cd9dbf6 /test/efc.c
parentf977c4dfd0e5eb6f6e8527bdc9e48edebe500d78 (diff)
downloadhdf5-bfe04875838d8c3baea58c3fbfb16d9ee88d3beb.zip
hdf5-bfe04875838d8c3baea58c3fbfb16d9ee88d3beb.tar.gz
hdf5-bfe04875838d8c3baea58c3fbfb16d9ee88d3beb.tar.bz2
Normalization and warning fixes from develop
Diffstat (limited to 'test/efc.c')
-rw-r--r--test/efc.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/test/efc.c b/test/efc.c
index 9881ea8..eeb633d 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -31,8 +31,14 @@ const char *FILENAME[] = {
NULL
};
+/* Windows doesn't have PATH_MAX */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif /* !PATH_MAX */
+
/* Global patched filename buffer */
-static char filename[6][1024];
+#define N_FILENAMES 6
+static char *filename[N_FILENAMES];
/* Global property lists - just copies of the defaults (necessary to use
* internal functions */
@@ -2895,8 +2901,9 @@ error:
int
main(void)
{
- unsigned nerrors = 0; /* track errors */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ unsigned nerrors = 0; /* track errors */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ int i; /* iterator */
/* Test Setup */
HDputs("Testing the external file cache");
@@ -2905,13 +2912,18 @@ main(void)
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
fapl_id = h5_fileaccess();
+ /* Allocate memory for filenames */
+ for(i = 0; i < N_FILENAMES; i++) {
+ filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char));
+ }
+
/* Patch filenames */
- h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0]));
- h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1]));
- h5_fixname(FILENAME[2], fapl_id, filename[2], sizeof(filename[2]));
- h5_fixname(FILENAME[3], fapl_id, filename[3], sizeof(filename[3]));
- h5_fixname(FILENAME[4], fapl_id, filename[4], sizeof(filename[4]));
- h5_fixname(FILENAME[5], fapl_id, filename[5], sizeof(filename[5]));
+ h5_fixname(FILENAME[0], fapl_id, filename[0], PATH_MAX);
+ h5_fixname(FILENAME[1], fapl_id, filename[1], PATH_MAX);
+ h5_fixname(FILENAME[2], fapl_id, filename[2], PATH_MAX);
+ h5_fixname(FILENAME[3], fapl_id, filename[3], PATH_MAX);
+ h5_fixname(FILENAME[4], fapl_id, filename[4], PATH_MAX);
+ h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX);
/* Push API context */
if(H5CX_push() < 0) FAIL_STACK_ERROR
@@ -2930,7 +2942,8 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if(api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
if(nerrors)
@@ -2940,6 +2953,10 @@ main(void)
h5_clean_files(FILENAME, fapl_id);
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
+
return EXIT_SUCCESS;
error:
@@ -2949,7 +2966,12 @@ error:
H5Pclose(fapl_id);
} H5E_END_TRY
- if(api_ctx_pushed) H5CX_pop();
+ if(api_ctx_pushed)
+ H5CX_pop();
+
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
return EXIT_FAILURE;
} /* end main() */