summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:37:20 (GMT)
commit3efed9c1110521a8361603436984a677f2bbea29 (patch)
tree5b676c2e131f18603b23dc8c67b142ded45ae3f9 /tools
parent97431e256b70a393605d515f186e914a044a3fee (diff)
downloadhdf5-3efed9c1110521a8361603436984a677f2bbea29.zip
hdf5-3efed9c1110521a8361603436984a677f2bbea29.tar.gz
hdf5-3efed9c1110521a8361603436984a677f2bbea29.tar.bz2
Fixes for warnings in the tools code.
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.h6
-rw-r--r--tools/src/h5diff/h5diff_common.c18
-rw-r--r--tools/src/h5dump/h5dump_xml.c6
-rw-r--r--tools/src/h5jam/h5jam.c2
-rw-r--r--tools/test/h5dump/CMakeLists.txt2
-rw-r--r--tools/test/h5dump/Makefile.am2
-rw-r--r--tools/test/h5dump/h5dumpgentest.c475
-rw-r--r--tools/test/h5import/h5importtest.c9
-rw-r--r--tools/test/h5repack/CMakeLists.txt2
-rw-r--r--tools/test/h5repack/h5repacktst.c543
-rw-r--r--tools/test/misc/CMakeLists.txt2
-rw-r--r--tools/test/misc/Makefile.am2
-rw-r--r--tools/test/misc/h5clear_gentest.c24
-rw-r--r--tools/test/perform/pio_perf.c8
-rw-r--r--tools/test/perform/sio_perf.c8
-rw-r--r--tools/test/perform/zip_perf.c4
16 files changed, 695 insertions, 418 deletions
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 8fe9d86..37eb775 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -53,9 +53,9 @@ typedef struct {
*/
/* linked list to keep exclude path list */
struct exclude_path_list {
- char *obj_path;
- h5trav_type_t obj_type;
- struct exclude_path_list * next;
+ const char *obj_path;
+ h5trav_type_t obj_type;
+ struct exclude_path_list *next;
};
/* Enumeration value for keeping track of whether an error occurred or differences were found */
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 771b20f..e0e6f8c 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -197,7 +197,7 @@ void parse_command_line(int argc,
}
/* init */
- exclude_node->obj_path = (char*)opt_arg;
+ exclude_node->obj_path = opt_arg;
exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
exclude_prev = exclude_head;
@@ -207,7 +207,7 @@ void parse_command_line(int argc,
}
else {
while(NULL != exclude_prev->next)
- exclude_prev=exclude_prev->next;
+ exclude_prev = exclude_prev->next;
exclude_node->next = NULL;
exclude_prev->next = exclude_node;
@@ -215,14 +215,14 @@ void parse_command_line(int argc,
break;
case 'd':
- opts->d=1;
+ opts->d = 1;
if (check_d_input(opt_arg) == - 1) {
HDprintf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->delta = atof(opt_arg);
+ opts->delta = HDatof(opt_arg);
/* -d 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
@@ -230,13 +230,13 @@ void parse_command_line(int argc,
break;
case 'p':
- opts->p=1;
+ opts->p = 1;
if (check_p_input(opt_arg) == -1) {
HDprintf("<-p %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->percent = atof(opt_arg);
+ opts->percent = HDatof(opt_arg);
/* -p 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
@@ -244,7 +244,7 @@ void parse_command_line(int argc,
break;
case 'n':
- opts->n=1;
+ opts->n = 1;
if ( check_n_input(opt_arg) == -1) {
HDprintf("<-n %s> is not a valid option\n", opt_arg);
usage();
@@ -427,7 +427,7 @@ check_p_input( const char *str )
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
- x = atof(str);
+ x = HDatof(str);
if (x < 0)
return -1;
@@ -461,7 +461,7 @@ check_d_input( const char *str )
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
- x = atof(str);
+ x = HDatof(str);
if (x < 0)
return -1;
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 5a5bb13..f599b7e 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -732,7 +732,7 @@ xml_escape_the_name(const char *str)
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
-static char *
+static char *
xml_escape_the_string(const char *str, int slen)
{
size_t extra;
@@ -794,18 +794,22 @@ xml_escape_the_string(const char *str, int slen)
else if (*cp == '\'') {
esc_len = HDstrlen(apos);
HDstrncpy(ncp, apos, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '<') {
esc_len = HDstrlen(lt);
HDstrncpy(ncp, lt, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '>') {
esc_len = HDstrlen(gt);
HDstrncpy(ncp, gt, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '&') {
esc_len = HDstrlen(amp);
HDstrncpy(ncp, amp, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else {
*ncp = *cp;
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 07797c8..009e527 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -148,7 +148,7 @@ parse_command_line (int argc, const char *argv[])
int opt = FALSE;
/* parse command line options */
- while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
{
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index cfc542f..8a83699 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -35,7 +35,7 @@ endif ()
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
- target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5dumpgentest STATIC)
target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools)
diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am
index a7a2bcb..21560fb 100644
--- a/tools/test/h5dump/Makefile.am
+++ b/tools/test/h5dump/Makefile.am
@@ -19,7 +19,7 @@
include $(top_srcdir)/config/commence.am
# Include files in /src directory and /tools/lib directory
-AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
# Test programs and scripts
TEST_PROG=h5dumpgentest
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 3cfc14f..984eec8 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -22,7 +22,7 @@
*/
#include "hdf5.h"
-#include "H5private.h"
+#include "h5test.h"
#include "h5tools.h"
#define FILE1 "tgroup.h5"
@@ -7207,19 +7207,43 @@ gent_dataset_idx(void)
static void
gent_packedbits(void)
{
- hid_t fid, dataset, space;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8];
+
+ uint8_t **dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t **dset8 = NULL;
+ int16_t **dset16 = NULL;
+ int32_t **dset32 = NULL;
+ int64_t **dset64 = NULL;
+ double **dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+
unsigned int i, j;
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
+
fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@@ -7235,7 +7259,7 @@ gent_packedbits(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7252,7 +7276,7 @@ gent_packedbits(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7269,7 +7293,7 @@ gent_packedbits(void)
valu32bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7286,7 +7310,7 @@ gent_packedbits(void)
valu64bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7303,7 +7327,7 @@ gent_packedbits(void)
val8bits = (int8_t)(val8bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7320,7 +7344,7 @@ gent_packedbits(void)
val16bits = (int16_t)(val16bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7337,7 +7361,7 @@ gent_packedbits(void)
val32bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7354,7 +7378,7 @@ gent_packedbits(void)
val64bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -7367,11 +7391,21 @@ gent_packedbits(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
- H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
+
+ HDfree(dsetu8);
+ HDfree(dsetu16);
+ HDfree(dsetu32);
+ HDfree(dsetu64);
+ HDfree(dset8);
+ HDfree(dset16);
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@@ -7388,19 +7422,44 @@ gent_packedbits(void)
static void
gent_attr_intsize(void)
{
- hid_t fid, attr, space, root;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t root = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8];
+
+ uint8_t **dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t **dset8 = NULL;
+ int16_t **dset16 = NULL;
+ int32_t **dset32 = NULL;
+ int64_t **dset64 = NULL;
+ double **dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+
unsigned int i, j;
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
+
fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
@@ -7418,7 +7477,7 @@ gent_attr_intsize(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
- H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8);
+ H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7436,7 +7495,7 @@ gent_attr_intsize(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
- H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16);
+ H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7454,7 +7513,7 @@ gent_attr_intsize(void)
valu32bits <<= 1;
}
- H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32);
+ H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7472,7 +7531,7 @@ gent_attr_intsize(void)
valu64bits <<= 1;
}
- H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64);
+ H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7490,7 +7549,7 @@ gent_attr_intsize(void)
val8bits = (int8_t)(val8bits << 1);
}
- H5Awrite(attr, H5T_NATIVE_INT8, dset8);
+ H5Awrite(attr, H5T_NATIVE_INT8, dset8[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7508,7 +7567,7 @@ gent_attr_intsize(void)
val16bits = (int16_t)(val16bits << 1);
}
- H5Awrite(attr, H5T_NATIVE_INT16, dset16);
+ H5Awrite(attr, H5T_NATIVE_INT16, dset16[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7526,7 +7585,7 @@ gent_attr_intsize(void)
val32bits <<= 1;
}
- H5Awrite(attr, H5T_NATIVE_INT32, dset32);
+ H5Awrite(attr, H5T_NATIVE_INT32, dset32[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7544,7 +7603,7 @@ gent_attr_intsize(void)
val64bits <<= 1;
}
- H5Awrite(attr, H5T_NATIVE_INT64, dset64);
+ H5Awrite(attr, H5T_NATIVE_INT64, dset64[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -7557,13 +7616,23 @@ gent_attr_intsize(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
- H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl[0]);
H5Sclose(space);
H5Aclose(attr);
H5Gclose(root);
H5Fclose(fid);
+
+ HDfree(dsetu8);
+ HDfree(dsetu16);
+ HDfree(dsetu32);
+ HDfree(dsetu64);
+ HDfree(dset8);
+ HDfree(dset16);
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dsetdbl);
}
static void
@@ -8405,19 +8474,44 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
static void
gent_intscalars(void)
{
- hid_t fid, dataset, space, tid;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
- uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
- uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
- uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
- int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
- int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
- int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
- int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
- double dsetdbl[F73_XDIM][F73_YDIM8];
+
+ uint8_t **dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t **dset8 = NULL;
+ int16_t **dset16 = NULL;
+ int32_t **dset32 = NULL;
+ int64_t **dset64 = NULL;
+ double **dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+
unsigned int i, j;
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
+
fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@@ -8435,7 +8529,7 @@ gent_intscalars(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8454,7 +8548,7 @@ gent_intscalars(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8473,7 +8567,7 @@ gent_intscalars(void)
valu32bits <<= 1;
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8492,7 +8586,7 @@ gent_intscalars(void)
valu64bits <<= 1;
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8511,7 +8605,7 @@ gent_intscalars(void)
val8bits = (int8_t)(val8bits << 1);
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8530,7 +8624,7 @@ gent_intscalars(void)
val16bits = (int16_t)(val16bits << 1);
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8549,7 +8643,7 @@ gent_intscalars(void)
val32bits <<= 1;
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8568,7 +8662,7 @@ gent_intscalars(void)
val64bits <<= 1;
}
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
H5Sclose(space);
H5Dclose(dataset);
@@ -8582,11 +8676,21 @@ gent_intscalars(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
- H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
+
+ HDfree(dsetu8);
+ HDfree(dsetu16);
+ HDfree(dsetu32);
+ HDfree(dsetu64);
+ HDfree(dset8);
+ HDfree(dset16);
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@@ -8603,19 +8707,46 @@ gent_intscalars(void)
static void
gent_attr_intscalars(void)
{
- hid_t fid, attr, space, root, tid;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t root = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
- uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
- uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
- uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
- int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
- int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
- int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
- int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
- double dsetdbl[F73_XDIM][F73_YDIM8];
+
+
+ uint8_t **dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t **dset8 = NULL;
+ int16_t **dset16 = NULL;
+ int32_t **dset32 = NULL;
+ int64_t **dset64 = NULL;
+ double **dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+
unsigned int i, j;
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
+
fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
@@ -8634,7 +8765,7 @@ gent_attr_intscalars(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
- H5Awrite(attr, tid, dsetu8);
+ H5Awrite(attr, tid, dsetu8[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8653,7 +8784,7 @@ gent_attr_intscalars(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
- H5Awrite(attr, tid, dsetu16);
+ H5Awrite(attr, tid, dsetu16[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8672,7 +8803,7 @@ gent_attr_intscalars(void)
valu32bits <<= 1;
}
- H5Awrite(attr, tid, dsetu32);
+ H5Awrite(attr, tid, dsetu32[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8691,7 +8822,7 @@ gent_attr_intscalars(void)
valu64bits <<= 1;
}
- H5Awrite(attr, tid, dsetu64);
+ H5Awrite(attr, tid, dsetu64[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8710,7 +8841,7 @@ gent_attr_intscalars(void)
val8bits = (int8_t)(val8bits << 1);
}
- H5Awrite(attr, tid, dset8);
+ H5Awrite(attr, tid, dset8[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8729,7 +8860,7 @@ gent_attr_intscalars(void)
val16bits = (int16_t)(val16bits << 1);
}
- H5Awrite(attr, tid, dset16);
+ H5Awrite(attr, tid, dset16[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8748,7 +8879,7 @@ gent_attr_intscalars(void)
val32bits <<= 1;
}
- H5Awrite(attr, tid, dset32);
+ H5Awrite(attr, tid, dset32[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8767,7 +8898,7 @@ gent_attr_intscalars(void)
val64bits <<= 1;
}
- H5Awrite(attr, tid, dset64);
+ H5Awrite(attr, tid, dset64[0]);
H5Sclose(space);
H5Aclose(attr);
@@ -8781,13 +8912,23 @@ gent_attr_intscalars(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
- H5Awrite(attr, tid, dsetdbl);
+ H5Awrite(attr, tid, dsetdbl[0]);
H5Sclose(space);
H5Aclose(attr);
H5Gclose(root);
H5Fclose(fid);
+
+ HDfree(dsetu8);
+ HDfree(dsetu16);
+ HDfree(dsetu32);
+ HDfree(dsetu64);
+ HDfree(dset8);
+ HDfree(dset16);
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@@ -9342,19 +9483,45 @@ static void gent_compound_ints(void) {
static void
gent_intattrscalars(void)
{
- hid_t fid, attr, dataset, space, tid;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
- uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
- uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
- uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
- int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
- int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
- int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
- int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
- double dsetdbl[F73_XDIM][F73_YDIM8];
+
+ uint8_t **dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t **dset8 = NULL;
+ int16_t **dset16 = NULL;
+ int32_t **dset32 = NULL;
+ int64_t **dset64 = NULL;
+ double **dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+
unsigned int i, j;
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
+
fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@@ -9375,7 +9542,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
/* Attribute of 8 bits unsigned int */
attr = H5Acreate2(dataset, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dsetu8);
+ H5Awrite(attr, tid, dsetu8[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9398,7 +9565,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
/* Attribute of 16 bits unsigned int */
attr = H5Acreate2(dataset, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dsetu16);
+ H5Awrite(attr, tid, dsetu16[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9421,7 +9588,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
/* Attribute of 32 bits unsigned int */
attr = H5Acreate2(dataset, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dsetu32);
+ H5Awrite(attr, tid, dsetu32[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9444,7 +9611,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
/* Attribute of 64 bits unsigned int */
attr = H5Acreate2(dataset, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dsetu64);
+ H5Awrite(attr, tid, dsetu64[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9467,7 +9634,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
/* Attribute of 8 bits signed int */
attr = H5Acreate2(dataset, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dset8);
+ H5Awrite(attr, tid, dset8[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9490,7 +9657,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
/* Attribute of 16 bits signed int */
attr = H5Acreate2(dataset, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dset16);
+ H5Awrite(attr, tid, dset16[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9513,7 +9680,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
/* Attribute of 32 bits signed int */
attr = H5Acreate2(dataset, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dset32);
+ H5Awrite(attr, tid, dset32[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9536,7 +9703,7 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
/* Attribute of 64 bits signed int */
attr = H5Acreate2(dataset, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dset64);
+ H5Awrite(attr, tid, dset64[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@@ -9554,11 +9721,22 @@ gent_intattrscalars(void)
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
/* Attribute of double */
attr = H5Acreate2(dataset, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(attr, tid, dsetdbl);
+ H5Awrite(attr, tid, dsetdbl[0]);
+
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
+
+ HDfree(dsetu8);
+ HDfree(dsetu16);
+ HDfree(dsetu32);
+ HDfree(dsetu64);
+ HDfree(dset8);
+ HDfree(dset16);
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@@ -9574,19 +9752,66 @@ gent_intattrscalars(void)
static void
gent_intsattrs(void)
{
- hid_t fid, attr, dataset, space, aspace;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t aspace = H5I_INVALID_HID;
hsize_t dims[2], adims[1];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], asetu8[F66_XDIM*F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], asetu16[F66_XDIM*F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], asetu32[F66_XDIM*F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], asetu64[F66_XDIM*F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], aset8[F66_XDIM*F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], aset16[F66_XDIM*F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], aset32[F66_XDIM*F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], aset64[F66_XDIM*F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8], asetdbl[F66_XDIM*F66_YDIM8];
+
+
+ uint8_t **dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t **dset8 = NULL;
+ int16_t **dset16 = NULL;
+ int32_t **dset32 = NULL;
+ int64_t **dset64 = NULL;
+ double **dsetdbl = NULL;
+
+ uint8_t *asetu8 = NULL;
+ uint16_t *asetu16 = NULL;
+ uint32_t *asetu32 = NULL;
+ uint64_t *asetu64 = NULL;
+ int8_t *aset8 = NULL;
+ int16_t *aset16 = NULL;
+ int32_t *aset32 = NULL;
+ int64_t *aset64 = NULL;
+ double *asetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+
unsigned int i, j;
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
+
+ asetu8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t));
+ asetu16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(uint16_t));
+ asetu32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(uint32_t));
+ asetu64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(uint64_t));
+ aset8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(int8_t));
+ aset16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(int16_t));
+ aset32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(int32_t));
+ aset64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(int64_t));
+ asetdbl = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(double));
+
fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@@ -9605,7 +9830,7 @@ gent_intsattrs(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
/* Attribute of 8 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM8;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9632,7 +9857,7 @@ gent_intsattrs(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
/* Attribute of 16 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM16;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9659,7 +9884,7 @@ gent_intsattrs(void)
valu32bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
/* Attribute of 32 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM32;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9686,7 +9911,7 @@ gent_intsattrs(void)
valu64bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
/* Attribute of 64 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM64;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9713,7 +9938,7 @@ gent_intsattrs(void)
val8bits = (int8_t)(val8bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
/* Attribute of 8 bits signed int */
adims[0] = F66_XDIM * F66_YDIM8;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9740,7 +9965,7 @@ gent_intsattrs(void)
val16bits = (int16_t)(val16bits << 1);
}
- H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
/* Attribute of 16 bits signed int */
adims[0] = F66_XDIM * F66_YDIM16;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9767,7 +9992,7 @@ gent_intsattrs(void)
val32bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
/* Attribute of 32 bits signed int */
adims[0] = F66_XDIM * F66_YDIM32;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9794,7 +10019,7 @@ gent_intsattrs(void)
val64bits <<= 1;
}
- H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
/* Attribute of 64 bits signed int */
adims[0] = F66_XDIM * F66_YDIM64;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9816,7 +10041,7 @@ gent_intsattrs(void)
asetdbl[i*dims[1]+j] = dsetdbl[i][j];
}
- H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
/* Attribute of double */
adims[0] = F66_XDIM * F66_YDIM8;
aspace = H5Screate_simple(1, adims, NULL);
@@ -9827,6 +10052,26 @@ gent_intsattrs(void)
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
+
+ HDfree(dsetu8);
+ HDfree(dsetu16);
+ HDfree(dsetu32);
+ HDfree(dsetu64);
+ HDfree(dset8);
+ HDfree(dset16);
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dsetdbl);
+
+ HDfree(asetu8);
+ HDfree(asetu16);
+ HDfree(asetu32);
+ HDfree(asetu64);
+ HDfree(aset8);
+ HDfree(aset16);
+ HDfree(aset32);
+ HDfree(aset64);
+ HDfree(asetdbl);
}
static void gent_bitnopaquefields(void)
diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c
index 560f1b3..580530a 100644
--- a/tools/test/h5import/h5importtest.c
+++ b/tools/test/h5import/h5importtest.c
@@ -68,13 +68,12 @@ main(void)
double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F;
/* Initialize machine endian */
- volatile uint32_t ibyte=0x01234567;
+ volatile uint32_t ibyte = 0x01234567;
/* 0 for big endian, 1 for little endian. */
- if ((*((uint8_t*)(&ibyte))) == 0x67)
- HDstrncpy(machine_order, "LE", 2);
+ if ((*((volatile uint8_t *)(&ibyte))) == 0x67)
+ HDstrcpy(machine_order, "LE");
else
- HDstrncpy(machine_order, "BE", 2);
-
+ HDstrcpy(machine_order, "BE");
/*
* initialize the row, column, and plane vectors
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index 6f0b284..54cff64 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -28,7 +28,7 @@ set (REPACK_COMMON_SOURCES
)
add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
target_include_directories (h5repacktest
- PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5repacktest STATIC)
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index baac684..a39c048 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -2479,24 +2479,24 @@ int make_szip(hid_t loc_id)
unsigned szip_pixels_per_block = 8;
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
int szip_can_encode = 0;
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
/*-------------------------------------------------------------------------
* SZIP
@@ -2509,25 +2509,30 @@ int make_szip(hid_t loc_id)
if (szip_can_encode) {
/* set szip data */
if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0)
- goto out;
- if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf[0]) < 0)
+ goto error;
}
else
/* WARNING? SZIP is decoder only, can't generate test files */
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
#endif /* H5_HAVE_FILTER_SZIP */
@@ -2548,26 +2553,25 @@ int make_deflate(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK] = {DIM1,DIM2};
hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf[DIM1][DIM2];
+ int **buf = NULL;
hobj_ref_t bufref[1]; /* reference */
hsize_t dims1r[1] = {1};
- int i, j, n;
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
/*-------------------------------------------------------------------------
* GZIP
@@ -2576,16 +2580,16 @@ int make_deflate(hid_t loc_id)
#if defined (H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
if(H5Pset_deflate(dcpl, 9) < 0)
- goto out;
- if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf[0]) < 0)
+ goto error;
/* create a reference to the dataset, test second seeep of file for references */
if (H5Rcreate(&bufref[0], loc_id, "dset_deflate", H5R_OBJECT, (hid_t)-1) < 0)
- goto out;
+ goto error;
if (write_dset(loc_id, 1, dims1r, "ref", H5T_STD_REF_OBJ, bufref) < 0)
- goto out;
+ goto error;
#endif
@@ -2594,17 +2598,22 @@ int make_deflate(hid_t loc_id)
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -2619,29 +2628,27 @@ out:
static
int make_shuffle(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
+
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
- }
- }
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
/*-------------------------------------------------------------------------
* shuffle
@@ -2650,9 +2657,9 @@ int make_shuffle(hid_t loc_id)
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
@@ -2660,17 +2667,22 @@ int make_shuffle(hid_t loc_id)
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -2688,23 +2700,23 @@ int make_fletcher32(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
+
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
/*-------------------------------------------------------------------------
@@ -2714,29 +2726,34 @@ int make_fletcher32(hid_t loc_id)
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* close space and dcpl
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -2757,45 +2774,45 @@ int make_nbit(hid_t loc_id)
hid_t dsid = H5I_INVALID_HID;
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
+
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
dtid = H5Tcopy(H5T_NATIVE_INT);
if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0)
- goto out;
+ goto error;
/* remove the filters from the dcpl */
if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
if(H5Pset_nbit(dcpl) < 0)
- goto out;
+ goto error;
if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ goto error;
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ goto error;
H5Dclose(dsid);
if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ goto error;
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ goto error;
H5Dclose(dsid);
/*-------------------------------------------------------------------------
@@ -2803,21 +2820,26 @@ int make_nbit(hid_t loc_id)
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
if (H5Tclose(dtid) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(dsid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -2838,40 +2860,40 @@ int make_scaleoffset(hid_t loc_id)
hid_t dsid = H5I_INVALID_HID;
hsize_t dims[RANK] = {DIM1,DIM2};
hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
+
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
dtid = H5Tcopy(H5T_NATIVE_INT);
/* remove the filters from the dcpl */
if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
- goto out;
+ goto error;
if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ goto error;
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ goto error;
H5Dclose(dsid);
if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ goto error;
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ goto error;
H5Tclose(dtid);
H5Dclose(dsid);
@@ -2880,19 +2902,24 @@ int make_scaleoffset(hid_t loc_id)
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Dclose(dsid);
H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -2912,41 +2939,39 @@ int make_all_filters(hid_t loc_id)
hid_t dtid = H5I_INVALID_HID;
hid_t dsid = H5I_INVALID_HID;
#if defined (H5_HAVE_FILTER_SZIP)
- unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=8;
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 8;
#endif /* H5_HAVE_FILTER_SZIP */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
#if defined (H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
- }
- }
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
- goto out;
+ goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
- goto out;
+ goto error;
#if defined (H5_HAVE_FILTER_SZIP)
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
@@ -2956,8 +2981,8 @@ int make_all_filters(hid_t loc_id)
if (szip_can_encode)
{
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
- goto out;
+ if(H5Pset_szip (dcpl,szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
} else {
/* WARNING? SZIP is decoder only, can't generate test data using szip */
}
@@ -2966,20 +2991,20 @@ int make_all_filters(hid_t loc_id)
#if defined (H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
if(H5Pset_deflate(dcpl, 9) < 0)
- goto out;
+ goto error;
#endif
- if (make_dset(loc_id,"dset_all",sid,dcpl,buf) < 0)
- goto out;
+ if (make_dset(loc_id, "dset_all", sid, dcpl, buf[0]) < 0)
+ goto error;
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf[0]) < 0)
+ goto error;
/* Make sure encoding is enabled */
@@ -2988,12 +3013,12 @@ int make_all_filters(hid_t loc_id)
{
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
- goto out;
- if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf[0]) < 0)
+ goto error;
} else
{
/* WARNING? SZIP is decoder only, can't generate test dataset */
@@ -3003,56 +3028,58 @@ int make_all_filters(hid_t loc_id)
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf[0]) < 0)
+ goto error;
#if defined (H5_HAVE_FILTER_DEFLATE)
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set deflate data */
if(H5Pset_deflate(dcpl, 1) < 0)
- goto out;
- if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf[0]) < 0)
+ goto error;
#endif
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set the shuffle filter */
if (H5Pset_nbit(dcpl) < 0)
- goto out;
+ goto error;
if ((dtid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- goto out;
+ goto error;
if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
- goto out;
+ goto error;
if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ goto error;
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ goto error;
/* close */
if(H5Tclose(dtid) < 0)
- goto out;
+ goto error;
if(H5Dclose(dsid) < 0)
- goto out;
+ goto error;
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY
{
H5Tclose(dtid);
@@ -3060,6 +3087,9 @@ out:
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -3176,28 +3206,25 @@ int make_layout(hid_t loc_id)
hid_t sid=H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
+ int **buf = NULL;
+ int i;
char name[16];
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
- }
- }
/*-------------------------------------------------------------------------
* make several dataset with no filters
*-------------------------------------------------------------------------
*/
- for (i=0; i<4; i++)
- {
+ for (i=0; i<4; i++) {
HDsprintf(name,"dset%d",i+1);
- if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf) < 0)
- return -1;
+ if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf[0]) < 0)
+ goto error;
}
@@ -3207,63 +3234,60 @@ int make_layout(hid_t loc_id)
*/
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- {
- goto out;
- }
+ goto error;
/*-------------------------------------------------------------------------
* H5D_COMPACT
*-------------------------------------------------------------------------
*/
if(H5Pset_layout (dcpl,H5D_COMPACT) < 0)
- goto out;
- if (make_dset(loc_id,"dset_compact",sid,dcpl,buf) < 0)
- {
- goto out;
- }
+ goto error;
+ if (make_dset(loc_id, "dset_compact", sid, dcpl, buf[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* H5D_CONTIGUOUS
*-------------------------------------------------------------------------
*/
if(H5Pset_layout (dcpl,H5D_CONTIGUOUS) < 0)
- goto out;
- if (make_dset(loc_id,"dset_contiguous",sid,dcpl,buf) < 0)
- {
- goto out;
- }
+ goto error;
+ if (make_dset(loc_id, "dset_contiguous", sid, dcpl, buf[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* H5D_CHUNKED
*-------------------------------------------------------------------------
*/
if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
- if (make_dset(loc_id,"dset_chunk",sid,dcpl,buf) < 0)
- {
- goto out;
- }
+ goto error;
+ if (make_dset(loc_id, "dset_chunk", sid, dcpl, buf[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* close space and dcpl
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY
{
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -3289,44 +3313,45 @@ int make_layout2(hid_t loc_id)
hid_t contig_dcpl = H5I_INVALID_HID; /* dataset creation property list */
hid_t chunked_dcpl = H5I_INVALID_HID; /* dataset creation property list */
- int i, j, n; /* Local index variables */
int ret_value = -1; /* Return value */
hid_t s_sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */
hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */
- int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */
+ int **s_buf = NULL; /* Temporary buffer */
- for(i = n = 0; i < S_DIM1; i++) {
- for (j = 0; j < S_DIM2; j++) {
- s_buf[i][j] = n++;
- }
- }
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(s_buf, int, S_DIM1, S_DIM2);
+ if (NULL == s_buf)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(s_buf, int, S_DIM1, S_DIM2);
/* Create dataspaces */
if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
- goto out;
+ goto error;
/* Create contiguous datasets */
if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
- goto out;
- if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0)
- goto out;
+ goto error;
+ if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf[0]) < 0)
+ goto error;
/* Create chunked datasets */
if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
- goto out;
- if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0)
- goto out;
+ goto error;
+ if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf[0]) < 0)
+ goto error;
+
+ HDfree(s_buf);
ret_value = 0;
-out:
+error:
H5E_BEGIN_TRY {
H5Pclose(contig_dcpl);
H5Pclose(chunked_dcpl);
@@ -3335,6 +3360,8 @@ out:
} H5E_END_TRY;
+ HDfree(s_buf);
+
return(ret_value);
} /* make_layout2() */
@@ -3372,27 +3399,20 @@ int make_layout3(hid_t loc_id)
hsize_t chunk_dims1[RANK]={DIM1_L3*2,5};
hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2};
hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2};
- int buf1[DIM1_L3][DIM2_L3];
- int buf2[SDIM1_L3][SDIM2_L3];
- int i, j, n;
+ int **buf1 = NULL;
+ int **buf2 = NULL;
- /* init buf1 */
- for (i=n=0; i<DIM1_L3; i++)
- {
- for (j=0; j<DIM2_L3; j++)
- {
- buf1[i][j]=n++;
- }
- }
+ /* Create and fill arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(buf1, int, DIM1_L3, DIM2_L3);
+ if (NULL == buf1)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf1, int, DIM1_L3, DIM2_L3);
+
+ H5TEST_ALLOCATE_2D_ARRAY(buf2, int, SDIM1_L3, SDIM2_L3);
+ if (NULL == buf2)
+ goto error;
+ H5TEST_FILL_2D_ARRAY(buf2, int, SDIM1_L3, SDIM2_L3);
- /* init buf2 */
- for (i=n=0; i<SDIM1_L3; i++)
- {
- for (j=0; j<SDIM2_L3; j++)
- {
- buf2[i][j]=n++;
- }
- }
/*-------------------------------------------------------------------------
* make chunked dataset with
@@ -3403,19 +3423,15 @@ int make_layout3(hid_t loc_id)
*/
/* create a space */
if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- {
- goto out;
- }
+ goto error;
if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
- goto out;
- if (make_dset(loc_id,"chunk_unlimit1",sid1,dcpl1,buf1) < 0)
- {
- goto out;
- }
+ goto error;
+ if (make_dset(loc_id, "chunk_unlimit1", sid1, dcpl1, buf1[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* make chunked dataset with
@@ -3427,16 +3443,16 @@ int make_layout3(hid_t loc_id)
/* create a space */
if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
- return -1;
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
- goto out;
+ goto error;
- if (make_dset(loc_id,"chunk_unlimit2",sid2,dcpl2,buf2) < 0)
- goto out;
+ if (make_dset(loc_id, "chunk_unlimit2", sid2, dcpl2, buf2[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* make chunked dataset with
@@ -3447,32 +3463,35 @@ int make_layout3(hid_t loc_id)
*/
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
- goto out;
+ goto error;
- if (make_dset(loc_id,"chunk_unlimit3",sid2,dcpl3,buf2) < 0)
- goto out;
+ if (make_dset(loc_id, "chunk_unlimit3", sid2, dcpl3, buf2[0]) < 0)
+ goto error;
/*-------------------------------------------------------------------------
* close space and dcpl
*-------------------------------------------------------------------------
*/
if(H5Sclose(sid1) < 0)
- goto out;
+ goto error;
if(H5Sclose(sid2) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl1) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl2) < 0)
- goto out;
+ goto error;
if(H5Pclose(dcpl3) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf1);
+ HDfree(buf2);
return 0;
-out:
+error:
H5E_BEGIN_TRY
{
H5Sclose(sid1);
@@ -3481,6 +3500,10 @@ out:
H5Pclose(dcpl2);
H5Pclose(dcpl3);
} H5E_END_TRY;
+
+ HDfree(buf1);
+ HDfree(buf2);
+
return -1;
}
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index 060c15b..8f13d84 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -18,7 +18,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repart_gentest>)
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
- target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5clear_gentest STATIC)
target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
diff --git a/tools/test/misc/Makefile.am b/tools/test/misc/Makefile.am
index f2d2489..c58ba38 100644
--- a/tools/test/misc/Makefile.am
+++ b/tools/test/misc/Makefile.am
@@ -21,7 +21,7 @@ include $(top_srcdir)/config/commence.am
SUBDIRS=vds
# Include src directory
-AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
#test scripts and programs
TEST_PROG=h5repart_gentest h5clear_gentest talign
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() */
diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c
index 8146d84..044ce0c 100644
--- a/tools/test/perform/pio_perf.c
+++ b/tools/test/perform/pio_perf.c
@@ -300,7 +300,7 @@ typedef struct _minmax {
/* local functions */
static off_t parse_size_directive(const char *size);
-static struct options *parse_command_line(int argc, char *argv[]);
+static struct options *parse_command_line(int argc, const char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@@ -327,7 +327,7 @@ static off_t squareo(off_t);
* Modifications:
*/
int
-main(int argc, char **argv)
+main(int argc, const char *argv[])
{
int ret;
int exit_value = EXIT_SUCCESS;
@@ -1262,7 +1262,7 @@ report_parameters(struct options *opts)
* Added 2D testing (Christian Chilan, 10. August 2005)
*/
static struct options *
-parse_command_line(int argc, char *argv[])
+parse_command_line(int argc, const char *argv[])
{
register int opt;
struct options *cl_opts;
@@ -1291,7 +1291,7 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
cl_opts->verify = FALSE; /* No Verify data correctness by default */
- while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'a':
cl_opts->h5_alignment = parse_size_directive(opt_arg);
diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c
index a56558e..d2eb3fc 100644
--- a/tools/test/perform/sio_perf.c
+++ b/tools/test/perform/sio_perf.c
@@ -303,7 +303,7 @@ typedef struct _minmax {
/* local functions */
static hsize_t parse_size_directive(const char *size);
-static struct options *parse_command_line(int argc, char *argv[]);
+static struct options *parse_command_line(int argc, const char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@@ -324,7 +324,7 @@ static void report_parameters(struct options *opts);
* Modifications:
*/
int
-main(int argc, char **argv)
+main(int argc, const char *argv[])
{
int exit_value = EXIT_SUCCESS;
struct options *opts = NULL;
@@ -944,7 +944,7 @@ report_parameters(struct options *opts)
* Added multidimensional testing (Christian Chilan, April, 2008)
*/
static struct options *
-parse_command_line(int argc, char *argv[])
+parse_command_line(int argc, const char *argv[])
{
int opt;
struct options *cl_opts;
@@ -984,7 +984,7 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_extendable = FALSE; /* Use extendable dataset */
cl_opts->verify = FALSE; /* No Verify data correctness by default */
- while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'a':
cl_opts->h5_alignment = parse_size_directive(opt_arg);
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
index e301bb3..8f1f584 100644
--- a/tools/test/perform/zip_perf.c
+++ b/tools/test/perform/zip_perf.c
@@ -552,7 +552,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
* Modifications:
*/
int
-main(int argc, char **argv)
+main(int argc, const char *argv[])
{
unsigned long min_buf_size = 128 * ONE_KB, max_buf_size = ONE_MB;
unsigned long file_size = 64 * ONE_MB;
@@ -563,7 +563,7 @@ main(int argc, char **argv)
/* Initialize h5tools lib */
h5tools_init();
- while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) > 0) {
switch ((char)opt) {
case '0': case '1': case '2':
case '3': case '4': case '5':