summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-08-25 23:35:25 (GMT)
committerGitHub <noreply@github.com>2021-08-25 23:35:25 (GMT)
commit32cb23fe7e5f0a29d113960a36039adfde8398d8 (patch)
tree271a5ce6b755bcd95deb355426efe9246498fde4
parente367c80b39529c9a863c3236e25bfb46b707b815 (diff)
downloadhdf5-32cb23fe7e5f0a29d113960a36039adfde8398d8.zip
hdf5-32cb23fe7e5f0a29d113960a36039adfde8398d8.tar.gz
hdf5-32cb23fe7e5f0a29d113960a36039adfde8398d8.tar.bz2
Merge of mostly clang-tidy changes from 1.12 (#965)
-rw-r--r--test/big.c4
-rw-r--r--test/cmpd_dset.c8
-rw-r--r--test/cmpd_dtransform.c112
-rw-r--r--test/cross_read.c2
-rw-r--r--test/direct_chunk.c98
-rw-r--r--test/dsets.c53
-rw-r--r--test/dt_arith.c8
-rw-r--r--test/dtransform.c70
-rw-r--r--test/dtypes.c68
-rw-r--r--test/file_image.c17
-rw-r--r--test/fillval.c6
-rw-r--r--test/h5test.c3
-rw-r--r--test/hyperslab.c24
-rw-r--r--test/pool.c2
-rw-r--r--test/set_extent.c6
-rw-r--r--test/tattr.c7
-rw-r--r--test/tconfig.c5
-rw-r--r--test/testhdf5.h2
-rw-r--r--test/tfile.c2
-rw-r--r--test/th5s.c10
-rw-r--r--test/tid.c2
-rw-r--r--test/timer.c18
-rw-r--r--test/titerate.c5
-rw-r--r--test/tmeta.c4
-rw-r--r--test/trefstr.c2
-rw-r--r--test/tselect.c2
-rw-r--r--test/tsohm.c2
-rw-r--r--test/tunicode.c2
-rw-r--r--test/use_common.c21
-rw-r--r--test/vds.c12
-rw-r--r--test/vfd.c2
-rw-r--r--testpar/t_cache.c2
-rw-r--r--testpar/t_cache_image.c10
-rw-r--r--testpar/t_chunk_alloc.c4
-rw-r--r--testpar/t_filters_parallel.c8
-rw-r--r--testpar/t_mdset.c4
-rw-r--r--testpar/t_shapesame.c22
37 files changed, 379 insertions, 250 deletions
diff --git a/test/big.c b/test/big.c
index 36fb27d..2bbae67 100644
--- a/test/big.c
+++ b/test/big.c
@@ -56,8 +56,8 @@
#define DNAME "big.data"
#define WRT_N 50
-#define WRT_SIZE 4 * 1024
-#define FAMILY_SIZE 1024 * 1024 * 1024
+#define WRT_SIZE (4 * 1024)
+#define FAMILY_SIZE (1024 * 1024 * 1024)
#define GB (HDoff_t)0x40000000L
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index e74b438..8777096 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -110,8 +110,8 @@ typedef struct {
long long r, s, t;
} stype4;
-#define NX 100u
-#define NY 2000u
+#define NX 100U
+#define NY 2000U
#define PACK_NMEMBS 100
/*-------------------------------------------------------------------------
@@ -1466,6 +1466,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
return 0;
error:
+ HDfree(orig);
+ HDfree(rbuf);
+ HDfree(rew_buf);
+
HDputs("*** DATASET TESTS FAILED ***");
return 1;
}
diff --git a/test/cmpd_dtransform.c b/test/cmpd_dtransform.c
index ef5ad75..f1af173 100644
--- a/test/cmpd_dtransform.c
+++ b/test/cmpd_dtransform.c
@@ -31,59 +31,75 @@ typedef struct {
int
main(void)
{
- hsize_t dima[] = {1};
- hsize_t dims[] = {LENGTH};
- hid_t str_dtyp_id, att_dtyp_id, file_id, fspace_id, dset_id, att_dspc_id, att_attr_id, dxpl_id;
+ hsize_t dima[] = {1};
+ hsize_t dims[] = {LENGTH};
+ hid_t str_dtyp_id = H5I_INVALID_HID, att_dtyp_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fspace_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t att_dspc_id = H5I_INVALID_HID;
+ hid_t att_attr_id = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ const char *expr = "2*x";
+ int * data = NULL;
+ int * data_res = NULL;
+ att_t * atts = NULL;
+ att_t * atts_res = NULL;
/* Compound datatype */
- att_t *atts = HDmalloc(sizeof(att_t));
+ if (NULL == (atts = HDmalloc(sizeof(att_t))))
+ TEST_ERROR;
HDstrcpy(atts[0].name, "Name");
HDstrcpy(atts[0].unit, "Unit");
/* String type */
if ((str_dtyp_id = H5Tcopy(H5T_C_S1)) < 0)
- TEST_ERROR;
- H5Tset_size(str_dtyp_id, 64);
+ FAIL_STACK_ERROR
+ if (H5Tset_size(str_dtyp_id, 64) < 0)
+ FAIL_STACK_ERROR
/* Attribute type */
if ((att_dtyp_id = H5Tcreate(H5T_COMPOUND, sizeof(att_t))) < 0)
- TEST_ERROR;
- H5Tinsert(att_dtyp_id, "NAME", HOFFSET(att_t, name), str_dtyp_id);
- H5Tinsert(att_dtyp_id, "UNIT", HOFFSET(att_t, unit), str_dtyp_id);
+ FAIL_STACK_ERROR
+ if (H5Tinsert(att_dtyp_id, "NAME", HOFFSET(att_t, name), str_dtyp_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(att_dtyp_id, "UNIT", HOFFSET(att_t, unit), str_dtyp_id) < 0)
+ FAIL_STACK_ERROR
/* Create file. */
if ((file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Create file dataspace. */
if ((fspace_id = H5Screate_simple(1, dims, NULL)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Create dataset. */
if ((dset_id = H5Dcreate2(file_id, "test_dset", H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Write the attribute (compound) to the dataset */
if ((att_dspc_id = H5Screate_simple(1, dima, NULL)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
if ((att_attr_id =
H5Acreate2(dset_id, "ATTRIBUTES", att_dtyp_id, att_dspc_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
if (H5Awrite(att_attr_id, att_dtyp_id, atts) < 0)
TEST_ERROR;
/* Create dataset transfer property list */
- const char *expr = "2*x";
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
if (H5Pset_data_transform(dxpl_id, expr) < 0) {
HDprintf("**** ERROR: H5Pset_data_transform (expression: %s) ****\n", expr);
- TEST_ERROR;
+ FAIL_STACK_ERROR
}
- int *data = HDmalloc(LENGTH * sizeof(int));
- int *data_res = HDmalloc(LENGTH * sizeof(int));
+ if (NULL == (data = HDmalloc(LENGTH * sizeof(int))))
+ TEST_ERROR;
+ if (NULL == (data_res = HDmalloc(LENGTH * sizeof(int))))
+ TEST_ERROR;
for (unsigned i = 0; i < LENGTH; i++) {
data[i] = 10;
data_res[i] = 2 * data[i];
@@ -91,12 +107,13 @@ main(void)
/* Write the data */
if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, data) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Read attribute */
- att_t *atts_res = HDmalloc(sizeof(att_t));
- if (H5Aread(att_attr_id, att_dtyp_id, atts_res) < 0)
+ if (NULL == (atts_res = HDmalloc(sizeof(att_t))))
TEST_ERROR;
+ if (H5Aread(att_attr_id, att_dtyp_id, atts_res) < 0)
+ FAIL_STACK_ERROR
/* Verify attribute */
if (HDstrcmp(atts_res[0].name, atts[0].name) != 0)
@@ -106,13 +123,12 @@ main(void)
/* Read the data */
if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Verify data */
- for (unsigned idx = 0; idx < LENGTH; idx++) {
+ for (unsigned idx = 0; idx < LENGTH; idx++)
if (data[idx] != data_res[idx])
TEST_ERROR;
- }
HDfree(atts);
HDfree(atts_res);
@@ -120,17 +136,47 @@ main(void)
HDfree(data_res);
/* Close all identifiers. */
- H5Pclose(dxpl_id);
- H5Aclose(att_attr_id);
- H5Sclose(att_dspc_id);
- H5Dclose(dset_id);
- H5Sclose(fspace_id);
- H5Fclose(file_id);
- H5Tclose(att_dtyp_id);
- H5Tclose(str_dtyp_id);
+ if (H5Pclose(dxpl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Aclose(att_attr_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(att_dspc_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(fspace_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(att_dtyp_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(str_dtyp_id) < 0)
+ FAIL_STACK_ERROR
return 0;
error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dxpl_id);
+ H5Aclose(att_attr_id);
+ H5Sclose(att_dspc_id);
+ H5Dclose(dset_id);
+ H5Sclose(fspace_id);
+ H5Fclose(file_id);
+ H5Tclose(att_dtyp_id);
+ H5Tclose(str_dtyp_id);
+ }
+ H5E_END_TRY
+
+ if (atts)
+ HDfree(atts);
+ if (atts_res)
+ HDfree(atts_res);
+ if (data)
+ HDfree(data);
+ if (data_res)
+ HDfree(data_res);
+
return 1;
}
diff --git a/test/cross_read.c b/test/cross_read.c
index eef814f..cb71996 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -41,8 +41,10 @@ const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL};
#define DATASETNAME14 "Fletcher_float_data_le"
#define DATASETNAME15 "Fletcher_float_data_be"
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME16 "Deflate_float_data_le"
#define DATASETNAME17 "Deflate_float_data_be"
+#endif
#ifdef H5_HAVE_FILTER_SZIP
#define DATASETNAME18 "Szip_float_data_le"
#define DATASETNAME19 "Szip_float_data_be"
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 61e3df9..b2b7cba 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -23,7 +23,9 @@
#define FILE_NAME "direct_chunk.h5"
/* Datasets for Direct Write tests */
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME1 "direct_write"
+#endif
#define DATASETNAME2 "skip_one_filter"
#define DATASETNAME3 "skip_two_filters"
#define DATASETNAME4 "data_conv"
@@ -31,9 +33,11 @@
#define DATASETNAME6 "invalid_argue"
#define DATASETNAME7 "overwrite_chunk"
/* Datasets for Direct Read tests */
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME8 "disabled_chunk_cache"
#define DATASETNAME9 "flush_chunk_cache"
#define DATASETNAME10 "read_w_valid_cache"
+#endif
#define DATASETNAME11 "unallocated_chunk"
#define DATASETNAME12 "unfiltered_data"
@@ -43,7 +47,9 @@
#define CHUNK_NX 4
#define CHUNK_NY 4
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0)
+#endif
/* Temporary filter IDs used for testing */
#define H5Z_FILTER_BOGUS1 305
@@ -1990,23 +1996,23 @@ test_read_unallocated_chunk(hid_t file)
/* Create the data space with unlimited dimensions. */
if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Modify dataset creation properties, i.e. enable chunking, no compression */
if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create a new dataset within the file using cparms creation properties. */
if ((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Write a single chunk to intialize the chunk storage */
HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int));
@@ -2014,7 +2020,7 @@ test_read_unallocated_chunk(hid_t file)
offset[1] = 0;
if (H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Attempt to read each chunk in the dataset. Chunks are not allocated,
* therefore we expect the result of H5Dread_chunk to fail. Chunk idx starts
@@ -2034,7 +2040,7 @@ test_read_unallocated_chunk(hid_t file)
/* Check that the chunk read call does not succeed. */
if (status != -1)
- goto error;
+ TEST_ERROR
/* Query the size of the non-existant chunk */
direct_chunk_nbytes = ULONG_MAX;
@@ -2046,18 +2052,23 @@ test_read_unallocated_chunk(hid_t file)
/* Check that the chunk storage size call does not succeed. */
if (status != -1)
- goto error;
+ TEST_ERROR
if (direct_chunk_nbytes != 0)
- goto error;
+ TEST_ERROR
}
}
/* Close/release resources. */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Sclose(mem_space) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Sclose(dataspace) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Pclose(cparms) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Pclose(dxpl) < 0)
+ FAIL_STACK_ERROR;
PASSED();
return 0;
@@ -2121,103 +2132,100 @@ test_single_chunk(unsigned config)
TESTING("Single chunk I/O");
/* Initialize data */
- for (i = 0; i < DIM0; i++) {
+ for (i = 0; i < DIM0; i++)
for (j = 0; j < DIM1; j++)
wdata[i][j] = j / CHUNK0;
- }
/* Create a new file with the latest format */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_LATEST)
if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create dataspace */
if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create the dataset creation property list and set the chunk size */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Pset_chunk(dcpl, 2, chunk) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create the dataset */
if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_DIRECT_WRITE) {
/* Write the data directly to the dataset */
if (H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0 * CHUNK1 * 4, (void *)wdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
} /* end if */
else
/* Write the data to the dataset */
if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/*
* Close and release resources.
*/
if (H5Pclose(dcpl) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_REOPEN_DSET)
if (H5Dclose(did) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Sclose(sid) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Pclose(fapl) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_REOPEN_FILE)
if (H5Fclose(fid) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Open the file and dataset with default properties */
if (config & CONFIG_REOPEN_FILE)
if ((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_REOPEN_DSET)
if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Retrieve dataset creation property list */
if ((dcpl = H5Dget_create_plist(did)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_DIRECT_READ) {
/* Read the data directly */
if (H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Verify returned filter mask */
if (filters != 0)
- goto error;
+ TEST_ERROR
} /* end if */
else
/* Read the data */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Verify that the data read was correct. */
- for (i = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
if (rdata[i][j] != wdata[i][j])
- goto error;
- }
- }
+ TEST_ERROR
/*
* Close and release resources
*/
if (H5Pclose(dcpl) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Dclose(did) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Fclose(fid) < 0)
- goto error;
+ FAIL_STACK_ERROR;
PASSED();
return 0;
diff --git a/test/dsets.c b/test/dsets.c
index 88337bf..101b3a2 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -93,25 +93,29 @@ const char *FILENAME[] = {"dataset", /* 0 */
#define FILE_DEFLATE_NAME "deflate.h5"
/* Dataset names for testing filters */
-#define DSET_DEFAULT_NAME "default"
-#define DSET_CHUNKED_NAME "chunked"
-#define DSET_COMPACT_NAME "compact"
-#define DSET_SIMPLE_IO_NAME "simple_io"
-#define DSET_USERBLOCK_IO_NAME "userblock_io"
-#define DSET_COMPACT_IO_NAME "compact_io"
-#define DSET_COMPACT_MAX_NAME "max_compact"
-#define DSET_COMPACT_MAX2_NAME "max_compact_2"
-#define DSET_CONV_BUF_NAME "conv_buf"
-#define DSET_TCONV_NAME "tconv"
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_SHUFFLE_NAME "shuffle"
-#define DSET_FLETCHER32_NAME "fletcher32"
-#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
-#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#define DSET_DEFAULT_NAME "default"
+#define DSET_CHUNKED_NAME "chunked"
+#define DSET_COMPACT_NAME "compact"
+#define DSET_SIMPLE_IO_NAME "simple_io"
+#define DSET_USERBLOCK_IO_NAME "userblock_io"
+#define DSET_COMPACT_IO_NAME "compact_io"
+#define DSET_COMPACT_MAX_NAME "max_compact"
+#define DSET_COMPACT_MAX2_NAME "max_compact_2"
+#define DSET_CONV_BUF_NAME "conv_buf"
+#define DSET_TCONV_NAME "tconv"
+#ifdef H5_HAVE_FILTER_DEFLATE
+#define DSET_DEFLATE_NAME "deflate"
+#endif
+#define DSET_SHUFFLE_NAME "shuffle"
+#define DSET_FLETCHER32_NAME "fletcher32"
+#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
+#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
-#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
-#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
+#endif
+#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
+#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
@@ -1390,10 +1394,10 @@ test_conv_buffer(hid_t fid)
cf->a[j][k][l] = 10 * (j + 1) + l + k;
for (j = 0; j < DIM2; j++)
- cf->b[j] = 100.0f * (float)(j + 1) + 0.01f * (float)j;
+ cf->b[j] = 100.0F * (float)(j + 1) + 0.01F * (float)j;
for (j = 0; j < DIM3; j++)
- cf->c[j] = 100.0f * (float)(j + 1) + 0.02f * (float)j;
+ cf->c[j] = 100.0F * (float)(j + 1) + 0.02F * (float)j;
/* Create data space */
if ((space = H5Screate(H5S_SCALAR)) < 0)
@@ -1502,6 +1506,9 @@ test_conv_buffer(hid_t fid)
return SUCCEED;
error:
+ HDfree(cfrR);
+ HDfree(cf);
+
H5E_BEGIN_TRY
{
H5Pclose(xfer_list);
@@ -3315,8 +3322,8 @@ test_nbit_float(hid_t file)
/* orig_data[] are initialized to be within the range that can be represented by
* dataset datatype (no precision loss during datatype conversion)
*/
- float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f},
- {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}};
+ float orig_data[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
+ {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
float new_data[2][5];
size_t precision, offset;
size_t i, j;
@@ -7160,6 +7167,7 @@ error:
H5E_END_TRY;
return FAIL;
#else
+ (void)file; /* Silence compiler */
SKIPPED();
return SUCCEED;
#endif
@@ -11632,7 +11640,7 @@ test_unfiltered_edge_chunks(hid_t fapl)
TEST_ERROR
/* Add "count" filter */
- if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0u, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0U, (size_t)0, NULL) < 0)
TEST_ERROR
/* Disable filters on partial chunks */
@@ -15407,6 +15415,7 @@ main(void)
/* Tests version bounds using its own file */
nerrors += (test_versionbounds() < 0 ? 1 : 0);
+ /* Tests that use their own file */
nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0);
/* Run misc tests */
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 7b79102..91e31d5 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -53,7 +53,7 @@ const char *FILENAME[] = {"dt_arith1", "dt_arith2", NULL};
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z, I, E) (H5T_ORDER_BE == E ? (I) : (Z) - ((I) + 1))
+#define ENDIAN(Z, I, E) (H5T_ORDER_BE == (E) ? (I) : (Z) - ((I) + 1))
typedef enum dtype_t {
INT_SCHAR,
@@ -3058,10 +3058,10 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
/* Check the software results against the hardware */
for (j = 0; j < nelmts; j++) {
underflow = 0;
- hw_f = 911.0f;
- hw_d = 911.0f;
+ hw_f = 911.0F;
+ hw_d = 911.0F;
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- hw_ld = 911.0f;
+ hw_ld = 911.0L;
#endif
/* The hardware conversion */
diff --git a/test/dtransform.c b/test/dtransform.c
index 9445d83..8d3a8c0 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -32,30 +32,30 @@ hid_t dset_id_int_chunk = -1;
hid_t dset_id_float_chunk = -1;
const float windchillFfloat[ROWS][COLS] = {
- {36.0f, 31.0f, 25.0f, 19.0f, 13.0f, 7.0f, 1.0f, -5.0f, -11.0f, -16.0f, -22.0f, -28.0f, -34.0f, -40.0f,
- -46.0f, -52.0f, -57.0f, -63.0f},
- {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f,
- -53.0f, -59.0f, -66.0f, -72.0f},
- {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f,
- -58.0f, -64.0f, -71.0f, -77.0f},
- {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f,
- -61.0f, -68.0f, -74.0f, -81.0f},
- {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f,
- -64.0f, -71.0f, -78.0f, -84.0f},
- {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f,
- -67.0f, -73.0f, -80.0f, -87.0f},
- {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f,
- -69.0f, -76.0f, -82.0f, -89.0f},
- {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f,
- -71.0f, -78.0f, -84.0f, -91.0f},
- {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f,
- -72.0f, -79.0f, -86.0f, -93.0f},
- {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f,
- -74.0f, -81.0f, -88.0f, -95.0f},
- {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f,
- -75.0f, -82.0f, -89.0f, -97.0f},
- {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f,
- -76.0f, -84.0f, -91.0f, -98.0f}};
+ {36.0F, 31.0F, 25.0F, 19.0F, 13.0F, 7.0F, 1.0F, -5.0F, -11.0F, -16.0F, -22.0F, -28.0F, -34.0F, -40.0F,
+ -46.0F, -52.0F, -57.0F, -63.0F},
+ {34.0F, 27.0F, 21.0F, 15.0F, 9.0F, 3.0F, -4.0F, -10.0F, -16.0F, -22.0F, -28.0F, -35.0F, -41.0F, -47.0F,
+ -53.0F, -59.0F, -66.0F, -72.0F},
+ {32.0F, 25.0F, 19.0F, 13.0F, 6.0F, 0.0F, -7.0F, -13.0F, -19.0F, -26.0F, -32.0F, -39.0F, -45.0F, -51.0F,
+ -58.0F, -64.0F, -71.0F, -77.0F},
+ {30.0F, 24.0F, 17.0F, 11.0F, 4.0F, -2.0F, -9.0F, -15.0F, -22.0F, -29.0F, -35.0F, -42.0F, -48.0F, -55.0F,
+ -61.0F, -68.0F, -74.0F, -81.0F},
+ {29.0F, 23.0F, 16.0F, 9.0F, 3.0F, -4.0F, -11.0F, -17.0F, -24.0F, -31.0F, -37.0F, -44.0F, -51.0F, -58.0F,
+ -64.0F, -71.0F, -78.0F, -84.0F},
+ {28.0F, 22.0F, 15.0F, 8.0F, 1.0F, -5.0F, -12.0F, -19.0F, -26.0F, -33.0F, -39.0F, -46.0F, -53.0F, -60.0F,
+ -67.0F, -73.0F, -80.0F, -87.0F},
+ {28.0F, 21.0F, 14.0F, 7.0F, 0.0F, -7.0F, -14.0F, -21.0F, -27.0F, -34.0F, -41.0F, -48.0F, -55.0F, -62.0F,
+ -69.0F, -76.0F, -82.0F, -89.0F},
+ {27.0F, 20.0F, 13.0F, 6.0F, -1.0F, -8.0F, -15.0F, -22.0F, -29.0F, -36.0F, -43.0F, -50.0F, -57.0F, -64.0F,
+ -71.0F, -78.0F, -84.0F, -91.0F},
+ {26.0F, 19.0F, 12.0F, 5.0F, -2.0F, -9.0F, -16.0F, -23.0F, -30.0F, -37.0F, -44.0F, -51.0F, -58.0F, -65.0F,
+ -72.0F, -79.0F, -86.0F, -93.0F},
+ {26.0F, 19.0F, 12.0F, 4.0F, -3.0F, -10.0F, -17.0F, -24.0F, -31.0F, -38.0F, -45.0F, -52.0F, -60.0F, -67.0F,
+ -74.0F, -81.0F, -88.0F, -95.0F},
+ {25.0F, 18.0F, 11.0F, 4.0F, -3.0F, -11.0F, -18.0F, -25.0F, -32.0F, -39.0F, -46.0F, -54.0F, -61.0F, -68.0F,
+ -75.0F, -82.0F, -89.0F, -97.0F},
+ {25.0F, 17.0F, 10.0F, 3.0F, -4.0F, -11.0F, -19.0F, -26.0F, -33.0F, -40.0F, -48.0F, -55.0F, -62.0F, -69.0F,
+ -76.0F, -84.0F, -91.0F, -98.0F}};
const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, 28, 34, 40, 46, 52, 57, 63},
{34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 1},
@@ -77,9 +77,9 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
for (i = 0; i < ROWS; i++) \
for (j = 0; j < COLS; j++) { \
if (!((((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && \
- (((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || \
+ (((VAR1)[i][j] - (TOL)) < (TYPE)((VAR2)[i][j]))) || \
(((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && \
- (((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) { \
+ (((VAR1)[i][j] + (TOL)) > (TYPE)((VAR2)[i][j]))))) { \
H5_FAILED(); \
HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
goto error; \
@@ -94,8 +94,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
\
for (i = 0; i < ROWS; i++) \
for (j = 0; j < COLS; j++) { \
- if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && \
- ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL)))) { \
+ if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + (TOL))) && \
+ ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - (TOL))))) { \
H5_FAILED(); \
HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
goto error; \
@@ -540,19 +540,19 @@ test_poly(const hid_t dxpl_id_polynomial)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
- polyflres[row][col] = ((2.0f + (float)windchillC) * (((float)windchillC - 8.0f) / 2.0f));
+ windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = ((2.0F + (float)windchillC) * (((float)windchillC - 8.0F) / 2.0F));
}
TESTING("data transform, polynomial transform (int->float)")
if (H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0)
TEST_ERROR
- COMPARE(float, polyflread, polyflres, 2.0f)
+ COMPARE(float, polyflread, polyflres, 2.0F)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32));
polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2));
}
@@ -752,7 +752,7 @@ test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32));
polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2));
}
@@ -786,7 +786,7 @@ test_trivial(const hid_t dxpl_id_simple)
TEST_ERROR
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
+ if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n");
}
@@ -843,7 +843,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
+ if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n")
}
diff --git a/test/dtypes.c b/test/dtypes.c
index 30585af..16c55c3 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -70,7 +70,7 @@
FAIL_STACK_ERROR \
if ((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \
H5_FAILED(); \
- HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)NMEMBS, \
+ HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)(NMEMBS), \
(long long)H5I_nmembers(H5I_DATATYPE)); \
goto error; \
}
@@ -783,9 +783,12 @@ test_compound_2(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -857,6 +860,10 @@ test_compound_2(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -903,9 +910,12 @@ test_compound_3(void)
FAIL_STACK_ERROR
/* Initialize */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -973,6 +983,10 @@ test_compound_3(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1023,9 +1037,12 @@ test_compound_4(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -1096,6 +1113,10 @@ test_compound_4(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1146,6 +1167,12 @@ test_compound_5(void)
TESTING("optimized struct converter");
+ if (!buf || !bkg) {
+ HDfree(buf);
+ HDfree(bkg);
+ return 1;
+ }
+
/* Build datatypes */
short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short));
array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
@@ -1238,9 +1265,12 @@ test_compound_6(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff);
@@ -6651,13 +6681,13 @@ static int
test_int_float_except(void)
{
#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f,
- (float)4.5f};
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0F, (float)INT_MAX - 32.0F, (float)INT_MAX - 68.0F,
+ (float)4.5F};
int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 4};
- float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
+ float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0F, (float)INT_MAX - 127.0F, 4};
int * intp; /* Pointer to buffer, as integers */
int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
- float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
+ float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0F, (float)0.0F};
int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
float *floatp; /* Pointer to buffer #2, as floats */
hid_t dxpl; /* Dataset transfer property list */
@@ -8121,7 +8151,7 @@ test_utf_ascii_conv(void)
/* Test conversion in memory */
H5E_BEGIN_TRY
{
- status = H5Tconvert(utf8_vtid, ascii_vtid, 1, (void *)utf8_w, NULL, H5P_DEFAULT);
+ status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT);
}
H5E_END_TRY
if (status >= 0)
@@ -8163,7 +8193,7 @@ test_utf_ascii_conv(void)
/* Test conversion in memory */
H5E_BEGIN_TRY
{
- status = H5Tconvert(ascii_vtid, utf8_vtid, 1, (void *)ascii_w, NULL, H5P_DEFAULT);
+ status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT);
}
H5E_END_TRY
if (status >= 0)
diff --git a/test/file_image.c b/test/file_image.c
index 1c3f973..0373468 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -102,8 +102,9 @@ test_properties(void)
* property list functions. In the file driver tests further down, this will
* not be the case.
*/
- size = (size_t)count * sizeof(char);
- buffer = (char *)HDmalloc(size);
+ size = (size_t)count * sizeof(char);
+ if (NULL == (buffer = (char *)HDmalloc(size)))
+ TEST_ERROR
for (i = 0; i < count - 1; i++)
buffer[i] = (char)(65 + i);
buffer[count - 1] = '\0';
@@ -338,8 +339,8 @@ test_callbacks(void)
H5FD_file_image_callbacks_t callbacks;
hid_t fapl_1;
hid_t fapl_2;
- udata_t * udata;
- char * file_image;
+ udata_t * udata = NULL;
+ char * file_image = NULL;
char * temp_file_image;
int count = 10;
int i;
@@ -350,6 +351,7 @@ test_callbacks(void)
/* Allocate and initialize udata */
udata = (udata_t *)HDmalloc(sizeof(udata_t));
+ VERIFY(udata != NULL, "udata malloc failed");
reset_udata(udata);
/* copy the address of the user data into read_callbacks */
@@ -358,6 +360,7 @@ test_callbacks(void)
/* Allocate and initialize file image buffer */
size = (size_t)count * sizeof(char);
file_image = (char *)HDmalloc(size);
+ VERIFY(file_image != NULL, "file_image malloc failed");
for (i = 0; i < count - 1; i++)
file_image[i] = (char)(65 + i);
file_image[count - 1] = '\0';
@@ -529,6 +532,9 @@ test_callbacks(void)
return 0;
error:
+ HDfree(file_image);
+ HDfree(udata);
+
return 1;
} /* test_callbacks() */
@@ -601,7 +607,8 @@ test_core(void)
reset_udata(udata);
file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl);
VERIFY(file >= 0, "H5Fopen failed");
- VERIFY(udata->used_callbacks == MALLOC, "opening a core file used the wrong callbacks");
+ VERIFY((udata->used_callbacks == MALLOC) || (udata->used_callbacks == (MALLOC | UDATA_COPY | UDATA_FREE)),
+ "opening a core file used the wrong callbacks");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN,
"Malloc callback came from wrong sourc in core open");
diff --git a/test/fillval.c b/test/fillval.c
index 8e21648..7bae587 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1050,7 +1050,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f
for (u = 0; u < nelmts; u++) {
buf_c[u].a = 1111.11F;
buf_c[u].x = 2222;
- buf_c[u].y = 3333.3333F;
+ buf_c[u].y = 3333.3333;
buf_c[u].z = 'd';
}
if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
@@ -1304,7 +1304,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
goto error;
HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
- fill_ctype.y = 4444.4444F;
+ fill_ctype.y = 4444.4444;
if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout,
@@ -1370,7 +1370,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
goto error;
HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
- fill_ctype.y = 4444.4444F;
+ fill_ctype.y = 4444.4444;
if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND,
diff --git a/test/h5test.c b/test/h5test.c
index d5ebfdf..8d0960e 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -1528,6 +1528,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
void * buf = NULL; /* Buffer for copying data */
const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */
+ if (!filename)
+ goto error;
+
/* Allocate copy buffer */
if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE)))
goto error;
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 8e67fd9..1c55259 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -177,7 +177,7 @@ test_fill(size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size
} /* end else */
HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim);
HDprintf("%-70s", s);
- fflush(stdout);
+ HDfflush(stdout);
/* Allocate array */
if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
@@ -366,7 +366,7 @@ test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_
HDsprintf(s, "Testing hyperslab copy %-11s %s", dim, sub);
HDprintf("%-70s", s);
- fflush(stdout);
+ HDfflush(stdout);
/*
* Allocate arrays
@@ -575,7 +575,7 @@ test_multifill(size_t nx)
hsize_t i, j;
HDprintf("%-70s", "Testing multi-byte fill value");
- fflush(stdout);
+ HDfflush(stdout);
/* Initialize the source and destination */
if (NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
@@ -585,10 +585,10 @@ test_multifill(size_t nx)
for (i = 0; i < nx; i++) {
src[i].left = 1111111;
- src[i].mid = 12345.6789F;
+ src[i].mid = 12345.6789;
src[i].right = 2222222;
dst[i].left = 3333333;
- dst[i].mid = 98765.4321F;
+ dst[i].mid = 98765.4321;
dst[i].right = 4444444;
} /* end for */
@@ -597,7 +597,7 @@ test_multifill(size_t nx)
* over and over again.
*/
fill.left = 55555555;
- fill.mid = 3.1415927F;
+ fill.mid = 3.1415927;
fill.right = 66666666;
src_stride = 0;
@@ -687,7 +687,7 @@ test_endian(size_t nx)
hsize_t i, j;
HDprintf("%-70s", "Testing endian conversion by stride");
- fflush(stdout);
+ HDfflush(stdout);
/* Initialize arrays */
if (NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
@@ -773,7 +773,7 @@ test_transpose(size_t nx, size_t ny)
HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny);
HDprintf("%-70s", s);
- fflush(stdout);
+ HDfflush(stdout);
/* Initialize */
if (NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
@@ -872,7 +872,7 @@ test_sub_super(size_t nx, size_t ny)
HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx),
(unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny);
HDprintf("%-70s", s);
- fflush(stdout);
+ HDfflush(stdout);
/* Initialize */
if (NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
@@ -922,7 +922,7 @@ test_sub_super(size_t nx, size_t ny)
HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny,
(unsigned long)(2 * nx), (unsigned long)(2 * ny));
HDprintf("%-70s", s);
- fflush(stdout);
+ HDfflush(stdout);
/* Setup stride */
size[0] = nx;
@@ -1117,8 +1117,8 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
/* Check computed coordinates */
for (v = 0; v < ARRAY_OFFSET_NDIMS; v++)
if (coords[v] != new_coords[v]) {
- HDfprintf(stderr, "coords[%u]=%Hu, new_coords[%u]=%Hu\n", (unsigned)v, coords[v], (unsigned)v,
- new_coords[v]);
+ HDfprintf(stderr, "coords[%zu]=%" PRIuHSIZE ", new_coords[%zu]=%" PRIuHSIZE "\n", v,
+ coords[v], v, new_coords[v]);
TEST_ERROR;
} /* end if */
} /* end for */
diff --git a/test/pool.c b/test/pool.c
index 9ce1846..c508025 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -34,7 +34,7 @@
#define MPOOL_LARGE_BLOCK (MPOOL_PAGE_SIZE * 3)
#define MPOOL_NUM_SMALL_BLOCKS 64
#define MPOOL_SMALL_BLOCK 1
-#define MPOOL_NUM_RANDOM 10 * 1024
+#define MPOOL_NUM_RANDOM (10 * 1024)
#define MPOOL_RANDOM_MAX_SIZE (MPOOL_PAGE_SIZE * 2)
/*-------------------------------------------------------------------------
diff --git a/test/set_extent.c b/test/set_extent.c
index daec7fd..e37d184 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -39,7 +39,7 @@ const char *FILENAME[] = {"set_extent1", "set_extent2", "set_extent3", "set_exte
#define CONFIG_EARLY_ALLOC 0x04u
#define CONFIG_UNFILT_EDGE 0x08u
#define CONFIG_ALL (CONFIG_COMPRESS + CONFIG_FILL + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE)
-#define FILL_VALUE -1
+#define FILL_VALUE (-1)
#define DO_RANKS_PRINT_CONFIG(TEST) \
{ \
HDprintf(" Config:\n"); \
@@ -134,11 +134,11 @@ main(void)
TEST_ERROR
/* Set chunk cache so only part of the chunks can be cached on fapl */
- if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0)
+ if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0)
TEST_ERROR
/* Disable chunk caching on fapl2 */
- if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0)
+ if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0) < 0)
TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
diff --git a/test/tattr.c b/test/tattr.c
index 9f0e4e4..a2eed24 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -94,8 +94,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test d
#define ATTR3_DIM2 2
#define ATTR3_DIM3 2
double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {
- {{2.3F, -26.1F}, {0.123F, -10.0F}},
- {{973.23F, -0.91827F}, {2.0F, 23.0F}}}; /* Test data for 3rd attribute */
+ {{2.3, -26.1}, {0.123, -10.0}}, {{973.23, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */
#define ATTR4_NAME "Attr4"
#define ATTR4_RANK 2
@@ -112,8 +111,8 @@ struct attr4_struct {
double d;
char c;
} attr_data4[ATTR4_DIM1][ATTR4_DIM2] = {
- {{3, -26.1F, 'd'}, {-100000, 0.123F, '3'}},
- {{-23, 981724.2F, 'Q'}, {0, 2.0F, '\n'}}}; /* Test data for 4th attribute */
+ {{3, -26.1, 'd'}, {-100000, 0.123, '3'}},
+ {{-23, 981724.2, 'Q'}, {0, 2.0, '\n'}}}; /* Test data for 4th attribute */
#define ATTR5_NAME "Attr5"
#define ATTR5_RANK 0
diff --git a/test/tconfig.c b/test/tconfig.c
index e3c6a2c..101de9a 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -37,8 +37,9 @@
/* verify if the sizeof(type) matches size defined in macro. */
/* Needs this extra step so that we can print the macro name. */
#define vrfy_macrosize(type, macro, macroname) \
- if (sizeof(type) != macro) \
- TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, (int)macro);
+ if (sizeof(type) != (macro)) \
+ TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, \
+ (int)(macro));
/* local routine prototypes */
void test_config_ctypes(void);
diff --git a/test/testhdf5.h b/test/testhdf5.h
index a38309a..2544dd4 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -136,7 +136,7 @@
"%s \n", \
(where), (int)__LINE__, __FILE__, x); \
} \
- if (HDstrcmp(x, val)) { \
+ if (HDstrcmp(x, val) != 0) { \
TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
"in %s\n", \
where, val, x, (int)__LINE__, __FILE__); \
diff --git a/test/tfile.c b/test/tfile.c
index c096342..6620fed 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -124,7 +124,7 @@
#define TEST_THRESHOLD10 10 /* Free space section threshold */
#define FSP_SIZE_DEF 4096 /* File space page size default */
#define FSP_SIZE512 512 /* File space page size */
-#define FSP_SIZE1G 1024 * 1024 * 1024 /* File space page size */
+#define FSP_SIZE1G (1024 * 1024 * 1024) /* File space page size */
/* Declaration for test_libver_macros2() */
#define FILE6 "tfile6.h5" /* Test file */
diff --git a/test/th5s.c b/test/th5s.c
index 9bcd52f..9e4547b 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -2884,9 +2884,9 @@ test_h5s(void)
void
cleanup_h5s(void)
{
- remove(DATAFILE);
- remove(NULLFILE);
- remove(BASICFILE);
- remove(ZEROFILE);
- remove(VERBFNAME);
+ HDremove(DATAFILE);
+ HDremove(NULLFILE);
+ HDremove(BASICFILE);
+ HDremove(ZEROFILE);
+ HDremove(VERBFNAME);
}
diff --git a/test/tid.c b/test/tid.c
index 2f5188e..c7e40a0 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -855,7 +855,7 @@ test_remove_clear_type(void)
return 0;
error:
- /* Cleanup. For simplicity, just destroy the types and ignore errors. */
+ /* Cleanup. For simplicity, just destroy the types and ignore errors. */
H5E_BEGIN_TRY
{
H5Idestroy_type(obj_type);
diff --git a/test/timer.c b/test/timer.c
index bb474ca..11b7427 100644
--- a/test/timer.c
+++ b/test/timer.c
@@ -43,55 +43,55 @@ test_time_formatting(void)
TESTING("Time string formats");
/* < 0, N/A */
- s = H5_timer_get_time_string(-1.0F);
+ s = H5_timer_get_time_string(-1.0);
if (NULL == s || HDstrcmp(s, "N/A") != 0)
TEST_ERROR;
HDfree(s);
/* 0 0 */
- s = H5_timer_get_time_string(0.0F);
+ s = H5_timer_get_time_string(0.0);
if (NULL == s || HDstrcmp(s, "0.0 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 us nanoseconds */
- s = H5_timer_get_time_string(123.0E-9F);
+ s = H5_timer_get_time_string(123.0E-9);
if (NULL == s || HDstrcmp(s, "123 ns") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 ms microseconds */
- s = H5_timer_get_time_string(23.456E-6F);
+ s = H5_timer_get_time_string(23.456E-6);
if (NULL == s || HDstrcmp(s, "23.5 us") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 s milliseconds */
- s = H5_timer_get_time_string(4.56789E-3F);
+ s = H5_timer_get_time_string(4.56789E-3);
if (NULL == s || HDstrcmp(s, "4.6 ms") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 min seconds */
- s = H5_timer_get_time_string(3.14F);
+ s = H5_timer_get_time_string(3.14);
if (NULL == s || HDstrcmp(s, "3.14 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 hr mins, secs */
- s = H5_timer_get_time_string(2521.0F);
+ s = H5_timer_get_time_string(2521.0);
if (NULL == s || HDstrcmp(s, "42 m 1 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 d hrs, mins, secs */
- s = H5_timer_get_time_string(9756.0F);
+ s = H5_timer_get_time_string(9756.0);
if (NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0)
TEST_ERROR;
HDfree(s);
/* > 1 d days, hrs, mins, secs */
- s = H5_timer_get_time_string(280802.0F);
+ s = H5_timer_get_time_string(280802.0);
if (NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0)
TEST_ERROR;
HDfree(s);
diff --git a/test/titerate.c b/test/titerate.c
index faabf14..d6edcbc 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -218,9 +218,14 @@ test_iter_group(hid_t fapl, hbool_t new_format)
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
+ //! [H5Oget_info_by_idx2_snip]
+
ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
+
+ //! [H5Oget_info_by_idx2_snip]
+
} /* end for */
H5E_BEGIN_TRY
diff --git a/test/tmeta.c b/test/tmeta.c
index 2609703..e70db16 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -22,9 +22,9 @@
#include "testhdf5.h"
#include "H5Fprivate.h"
-#define TEST_INT16_VALUE -7641
+#define TEST_INT16_VALUE (-7641)
#define TEST_UINT16_VALUE 45002
-#define TEST_INT32_VALUE -981236
+#define TEST_INT32_VALUE (-981236)
#define TEST_UINT32_VALUE 3476589
uint8_t compar_buffer[] = {
diff --git a/test/trefstr.c b/test/trefstr.c
index 0dcf621..ea30f24 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -186,7 +186,7 @@ test_refstr_cmp(void)
H5RS_str_t *rs1; /* Ref-counted string created */
H5RS_str_t *rs2; /* Ref-counted string created */
int cmp; /* Comparison value */
- ssize_t len; /* Length of string */
+ size_t len; /* Length of string */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
diff --git a/test/tselect.c b/test/tselect.c
index c5c50f8..053ffaa 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -8401,7 +8401,7 @@ test_shape_same(void)
/* Output message about test being performed */
MESSAGE(6, ("Testing Same Shape Comparisons\n"));
- assert(SPACE9_DIM2 >= POINT1_NPOINTS);
+ HDassert(SPACE9_DIM2 >= POINT1_NPOINTS);
/* Create dataspace for "all" selection */
all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
diff --git a/test/tsohm.c b/test/tsohm.c
index b7df355..29057b8 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -622,7 +622,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
HDprintf("Can't read data\n"); \
goto error; \
} \
- if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \
+ if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str) != 0) { \
H5_FAILED(); \
AT(); \
HDprintf("incorrect read data\n"); \
diff --git a/test/tunicode.c b/test/tunicode.c
index 83d31aa..f719ffd 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -33,7 +33,7 @@
#define RANK 1
#define COMP_INT_VAL 7
-#define COMP_FLOAT_VAL -42.0F
+#define COMP_FLOAT_VAL (-42.0F)
#define COMP_DOUBLE_VAL 42.0F
/* Test function prototypes */
diff --git a/test/use_common.c b/test/use_common.c
index 0ea2c83..8f78f3b 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -322,10 +322,12 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ HDfree(buffer);
return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
@@ -334,12 +336,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) {
HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0],
(unsigned long long)dims[1], (unsigned long long)dims[2]);
+ HDfree(buffer);
return -1;
}
/* setup mem-space for buffer */
if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ HDfree(buffer);
return -1;
}
@@ -360,6 +364,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (opts->use_swmr) {
if (H5Odisable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n");
+ HDfree(buffer);
return -1;
}
}
@@ -368,12 +373,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
dims[0] = i + 1;
if (H5Dset_extent(dsid, dims) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
+ HDfree(buffer);
return -1;
}
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
+ HDfree(buffer);
return -1;
}
@@ -381,12 +388,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
/* Choose the next plane to write */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
+ HDfree(buffer);
return -1;
}
/* Write plane to the dataset */
if (H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
HDfprintf(stderr, "Failed H5Dwrite\n");
+ HDfree(buffer);
return -1;
}
@@ -394,6 +403,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (opts->use_swmr) {
if (H5Oenable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Oenable_mdc_flushes failed\n");
+ HDfree(buffer);
return -1;
}
}
@@ -401,6 +411,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
/* flush file to make the just written plane available. */
if (H5Dflush(dsid) < 0) {
HDfprintf(stderr, "Failed to H5Fflush file\n");
+ HDfree(buffer);
return -1;
}
} /* end for each plane to write */
@@ -488,10 +499,12 @@ read_uc_file(hbool_t towait, options_t *opts)
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ HDfree(buffer);
return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
@@ -502,12 +515,14 @@ read_uc_file(hbool_t towait, options_t *opts)
(unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]);
HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", (unsigned long long)memdims[0],
(unsigned long long)memdims[1], (unsigned long long)memdims[2]);
+ HDfree(buffer);
return -1;
}
/* Setup mem-space for buffer */
if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ HDfree(buffer);
return -1;
}
@@ -533,6 +548,7 @@ read_uc_file(hbool_t towait, options_t *opts)
HDprintf(".");
if (loops_waiting_for_plane >= 30) {
HDfprintf(stderr, "waited too long for new plane, quit.\n");
+ HDfree(buffer);
return -1;
}
}
@@ -550,6 +566,7 @@ read_uc_file(hbool_t towait, options_t *opts)
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
HDfprintf(stderr, "H5Dget_space failed\n");
+ HDfree(buffer);
return -1;
}
@@ -557,12 +574,14 @@ read_uc_file(hbool_t towait, options_t *opts)
/* Choose the next plane to read */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "H5Sselect_hyperslab failed\n");
+ HDfree(buffer);
return -1;
}
/* Read the plane from the dataset */
if (H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
HDfprintf(stderr, "H5Dread failed\n");
+ HDfree(buffer);
return -1;
}
@@ -594,12 +613,14 @@ read_uc_file(hbool_t towait, options_t *opts)
f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
} /* end while (expecting more planes to read) */
if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "H5Fclose failed\n");
+ HDfree(buffer);
return -1;
}
diff --git a/test/vds.c b/test/vds.c
index 856ea52..784f623 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -78,12 +78,12 @@ char vds_test_str_g[128] = "";
#endif /* VDS_TEST_VERBOSE */
/* I/O test config flags */
-#define TEST_IO_CLOSE_SRC 0x01u
-#define TEST_IO_DIFFERENT_FILE 0x02u
-#define TEST_IO_REOPEN_VIRT 0x04u
-#define TEST_IO_FCLOSE_SEMI 0x08u
-#define TEST_IO_FCLOSE_STRONG 0x10u
-#define TEST_IO_NTESTS 0x20u
+#define TEST_IO_CLOSE_SRC 0x01U
+#define TEST_IO_DIFFERENT_FILE 0x02U
+#define TEST_IO_REOPEN_VIRT 0x04U
+#define TEST_IO_FCLOSE_SEMI 0x08U
+#define TEST_IO_FCLOSE_STRONG 0x10U
+#define TEST_IO_NTESTS 0x20U
#define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1)
diff --git a/test/vfd.c b/test/vfd.c
index af734d8..df348ba 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -340,7 +340,7 @@ test_core(void)
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
- /* Retrieve the access property list... */
+ /* Retrieve the access property list */
if ((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 94d09e6..c7d9138 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -211,7 +211,9 @@ struct datum data[NUM_DATA_ENTRIES];
#define STD_VIRT_NUM_DATA_ENTRIES NUM_DATA_ENTRIES
#define EXPRESS_VIRT_NUM_DATA_ENTRIES (NUM_DATA_ENTRIES / 10)
/* Use a smaller test size to avoid creating huge MPE logfiles. */
+#ifdef H5_HAVE_MPE
#define MPE_VIRT_NUM_DATA_ENTIES (NUM_DATA_ENTRIES / 100)
+#endif
int virt_num_data_entries = NUM_DATA_ENTRIES;
diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c
index fcbe83b..a27009d 100644
--- a/testpar/t_cache_image.c
+++ b/testpar/t_cache_image.c
@@ -3117,8 +3117,9 @@ verify_cache_image_RO(int file_name_id, int md_write_strat, int mpi_rank)
H5_FAILED();
- if (show_progress)
- HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", failure_mssg);
+ if (show_progress) {
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, failure_mssg);
+ }
}
}
@@ -3401,8 +3402,9 @@ verify_cache_image_RW(int file_name_id, int md_write_strat, int mpi_rank)
H5_FAILED();
- if (show_progress)
- HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", failure_mssg);
+ if (show_progress) {
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, failure_mssg);
+ }
}
}
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index 865e1f8..06f6f20 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -148,7 +148,7 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
/* verify file size */
filesize = get_filesize(filename);
- est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char);
+ est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char);
VRFY((filesize >= est_filesize), "file size check");
}
@@ -284,7 +284,7 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
/* verify file size */
filesize = get_filesize(filename);
- est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char);
+ est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char);
VRFY((filesize >= est_filesize), "file size check");
/* Can close some plists */
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index 5153bce..50cd306 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -1762,8 +1762,8 @@ test_write_3d_filtered_dataset_overlap(void)
WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS)) /
(hsize_t)(WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS))
- /* Add the amount that gets added when a rank moves down to its next section vertically in the
- dataset */
+ /* Add the amount that gets added when a rank moves down to its next
+ section vertically in the dataset */
+ ((hsize_t)(WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS) *
(i / (hsize_t)(mpi_size * WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH *
WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS))));
@@ -4497,8 +4497,8 @@ test_read_3d_filtered_dataset_overlap(void)
READ_SHARED_FILTERED_CHUNKS_3D_NCOLS)) /
(hsize_t)(READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS))
- /* Add the amount that gets added when a rank moves down to its next section vertically in the
- dataset */
+ /* Add the amount that gets added when a rank moves down to its next
+ section vertically in the dataset */
+ ((hsize_t)(READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS) *
(i / (hsize_t)(mpi_size * READ_SHARED_FILTERED_CHUNKS_3D_DEPTH *
READ_SHARED_FILTERED_CHUNKS_3D_NCOLS))));
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index a75ffe3..6dfa6f8 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -347,7 +347,7 @@ null_dataset(void)
hid_t iof, plist, dxpl, dataset, attr, sid;
unsigned uval = 2; /* Buffer for writing to dataset */
int val = 1; /* Buffer for writing to attribute */
- int nelem;
+ hssize_t nelem;
char dname[] = "dataset";
char attr_name[] = "attribute";
herr_t ret;
@@ -597,7 +597,7 @@ dataset_fillvalue(void)
/* Set the dataset dimension to be one row more than number of processes */
/* and calculate the actual dataset size. */
- dset_dims[0] = mpi_size + 1;
+ dset_dims[0] = (hsize_t)(mpi_size + 1);
dset_size = dset_dims[0] * dset_dims[1] * dset_dims[2] * dset_dims[3];
/* Allocate space for the buffers */
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index 16226ee..ab9ce26 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -446,11 +446,8 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker
VRFY((ret >= 0), "H5Dwrite() small_dataset initial write succeeded");
/* sync with the other processes before checking data */
- if (!use_collective_io) {
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc == MPI_SUCCESS), "Sync after small dataset writes");
- }
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after small dataset writes");
/* read the small data set back to verify that it contains the
* expected data. Note that each process reads in the entire
@@ -520,11 +517,8 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
/* sync with the other processes before checking data */
- if (!use_collective_io) {
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc == MPI_SUCCESS), "Sync after large dataset writes");
- }
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after large dataset writes");
/* read the large data set back to verify that it contains the
* expected data. Note that each process reads in the entire
@@ -552,12 +546,8 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker
VRFY((mis_match == FALSE), "large ds init data good.");
/* sync with the other processes before changing data */
-
- if (!use_collective_io) {
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc == MPI_SUCCESS), "Sync initial values check");
- }
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync initial values check");
return;