summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-20 22:22:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-20 22:22:40 (GMT)
commit0b00c26b027b2d2afd3112d24573ceb767fc8376 (patch)
tree6dfeabd5453da487c6e6473bd24c82895b4496b5 /test
parent2d7c01d1eb8254c3b5d4977428edcf1c2523bd5e (diff)
downloadhdf5-0b00c26b027b2d2afd3112d24573ceb767fc8376.zip
hdf5-0b00c26b027b2d2afd3112d24573ceb767fc8376.tar.gz
hdf5-0b00c26b027b2d2afd3112d24573ceb767fc8376.tar.bz2
[svn-r19274] Description:
Bring r19272 & 19273 from trunk to 1.8 branch: Close out various resource leaks and usages of uninitialized memory that were flagged by valgrind. [There's still some more valgrind warnings, but it's better now... :-/ ] Also clean up warnings and code formatting. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'test')
-rw-r--r--test/cmpd_dset.c64
-rw-r--r--test/dsets.c27
-rw-r--r--test/dt_arith.c415
-rw-r--r--test/dtypes.c4
-rw-r--r--test/fillval.c2
-rw-r--r--test/gheap.c69
-rw-r--r--test/hyperslab.c30
-rwxr-xr-xtest/objcopy.c33
-rw-r--r--test/pool.c4
-rw-r--r--test/stab.c2
-rw-r--r--test/tattr.c16
-rw-r--r--test/th5s.c4
-rw-r--r--test/tsohm.c198
13 files changed, 538 insertions, 330 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index d565e82..08890a8 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1811,18 +1811,18 @@ test_pack_ooo(void)
TESTING("random member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1837,18 +1837,18 @@ test_pack_ooo(void)
TESTING("random member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1864,18 +1864,18 @@ test_pack_ooo(void)
TESTING("reverse member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1890,18 +1890,18 @@ test_pack_ooo(void)
TESTING("reverse member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
@@ -1917,18 +1917,18 @@ test_pack_ooo(void)
TESTING("forward member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in forward order, with compound first */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1943,18 +1943,18 @@ test_pack_ooo(void)
TESTING("forward member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in forward order */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
@@ -2010,11 +2010,11 @@ test_ooo_order(char *filename)
TEST_ERROR
/* Create the compound */
- if((dtype = H5Tcreate(H5T_COMPOUND, 20)) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "A", 8, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "B", 12, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "C", 0, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "D", 16, H5T_STD_I32LE) < 0) TEST_ERROR
+ if((dtype = H5Tcreate(H5T_COMPOUND, (size_t)20)) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "A", (size_t)8, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "B", (size_t)12, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "C", (size_t)0, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "D", (size_t)16, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is not packed */
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
@@ -2065,7 +2065,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
/* Insert the last member */
- if(H5Tinsert(dtype, "E", 4, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "E", (size_t)4, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is packed */
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
@@ -2112,7 +2112,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Expand the type, and verify that it became unpacked */
- if(H5Tset_size(dtype, 21) < 0) TEST_ERROR
+ if(H5Tset_size(dtype, (size_t)21) < 0) TEST_ERROR
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
TEST_ERROR
if(dt->shared->u.compnd.packed) TEST_ERROR
@@ -2123,7 +2123,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Shrink the type, and verify that it became packed */
- if(H5Tset_size(dtype, 20) < 0) TEST_ERROR
+ if(H5Tset_size(dtype, (size_t)20) < 0) TEST_ERROR
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
TEST_ERROR
if(!dt->shared->u.compnd.packed) TEST_ERROR
diff --git a/test/dsets.c b/test/dsets.c
index 30291df..8eed894 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -67,21 +67,27 @@ const char *FILENAME[] = {
#define DSET_CONV_BUF_NAME "conv_buf"
#define DSET_TCONV_NAME "tconv"
#define DSET_DEFLATE_NAME "deflate"
+#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
+#endif /* H5_HAVE_FILTER_SZIP */
#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_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
+#if defined H5_HAVE_FILTER_SZIP && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
+#endif /* defined H5_HAVE_FILTER_SZIP && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 */
#define DSET_BOGUS_NAME "bogus"
#define DSET_MISSING_NAME "missing"
#define DSET_CAN_APPLY_NAME "can_apply"
#define DSET_CAN_APPLY_NAME2 "can_apply2"
+#ifdef H5_HAVE_FILTER_SZIP
#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DSET_SET_LOCAL_NAME "set_local"
#define DSET_SET_LOCAL_NAME_2 "set_local_2"
#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
@@ -1279,7 +1285,7 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
*/
static size_t
filter_bogus3(unsigned int UNUSED flags, size_t UNUSED cd_nelmts,
- const unsigned int UNUSED *cd_values, size_t nbytes,
+ const unsigned int UNUSED *cd_values, size_t UNUSED nbytes,
size_t UNUSED *buf_size, void UNUSED **buf)
{
return 0;
@@ -2380,7 +2386,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size=H5Dget_storage_size(dsid))==0) {
+ if(0 == (dset_size = H5Dget_storage_size(dsid))) {
H5_FAILED();
printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size);
goto error;
@@ -2388,7 +2394,7 @@ test_missing_filter(hid_t file)
/* Verify that the size indicates data is uncompressed */
/* (i.e. the deflation filter we asked for was silently ignored) */
- if((H5Tget_size(H5T_NATIVE_INT)*DSET_DIM1*DSET_DIM2)!=dset_size) {
+ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) {
H5_FAILED();
printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
goto error;
@@ -3763,6 +3769,7 @@ test_nbit_compound_3(hid_t file)
/* Initialize data */
for(i = 0; i < (size_t)size[0]; i++) {
+ HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -5839,7 +5846,7 @@ test_copy_dcpl(hid_t file, hid_t fapl)
* until the data is written to it. */
if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0) TEST_ERROR
if(H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0) TEST_ERROR
- if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, 0, 500*4096*sizeof(int)) < 0) TEST_ERROR
+ if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, (off_t)0, (hsize_t)(500 * 4096 * sizeof(int))) < 0) TEST_ERROR
/* Create second dataset of contiguous layout with external storage */
if((dsid2 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
@@ -5977,7 +5984,7 @@ test_filter_delete(hid_t file)
/* try to get the info for the deflate filter */
H5E_BEGIN_TRY {
- ret=H5Pget_filter_by_id2(dcpl1,H5Z_FILTER_DEFLATE,&flags,NULL,NULL,0,NULL,NULL);
+ ret = H5Pget_filter_by_id2(dcpl1, H5Z_FILTER_DEFLATE, &flags, NULL, NULL, (size_t)0, NULL, NULL);
} H5E_END_TRY;
if(ret >=0) {
H5_FAILED();
@@ -6437,7 +6444,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Write into dataset */
if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
@@ -6462,7 +6469,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -6527,7 +6534,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Write into dataset */
if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
@@ -6552,7 +6559,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -6958,7 +6965,7 @@ test_chunk_cache(hid_t fapl)
FAIL_PUTS_ERROR(" Cache values from default dapl do not match those from fapl.")
/* Set a lapl property on dapl1 (to verify inheritance) */
- if (H5Pset_nlinks(dapl1, 134) < 0) FAIL_STACK_ERROR
+ if (H5Pset_nlinks(dapl1, (size_t)134) < 0) FAIL_STACK_ERROR
if (H5Pget_nlinks(dapl1, &nlinks) < 0) FAIL_STACK_ERROR
if (nlinks != 134)
FAIL_PUTS_ERROR(" nlinks parameter not set properly on dapl.")
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 2e23f25..5357f52 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -290,8 +290,8 @@ static int without_hardware_g = 0;
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
\
- tmp1 = (unsigned char*)calloc(1, SRC_SIZE); \
- tmp2 = (unsigned char*)calloc(1, SRC_SIZE); \
+ tmp1 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp2 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
\
buf_p = BUF; \
saved_p = SAVED; \
@@ -300,9 +300,9 @@ static int without_hardware_g = 0;
*00000111,..., until 11111111.*/ \
memset(tmp1, 0, SRC_SIZE); \
memset(tmp2, 0, SRC_SIZE); \
- H5T_bit_set (tmp2, SRC_PREC-1, 1, TRUE); /*the negative value*/ \
+ H5T_bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \
for(n=0; n<SRC_MANT_DIG-1; n++) { \
- H5T_bit_set (tmp1, n, 1, TRUE); /*turn on 1 bit each time*/ \
+ H5T_bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
memcpy(buf_p, tmp1, SRC_SIZE); \
memcpy(saved_p, tmp1, SRC_SIZE); \
@@ -311,7 +311,7 @@ static int without_hardware_g = 0;
saved_p += SRC_SIZE; \
\
/*negative values*/ \
- H5T_bit_set (tmp2, n, 1, TRUE); \
+ H5T_bit_set (tmp2, n, (size_t)1, TRUE); \
CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
memcpy(buf_p, tmp2, SRC_SIZE); \
memcpy(saved_p, tmp2, SRC_SIZE); \
@@ -347,7 +347,7 @@ static int without_hardware_g = 0;
buf_p = BUF; \
\
/* +0 */ \
- H5T_bit_set(value, 0, SRC_PREC, FALSE); \
+ H5T_bit_set(value, (size_t)0, SRC_PREC, FALSE); \
memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
buf_p += SRC_SIZE; \
\
@@ -355,36 +355,36 @@ static int without_hardware_g = 0;
if(n==1) { \
memset(value, 0, SRC_SIZE*sizeof(unsigned char)); \
/* -0 */ \
- H5T_bit_set(value, SRC_PREC-1, 1, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
/* +/-infinity */ \
- H5T_bit_set(value, SRC_MANT_DIG-1, SRC_PREC-SRC_MANT_DIG, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-SNaN */ \
- H5T_bit_set(value, 0, 1, TRUE); \
+ H5T_bit_set(value, (size_t)0, (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-QNaN */ \
- H5T_bit_set(value, SRC_MANT_DIG-2, 1, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
- memcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
free(value); \
}
@@ -565,7 +565,7 @@ generates_sigfpe(void)
HDfflush(stdout);
HDfflush(stderr);
- if ((pid=fork())<0) {
+ if ((pid=fork()) < 0) {
HDperror("fork");
HDexit(1);
} else if (0==pid) {
@@ -735,7 +735,7 @@ static int test_particular_fp_integer(void)
TESTING("hard particular floating number -> integer conversions");
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
@@ -745,22 +745,22 @@ static int test_particular_fp_integer(void)
endian = H5Tget_order(H5T_NATIVE_DOUBLE);
src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE);
dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR);
- buf1 = (unsigned char*)calloc(1, MAX(src_size1, dst_size1));
- saved_buf1 = (unsigned char*)calloc(1, MAX(src_size1, dst_size1));
+ buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ saved_buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
memcpy(buf1, &src_d, src_size1);
memcpy(saved_buf1, &src_d, src_size1);
/* Register exception handling function and signal the destination is "signed char". */
flag = 1;
- if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag)<0) {
+ if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
H5_FAILED();
printf("Can't register conversion callback\n");
goto error;
}
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, 1, buf1, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -795,16 +795,16 @@ static int test_particular_fp_integer(void)
/* Test conversion from float (the value is INT_MAX) to int. */
src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
dst_size2 = H5Tget_size(H5T_NATIVE_INT);
- buf2 = (unsigned char*)calloc(1, MAX(src_size2, dst_size2));
- saved_buf2 = (unsigned char*)calloc(1, MAX(src_size2, dst_size2));
- memcpy(buf2, &src_f, src_size2);
- memcpy(saved_buf2, &src_f, src_size2);
+ buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ saved_buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ HDmemcpy(buf2, &src_f, src_size2);
+ HDmemcpy(saved_buf2, &src_f, src_size2);
/* signal exception handling function that the destination is "int". */
flag = 0;
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, 1, buf2, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -839,7 +839,7 @@ static int test_particular_fp_integer(void)
if(fails_this_test)
goto error;
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
@@ -913,25 +913,25 @@ test_derived_flt(void)
/* Create File */
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) {
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_IEEE_F64LE))<0) {
+ if((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_IEEE_F32LE))<0) {
+ if((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
@@ -955,28 +955,28 @@ test_derived_flt(void)
* holes among the significant bits. Exponent bias usually is set
* 2^(n-1)-1, where n is the exponent size.
*-----------------------------------------------------------------------*/
- if(H5Tset_fields(tid1, 44, 34, 10, 3, 31)<0) {
+ if(H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
H5_FAILED();
printf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid1, 3)<0) {
+ if(H5Tset_offset(tid1, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid1, 42)<0) {
+ if(H5Tset_precision(tid1, (size_t)42) < 0) {
H5_FAILED();
printf("Can't set precision 1\n");
goto error;
}
- if(H5Tset_size(tid1, 7)<0) {
+ if(H5Tset_size(tid1, (size_t)7) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid1, 511) < 0) {
+ if(H5Tset_ebias(tid1, (size_t)511) < 0) {
H5_FAILED();
printf("Can't set exponent bias\n");
goto error;
@@ -1038,24 +1038,24 @@ test_derived_flt(void)
*/
src_size = H5Tget_size(H5T_NATIVE_INT);
endian = H5Tget_order(H5T_NATIVE_INT);
- buf = (unsigned char*)malloc(nelmts*(MAX(src_size, size)));
- saved_buf = (unsigned char*)malloc(nelmts*src_size);
- HDmemset(buf, 0, nelmts*MAX(src_size, size));
- HDmemset(saved_buf, 0, nelmts*src_size);
- aligned = (int*)calloc(1, src_size);
+ buf = (unsigned char*)malloc(nelmts * (MAX(src_size, size)));
+ saved_buf = (unsigned char*)malloc(nelmts * src_size);
+ HDmemset(buf, 0, nelmts * MAX(src_size, size));
+ HDmemset(saved_buf, 0, nelmts * src_size);
+ aligned = (int*)calloc((size_t)1, src_size);
- for(i=0; i<nelmts*src_size; i++)
+ for(i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = HDrand();
/* Convert data from native integer to derived floating-point type.
* The mantissa is big enough to retain the integer's precision. */
- if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the derived floating-point type back to native integer. */
- if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1115,27 +1115,27 @@ test_derived_flt(void)
* 2 1 0
* SEEEEEEE MMMMMMMM MMMMMMMM
*--------------------------------------------------------------------------*/
- if(H5Tset_fields(tid2, 23, 16, 7, 0, 16)<0) {
+ if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
H5_FAILED();
printf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid2, 0)<0) {
+ if(H5Tset_offset(tid2, (size_t)0) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid2, 24)<0) {
+ if(H5Tset_precision(tid2, (size_t)24) < 0) {
H5_FAILED();
printf("Can't set precision 2\n");
goto error;
}
- if(H5Tset_size(tid2, 3)<0) {
+ if(H5Tset_size(tid2, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid2, 63) < 0) {
+ if(H5Tset_ebias(tid2, (size_t)63) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
@@ -1209,13 +1209,13 @@ test_derived_flt(void)
/* Convert data from the 2nd to the 1st derived floating-point type.
* The mantissa and exponent of the 2nd type are big enough to retain
* the precision and exponent power. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the 1st back to the 2nd derived floating-point type. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1265,25 +1265,25 @@ test_derived_flt(void)
if (buf) free(buf);
if (saved_buf) free(saved_buf);
- if(H5Tclose(tid1)<0) {
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2)<0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file)<0) {
+ if(H5Fclose(file) < 0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
@@ -1345,25 +1345,25 @@ test_derived_integer(void)
/* Create File */
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) {
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_STD_I32LE))<0) {
+ if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_STD_U64LE))<0) {
+ if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
@@ -1381,19 +1381,19 @@ test_derived_integer(void)
* of a new integer type, H5Tset_precision, H5Tset_offset, H5Tset_size,
* H5Tset_order, H5Tset_pad, H5Tset_sign.
*--------------------------------------------------------------------------*/
- if(H5Tset_offset(tid1,0)<0) {
+ if(H5Tset_offset(tid1, (size_t)0) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_size(tid1, 3)<0) {
+ if(H5Tset_size(tid1, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_precision(tid1, 24) < 0) {
+ if(H5Tset_precision(tid1, (size_t)24) < 0) {
H5_FAILED();
printf("Can't set precision\n");
goto error;
@@ -1448,13 +1448,13 @@ test_derived_integer(void)
* 7 6 5 4 3 2 1 0
* ??????SI IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIII?? ????????
*--------------------------------------------------------------------------*/
- if(H5Tset_precision(tid2,48)<0) {
+ if(H5Tset_precision(tid2, (size_t)48) < 0) {
H5_FAILED();
printf("Can't set precision\n");
goto error;
}
- if(H5Tset_offset(tid2, 10) < 0) {
+ if(H5Tset_offset(tid2, (size_t)10) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
@@ -1519,13 +1519,13 @@ test_derived_integer(void)
/* Convert data from the 1st to the 2nd derived integer type.
* The precision of the 2nd type are big enough to retain
* the 1st type's precision. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the 2nd back to the 1st derived integer type. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1564,30 +1564,33 @@ test_derived_integer(void)
}
}
- if(H5Tclose(tid1)<0) {
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2)<0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file)<0) {
+ if(H5Fclose(file) < 0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
} /* end if */
+ free(buf);
+ free(saved_buf);
+
PASSED();
reset_hdf5(); /*print statistics*/
@@ -1761,7 +1764,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
src_sign = H5Tget_sign(src);
dst_sign = H5Tget_sign(dst);
- aligned = HDcalloc(1, sizeof(long long));
+ aligned = HDcalloc((size_t)1, sizeof(long long));
/* Allocate and initialize the source buffer through macro INIT_INTEGER. The BUF
* will be used for the conversion while the SAVED buffer will be
@@ -1791,7 +1794,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
goto error;
/* Perform the conversion */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
/* Check the results from the library against hardware */
@@ -1839,6 +1842,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_char = (signed char)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1885,6 +1892,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_uchar = (unsigned char)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1932,6 +1943,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_short = (short)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1978,6 +1993,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ushort = (unsigned short)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2024,6 +2043,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_int = (int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2070,6 +2093,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_uint = (unsigned int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2116,6 +2143,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_long = (long int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2162,6 +2193,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ulong = (unsigned long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2208,6 +2243,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_llong = (long long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2254,6 +2293,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ullong = (unsigned long long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2288,7 +2331,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
*/
if (H5T_SGN_2==src_sign && H5T_SGN_2==dst_sign) {
if (src_nbits>dst_nbits) {
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
H5T_BIT_MSB, 1)>=0) {
/*
@@ -2296,49 +2339,49 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination. The destination should be set to the
* maximum possible value: 0x7f...f
*/
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
- } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
- H5T_bit_find(src_bits, 0, src_nbits-1, H5T_BIT_MSB,
+ } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(src_bits, (size_t)0, src_nbits-1, H5T_BIT_MSB,
0)+1>=(ssize_t)dst_nbits) {
/*
* Source is negative but the magnitude is too large for
* the destination. The destination should be set to the
* smallest possible value: 0x80...0
*/
- if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 1)<0)
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
}
} else if(src_nbits<dst_nbits) {
/* Source is smaller than the destination */
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* Source is positive, so the excess bits in the
* destination should be set to 0's.
*/
- if (0==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
- H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1)<0)
+ if (0==H5T_bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
/*
* Source is negative, so the excess bits in the
* destination should be set to 1's.
*/
- if (1==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
- H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0)<0)
+ if (1==H5T_bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
} else if (H5T_SGN_2==src_sign && H5T_SGN_NONE==dst_sign) {
- if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else if (src_nbits>dst_nbits &&
H5T_bit_find(src_bits, dst_nbits-1,
@@ -2348,7 +2391,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination. The destination should be the
* largest possible value: 0xff...f
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
} else if (H5T_SGN_NONE==src_sign && H5T_SGN_2==dst_sign) {
@@ -2360,8 +2403,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination can handle. The destination should be
* set to the largest possible positive value: 0x7f...f
*/
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
} else {
@@ -2373,7 +2416,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the unsigned destination. The destination should be
* set to the largest possible value: 0xff...f
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
@@ -2428,6 +2471,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2477,6 +2524,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(unsigned long long));
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2516,6 +2567,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULLONG:
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2589,7 +2644,7 @@ test_conv_int_2(void)
* Conversion. If overlap calculations aren't right then an
* assertion will fail in H5T_conv_i_i()
*/
- H5Tconvert(src_type, dst_type, 100, buf, NULL, H5P_DEFAULT);
+ H5Tconvert(src_type, dst_type, (size_t)100, buf, NULL, H5P_DEFAULT);
H5Tclose(src_type);
H5Tclose(dst_type);
}
@@ -2707,7 +2762,7 @@ my_isinf(int endian, unsigned char *val, size_t size,
int retval = 0;
size_t i;
- bits = (unsigned char*)calloc(1, size);
+ bits = (unsigned char*)calloc((size_t)1, size);
#ifdef H5_VMS
if(H5T_ORDER_VAX==endian) {
@@ -2812,7 +2867,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
*/
HDfflush(stdout);
HDfflush(stderr);
- if ((child_pid=fork())<0) {
+ if ((child_pid=fork()) < 0) {
HDperror("fork");
return 1;
} else if (child_pid>0) {
@@ -2925,7 +2980,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
dendian = H5Tget_order(dst);
/* Allocate buffers */
- aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(double)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(double)));
/* Allocate and initialize the source buffer through macro INIT_FP_NORM or INIT_FP_SPECIAL.
* The BUF will be used for the conversion while the SAVED buffer will be used for
@@ -3017,7 +3072,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
}
/* Perform the conversion in software */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
/* Check the software results against the hardware */
@@ -3647,7 +3702,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
- aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(long long)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(long long)));
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
@@ -3664,19 +3719,19 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* conversion exception happens. We only test (unsigned) int - float
* and float - (unsigned) int conversions, which should cover more cases.
*/
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
if((src_type == INT_INT && dst_type == FLT_FLOAT) ||
(src_type == INT_UINT && dst_type == FLT_FLOAT) ||
(src_type == FLT_FLOAT && dst_type == INT_UINT) ||
(src_type == FLT_FLOAT && dst_type == INT_INT)) {
- if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value)<0)
+ if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value) < 0)
goto error;
else
except_set = TRUE;
- if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data)<0)
+ if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data) < 0)
goto error;
if(op != except_func || *(int*)user_data != fill_value)
@@ -3743,7 +3798,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
goto error;
/* Perform the conversion */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id)<0)
+ if(H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id) < 0)
goto error;
/* Check the results from the library against hardware */
@@ -3801,6 +3856,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_float = (float)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3849,6 +3908,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_double = (double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3898,6 +3961,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ldouble = (long double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3919,6 +3986,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_schar = (signed char)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3939,6 +4017,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_uchar = (unsigned char)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3959,6 +4048,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_short = (short)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3979,6 +4079,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ushort = (unsigned short)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3999,6 +4110,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_int = (int)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4019,6 +4141,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_uint = (unsigned int)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4039,6 +4172,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_long = (long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4059,6 +4203,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ulong = (unsigned long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4079,6 +4234,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_llong = (long long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4099,6 +4265,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ullong = (unsigned long long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4165,7 +4342,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
)
&& (INT_SCHAR==dst_type || INT_SHORT==dst_type || INT_INT==dst_type
|| INT_LONG==dst_type || INT_LLONG==dst_type)) {
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is positive and the magnitude is too large for
@@ -4173,15 +4350,15 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* maximum possible value: 0x7f...f
*/
if(!except_set) {
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
} else {
/* fill_value is small so we know only the 1st byte is set */
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
- } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is negative but the magnitude is too large for
@@ -4189,8 +4366,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* smallest possible value: 0x80...0
*/
if(!except_set) {
- if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 1)<0)
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4206,14 +4383,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
)
&& (INT_UCHAR==dst_type || INT_USHORT==dst_type || INT_UINT==dst_type
|| INT_ULONG==dst_type || INT_ULLONG==dst_type)) {
- if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
if(!except_set) {
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4226,7 +4403,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* largest possible value: 0xff...f
*/
if(!except_set) {
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4558,8 +4735,8 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
ssize_t indx;
unsigned char bits[32], mant_bits[32];
- HDmemset(bits, 0, 32);
- HDmemset(mant_bits, 0, 32);
+ HDmemset(bits, 0, (size_t)32);
+ HDmemset(mant_bits, 0, (size_t)32);
/*
* Sometimes, type size isn't equal to the precision like Linux's "long
@@ -4574,14 +4751,14 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
HDmemcpy(bits, origin_bits, src_prec/8+1);
/*Check for special cases: +Inf, -Inf*/
- if (H5T_bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE)<0) {
- if (H5T_bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE)<0) {
+ if (H5T_bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE) < 0) {
+ if (H5T_bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE) < 0) {
ret_value=TRUE;
goto done;
}
} else if (H5T_NORM_NONE==norm && H5T_bit_find (bits, mpos, mant_digits-1,
- H5T_BIT_LSB, TRUE)<0 && H5T_bit_find (bits, epos, expt_digits,
- H5T_BIT_LSB, FALSE)<0) {
+ H5T_BIT_LSB, TRUE) < 0 && H5T_bit_find (bits, epos, expt_digits,
+ H5T_BIT_LSB, FALSE) < 0) {
/*This is a special case for the source of no implied mantissa bit.
*If the exponent bits are all 1s and only the 1st bit of mantissa
*is set to 1. It's infinity. The Intel-Linux "long double" is this case.*/
@@ -4598,19 +4775,19 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
}
/* get significand */
- H5T_bit_copy (mant_bits, 0, bits, 0, mant_digits);
+ H5T_bit_copy (mant_bits, (size_t)0, bits, (size_t)0, mant_digits);
/* restore implicit bit if normalization is implied*/
if(norm == H5T_NORM_IMPLIED) {
- H5T_bit_inc(mant_bits, mant_digits, 1);
+ H5T_bit_inc(mant_bits, mant_digits, (size_t)1);
mant_digits++;
}
/* shift significand */
- H5T_bit_shift (mant_bits, (ssize_t)(expt-expt_digits), 0, 32*8);
+ H5T_bit_shift (mant_bits, (ssize_t)(expt-expt_digits), (size_t)0, (size_t)(32 * 8));
- indx = H5T_bit_find(mant_bits, 0, 32*8, H5T_BIT_MSB, 1);
+ indx = H5T_bit_find(mant_bits, (size_t)0, (size_t)(32 * 8), H5T_BIT_MSB, 1);
if((size_t)indx>=dst_num_bits)
ret_value=TRUE;
diff --git a/test/dtypes.c b/test/dtypes.c
index 088030c..bb6f5e4 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -2322,6 +2322,7 @@ test_compound_13(void)
TESTING("compound datatypes of boundary size with latest format");
/* Create some phony data. */
+ HDmemset(&data_out, 0, sizeof(data_out));
for(u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
data_out.x[u] = u;
data_out.y = 99.99;
@@ -5302,7 +5303,7 @@ test_encode(void)
goto error;
} /* end if */
- if(vlstr_buf_size>0)
+ if(vlstr_buf_size > 0)
vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
@@ -5317,6 +5318,7 @@ test_encode(void)
printf("Can't decode VL string type\n");
goto error;
} /* end if */
+ free(vlstr_buf);
/* Verify that the datatype was copied exactly */
if(H5Tequal(decoded_tid3, tid3)<=0) {
diff --git a/test/fillval.c b/test/fillval.c
index 8584816..697fe5f 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1142,6 +1142,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
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,
@@ -1194,6 +1195,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
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,
diff --git a/test/gheap.c b/test/gheap.c
index b2c9090..2829e34 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -75,24 +75,24 @@ const char *FILENAME[] = {
static int
test_1 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically increasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -103,16 +103,16 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
- if (status<0) {
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + i);
+ if(status < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
- } else if (i && H5F_addr_gt (obj[i-1].addr, obj[i].addr)) {
+ } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
H5_FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -122,27 +122,28 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
- } else if (memcmp (in, out, size)) {
+ } else if(HDmemcmp(in, out, size)) {
H5_FAILED();
puts(" Value read doesn't match value written");
nerrors++;
}
}
- if (H5Fclose(file)<0) goto error;
- if (nerrors) goto error;
+ if(H5Fclose(file) < 0) goto error;
+ if(nerrors) goto error;
+
PASSED();
return 0;
- error:
+error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
@@ -170,23 +171,23 @@ test_1 (hid_t fapl)
static int
test_2 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically decreasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -257,23 +258,23 @@ test_2 (hid_t fapl)
static int
test_3 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("complete object removal");
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -336,23 +337,23 @@ test_3 (hid_t fapl)
static int
test_4 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("partial object removal");
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
diff --git a/test/hyperslab.c b/test/hyperslab.c
index e216b95..fdeaffd 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -125,7 +125,7 @@ print_ref(size_t nx, size_t ny, size_t nz)
{
uint8_t *array;
- if(NULL != (array = HDmalloc(nx * ny * nz))) {
+ if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) {
printf("Reference array:\n");
init_full(array, nx, ny, nz);
print_array(array, nx, ny, nz);
@@ -190,7 +190,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
fflush(stdout);
/* Allocate array */
- if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(dst, nx, ny, nz);
@@ -387,9 +387,9 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- if(NULL == (src = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
- if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(src, nx, ny, nz);
@@ -602,9 +602,9 @@ test_multifill(size_t nx)
fflush(stdout);
/* Initialize the source and destination */
- if(NULL == (src = HDmalloc(nx * sizeof(*src))))
+ if(NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = HDmalloc(nx * sizeof(*dst))))
+ if(NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst))))
TEST_ERROR
for(i = 0; i < nx; i++) {
@@ -717,9 +717,9 @@ test_endian(size_t nx)
fflush(stdout);
/* Initialize arrays */
- if(NULL == (src = HDmalloc(nx * 4)))
+ if(NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
TEST_ERROR
- if(NULL == (dst = HDcalloc(nx , (size_t)4)))
+ if(NULL == (dst = (uint8_t *)HDcalloc(nx , (size_t)4)))
TEST_ERROR
init_full(src, nx, (size_t)4,(size_t)1);
@@ -805,9 +805,9 @@ test_transpose(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- if(NULL == (src = HDmalloc(nx * ny * sizeof(*src))))
+ if(NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = HDcalloc(nx * ny, sizeof(*dst))))
+ if(NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst))))
TEST_ERROR
for(i = 0; i < nx; i++)
@@ -911,11 +911,11 @@ test_sub_super(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- if(NULL == (full = HDmalloc(4 * nx * ny)))
+ if(NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
TEST_ERROR
- if(NULL == (half = HDcalloc((size_t)1, nx * ny)))
+ if(NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny)))
TEST_ERROR
- if(NULL == (twice = HDcalloc((size_t)4, nx * ny)))
+ if(NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny)))
TEST_ERROR
init_full(full, 2 * nx, 2 * ny, (size_t)1);
@@ -1063,7 +1063,7 @@ test_array_fill(size_t lo, size_t hi)
TESTING(s);
/* Initialize */
- if(NULL == (dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
+ if(NULL == (dst = (int *)HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
TEST_ERROR
/* Setup */
@@ -1128,7 +1128,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
TESTING(s);
/* Initialize */
- if(NULL == (a = HDmalloc(sizeof(hsize_t) * x * y *z)))
+ if(NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y *z)))
TEST_ERROR
dims[0] = z;
diff --git a/test/objcopy.c b/test/objcopy.c
index 7f971b4..f4fee13 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -803,7 +803,7 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
/* Check the attributes are equal */
for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Aget_name(aid, ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
+ if(H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -988,8 +988,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
}
/* Check for types of objects handled */
- switch(obj1_type)
- {
+ switch(obj1_type) {
case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
@@ -1002,6 +1001,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
TEST_ERROR
} /* end switch */
@@ -1045,8 +1046,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
}
/* Check for types of objects handled */
- switch(obj1_type)
- {
+ switch(obj1_type) {
case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
@@ -1059,6 +1059,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
TEST_ERROR
} /* end switch */
@@ -1188,8 +1190,8 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Ensure that all external file information is the same */
for(x=0; x < (unsigned) ext_count; ++x)
{
- if(H5Pget_external(dcpl, x, NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR
- if(H5Pget_external(dcpl2, x, NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR
+ if(H5Pget_external(dcpl, x, (size_t)NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR
+ if(H5Pget_external(dcpl2, x, (size_t)NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR
if(offset1 != offset2) TEST_ERROR
if(size1 != size2) TEST_ERROR
@@ -1413,6 +1415,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
HDassert(0 && "Unknown type of object");
break;
@@ -2112,10 +2116,13 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
TESTING("H5Ocopy(): compound dataset");
- for (i=0; i<DIM_SIZE_1; i++) {
+#ifdef H5_CLEAR_MEMORY
+ HDmemset(buf, 0, sizeof(buf));
+#endif /* H5_CLEAR_MEMORY */
+ for(i = 0; i < DIM_SIZE_1; i++) {
buf[i].a = i;
- buf[i].d = 1./(i+1);
- }
+ buf[i].d = 1. / (i + 1);
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
@@ -2134,7 +2141,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if((tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
if(H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
if(H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
@@ -8287,7 +8294,7 @@ main(void)
/* Create an FCPL with sharing enabled */
if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, (size_t) 10) < 0) TEST_ERROR
+ if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0) TEST_ERROR
/* Obtain the default attribute storage phase change values */
if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) TEST_ERROR
@@ -8422,7 +8429,7 @@ main(void)
nerrors += test_copy_same_file_named_datatype(fcpl_src, my_fapl);
nerrors += test_copy_old_layout(fcpl_dst, my_fapl);
nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, my_fapl);
- }
+ }
/* TODO: not implemented
nerrors += test_copy_mount(my_fapl);
diff --git a/test/pool.c b/test/pool.c
index 9b2e8b9..916d45e 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -649,11 +649,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TEST_ERROR
/* Allocate space for the block sizes */
- if(NULL == (blk_size = HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
+ if(NULL == (blk_size = (size_t *)HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Allocate space for the block pointers */
- if(NULL == (spc = HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
+ if(NULL == (spc = (void **)HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Initialize the block sizes with random values */
diff --git a/test/stab.c b/test/stab.c
index cab0b1b..e8ffec3 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -53,7 +53,6 @@ const char *FILENAME[] = {
/* Definitions for 'read_old' test */
#define READ_OLD_NGROUPS 100
-#define READ_OLD_BUFSIZE 1024
/* The group_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
* for version 1.6. To get this data file, simply compile gen_old_group.c with
@@ -79,7 +78,6 @@ const char *FILENAME[] = {
/* Definitions for 'corrupt_stab_msg' test */
#define CORRUPT_STAB_FILE "corrupt_stab_msg.h5"
#define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5"
-#define CORRUPT_STAB_COPY_BUF_SIZE 4096
#define CORRUPT_STAB_DSET "DS1"
diff --git a/test/tattr.c b/test/tattr.c
index bec6743..baf30cc 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -9802,6 +9802,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
dims2[2] = {3, 3}; /* Dimensions */
int wdata1[2][2];
unsigned wdata2[3][3]; /* Write buffers */
+ unsigned u, v; /* Local index variables */
herr_t ret; /* Generic return status */
/* Output message about test being performed */
@@ -9849,11 +9850,18 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
aid2 = H5Aopen(did, "attr", H5P_DEFAULT);
CHECK(aid2, FAIL, "H5Aopen");
- /* Write data to the attributes (the data is uninitialized, we only care
- * that H5Awrite succeeds for now) */
- ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1[0]);
+ /* Initialize the write buffers */
+ for(u = 0; u < dims1[0]; u++)
+ for(v = 0; v < dims1[1]; v++)
+ wdata1[u][v] = (int)((u * dims1[1]) + v);
+ for(u = 0; u < dims2[0]; u++)
+ for(v = 0; v < dims2[1]; v++)
+ wdata2[u][v] = (int)((u * dims2[1]) + v);
+
+ /* Write data to the attributes */
+ ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1);
CHECK(ret, FAIL, "H5Awrite");
- ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2[0]);
+ ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2);
CHECK(ret, FAIL, "H5Awrite");
/* Close attributes */
diff --git a/test/th5s.c b/test/th5s.c
index a57cd80..5ff811b 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -894,6 +894,10 @@ test_h5s_compound_scalar_write(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
+ /* Close compound datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
/* Close scalar dataspace */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
diff --git a/test/tsohm.c b/test/tsohm.c
index 8782a6d..62154b1 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -74,6 +74,7 @@ typedef struct dtype1_struct {
int i8;
float f1;
} dtype1_struct;
+
#define DTYPE2_SIZE 1024
const char *DSETNAME[] = {
"dataset0", "dataset1",
@@ -167,7 +168,9 @@ static hid_t make_dtype_1(void);
static hid_t make_dtype_2(void);
static hid_t close_reopen_file(hid_t file, const char* filename, hid_t fapl_id);
static void test_sohm_attrs(void);
+#ifdef NOT_NOW
static void size2_dump_struct(const char *name, size2_helper_struct *sizes);
+#endif /* NOT_NOW */
static void size2_verify(void);
static void test_sohm_delete(void);
static void test_sohm_delete_revert(void);
@@ -280,11 +283,10 @@ static void test_sohm_fcpl(void)
/* Set up index values */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=0; x<TEST_NUM_INDEXES; ++x)
- {
+ for(x = 0; x < TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- }
+ } /* end for */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -419,8 +421,6 @@ static void test_sohm_fcpl(void)
* Programmer: James Laird
* Saturday, August 26, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -429,23 +429,23 @@ make_dtype_1(void)
hid_t dtype1_id = -1;
hid_t str_id = -1;
- /* Create compound datatype. */
- if((dtype1_id = H5Tcreate( H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
+ /* Create compound datatype. */
+ if((dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i1",HOFFSET(struct dtype1_struct,i1),H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i1", HOFFSET(dtype1_struct, i1), H5T_NATIVE_INT) < 0) TEST_ERROR
str_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_id,(size_t) 10) < 0) TEST_ERROR
-
- if(H5Tinsert(dtype1_id,"vl_string",HOFFSET(dtype1_struct,str),str_id) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i2",HOFFSET(struct dtype1_struct,i2),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i3",HOFFSET(struct dtype1_struct,i3),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i4",HOFFSET(struct dtype1_struct,i4),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i5",HOFFSET(struct dtype1_struct,i5),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i6",HOFFSET(struct dtype1_struct,i6),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i7",HOFFSET(struct dtype1_struct,i7),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i8",HOFFSET(struct dtype1_struct,i8),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"f1",HOFFSET(struct dtype1_struct,f1),H5T_NATIVE_FLOAT) < 0) TEST_ERROR
+ if(H5Tset_size(str_id, (size_t)10) < 0) TEST_ERROR
+
+ if(H5Tinsert(dtype1_id, "string", HOFFSET(dtype1_struct, str), str_id) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i2", HOFFSET(dtype1_struct, i2), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i3", HOFFSET(dtype1_struct, i3), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i4", HOFFSET(dtype1_struct, i4), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i5", HOFFSET(dtype1_struct, i5), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i6", HOFFSET(dtype1_struct, i6), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i7", HOFFSET(dtype1_struct, i7), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i8", HOFFSET(dtype1_struct, i8), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "f1", HOFFSET(dtype1_struct, f1), H5T_NATIVE_FLOAT) < 0) TEST_ERROR
if(H5Tclose(str_id) < 0) TEST_ERROR
@@ -488,15 +488,13 @@ make_dtype_2(void)
/* Create an int with a strange precision */
if((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tset_precision(int_id, 24) < 0) TEST_ERROR
+ if(H5Tset_precision(int_id, (size_t)24) < 0) TEST_ERROR
/* Create an enumeration using that int */
if((enum_id = H5Tenum_create(int_id)) < 0) TEST_ERROR
- for(x=0; x<ENUM_NUM_MEMBS; x++)
- {
+ for(x = 0; x < ENUM_NUM_MEMBS; x++)
if(H5Tenum_insert(enum_id, ENUM_NAME[x], &ENUM_VAL[x]) < 0) TEST_ERROR
- }
/* Create arrays of arrays of arrays of enums */
if((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0) TEST_ERROR
@@ -572,14 +570,12 @@ error:
* Programmer: James Laird
* Monday, April 10, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_closing)
{
- dtype1_struct wdata = {11, "string", 22, 33, 44, 55, 66, 77, 88, 0.0};
+ dtype1_struct wdata;
dtype1_struct rdata;
hid_t dtype1_id = -1;
hid_t space_id = -1;
@@ -593,23 +589,36 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if(GetTestExpress() > 1)
test_file_closing = 0;
+ /* Intialize wdata */
+ HDmemset(&wdata, 0, sizeof(wdata));
+ wdata.i1 = 11;
+ HDstrcpy(wdata.str, "string");
+ wdata.i2 = 22;
+ wdata.i3 = 33;
+ wdata.i4 = 44;
+ wdata.i5 = 55;
+ wdata.i6 = 66;
+ wdata.i7 = 77;
+ wdata.i8 = 88;
+ wdata.f1 = 0.0;
+
/* Intialize rdata */
- strcpy(rdata.str, "\0");
+ HDmemset(&rdata, 0, sizeof(rdata));
if((dtype1_id = make_dtype_1()) < 0) TEST_ERROR
/* Create the dataspace and dataset */
dim1[0] = 1;
- if((space_id=H5Screate_simple(1,dim1,NULL)) < 0) TEST_ERROR
+ if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) TEST_ERROR
- if((dset_id = H5Dcreate2(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Test writing and reading */
- if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) FAIL_STACK_ERROR
+ if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR
- if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) FAIL_STACK_ERROR
+ if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) FAIL_STACK_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)) {
H5_FAILED(); AT();
printf("incorrect read data\n");
goto error;
@@ -617,26 +626,23 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
/* Create more datasets with the same datatype */
- if((dset_id = H5Dcreate2(file,DSETNAME[1],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[1], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
- if((dset_id = H5Dcreate2(file,DSETNAME[2],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[2], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
if((dset_id = H5Dcreate2(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -654,10 +660,8 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if((dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT)) < 0) TEST_ERROR
if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
- rdata.i1 = rdata.i2 = 0;
- HDstrcpy(rdata.str, "\0");
-
/* Read data back again */
+ HDmemset(&rdata, 0, sizeof(rdata));
if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
printf("Can't read data\n");
@@ -689,9 +693,8 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if((dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT)) < 0) TEST_ERROR
if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
- rdata.i1 = rdata.i2 = 0;
-
/* Read data back again */
+ HDmemset(&rdata, 0, sizeof(rdata));
if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
printf("Can't read data\n");
@@ -1016,12 +1019,11 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1055,12 +1057,11 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1092,13 +1093,12 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify the data with another ID handle */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id2, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1249,23 +1249,23 @@ static void size2_verify_plist1(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_FLETCHER32, "H5Pget_filter2");
@@ -1273,7 +1273,7 @@ static void size2_verify_plist1(hid_t plist)
/* Check fill value */
dtype1_id=make_dtype_1();
CHECK_I(dtype1_id, "make_dtype_1");
- memset(&fill1_correct, '1', sizeof(fill1_correct));
+ HDmemset(&fill1_correct, '1', sizeof(fill1_correct));
ret = H5Pget_fill_value(plist, dtype1_id, &fill1);
CHECK_I(ret, "H5Pget_fill_value");
@@ -1308,48 +1308,49 @@ static void size2_verify_plist2(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 5, "H5Pget_filter2");
/* Check fill value */
- dtype2_id=make_dtype_2();
+ dtype2_id = make_dtype_2();
CHECK_I(dtype2_id, "make_dtype_2");
- memset(&fill2_correct, '2', DTYPE2_SIZE);
+ HDmemset(&fill2_correct, '2', (size_t)DTYPE2_SIZE);
ret = H5Pget_fill_value(plist, dtype2_id, &fill2);
CHECK_I(ret, "H5Pget_fill_value");
- ret = memcmp(&fill2, &fill2_correct, DTYPE2_SIZE);
+ ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE);
VERIFY(ret, 0, memcmp);
}
+#ifdef NOT_NOW
/*-------------------------------------------------------------------------
* Function: size2_dump_struct
@@ -1378,6 +1379,7 @@ size2_dump_struct(const char *name, size2_helper_struct *sizes)
printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved));
printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1));
}
+#endif /* NOT_NOW */
/*-------------------------------------------------------------------------
@@ -1466,7 +1468,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
* We'll set them in the DCPL.
*/
HDmemset(&fill1, '1', sizeof(dtype1_struct));
- HDmemset(&fill2, '2', DTYPE2_SIZE);
+ HDmemset(&fill2, '2', (size_t)DTYPE2_SIZE);
dcpl1_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK_I(dcpl1_id, "H5Pcreate");
@@ -1509,8 +1511,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
size2_verify_plist2(dcpl2_id);
/* Set up attribute data */
- HDmemset(attr_string1, 0, NAME_BUF_SIZE);
- HDmemset(attr_string2, 0, NAME_BUF_SIZE);
+ HDmemset(attr_string1, 0, (size_t)NAME_BUF_SIZE);
+ HDmemset(attr_string2, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_string1, LONG_STRING);
HDstrcpy(attr_string2, LONG_STRING);
attr_string2[1] = '1'; /* The second string starts "01 index..." */
@@ -1518,7 +1520,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
/* Set up attribute metadata */
attr_type_id = H5Tcopy(H5T_C_S1);
CHECK_I(attr_type_id, "H5Tcopy");
- ret = H5Tset_size(attr_type_id ,NAME_BUF_SIZE);
+ ret = H5Tset_size(attr_type_id, (size_t)NAME_BUF_SIZE);
CHECK_I(ret, "H5Tset_size");
attr_space_id = H5Screate_simple(1, dims, dims);
CHECK_I(attr_space_id, "H5Screate_simple");
@@ -1669,10 +1671,9 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
- strcpy(attr_name, "00 index");
+ HDstrcpy(attr_name, "00 index");
- for(x=0; x<NUM_ATTRIBUTES; ++x)
- {
+ for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create a unique name and value for each attribute */
attr_string1[0] = attr_name[0] = (x / 10) + '0';
attr_string1[1] = attr_name[1] = (x % 10) + '0';
@@ -1917,7 +1918,7 @@ static void size2_verify(void)
/* Create attribute data type */
attr_type_id = H5Tcopy(H5T_C_S1);
CHECK_I(attr_type_id, "H5Tcopy");
- ret = H5Tset_size(attr_type_id ,NAME_BUF_SIZE);
+ ret = H5Tset_size(attr_type_id, (size_t)NAME_BUF_SIZE);
CHECK_I(ret, "H5Tset_size");
/* Read attributes on both groups and verify that they are correct */
@@ -1926,8 +1927,8 @@ static void size2_verify(void)
group2_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group2_id, "H5Gopen2");
- HDmemset(attr_string, 0, NAME_BUF_SIZE);
- HDmemset(attr_correct_string, 0, NAME_BUF_SIZE);
+ HDmemset(attr_string, 0, (size_t)NAME_BUF_SIZE);
+ HDmemset(attr_correct_string, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_correct_string, LONG_STRING);
HDstrcpy(attr_name, "00 index");
@@ -2785,11 +2786,12 @@ static void
test_sohm_delete(void)
{
hid_t fcpl_id;
- /* We'll use dataspaces, filter pipelines, and attributes for this
- * test. Create a number of distinct messages of each type.
+ /* We'll use dataspaces and filter pipelines for this test.
+ * Create a number of distinct messages of each type.
*/
hid_t dspace_id[DELETE_NUM_MESGS] = {0};
hid_t dcpl_id[DELETE_NUM_MESGS] = {0};
+ unsigned u;
int x;
hsize_t dims[] = DELETE_DIMS;
herr_t ret;
@@ -2797,10 +2799,10 @@ test_sohm_delete(void)
/* Create a number of different dataspaces.
* For simplicity, each dataspace has only one element.
*/
- for(x=0; x<DELETE_NUM_MESGS; ++x) {
- dspace_id[x] = H5Screate_simple(x + 1, dims, dims);
- CHECK_I(dspace_id[x], "H5Screate_simple");
- }
+ for(u = 0; u < DELETE_NUM_MESGS; ++u) {
+ dspace_id[u] = H5Screate_simple((int)(u + 1), dims, dims);
+ CHECK_I(dspace_id[u], "H5Screate_simple");
+ } /* end for */
/* Create a number of different filter pipelines. */
dcpl_id[0] = H5Pcreate(H5P_DATASET_CREATE);
@@ -2811,21 +2813,21 @@ test_sohm_delete(void)
ret = H5Pset_shuffle(dcpl_id[0]);
CHECK_I(ret, "H5Pset_shuffle");
- for(x=1; x<DELETE_NUM_MESGS; x+=2) {
- dcpl_id[x] = H5Pcopy(dcpl_id[x-1]);
- CHECK_I(dcpl_id[x], "H5Pcopy");
- ret = H5Pset_chunk(dcpl_id[x], x+1, dims);
+ for(u = 1; u < DELETE_NUM_MESGS; u += 2) {
+ dcpl_id[u] = H5Pcopy(dcpl_id[u - 1]);
+ CHECK_I(dcpl_id[u], "H5Pcopy");
+ ret = H5Pset_chunk(dcpl_id[u], (int)(u + 1), dims);
CHECK_I(ret, "H5Pset_chunk");
- ret = H5Pset_deflate(dcpl_id[x], 1);
+ ret = H5Pset_deflate(dcpl_id[u], 1);
CHECK_I(ret, "H5Pset_deflate");
- dcpl_id[x+1] = H5Pcopy(dcpl_id[x]);
- CHECK_I(dcpl_id[x+1], "H5Pcopy");
- ret = H5Pset_chunk(dcpl_id[x+1], x+2, dims);
+ dcpl_id[u + 1] = H5Pcopy(dcpl_id[u]);
+ CHECK_I(dcpl_id[u + 1], "H5Pcopy");
+ ret = H5Pset_chunk(dcpl_id[u + 1], (int)(u + 2), dims);
CHECK_I(ret, "H5Pset_chunk");
- ret = H5Pset_shuffle(dcpl_id[x+1]);
+ ret = H5Pset_shuffle(dcpl_id[u + 1]);
CHECK_I(ret, "H5Pset_shuffle");
- }
+ } /* end for */
/* Create an fcpl where all messages are shared in the same index */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
@@ -2889,22 +2891,22 @@ test_sohm_delete(void)
*/
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=DELETE_MIN_MESG_SIZE; x<=DELETE_MAX_MESG_SIZE; x += 10) {
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, (size_t) x);
+ for(u = DELETE_MIN_MESG_SIZE; u <= DELETE_MAX_MESG_SIZE; u += 10) {
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, u);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
- }
+ } /* end for */
/* Cleanup */
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
- for(x=DELETE_NUM_MESGS - 1; x>=0; --x) {
+ for(x = DELETE_NUM_MESGS - 1; x >= 0; --x) {
ret = H5Sclose(dspace_id[x]);
CHECK_I(ret, "H5Sclose");
ret = H5Pclose(dcpl_id[x]);
CHECK_I(ret, "H5Pclose");
- }
+ } /* end for */
} /* end test_sohm_delete() */