summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkmu <kmu@hdfgroup.org>2019-11-25 18:48:51 (GMT)
committerkmu <kmu@hdfgroup.org>2019-11-25 18:48:51 (GMT)
commitd242a900f420b040e364f6c0976c01593e955db3 (patch)
tree7b6849d8aff9ab9c9fe4b8f6ac40113e69454de3 /test
parent3613ec7296a782c86ea5f0706a5a0cb51602abc9 (diff)
downloadhdf5-d242a900f420b040e364f6c0976c01593e955db3.zip
hdf5-d242a900f420b040e364f6c0976c01593e955db3.tar.gz
hdf5-d242a900f420b040e364f6c0976c01593e955db3.tar.bz2
fix issues from previous PR comments
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c6
-rw-r--r--test/dtypes.c4
-rw-r--r--test/ntypes.c2
-rw-r--r--test/tsohm.c8
4 files changed, 10 insertions, 10 deletions
diff --git a/test/dsets.c b/test/dsets.c
index b32c5b6..15d319c 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -5293,7 +5293,7 @@ test_types(hid_t file)
(space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
(dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i);
+ for(i=0; i<sizeof buf; i++) ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
@@ -5307,7 +5307,7 @@ test_types(hid_t file)
(space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
(dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i);
+ for(i=0; i<sizeof buf; i++) ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
if(H5Sclose(space) < 0) goto error;
@@ -5322,7 +5322,7 @@ test_types(hid_t file)
(dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
for(i = 0; i < sizeof buf; i++)
- buf[i] = (unsigned char)(0xff ^ i);
+ ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Tclose(type) < 0) goto error;
diff --git a/test/dtypes.c b/test/dtypes.c
index 5238306..5369351 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1216,8 +1216,8 @@ test_compound_6(void)
orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->b = (short)((i*8+1) & 0x7fff);
- s_ptr->d = (short)((i*8+6) & 0x7fff);
+ ASSIGN_TO_SMALLER_SIZE(s_ptr->b, short, (i*8+1) & 0x7fff, int);
+ ASSIGN_TO_SMALLER_SIZE(s_ptr->d, short, (i*8+6) & 0x7fff, int);
}
HDmemcpy(buf, orig, nelmts*sizeof(struct st));
diff --git a/test/ntypes.c b/test/ntypes.c
index f1d2449..03eefe6 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -2484,7 +2484,7 @@ test_opaque_dtype(hid_t file)
TEST_ERROR;
for(i = 0; i < sizeof(wbuf); i++)
- wbuf[i] = (unsigned char)(0xff ^ i);
+ ASSIGN_TO_SMALLER_SIZE(wbuf[i], unsigned char, 0xff ^ i, size_t);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
if(H5Sclose(space) < 0) TEST_ERROR;
diff --git a/test/tsohm.c b/test/tsohm.c
index 0fc273b..c126608 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -3342,11 +3342,11 @@ test_sohm_extlink(void)
static int
verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
{
- hid_t file_id = -1;
- hid_t orig_space_id = -1;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t orig_space_id = H5I_INVALID_HID;
hid_t space1_id, space2_id, space3_id;
- hid_t dcpl_id = -1;
- hid_t dset1_id, dset2_id = -1, dset3_id = -1;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID;
hsize_t dims1[] = {1, 2};
hsize_t max_dims[] = {H5S_UNLIMITED, 2};
hsize_t dims2[] = {5, 2};