summaryrefslogtreecommitdiffstats
path: root/tools/test/misc/h5clear_gentest.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
commita8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba (patch)
treee10dce719d3ddb94a1a89c9c498a2df23f2df2b2 /tools/test/misc/h5clear_gentest.c
parente54f5a14d28cf9eb1226ce7feab2e2600d3984b4 (diff)
downloadhdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.zip
hdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.tar.gz
hdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.tar.bz2
Fixes for warnings in the tools code.
Diffstat (limited to 'tools/test/misc/h5clear_gentest.c')
-rw-r--r--tools/test/misc/h5clear_gentest.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c
index d5f415e..06ba473 100644
--- a/tools/test/misc/h5clear_gentest.c
+++ b/tools/test/misc/h5clear_gentest.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "hdf5.h"
-#include "H5private.h"
+#include "h5test.h"
/* The HDF5 test files */
const char *FILENAME[] = {
@@ -62,13 +62,18 @@ gen_cache_image_file(const char *fname)
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2]; /* Dimension sizes */
hsize_t chunks[2]; /* Chunked dimension sizes */
- int buf[50][100]; /* Buffer for data to write */
- int i, j; /* Local index variables */
+ int **buf = NULL; /* Buffer for data to write */
H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */
{ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
TRUE, FALSE,
H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, 50, 100);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, 50, 100);
+
/* Create a copy of file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
@@ -91,11 +96,6 @@ gen_cache_image_file(const char *fname)
if((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto error;
- /* Initialize buffer for writing to dataset */
- for(i = 0; i < 50; i++)
- for(j = 0; j < 100; j++)
- buf[i][j] = i * j;
-
/* Set up to create a chunked dataset */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
@@ -107,7 +107,7 @@ gen_cache_image_file(const char *fname)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
/* Closing */
@@ -121,6 +121,9 @@ gen_cache_image_file(const char *fname)
goto error;
if(H5Fclose(fid) < 0)
goto error;
+
+ HDfree(buf);
+
return 0;
error:
@@ -132,6 +135,9 @@ error:
H5Pclose(fapl);
H5Pclose(dcpl);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return 1;
} /* gen_cache_image_file() */