summaryrefslogtreecommitdiffstats
path: root/test/tattr.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-08-11 19:13:45 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-08-11 19:13:45 (GMT)
commit88fb6b1374e748b06826e17ca65c15087ae5b5ac (patch)
tree7c550af01bb506aa5d5bb9208abad6687f7b0f3a /test/tattr.c
parent2a5454616a653b9830c103be7381af28ba397a3d (diff)
downloadhdf5-88fb6b1374e748b06826e17ca65c15087ae5b5ac.zip
hdf5-88fb6b1374e748b06826e17ca65c15087ae5b5ac.tar.gz
hdf5-88fb6b1374e748b06826e17ca65c15087ae5b5ac.tar.bz2
[svn-r25531] remove use of C99 PRI that failed on windows in dtypes.c
fix bugs where hid_t were assumed to be 32 bit ints or herr_t.
Diffstat (limited to 'test/tattr.c')
-rw-r--r--test/tattr.c82
1 files changed, 44 insertions, 38 deletions
diff --git a/test/tattr.c b/test/tattr.c
index 57b3263..2885124 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -178,6 +178,7 @@ test_attr_basic_write(hid_t fapl)
hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
int i;
+ hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -228,8 +229,8 @@ test_attr_basic_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
@@ -366,8 +367,8 @@ test_attr_basic_write(hid_t fapl)
VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
@@ -682,6 +683,7 @@ test_attr_compound_write(hid_t fapl)
hid_t attr; /* Attribute ID */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
+ hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -725,8 +727,8 @@ test_attr_compound_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write complex attribute data */
ret = H5Awrite(attr, tid1, attr_data4);
@@ -917,6 +919,7 @@ test_attr_scalar_write(hid_t fapl)
hid_t sid1,sid2; /* Dataspace ID */
hid_t attr; /* Attribute ID */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -943,8 +946,8 @@ test_attr_scalar_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_FLOAT, &attr_data5);
@@ -1057,6 +1060,7 @@ test_attr_mult_write(hid_t fapl)
hsize_t dims2[] = {ATTR1_DIM1};
hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
+ hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1087,8 +1091,8 @@ test_attr_mult_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write 1st attribute data */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
@@ -1111,8 +1115,8 @@ test_attr_mult_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write 2nd attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
@@ -1135,8 +1139,8 @@ test_attr_mult_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write 3rd attribute information */
ret = H5Awrite(attr, H5T_NATIVE_DOUBLE, attr_data3);
@@ -7203,6 +7207,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
+ hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
@@ -7297,8 +7302,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening an attribute on an object with no attributes */
- ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_idx");
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -7330,8 +7335,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for out of bound opening an attribute on an object */
- ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_idx");
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Test opening attributes by index stored compactly */
ret = attr_open_by_idx_check(my_dataset, idx_type, order, u);
@@ -7403,8 +7408,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end if */
/* Check for out of bound opening an attribute on an object */
- ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_idx");
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Test opening attributes by index stored compactly */
ret = attr_open_by_idx_check(my_dataset, idx_type, order, u);
@@ -7549,6 +7554,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
+ hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
@@ -7618,14 +7624,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with no attributes */
- ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen");
+ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen");
- ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
- ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -7657,14 +7663,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with compact attribute storage */
- ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen");
+ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen");
- ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
- ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Test opening attributes stored compactly */
ret = attr_open_check(fid, dsetname, my_dataset, u);
@@ -7739,14 +7745,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end if */
/* Check for opening a non-existant attribute on an object with dense attribute storage */
- ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen");
+ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen");
- ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
- ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Test opening attributes stored compactly */
ret = attr_open_check(fid, dsetname, my_dataset, u);