summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c513
1 files changed, 382 insertions, 131 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 27d31d4..8b3101c 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -70,7 +70,7 @@
FAIL_STACK_ERROR \
if ((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \
H5_FAILED(); \
- HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)NMEMBS, \
+ HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)(NMEMBS), \
(long long)H5I_nmembers(H5I_DATATYPE)); \
goto error; \
}
@@ -312,7 +312,10 @@ test_copy(void)
goto error;
/* We should not be able to close a built-in byte */
- H5E_BEGIN_TRY { status = H5Tclose(H5T_NATIVE_SCHAR); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tclose(H5T_NATIVE_SCHAR);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -598,7 +601,10 @@ test_compound_1(void)
goto error;
/* Attempt to add the new compound datatype as a field within itself */
- H5E_BEGIN_TRY { ret = H5Tinsert(complex_id, "compound", (size_t)0, complex_id); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tinsert(complex_id, "compound", (size_t)0, complex_id);
+ }
H5E_END_TRY;
if (ret >= 0) {
FAIL_PUTS_ERROR("Inserted compound datatype into itself?");
@@ -612,56 +618,83 @@ test_compound_1(void)
/* Test some functions that aren't supposed to work for compound type */
/* Tries to shrink the size and trail the last member */
- H5E_BEGIN_TRY { ret = H5Tset_size(complex_id, sizeof(double)); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_size(complex_id, sizeof(double));
+ }
H5E_END_TRY;
if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { size = H5Tget_precision(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ size = H5Tget_precision(complex_id);
+ }
H5E_END_TRY;
if (size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
size = 128;
- H5E_BEGIN_TRY { ret = H5Tset_precision(complex_id, size); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_precision(complex_id, size);
+ }
H5E_END_TRY;
if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { ret = H5Tget_pad(complex_id, &lsb, &msb); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tget_pad(complex_id, &lsb, &msb);
+ }
H5E_END_TRY;
if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { size = H5Tget_ebias(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ size = H5Tget_ebias(complex_id);
+ }
H5E_END_TRY;
if (size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { lsb = H5Tget_inpad(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ lsb = H5Tget_inpad(complex_id);
+ }
H5E_END_TRY;
if (lsb >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { cset = H5Tget_cset(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ cset = H5Tget_cset(complex_id);
+ }
H5E_END_TRY;
if (cset > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { strpad = H5Tget_strpad(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ strpad = H5Tget_strpad(complex_id);
+ }
H5E_END_TRY;
if (strpad > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { offset = H5Tget_offset(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ offset = H5Tget_offset(complex_id);
+ }
H5E_END_TRY;
if (offset >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
@@ -673,19 +706,28 @@ test_compound_1(void)
if (order != H5T_ORDER_LE && order != H5T_ORDER_BE)
FAIL_PUTS_ERROR("Wrong order for this type.");
- H5E_BEGIN_TRY { sign = H5Tget_sign(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ sign = H5Tget_sign(complex_id);
+ }
H5E_END_TRY;
if (sign > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { tag = H5Tget_tag(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ tag = H5Tget_tag(complex_id);
+ }
H5E_END_TRY;
if (tag) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { super = H5Tget_super(complex_id); }
+ H5E_BEGIN_TRY
+ {
+ super = H5Tget_super(complex_id);
+ }
H5E_END_TRY;
if (super >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
@@ -741,9 +783,12 @@ test_compound_2(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -815,6 +860,10 @@ test_compound_2(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -861,9 +910,12 @@ test_compound_3(void)
FAIL_STACK_ERROR
/* Initialize */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -931,6 +983,10 @@ test_compound_3(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -981,9 +1037,12 @@ test_compound_4(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -1054,6 +1113,10 @@ test_compound_4(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1104,6 +1167,12 @@ test_compound_5(void)
TESTING("optimized struct converter");
+ if (!buf || !bkg) {
+ HDfree(buf);
+ HDfree(bkg);
+ return 1;
+ }
+
/* Build datatypes */
short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short));
array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
@@ -1141,7 +1210,7 @@ test_compound_5(void)
H5Tclose(int_array);
/* Check results */
- if (HDmemcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim ||
+ if (HDmemcmp(src[1].name, dst[1].name, sizeof(src[1].name)) != 0 || src[1].tdim != dst[1].tdim ||
src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] ||
src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) {
H5_FAILED();
@@ -1196,9 +1265,12 @@ test_compound_6(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff);
@@ -1347,7 +1419,10 @@ test_compound_7(void)
} /* end if */
/* Should not be able to insert field past end of compound datatype */
- H5E_BEGIN_TRY { ret = H5Tinsert(tid2, "d", HOFFSET(struct s2, d), H5T_NATIVE_DOUBLE); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tinsert(tid2, "d", HOFFSET(struct s2, d), H5T_NATIVE_DOUBLE);
+ }
H5E_END_TRY;
if (ret >= 0) {
H5_FAILED();
@@ -1356,7 +1431,10 @@ test_compound_7(void)
} /* end if */
/* Should not be able to shrink size of compound datatype */
- H5E_BEGIN_TRY { ret = H5Tset_size(tid2, sizeof(struct s1) / 2); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_size(tid2, sizeof(struct s1) / 2);
+ }
H5E_END_TRY;
if (ret >= 0) {
H5_FAILED();
@@ -1434,10 +1512,10 @@ test_compound_8(void)
int b;
} s1;
- typedef struct s2 {
+ struct s2 {
char c;
s1 d;
- } s2;
+ };
hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid;
size_t tsize;
hsize_t dims[1] = {ARRAY_DIM};
@@ -1590,7 +1668,10 @@ test_compound_8(void)
} /* end if */
/* If the type is not packed, packing a locked type shouldn't work */
- H5E_BEGIN_TRY { ret = H5Tpack(tid3); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tpack(tid3);
+ }
H5E_END_TRY;
if (ret >= 0) {
H5_FAILED();
@@ -1817,7 +1898,7 @@ test_compound_9(void)
goto error;
} /* end if */
- if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
+ if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str) != 0) {
H5_FAILED();
AT();
HDprintf("incorrect read data\n");
@@ -1891,7 +1972,7 @@ test_compound_9(void)
goto error;
} /* end if */
- if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
+ if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str) != 0) {
H5_FAILED();
AT();
HDprintf("incorrect read data\n");
@@ -2081,7 +2162,7 @@ test_compound_10(void)
for (i = 0; i < ARRAY_DIM; i++) {
if (rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 ||
- HDstrcmp(rdata[i].str, wdata[i].str)) {
+ HDstrcmp(rdata[i].str, wdata[i].str) != 0) {
H5_FAILED();
AT();
HDprintf("incorrect read data\n");
@@ -2097,7 +2178,7 @@ test_compound_10(void)
t1 = rdata[i].text.p;
t2 = wdata[i].text.p;
- if (HDstrcmp((char *)t1, (char *)t2)) {
+ if (HDstrcmp((char *)t1, (char *)t2) != 0) {
H5_FAILED();
AT();
HDprintf("incorrect VL read data\n");
@@ -2233,12 +2314,14 @@ test_compound_11(void)
/* Initialize buffer */
for (u = 0; u < NTESTELEM; u++) {
- ((big_t *)buf)[u].d1 = (double)u * (double)1.5f;
- ((big_t *)buf)[u].d2 = (double)u * (double)2.5f;
- ((big_t *)buf)[u].d3 = (double)u * (double)3.5f;
+ ((big_t *)buf)[u].d1 = (double)u * 1.5;
+ ((big_t *)buf)[u].d2 = (double)u * 2.5;
+ ((big_t *)buf)[u].d3 = (double)u * 3.5;
((big_t *)buf)[u].i1 = (int)(u * 3);
((big_t *)buf)[u].i2 = (int)(u * 5);
((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
+ if (!((big_t *)buf)[u].s1)
+ TEST_ERROR
HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */
@@ -2282,7 +2365,7 @@ test_compound_11(void)
((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) {
+ else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1) != 0) {
HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u,
((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
@@ -2333,7 +2416,7 @@ test_compound_11(void)
((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) {
+ else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1) != 0) {
HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u,
((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
@@ -2374,7 +2457,7 @@ test_compound_11(void)
((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) {
+ else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1) != 0) {
HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u,
((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
@@ -2498,7 +2581,10 @@ test_compound_12(void)
/* Tries to cut last member. Supposed to fail. */
size--;
- H5E_BEGIN_TRY { ret = H5Tset_size(complex_id, size); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_size(complex_id, size);
+ }
H5E_END_TRY;
if (ret >= 0) {
H5_FAILED();
@@ -2956,14 +3042,14 @@ test_compound_14(void)
goto error;
} /* end if */
- if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) {
+ if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str) != 0) {
H5_FAILED();
AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) ||
+ if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) != 0 ||
rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 ||
rdata2.l4 != wdata2.l4) {
H5_FAILED();
@@ -3054,14 +3140,14 @@ test_compound_14(void)
goto error;
} /* end if */
- if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) {
+ if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str) != 0) {
H5_FAILED();
AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) ||
+ if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) != 0 ||
rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 ||
rdata2.l4 != wdata2.l4) {
H5_FAILED();
@@ -3594,7 +3680,10 @@ test_compound_18(void)
HDassert(sid > 0);
/* Create a dataset with the bad compound datatype */
- H5E_BEGIN_TRY { did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }
H5E_END_TRY;
if (did > 0) {
H5Dclose(did);
@@ -3606,7 +3695,10 @@ test_compound_18(void)
HDassert(gid > 0);
/* Create an attribute with the bad compound datatype */
- H5E_BEGIN_TRY { aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ }
H5E_END_TRY;
if (aid > 0) {
H5Aclose(aid);
@@ -3614,7 +3706,10 @@ test_compound_18(void)
} /* end if */
/* Commit the datatype */
- H5E_BEGIN_TRY { ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }
H5E_END_TRY;
if (ret >= 0) {
FAIL_PUTS_ERROR("committed named datatype with bad compound datatype")
@@ -3636,7 +3731,10 @@ test_compound_18(void)
FAIL_STACK_ERROR
/* Try to open the datatype */
- H5E_BEGIN_TRY { tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ tid = H5Topen2(file, "cmpnd", H5P_DEFAULT);
+ }
H5E_END_TRY;
if (tid > 0) {
H5Tclose(tid);
@@ -3644,7 +3742,10 @@ test_compound_18(void)
} /* end if */
/* Try to open the dataset */
- H5E_BEGIN_TRY { did = H5Dopen2(file, "dataset", H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ did = H5Dopen2(file, "dataset", H5P_DEFAULT);
+ }
H5E_END_TRY;
if (did > 0) {
H5Dclose(did);
@@ -3656,7 +3757,10 @@ test_compound_18(void)
TEST_ERROR
/* Try to open the dataset */
- H5E_BEGIN_TRY { aid = H5Aopen(gid, "attr", H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ aid = H5Aopen(gid, "attr", H5P_DEFAULT);
+ }
H5E_END_TRY;
if (aid > 0) {
H5Aclose(aid);
@@ -3885,7 +3989,7 @@ test_query(void)
HDprintf("Can't get name for enum member\n");
goto error;
} /* end if */
- if (HDstrcmp("YELLOW", enum_name)) {
+ if (HDstrcmp("YELLOW", enum_name) != 0) {
H5_FAILED();
HDprintf("Incorrect name for enum member\n");
goto error;
@@ -3958,14 +4062,20 @@ test_transient(hid_t fapl)
goto error;
/* Predefined types cannot be modified or closed */
- H5E_BEGIN_TRY { status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
HDputs(" Predefined types should not be modifiable!");
goto error;
}
- H5E_BEGIN_TRY { status = H5Tclose(H5T_NATIVE_INT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tclose(H5T_NATIVE_INT);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -3980,7 +4090,10 @@ test_transient(hid_t fapl)
goto error;
/* It should not be possible to create an attribute for a transient type */
- H5E_BEGIN_TRY { ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT);
+ }
H5E_END_TRY;
if (ret_id >= 0) {
H5_FAILED();
@@ -3999,7 +4112,10 @@ test_transient(hid_t fapl)
/* The type returned from a dataset should not be modifiable */
if ((t2 = H5Dget_type(dset)) < 0)
goto error;
- H5E_BEGIN_TRY { status = H5Tset_precision(t2, (size_t)256); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tset_precision(t2, (size_t)256);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -4019,7 +4135,10 @@ test_transient(hid_t fapl)
goto error;
if ((t2 = H5Dget_type(dset)) < 0)
goto error;
- H5E_BEGIN_TRY { status = H5Tset_precision(t2, (size_t)256); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tset_precision(t2, (size_t)256);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -4127,7 +4246,10 @@ test_named(hid_t fapl)
}
/* We should not be able to modify a type after it has been committed. */
- H5E_BEGIN_TRY { status = H5Tset_precision(type, (size_t)256); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tset_precision(type, (size_t)256);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -4325,7 +4447,10 @@ test_named(hid_t fapl)
/* Verify that H5Tcommit_anon returns an error */
if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto error;
- H5E_BEGIN_TRY { status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -4504,14 +4629,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Truncated C-string test failed");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Extended C-string test failed");
goto error;
@@ -4535,14 +4660,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Truncated C buffer test failed");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Extended C buffer test failed");
goto error;
@@ -4566,14 +4691,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Truncated Fortran-string test failed");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) {
+ if (HDmemcmp(buf, "abcde abcde ", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Extended Fortran-string test failed");
goto error;
@@ -4600,7 +4725,7 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Non-terminated string test 1");
goto error;
@@ -4611,7 +4736,7 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Non-terminated string test 2");
goto error;
@@ -4619,7 +4744,7 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20);
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Non-terminated string test 2");
goto error;
@@ -4643,14 +4768,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20) != 0) {
H5_FAILED();
HDputs(" C string to Fortran test 1");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Fortran to C string test 1");
goto error;
@@ -4662,14 +4787,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" C string to Fortran test 2");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Fortran to C string test 2");
goto error;
@@ -4685,14 +4810,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd abcd ", (size_t)20) != 0) {
H5_FAILED();
HDputs(" C string to Fortran test 3");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Fortran to C string test 3");
goto error;
@@ -4716,14 +4841,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20) != 0) {
H5_FAILED();
HDputs(" C buffer to Fortran test 1");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Fortran to C buffer test 1");
goto error;
@@ -4735,14 +4860,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" C buffer to Fortran test 2");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Fortran to C buffer test 2");
goto error;
@@ -4758,14 +4883,14 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd abcd ", (size_t)20) != 0) {
H5_FAILED();
HDputs(" C buffer to Fortran test 3");
goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
+ if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20) != 0) {
H5_FAILED();
HDputs(" Fortran to C buffer test 3");
goto error;
@@ -4935,37 +5060,55 @@ test_conv_str_3(void)
if (H5Tget_order(type) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY { ret = H5Tset_precision(type, nelmts); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_precision(type, nelmts);
+ }
H5E_END_TRY;
if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_BEGIN_TRY
+ {
+ size = H5Tget_ebias(type);
+ }
H5E_END_TRY;
if (size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_BEGIN_TRY
+ {
+ inpad = H5Tget_inpad(type);
+ }
H5E_END_TRY;
if (inpad > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { sign = H5Tget_sign(type); }
+ H5E_BEGIN_TRY
+ {
+ sign = H5Tget_sign(type);
+ }
H5E_END_TRY;
if (sign > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { tag = H5Tget_tag(type); }
+ H5E_BEGIN_TRY
+ {
+ tag = H5Tget_tag(type);
+ }
H5E_END_TRY;
if (tag) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY { super = H5Tget_super(type); }
+ H5E_BEGIN_TRY
+ {
+ super = H5Tget_super(type);
+ }
H5E_END_TRY;
if (super >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
@@ -5298,7 +5441,10 @@ test_bitfield_funcs(void)
if ((ntype = H5Tget_native_type(type, H5T_DIR_ASCEND)) < 0)
goto error;
- H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_BEGIN_TRY
+ {
+ size = H5Tget_ebias(type);
+ }
H5E_END_TRY;
if (size > 0) {
H5_FAILED();
@@ -5306,7 +5452,10 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_BEGIN_TRY
+ {
+ inpad = H5Tget_inpad(type);
+ }
H5E_END_TRY;
if (inpad > -1) {
H5_FAILED();
@@ -5314,7 +5463,10 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_BEGIN_TRY
+ {
+ cset = H5Tget_cset(type);
+ }
H5E_END_TRY;
if (cset > -1) {
H5_FAILED();
@@ -5322,7 +5474,10 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_BEGIN_TRY
+ {
+ strpad = H5Tget_strpad(type);
+ }
H5E_END_TRY;
if (strpad > -1) {
H5_FAILED();
@@ -5330,7 +5485,10 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5E_BEGIN_TRY { ret = H5Tset_sign(type, H5T_SGN_2); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_sign(type, H5T_SGN_2);
+ }
H5E_END_TRY;
if (ret >= 0) {
H5_FAILED();
@@ -5338,7 +5496,10 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5E_BEGIN_TRY { tag = H5Tget_tag(type); }
+ H5E_BEGIN_TRY
+ {
+ tag = H5Tget_tag(type);
+ }
H5E_END_TRY;
if (tag) {
H5_FAILED();
@@ -5346,7 +5507,10 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5E_BEGIN_TRY { super = H5Tget_super(type); }
+ H5E_BEGIN_TRY
+ {
+ super = H5Tget_super(type);
+ }
H5E_END_TRY;
if (super >= 0) {
H5_FAILED();
@@ -5471,7 +5635,10 @@ opaque_check(int tag_it)
}
/* Make sure that we can't convert between the types yet */
- H5E_BEGIN_TRY { status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -5540,7 +5707,10 @@ opaque_long(void)
long_tag[16384] = '\0';
/* Set opaque type's tag */
- H5E_BEGIN_TRY { ret = H5Tset_tag(dt, long_tag); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_tag(dt, long_tag);
+ }
H5E_END_TRY;
if (ret != FAIL)
TEST_ERROR
@@ -5596,63 +5766,90 @@ opaque_funcs(void)
if ((size = H5Tget_size(type)) == 0)
goto error;
- H5E_BEGIN_TRY { ret = H5Tset_precision(type, (size_t)32); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_precision(type, (size_t)32);
+ }
H5E_END_TRY;
if (ret >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ }
H5E_END_TRY;
if (ret >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_BEGIN_TRY
+ {
+ size = H5Tget_ebias(type);
+ }
H5E_END_TRY;
if (size > 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_BEGIN_TRY
+ {
+ inpad = H5Tget_inpad(type);
+ }
H5E_END_TRY;
if (inpad > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_BEGIN_TRY
+ {
+ cset = H5Tget_cset(type);
+ }
H5E_END_TRY;
if (cset > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_BEGIN_TRY
+ {
+ strpad = H5Tget_strpad(type);
+ }
H5E_END_TRY;
if (strpad > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { ret = H5Tset_offset(type, (size_t)16); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tset_offset(type, (size_t)16);
+ }
H5E_END_TRY;
if (ret >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { sign = H5Tget_sign(type); }
+ H5E_BEGIN_TRY
+ {
+ sign = H5Tget_sign(type);
+ }
H5E_END_TRY;
if (sign > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY { super = H5Tget_super(type); }
+ H5E_BEGIN_TRY
+ {
+ super = H5Tget_super(type);
+ }
H5E_END_TRY;
if (super >= 0) {
HDprintf("Operation not allowed for this type.\n");
@@ -5810,7 +6007,10 @@ test_encode(void)
cmpd_buf = (unsigned char *)HDcalloc((size_t)1, cmpd_buf_size);
/* Try decoding bogus buffer */
- H5E_BEGIN_TRY { ret_id = H5Tdecode(cmpd_buf); }
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Tdecode(cmpd_buf);
+ }
H5E_END_TRY;
if (ret_id != FAIL) {
H5_FAILED();
@@ -6159,7 +6359,10 @@ test_encode(void)
} /* end if */
/* Make sure the decoded datatypes are already closed. */
- H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid1); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tclose(decoded_tid1);
+ }
H5E_END_TRY;
if (ret != FAIL) {
H5_FAILED();
@@ -6167,7 +6370,10 @@ test_encode(void)
goto error;
}
- H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid2); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tclose(decoded_tid2);
+ }
H5E_END_TRY;
if (ret != FAIL) {
H5_FAILED();
@@ -6175,7 +6381,10 @@ test_encode(void)
goto error;
}
- H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid3); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tclose(decoded_tid3);
+ }
H5E_END_TRY;
if (ret != FAIL) {
H5_FAILED();
@@ -6474,13 +6683,13 @@ static int
test_int_float_except(void)
{
#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f,
- (float)4.5f};
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0F, (float)INT_MAX - 32.0F, (float)INT_MAX - 68.0F,
+ (float)4.5F};
int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 4};
- float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
+ float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0F, (float)INT_MAX - 127.0F, 4};
int * intp; /* Pointer to buffer, as integers */
int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
- float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
+ float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0F, (float)0.0F};
int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
float *floatp; /* Pointer to buffer #2, as floats */
hid_t dxpl; /* Dataset transfer property list */
@@ -6610,7 +6819,10 @@ test_int_float_except(void)
#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
error:
- H5E_BEGIN_TRY { H5Pclose(dxpl); }
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dxpl);
+ }
H5E_END_TRY;
return 1;
#endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
@@ -7193,7 +7405,7 @@ test_named_indirect_reopen(hid_t fapl)
TEST_ERROR
if (NULL == (tag_ret = H5Tget_tag(type)))
TEST_ERROR
- if (HDstrcmp(tag, tag_ret))
+ if (HDstrcmp(tag, tag_ret) != 0)
TEST_ERROR
H5free_memory(tag_ret);
tag_ret = NULL;
@@ -7209,7 +7421,7 @@ test_named_indirect_reopen(hid_t fapl)
TEST_ERROR
if (NULL == (tag_ret = H5Tget_tag(type)))
TEST_ERROR
- if (HDstrcmp(tag, tag_ret))
+ if (HDstrcmp(tag, tag_ret) != 0)
TEST_ERROR
H5free_memory(tag_ret);
tag_ret = NULL;
@@ -7788,7 +8000,10 @@ test_deprec(hid_t fapl)
FAIL_STACK_ERROR
/* Predefined types cannot be committed */
- H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT);
+ }
H5E_END_TRY;
if (status >= 0)
FAIL_PUTS_ERROR(" Predefined types should not be committable!")
@@ -7804,13 +8019,19 @@ test_deprec(hid_t fapl)
FAIL_PUTS_ERROR(" H5Tcommitted() returned false!")
/* We should not be able to modify a type after it has been committed. */
- H5E_BEGIN_TRY { status = H5Tset_precision(type, (size_t)256); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tset_precision(type, (size_t)256);
+ }
H5E_END_TRY;
if (status >= 0)
FAIL_PUTS_ERROR(" Committed type is not constant!")
/* We should not be able to re-commit a committed type */
- H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_2 (should not exist)", type); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tcommit1(file, "test_named_2 (should not exist)", type);
+ }
H5E_END_TRY;
if (status >= 0)
FAIL_PUTS_ERROR(" Committed types should not be recommitted!")
@@ -7840,7 +8061,10 @@ test_deprec(hid_t fapl)
/* Verify that H5Tcommit2 returns an error */
if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto error;
- H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_3 (should not exist)", type); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tcommit1(file, "test_named_3 (should not exist)", type);
+ }
H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
@@ -7927,7 +8151,10 @@ test_utf_ascii_conv(void)
FAIL_STACK_ERROR
/* Test conversion in memory */
- H5E_BEGIN_TRY { status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -7950,7 +8177,10 @@ test_utf_ascii_conv(void)
FAIL_STACK_ERROR
/* Read the UTF8 string, as ASCII, supposed to fail */
- H5E_BEGIN_TRY { status = H5Dread(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_r); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Dread(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_r);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -7963,7 +8193,10 @@ test_utf_ascii_conv(void)
* Test VL string conversion from ASCII to UTF8
************************************************/
/* Test conversion in memory */
- H5E_BEGIN_TRY { status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -7977,7 +8210,10 @@ test_utf_ascii_conv(void)
FAIL_STACK_ERROR
/* Read the ASCII string, as UTF8, supposed to fail */
- H5E_BEGIN_TRY { status = H5Dread(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_r); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Dread(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_r);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -8020,7 +8256,10 @@ test_utf_ascii_conv(void)
FAIL_STACK_ERROR
/* Test conversion in memory */
- H5E_BEGIN_TRY { status = H5Tconvert(utf8_tid, ascii_tid, 1, utf8_2, NULL, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tconvert(utf8_tid, ascii_tid, 1, utf8_2, NULL, H5P_DEFAULT);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -8034,7 +8273,10 @@ test_utf_ascii_conv(void)
FAIL_STACK_ERROR
/* Read the UTF8 string as ASCII, supposed to fail */
- H5E_BEGIN_TRY { status = H5Dread(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii2); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Dread(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii2);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -8047,7 +8289,10 @@ test_utf_ascii_conv(void)
* Test fixed-length string conversion from ASCII to UTF8
**********************************************************/
/* Test conversion in memory */
- H5E_BEGIN_TRY { status = H5Tconvert(ascii_tid, utf8_tid, 1, ascii2, NULL, H5P_DEFAULT); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Tconvert(ascii_tid, utf8_tid, 1, ascii2, NULL, H5P_DEFAULT);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -8061,7 +8306,10 @@ test_utf_ascii_conv(void)
FAIL_STACK_ERROR
/* Read the UTF8 string as ASCII, supposed to fail */
- H5E_BEGIN_TRY { status = H5Dread(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_2); }
+ H5E_BEGIN_TRY
+ {
+ status = H5Dread(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_2);
+ }
H5E_END_TRY
if (status >= 0)
FAIL_STACK_ERROR
@@ -8441,7 +8689,10 @@ test_versionbounds(void)
for (high = 0; high < versions_count; high++) {
/* Set version bounds */
- H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, versions[low], versions[high]); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5Pset_libver_bounds(fapl, versions[low], versions[high]);
+ }
H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */