diff options
Diffstat (limited to 'test/cmpd_dset.c')
-rw-r--r-- | test/cmpd_dset.c | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 062707e..00ef239 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -128,10 +128,11 @@ main (int argc, char *argv[]) /* Other variables */ unsigned int i, j; hid_t file, dataset, space, PRESERVE, fapl; + hid_t array_dt; static hsize_t dim[] = {NX, NY}; hssize_t f_offset[2]; /*offset of hyperslab in file */ hsize_t h_size[2]; /*size of hyperslab */ - size_t memb_size[1] = {4}; + hsize_t memb_size[1] = {4}; char filename[256]; h5_reset(); @@ -178,15 +179,16 @@ main (int argc, char *argv[]) } /* Create the memory data type */ - if ((s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) goto error; + if ((s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) + goto error; + array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); if (H5Tinsert (s1_tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0 || - H5Tinsert (s1_tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0 || - H5Tinsert_array (s1_tid, "c", HOFFSET(s1_t,c), 1, memb_size, NULL, - H5T_NATIVE_INT)<0 || - H5Tinsert (s1_tid, "d", HOFFSET(s1_t,d), H5T_NATIVE_INT)<0 || - H5Tinsert (s1_tid, "e", HOFFSET(s1_t,e), H5T_NATIVE_INT)<0) { - goto error; - } + H5Tinsert (s1_tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0 || + H5Tinsert (s1_tid, "c", HOFFSET(s1_t,c), array_dt)<0 || + H5Tinsert (s1_tid, "d", HOFFSET(s1_t,d), H5T_NATIVE_INT)<0 || + H5Tinsert (s1_tid, "e", HOFFSET(s1_t,e), H5T_NATIVE_INT)<0) + goto error; + H5Tclose(array_dt); /* Create the dataset */ if ((dataset = H5Dcreate (file, "s1", s1_tid, space, H5P_DEFAULT))<0) { @@ -208,15 +210,16 @@ main (int argc, char *argv[]) TESTING("basic compound read"); /* Create a data type for s2 */ - if ((s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t)))<0) goto error; + if ((s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t)))<0) + goto error; + array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); if (H5Tinsert (s2_tid, "a", HOFFSET(s2_t,a), H5T_NATIVE_INT)<0 || - H5Tinsert (s2_tid, "b", HOFFSET(s2_t,b), H5T_NATIVE_INT)<0 || - H5Tinsert_array (s2_tid, "c", HOFFSET(s2_t,c), 1, memb_size, NULL, - H5T_NATIVE_INT)<0 || - H5Tinsert (s2_tid, "d", HOFFSET(s2_t,d), H5T_NATIVE_INT)<0 || - H5Tinsert (s2_tid, "e", HOFFSET(s2_t,e), H5T_NATIVE_INT)<0) { - goto error; - } + H5Tinsert (s2_tid, "b", HOFFSET(s2_t,b), H5T_NATIVE_INT)<0 || + H5Tinsert (s2_tid, "c", HOFFSET(s2_t,c), array_dt)<0 || + H5Tinsert (s2_tid, "d", HOFFSET(s2_t,d), H5T_NATIVE_INT)<0 || + H5Tinsert (s2_tid, "e", HOFFSET(s2_t,e), H5T_NATIVE_INT)<0) + goto error; + H5Tclose(array_dt); /* Read the data */ if (H5Dread (dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2)<0) { @@ -249,15 +252,16 @@ main (int argc, char *argv[]) TESTING("reversal of struct members"); /* Create a data type for s3 */ - if ((s3_tid = H5Tcreate (H5T_COMPOUND, sizeof(s3_t)))<0) goto error; + if ((s3_tid = H5Tcreate (H5T_COMPOUND, sizeof(s3_t)))<0) + goto error; + array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); if (H5Tinsert (s3_tid, "a", HOFFSET(s3_t,a), H5T_NATIVE_INT)<0 || - H5Tinsert (s3_tid, "b", HOFFSET(s3_t,b), H5T_NATIVE_INT)<0 || - H5Tinsert_array (s3_tid, "c", HOFFSET(s3_t,c), 1, memb_size, NULL, - H5T_NATIVE_INT)<0 || - H5Tinsert (s3_tid, "d", HOFFSET(s3_t,d), H5T_NATIVE_INT)<0 || - H5Tinsert (s3_tid, "e", HOFFSET(s3_t,e), H5T_NATIVE_INT)<0) { - goto error; - } + H5Tinsert (s3_tid, "b", HOFFSET(s3_t,b), H5T_NATIVE_INT)<0 || + H5Tinsert (s3_tid, "c", HOFFSET(s3_t,c), array_dt)<0 || + H5Tinsert (s3_tid, "d", HOFFSET(s3_t,d), H5T_NATIVE_INT)<0 || + H5Tinsert (s3_tid, "e", HOFFSET(s3_t,e), H5T_NATIVE_INT)<0) + goto error; + H5Tclose(array_dt); /* Read the data */ if (H5Dread (dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3)<0) { @@ -325,15 +329,16 @@ main (int argc, char *argv[]) } /* Create a data type for s5 */ - if ((s5_tid = H5Tcreate (H5T_COMPOUND, sizeof(s5_t)))<0) goto error; + if ((s5_tid = H5Tcreate (H5T_COMPOUND, sizeof(s5_t)))<0) + goto error; + array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); if (H5Tinsert (s5_tid, "a", HOFFSET(s5_t,a), H5T_NATIVE_INT)<0 || - H5Tinsert (s5_tid, "b", HOFFSET(s5_t,b), H5T_NATIVE_INT)<0 || - H5Tinsert_array (s5_tid, "c", HOFFSET(s5_t,c), 1, memb_size, NULL, - H5T_NATIVE_INT)<0 || - H5Tinsert (s5_tid, "d", HOFFSET(s5_t,d), H5T_NATIVE_INT)<0 || - H5Tinsert (s5_tid, "e", HOFFSET(s5_t,e), H5T_NATIVE_INT)) { - goto error; - } + H5Tinsert (s5_tid, "b", HOFFSET(s5_t,b), H5T_NATIVE_INT)<0 || + H5Tinsert (s5_tid, "c", HOFFSET(s5_t,c), array_dt)<0 || + H5Tinsert (s5_tid, "d", HOFFSET(s5_t,d), H5T_NATIVE_INT)<0 || + H5Tinsert (s5_tid, "e", HOFFSET(s5_t,e), H5T_NATIVE_INT)) + goto error; + H5Tclose(array_dt); /* Read the data */ if (H5Dread (dataset, s5_tid, H5S_ALL, H5S_ALL, PRESERVE, s5)<0) { |