diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-08 19:59:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-08 19:59:36 (GMT) |
commit | 16683943c6edb42f9129cc5d6c8f340c74014dad (patch) | |
tree | d1ed13b0b7677e56d4253b4fe5e0640f851e27ca /test | |
parent | d3ee3988b68292524b3a893b9db55c074f4b9e87 (diff) | |
download | hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.zip hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.tar.gz hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.tar.bz2 |
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'test')
40 files changed, 2488 insertions, 2380 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index ae89ca2..8ced149 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -121,9 +121,9 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ - tgenprop.c th5o.c th5s.c theap.c tid.c titerate.c tmeta.c tmisc.c ttime.c \ - trefer.c trefstr.c tselect.c tsohm.c tskiplist.c ttst.c tunicode.c tvltypes.c \ - tvlstr.c + tgenprop.c th5o.c th5s.c theap.c tid.c titerate.c tmeta.c tmisc.c \ + trefer.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \ + tvlstr.c tvltypes.c # Temporary files. DISTCLEANFILES=testerror.sh @@ -125,12 +125,12 @@ is_sparse(void) int fd; h5_stat_t sb; - if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0; + if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0; if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0; if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; - if (HDclose(fd)<0) return 0; - if (HDstat("x.h5", &sb)<0) return 0; - if (HDunlink("x.h5")<0) return 0; + if (HDclose(fd) < 0) return 0; + if (HDstat("x.h5", &sb) < 0) return 0; + if (HDunlink("x.h5") < 0) return 0; #ifdef H5_HAVE_STAT_ST_BLOCKS return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size); #else @@ -162,7 +162,7 @@ supports_big(void) { int fd; - if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0; + if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0; /* Write a few bytes at 2GB */ if (HDlseek(fd, BIG_FILE, SEEK_SET)!=BIG_FILE) return 0; @@ -172,8 +172,8 @@ supports_big(void) if (HDlseek(fd, 2*BIG_FILE, SEEK_SET) != 2*BIG_FILE) return 0; if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; - if (HDclose(fd)<0) return 0; - if (HDunlink("y.h5")<0) return 0; + if (HDclose(fd) < 0) return 0; + if (HDunlink("y.h5") < 0) return 0; return (1); } @@ -215,7 +215,7 @@ enough_room(hid_t fapl) /* Create files */ for (i=0; i<NELMTS(fd); i++) { HDsnprintf(name, sizeof name, filename, i); - if ((fd[i]=HDopen(name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { + if ((fd[i]=HDopen(name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) { goto done; } if ((off_t)size != HDlseek(fd[i], (off_t)size, SEEK_SET)) { @@ -230,7 +230,7 @@ enough_room(hid_t fapl) done: for (i=0; i<NELMTS(fd) && fd[i]>=0; i++) { HDsnprintf(name, sizeof name, filename, i); - if(HDclose(fd[i])<0) + if(HDclose(fd[i]) < 0) ret_value=0; HDunlink(name); } @@ -276,13 +276,13 @@ writer (char* filename, hid_t fapl, int wrt_n) * We might be on a machine that has 32-bit files, so create an HDF5 file * which is a family of files. Each member of the family will be 1GB */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { goto error; } /* Create simple data spaces according to the size specified above. */ - if ((space1 = H5Screate_simple (4, size1, size1))<0 || - (space2 = H5Screate_simple (1, size2, size2))<0) { + if ((space1 = H5Screate_simple (4, size1, size1)) < 0 || + (space2 = H5Screate_simple (1, size2, size2)) < 0) { goto error; } @@ -295,41 +295,41 @@ writer (char* filename, hid_t fapl, int wrt_n) * We should create a dataset allocating space late and never writing fill values. * EIP 4/8/03 - if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT))<0 || - (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT))<0) { + if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0 || + (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0) { goto error; } */ dcpl = H5Pcreate(H5P_DATASET_CREATE); H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); - if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, dcpl))<0 || - (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, dcpl))<0) { + if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, dcpl)) < 0 || + (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, dcpl)) < 0) { goto error; } /* Write some things to them randomly */ hs_size[0] = WRT_SIZE; - if ((mem_space = H5Screate_simple (1, hs_size, hs_size))<0) goto error; + if ((mem_space = H5Screate_simple (1, hs_size, hs_size)) < 0) goto error; for (i=0; i<wrt_n; i++) { hs_start[0] = randll (size2[0], i); HDfprintf (out, "#%03d 0x%016Hx\n", i, hs_start[0]); if (H5Sselect_hyperslab (space2, H5S_SELECT_SET, hs_start, NULL, - hs_size, NULL)<0) goto error; + hs_size, NULL) < 0) goto error; for (j=0; j<WRT_SIZE; j++) { buf[j] = i+1; } if (H5Dwrite (d2, H5T_NATIVE_INT, mem_space, space2, - H5P_DEFAULT, buf)<0) goto error; + H5P_DEFAULT, buf) < 0) goto error; } - if (H5Dclose (d1)<0) goto error; - if (H5Dclose (d2)<0) goto error; - if (H5Sclose (mem_space)<0) goto error; - if (H5Sclose (space1)<0) goto error; - if (H5Sclose (space2)<0) goto error; - if (H5Fclose (file)<0) goto error; + if (H5Dclose (d1) < 0) goto error; + if (H5Dclose (d2) < 0) goto error; + if (H5Sclose (mem_space) < 0) goto error; + if (H5Sclose (space1) < 0) goto error; + if (H5Sclose (space2) < 0) goto error; + if (H5Fclose (file) < 0) goto error; free (buf); fclose(out); PASSED(); @@ -367,52 +367,54 @@ writer (char* filename, hid_t fapl, int wrt_n) *------------------------------------------------------------------------- */ static int -reader (char *filename, hid_t fapl) +reader(char *filename, hid_t fapl) { FILE *script = NULL; - hid_t file=-1, mspace=-1, fspace=-1, d2=-1; + hid_t file = -1, mspace = -1, fspace = -1, d2 = -1; char ln[128], *s; hsize_t hs_offset[1]; hsize_t hs_size[1] = {WRT_SIZE}; - int *buf = (int*)malloc (sizeof(int) * WRT_SIZE); - int i, j, zero, wrong, nerrors=0; + int *buf = (int *)malloc(sizeof(int) * WRT_SIZE); + int i, j, zero, wrong, nerrors = 0; /* Open script file */ - script = fopen (DNAME, "r"); + script = fopen(DNAME, "r"); /* Open HDF5 file */ - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error; + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; /* Open the dataset */ - if ((d2 = H5Dopen (file, "d2"))<0) goto error; - if ((fspace = H5Dget_space (d2))<0) goto error; + if((d2 = H5Dopen2(file, "d2", H5P_DEFAULT)) < 0) goto error; + if((fspace = H5Dget_space(d2)) < 0) goto error; /* Describe `buf' */ - if ((mspace = H5Screate_simple (1, hs_size, hs_size))<0) goto error; + if((mspace = H5Screate_simple(1, hs_size, hs_size)) < 0) goto error; /* Read each region */ - while (fgets (ln, (int)sizeof(ln), script)) { - if ('#'!=ln[0]) break; - i = (int)strtol (ln+1, &s, 10); - hs_offset[0] = HDstrtoll (s, NULL, 0); - HDfprintf (stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); - fflush (stdout); - - if (H5Sselect_hyperslab (fspace, H5S_SELECT_SET, hs_offset, NULL, - hs_size, NULL)<0) goto error; - if (H5Dread (d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf)<0) { + while(fgets(ln, (int)sizeof(ln), script)) { + if('#' != ln[0]) + break; + i = (int)strtol(ln + 1, &s, 10); + hs_offset[0] = HDstrtoll(s, NULL, 0); + HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); + fflush(stdout); + + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, + hs_size, NULL) < 0) goto error; + if(H5Dread(d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0) goto error; - } /* Check */ - for (j=zero=wrong=0; j<WRT_SIZE; j++) { - if (0==buf[j]) zero++; - else if (buf[j]!=i+1) wrong++; + for(j = zero = wrong = 0; j < WRT_SIZE; j++) { + if(0 == buf[j]) + zero++; + else if(buf[j] != i + 1) + wrong++; } - if (zero) { + if(zero) { H5_FAILED(); - printf(" %d zero%s\n", zero, 1==zero?"":"s"); - } else if (wrong) { + printf(" %d zero%s\n", zero, 1 == zero ? "" : "s"); + } else if(wrong) { SKIPPED(); puts(" Possible overlap with another region."); nerrors++; @@ -421,23 +423,26 @@ reader (char *filename, hid_t fapl) } } - if (H5Dclose (d2)<0) goto error; - if (H5Sclose (mspace)<0) goto error; - if (H5Sclose (fspace)<0) goto error; - if (H5Fclose (file)<0) goto error; - free (buf); - fclose (script); + if(H5Dclose(d2) < 0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; + if(H5Fclose(file) < 0) goto error; + free(buf); + fclose(script); + return nerrors; - error: +error: H5E_BEGIN_TRY { H5Dclose(d2); H5Sclose(mspace); H5Sclose(fspace); H5Fclose(file); } H5E_END_TRY; - if (buf) free(buf); - if (script) fclose(script); + if(buf) + free(buf); + if(script) + fclose(script); return 1; } @@ -552,13 +557,13 @@ main (int ac, char **av) HDfprintf(stdout, "Changing file drivers to the family driver, %Hu bytes each\n", family_size_def); - if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT)<0) goto error; - } else if (H5Pget_fapl_family(fapl, &family_size, NULL)<0) { + if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) goto error; + } else if (H5Pget_fapl_family(fapl, &family_size, NULL) < 0) { goto error; } else if (family_size!=family_size_def) { HDfprintf(stdout, "Changing family member size from %Hu to %Hu\n", family_size, family_size_def); - if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT)<0) + if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) goto error; } @@ -618,7 +623,7 @@ main (int ac, char **av) puts("Testing big file with the SEC2 Driver "); fapl = h5_fileaccess(); - if(H5Pset_fapl_sec2(fapl)<0) + if(H5Pset_fapl_sec2(fapl) < 0) HDmemset(filename, 0, sizeof(filename)); h5_fixname(FILENAME[1], fapl, filename, sizeof filename); @@ -638,7 +643,7 @@ main (int ac, char **av) puts("\nTesting big file with the STDIO Driver "); fapl = h5_fileaccess(); - if(H5Pset_fapl_stdio(fapl)<0) + if(H5Pset_fapl_stdio(fapl) < 0) HDmemset(filename, 0, sizeof(filename)); h5_fixname(FILENAME[2], fapl, filename, sizeof filename); diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 53f9746..223537d 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -199,16 +199,16 @@ test_compound (char *filename, hid_t fapl) hsize_t memb_size[1] = {4}; /* Create the file */ - if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { goto error; } /* Create the data space */ - if ((space = H5Screate_simple (2, dim, NULL))<0) goto error; + if ((space = H5Screate_simple (2, dim, NULL)) < 0) goto error; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error; - if (H5Pset_preserve (PRESERVE, 1)<0) goto error; + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER)) < 0) goto error; + if (H5Pset_preserve (PRESERVE, 1) < 0) goto error; /* *###################################################################### @@ -229,24 +229,24 @@ test_compound (char *filename, hid_t fapl) } /* Create the memory data type */ - if ((s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) + 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 (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) + 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 (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) { + if ((dataset = H5Dcreate (file, "s1", s1_tid, space, H5P_DEFAULT)) < 0) { goto error; } /* Write the data */ - if (H5Dwrite (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1)<0) { + if (H5Dwrite (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) { goto error; } PASSED(); @@ -260,19 +260,19 @@ test_compound (char *filename, hid_t fapl) TESTING("basic compound read"); /* Create a data type for s2 */ - if ((s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t)))<0) + 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 (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) + 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 (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) { + if (H5Dread (dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2) < 0) { goto error; } @@ -302,19 +302,19 @@ test_compound (char *filename, hid_t fapl) TESTING("reversal of struct members"); /* Create a data type for s3 */ - if ((s3_tid = H5Tcreate (H5T_COMPOUND, sizeof(s3_t)))<0) + 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 (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) + 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 (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) { + if (H5Dread (dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3) < 0) { goto error; } @@ -343,12 +343,12 @@ test_compound (char *filename, hid_t fapl) TESTING("subset struct read"); /* Create a datatype for s4 */ - if ((s4_tid = H5Tcreate (H5T_COMPOUND, sizeof(s4_t)))<0) goto error; - if (H5Tinsert (s4_tid, "b", HOFFSET(s4_t,b), H5T_NATIVE_INT)<0) goto error; - if (H5Tinsert (s4_tid, "d", HOFFSET(s4_t,d), H5T_NATIVE_INT)<0) goto error; + if ((s4_tid = H5Tcreate (H5T_COMPOUND, sizeof(s4_t))) < 0) goto error; + if (H5Tinsert (s4_tid, "b", HOFFSET(s4_t,b), H5T_NATIVE_INT) < 0) goto error; + if (H5Tinsert (s4_tid, "d", HOFFSET(s4_t,d), H5T_NATIVE_INT) < 0) goto error; /* Read the data */ - if (H5Dread (dataset, s4_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s4)<0) { + if (H5Dread (dataset, s4_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s4) < 0) { goto error; } @@ -379,19 +379,19 @@ test_compound (char *filename, hid_t fapl) } /* Create a data type for s5 */ - if ((s5_tid = H5Tcreate (H5T_COMPOUND, sizeof(s5_t)))<0) + 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 (s5_tid, "c", HOFFSET(s5_t,c), array_dt)<0 || - H5Tinsert (s5_tid, "d", HOFFSET(s5_t,d), H5T_NATIVE_INT)<0 || + 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 (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) { + if (H5Dread (dataset, s5_tid, H5S_ALL, H5S_ALL, PRESERVE, s5) < 0) { goto error; } @@ -451,23 +451,23 @@ test_compound (char *filename, hid_t fapl) } /* Create a data type for s6 */ - if ((s6_tid = H5Tcreate (H5T_COMPOUND, sizeof(s6_t)))<0) + if ((s6_tid = H5Tcreate (H5T_COMPOUND, sizeof(s6_t))) < 0) goto error; array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); - if (H5Tinsert (s6_tid, "a", HOFFSET(s6_t,a), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "b", HOFFSET(s6_t,b), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "c", HOFFSET(s6_t,c), array_dt)<0 || - H5Tinsert (s6_tid, "d", HOFFSET(s6_t,d), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "e", HOFFSET(s6_t,e), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "pre", HOFFSET(s6_t,pre), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "mid1", HOFFSET(s6_t,mid1), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "mid2", HOFFSET(s6_t,mid2), H5T_NATIVE_INT)<0 || - H5Tinsert (s6_tid, "post", HOFFSET(s6_t,post), H5T_NATIVE_INT)<0) + if (H5Tinsert (s6_tid, "a", HOFFSET(s6_t,a), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "b", HOFFSET(s6_t,b), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "c", HOFFSET(s6_t,c), array_dt) < 0 || + H5Tinsert (s6_tid, "d", HOFFSET(s6_t,d), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "e", HOFFSET(s6_t,e), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "pre", HOFFSET(s6_t,pre), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "mid1", HOFFSET(s6_t,mid1), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "mid2", HOFFSET(s6_t,mid2), H5T_NATIVE_INT) < 0 || + H5Tinsert (s6_tid, "post", HOFFSET(s6_t,post), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); /* Read the data */ - if (H5Dread (dataset, s6_tid, H5S_ALL, H5S_ALL, PRESERVE, s6)<0) { + if (H5Dread (dataset, s6_tid, H5S_ALL, H5S_ALL, PRESERVE, s6) < 0) { goto error; } @@ -516,12 +516,12 @@ test_compound (char *filename, hid_t fapl) } /* Write the data to file */ - if (H5Dwrite (dataset, s4_tid, H5S_ALL, H5S_ALL, PRESERVE, s4)<0) { + if (H5Dwrite (dataset, s4_tid, H5S_ALL, H5S_ALL, PRESERVE, s4) < 0) { goto error; } /* Read the data back */ - if (H5Dread (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1)<0) { + if (H5Dread (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) { goto error; } @@ -556,10 +556,10 @@ test_compound (char *filename, hid_t fapl) TESTING("explicit data space"); /* Create the data space */ - if ((s7_sid = H5Screate_simple (2, dim, NULL))<0) goto error; + if ((s7_sid = H5Screate_simple (2, dim, NULL)) < 0) goto error; /* Read the dataset */ - if (H5Dread (dataset, s2_tid, s7_sid, H5S_ALL, H5P_DEFAULT, s2)<0) { + if (H5Dread (dataset, s2_tid, s7_sid, H5S_ALL, H5P_DEFAULT, s2) < 0) { goto error; } @@ -589,21 +589,21 @@ test_compound (char *filename, hid_t fapl) TESTING("hyperslab partial read to array"); /* Create the file data space */ - if ((s8_f_sid = H5Dget_space (dataset))<0) goto error; + if ((s8_f_sid = H5Dget_space (dataset)) < 0) goto error; f_offset[0] = NX/3; f_offset[1] = NY/3; h_size[0] = 2*NX/3 - f_offset[0]; h_size[1] = 2*NY/3 - f_offset[1]; if (H5Sselect_hyperslab (s8_f_sid, H5S_SELECT_SET, f_offset, NULL, - h_size, NULL)<0) goto error; + h_size, NULL) < 0) goto error; /* Create memory data space */ - if ((s8_m_sid = H5Screate_simple (2, h_size, NULL))<0) goto error; + if ((s8_m_sid = H5Screate_simple (2, h_size, NULL)) < 0) goto error; /* Read the dataset */ s8 = calloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t)); assert (s8); - if (H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8)<0) { + if (H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) { goto error; } @@ -647,7 +647,7 @@ test_compound (char *filename, hid_t fapl) } /* Read the hyperslab */ - if (H5Dread (dataset, s2_tid, s8_f_sid, s8_f_sid, H5P_DEFAULT, s2)<0) { + if (H5Dread (dataset, s2_tid, s8_f_sid, s8_f_sid, H5P_DEFAULT, s2) < 0) { goto error; } @@ -705,7 +705,7 @@ test_compound (char *filename, hid_t fapl) } /* Read the hyperslab */ - if (H5Dread (dataset, s5_tid, s8_f_sid, s8_f_sid, PRESERVE, s5)<0) { + if (H5Dread (dataset, s5_tid, s8_f_sid, s8_f_sid, PRESERVE, s5) < 0) { goto error; } @@ -777,14 +777,14 @@ test_compound (char *filename, hid_t fapl) } /* Write to disk */ - if (H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11)<0) { + if (H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11) < 0) { goto error; } free (s11); s11=NULL; /* Read the whole thing */ - if (H5Dread (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1)<0) { + if (H5Dread (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) { goto error; } @@ -1035,31 +1035,31 @@ create_stype1(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL))<0) + if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL))<0) + if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype1)))<0 || - H5Tinsert(tid, "a", HOFFSET(stype1, a), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "b", HOFFSET(stype1, b), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "c", HOFFSET(stype1, c), array_dt1)<0 || - H5Tinsert(tid, "d", HOFFSET(stype1, d), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "e", HOFFSET(stype1, e), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "f", HOFFSET(stype1, f), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "g", HOFFSET(stype1, g), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "h", HOFFSET(stype1, h), array_dt2)<0 || - H5Tinsert(tid, "i", HOFFSET(stype1, i), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "j", HOFFSET(stype1, j), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "k", HOFFSET(stype1, k), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "l", HOFFSET(stype1, l), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "m", HOFFSET(stype1, m), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "n", HOFFSET(stype1, n), H5T_NATIVE_DOUBLE)<0) + if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 || + H5Tinsert(tid, "a", HOFFSET(stype1, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "b", HOFFSET(stype1, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "c", HOFFSET(stype1, c), array_dt1) < 0 || + H5Tinsert(tid, "d", HOFFSET(stype1, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "e", HOFFSET(stype1, e), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "f", HOFFSET(stype1, f), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "g", HOFFSET(stype1, g), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "h", HOFFSET(stype1, h), array_dt2) < 0 || + H5Tinsert(tid, "i", HOFFSET(stype1, i), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "j", HOFFSET(stype1, j), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "k", HOFFSET(stype1, k), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "l", HOFFSET(stype1, l), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "m", HOFFSET(stype1, m), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "n", HOFFSET(stype1, n), H5T_NATIVE_DOUBLE) < 0) goto error; - if(H5Tclose(array_dt1)<0) + if(H5Tclose(array_dt1) < 0) goto error; - if(H5Tclose(array_dt2)<0) + if(H5Tclose(array_dt2) < 0) goto error; return tid; @@ -1091,34 +1091,34 @@ create_stype2(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL))<0) + if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL))<0) + if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype2)))<0 || - H5Tinsert(tid, "a", HOFFSET(stype2, a), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "b", HOFFSET(stype2, b), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "c", HOFFSET(stype2, c), array_dt1)<0 || - H5Tinsert(tid, "d", HOFFSET(stype2, d), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "e", HOFFSET(stype2, e), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "f", HOFFSET(stype2, f), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "g", HOFFSET(stype2, g), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "h", HOFFSET(stype2, h), array_dt2)<0 || - H5Tinsert(tid, "i", HOFFSET(stype2, i), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "j", HOFFSET(stype2, j), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "k", HOFFSET(stype2, k), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "l", HOFFSET(stype2, l), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "m", HOFFSET(stype2, m), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "n", HOFFSET(stype2, n), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "o", HOFFSET(stype2, o), H5T_NATIVE_LONG)<0 || - H5Tinsert(tid, "p", HOFFSET(stype2, p), H5T_NATIVE_LONG)<0 || - H5Tinsert(tid, "q", HOFFSET(stype2, q), H5T_NATIVE_LONG)<0) + if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 || + H5Tinsert(tid, "a", HOFFSET(stype2, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "b", HOFFSET(stype2, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "c", HOFFSET(stype2, c), array_dt1) < 0 || + H5Tinsert(tid, "d", HOFFSET(stype2, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "e", HOFFSET(stype2, e), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "f", HOFFSET(stype2, f), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "g", HOFFSET(stype2, g), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "h", HOFFSET(stype2, h), array_dt2) < 0 || + H5Tinsert(tid, "i", HOFFSET(stype2, i), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "j", HOFFSET(stype2, j), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "k", HOFFSET(stype2, k), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "l", HOFFSET(stype2, l), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "m", HOFFSET(stype2, m), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "n", HOFFSET(stype2, n), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "o", HOFFSET(stype2, o), H5T_NATIVE_LONG) < 0 || + H5Tinsert(tid, "p", HOFFSET(stype2, p), H5T_NATIVE_LONG) < 0 || + H5Tinsert(tid, "q", HOFFSET(stype2, q), H5T_NATIVE_LONG) < 0) goto error; - if(H5Tclose(array_dt1)<0) + if(H5Tclose(array_dt1) < 0) goto error; - if(H5Tclose(array_dt2)<0) + if(H5Tclose(array_dt2) < 0) goto error; return tid; @@ -1150,18 +1150,18 @@ create_stype3(void) const hsize_t eight = 8; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL))<0) + if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype3)))<0 || - H5Tinsert(tid, "a", HOFFSET(stype3, a), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "b", HOFFSET(stype3, b), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "c", HOFFSET(stype3, c), array_dt1)<0 || - H5Tinsert(tid, "d", HOFFSET(stype3, d), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "e", HOFFSET(stype3, e), H5T_NATIVE_INT)<0) + if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 || + H5Tinsert(tid, "a", HOFFSET(stype3, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "b", HOFFSET(stype3, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "c", HOFFSET(stype3, c), array_dt1) < 0 || + H5Tinsert(tid, "d", HOFFSET(stype3, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "e", HOFFSET(stype3, e), H5T_NATIVE_INT) < 0) goto error; - if(H5Tclose(array_dt1)<0) + if(H5Tclose(array_dt1) < 0) goto error; return tid; @@ -1193,37 +1193,37 @@ create_stype4(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL))<0) + if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL))<0) + if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype4)))<0 || - H5Tinsert(tid, "a", HOFFSET(stype4, a), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "b", HOFFSET(stype4, b), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "c", HOFFSET(stype4, c), array_dt1)<0 || - H5Tinsert(tid, "d", HOFFSET(stype4, d), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "e", HOFFSET(stype4, e), H5T_NATIVE_INT)<0 || - H5Tinsert(tid, "f", HOFFSET(stype4, f), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "g", HOFFSET(stype4, g), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "h", HOFFSET(stype4, h), array_dt2)<0 || - H5Tinsert(tid, "i", HOFFSET(stype4, i), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "j", HOFFSET(stype4, j), H5T_NATIVE_FLOAT)<0 || - H5Tinsert(tid, "k", HOFFSET(stype4, k), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "l", HOFFSET(stype4, l), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "m", HOFFSET(stype4, m), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "n", HOFFSET(stype4, n), H5T_NATIVE_DOUBLE)<0 || - H5Tinsert(tid, "o", HOFFSET(stype4, o), H5T_NATIVE_LONG)<0 || - H5Tinsert(tid, "p", HOFFSET(stype4, p), H5T_NATIVE_LONG)<0 || - H5Tinsert(tid, "q", HOFFSET(stype4, q), H5T_NATIVE_LONG)<0 || - H5Tinsert(tid, "r", HOFFSET(stype4, r), H5T_NATIVE_LLONG)<0 || - H5Tinsert(tid, "s", HOFFSET(stype4, s), H5T_NATIVE_LLONG)<0 || - H5Tinsert(tid, "t", HOFFSET(stype4, t), H5T_NATIVE_LLONG)<0) + if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 || + H5Tinsert(tid, "a", HOFFSET(stype4, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "b", HOFFSET(stype4, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "c", HOFFSET(stype4, c), array_dt1) < 0 || + H5Tinsert(tid, "d", HOFFSET(stype4, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "e", HOFFSET(stype4, e), H5T_NATIVE_INT) < 0 || + H5Tinsert(tid, "f", HOFFSET(stype4, f), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "g", HOFFSET(stype4, g), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "h", HOFFSET(stype4, h), array_dt2) < 0 || + H5Tinsert(tid, "i", HOFFSET(stype4, i), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "j", HOFFSET(stype4, j), H5T_NATIVE_FLOAT) < 0 || + H5Tinsert(tid, "k", HOFFSET(stype4, k), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "l", HOFFSET(stype4, l), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "m", HOFFSET(stype4, m), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "n", HOFFSET(stype4, n), H5T_NATIVE_DOUBLE) < 0 || + H5Tinsert(tid, "o", HOFFSET(stype4, o), H5T_NATIVE_LONG) < 0 || + H5Tinsert(tid, "p", HOFFSET(stype4, p), H5T_NATIVE_LONG) < 0 || + H5Tinsert(tid, "q", HOFFSET(stype4, q), H5T_NATIVE_LONG) < 0 || + H5Tinsert(tid, "r", HOFFSET(stype4, r), H5T_NATIVE_LLONG) < 0 || + H5Tinsert(tid, "s", HOFFSET(stype4, s), H5T_NATIVE_LLONG) < 0 || + H5Tinsert(tid, "t", HOFFSET(stype4, t), H5T_NATIVE_LLONG) < 0) goto error; - if(H5Tclose(array_dt1)<0) + if(H5Tclose(array_dt1) < 0) goto error; - if(H5Tclose(array_dt2)<0) + if(H5Tclose(array_dt2) < 0) goto error; return tid; @@ -1257,11 +1257,11 @@ compare_data(void *src_data, void *dst_data, hbool_t src_subset) for(i = 0; i < (int)(NX * NY); i++) { if(src_subset) { - s_ptr = ((stype1*)src_data) + i; - d_ptr = ((stype2*)dst_data) + i; + s_ptr = ((stype1 *)src_data) + i; + d_ptr = ((stype2 *)dst_data) + i; } else { - s_ptr = ((stype2*)src_data) + i; - d_ptr = ((stype1*)dst_data) + i; + s_ptr = (stype1 *)(((stype2 *)src_data) + i); + d_ptr = (stype2 *)(((stype1 *)dst_data) + i); } if (s_ptr->a != d_ptr->a || @@ -1353,17 +1353,17 @@ test_hdf5_src_subset(char *filename, hid_t fapl) goto error; /* Build hdf5 datatypes */ - if ((src_tid=create_stype1())<0) + if ((src_tid=create_stype1()) < 0) goto error; - if ((dst_tid=create_stype2())<0) + if ((dst_tid=create_stype2()) < 0) goto error; - if ((rew_tid=create_stype3())<0) + if ((rew_tid=create_stype3()) < 0) goto error; /* Create the data space */ - if((space = H5Screate_simple(2, dims, NULL))<0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; /* Allocate space and initialize data */ @@ -1377,7 +1377,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* @@ -1387,26 +1387,26 @@ test_hdf5_src_subset(char *filename, hid_t fapl) TESTING("writing data to contiguous and chunked datasets"); /* Create contiguous data set */ - if((dataset = H5Dcreate(file, DSET_NAME[0], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[0], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Set chunking */ - if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) + if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) goto error; /* Create chunked data set */ - if((dataset = H5Dcreate(file, DSET_NAME[1], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[1], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1421,29 +1421,29 @@ test_hdf5_src_subset(char *filename, hid_t fapl) TESTING("rewriting data with a subset of original data type"); /* Create xfer properties to preserve initialized data */ - if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error; - if (H5Pset_preserve (dxpl, TRUE)<0) + if(H5Pset_preserve(dxpl, TRUE) < 0) goto error; /* Rewrite contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[0]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Rewrite chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[1]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1458,10 +1458,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl) TESTING("reading data with a subset of original data type"); /* Check contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[0]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, TRUE) < 0) @@ -1471,10 +1471,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl) goto error; /* Check chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[1]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, TRUE) < 0) @@ -1493,11 +1493,11 @@ test_hdf5_src_subset(char *filename, hid_t fapl) if(H5Pclose(dxpl) < 0) goto error; - if(H5Tclose(src_tid)<0) + if(H5Tclose(src_tid) < 0) goto error; - if(H5Tclose(dst_tid)<0) + if(H5Tclose(dst_tid) < 0) goto error; - if(H5Tclose(rew_tid)<0) + if(H5Tclose(rew_tid) < 0) goto error; if(H5Fclose(file) < 0) goto error; @@ -1558,17 +1558,17 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) goto error; /* Build hdf5 datatypes */ - if ((src_tid=create_stype2())<0) + if ((src_tid=create_stype2()) < 0) goto error; - if ((dst_tid=create_stype1())<0) + if ((dst_tid=create_stype1()) < 0) goto error; - if ((rew_tid=create_stype4())<0) + if ((rew_tid=create_stype4()) < 0) goto error; /* Create the data space */ - if((space = H5Screate_simple(2, dims, NULL))<0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; /* Allocate space and initialize data */ @@ -1581,7 +1581,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) initialize_stype4(rew_buf, (size_t)NX*NY); /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* @@ -1591,26 +1591,26 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) TESTING("writing data to contiguous and chunked datasets"); /* Create contiguous data set */ - if((dataset = H5Dcreate(file, DSET_NAME[2], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[2], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Set chunking */ - if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) + if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) goto error; /* Create chunked data set */ - if((dataset = H5Dcreate(file, DSET_NAME[3], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[3], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1625,29 +1625,29 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) TESTING("rewriting data with a subset of original data type"); /* Create xfer properties to preserve initialized data */ - if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) + if((dxpl = H5Pcreate (H5P_DATASET_XFER)) < 0) goto error; - if (H5Pset_preserve (dxpl, TRUE)<0) + if(H5Pset_preserve(dxpl, TRUE) < 0) goto error; /* Rewrite contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[2]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Rewrite chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[3]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1662,10 +1662,10 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) TESTING("reading data with a subset of original data type"); /* Check contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[2]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, FALSE) < 0) @@ -1675,10 +1675,10 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) goto error; /* Check chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[3]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, FALSE) < 0) @@ -1697,11 +1697,11 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) if(H5Pclose(dxpl) < 0) goto error; - if(H5Tclose(src_tid)<0) + if(H5Tclose(src_tid) < 0) goto error; - if(H5Tclose(dst_tid)<0) + if(H5Tclose(dst_tid) < 0) goto error; - if(H5Tclose(rew_tid)<0) + if(H5Tclose(rew_tid) < 0) goto error; if(H5Fclose(file) < 0) goto error; diff --git a/test/cross_read.c b/test/cross_read.c index bdd33c0..b036217 100755 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -75,25 +75,25 @@ static int read_data(char *fname) /* * Open the file and the dataset. */ - if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT))<0) + if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dataset = H5Dopen(file, DATASETNAME))<0) + if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* * Get datatype and dataspace handles and then query * dataset class, order, size, rank and dimensions. */ - if((dt = H5Dget_type(dataset))<0) /* datatype handle */ + if((dt = H5Dget_type(dataset)) < 0) /* datatype handle */ TEST_ERROR; - if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT))<0) + if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* * Read data from hyperslab in the file into the hyperslab in * memory and display. */ - if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out)<0) + if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0) TEST_ERROR; /* Check results */ diff --git a/test/dangle.c b/test/dangle.c index 4b1be63..834d659 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -89,7 +89,7 @@ test_dangle_dataset(H5F_close_degree_t degree) /* Try creating duplicate dataset */ H5E_BEGIN_TRY { - if((dsid = H5Dcreate (fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))>=0) + if((dsid = H5Dcreate(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) >= 0) TEST_ERROR; } H5E_END_TRY; @@ -97,14 +97,13 @@ test_dangle_dataset(H5F_close_degree_t degree) TEST_ERROR; /* Leave open a _lot_ of objects */ - for(u=0; u<MAX_DANGLE; u++) { - if((dsid = H5Dopen (fid, DSETNAME)) < 0) + for(u = 0; u < MAX_DANGLE; u++) + if((dsid = H5Dopen2(fid, DSETNAME, H5P_DEFAULT)) < 0) TEST_ERROR; - } /* end for */ - if(degree==H5F_CLOSE_SEMI) { + if(degree == H5F_CLOSE_SEMI) { H5E_BEGIN_TRY { - if(H5Fclose(fid)>=0) + if(H5Fclose(fid) >= 0) TEST_ERROR; } H5E_END_TRY; } /* end if */ diff --git a/test/dsets.c b/test/dsets.c index cf1f650..3e8a25d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -74,7 +74,7 @@ const char *FILENAME[] = { #define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip" #define DSET_SET_LOCAL_NAME "set_local" #define DSET_SET_LOCAL_NAME_2 "set_local_2" -#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" +#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" #define DSET_NBIT_INT_NAME "nbit_int" #define DSET_NBIT_FLOAT_NAME "nbit_float" #define DSET_NBIT_DOUBLE_NAME "nbit_double" @@ -88,8 +88,11 @@ const char *FILENAME[] = { #define DSET_SCALEOFFSET_FLOAT_NAME_2 "scaleoffset_float_2" #define DSET_SCALEOFFSET_DOUBLE_NAME "scaleoffset_double" #define DSET_SCALEOFFSET_DOUBLE_NAME_2 "scaleoffset_double_2" -#define DSET_COMPARE_DCPL_NAME "compare_dcpl" +#define DSET_COMPARE_DCPL_NAME "compare_dcpl" #define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2" +#define DSET_DEPREC_NAME "deprecated" +#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" +#define DSET_DEPREC_NAME_COMPACT "deprecated_compact" #define USER_BLOCK 1024 #define SIXTY_FOUR_KB 65536 @@ -208,11 +211,11 @@ test_create(hid_t file) if (dataset<0) goto error; /* Close the dataset */ - if (H5Dclose(dataset) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; /* Add a comment to the dataset */ status = H5Oset_comment(file, DSET_DEFAULT_NAME, "This is a dataset", H5P_DEFAULT); - if (status<0) goto error; + if(status < 0) goto error; /* * Try creating a dataset that already exists. This should fail since a @@ -223,7 +226,7 @@ test_create(hid_t file) dataset = H5Dcreate(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT); } H5E_END_TRY; - if (dataset >= 0) { + if(dataset >= 0) { H5_FAILED(); puts(" Library allowed overwrite of existing dataset."); goto error; @@ -233,9 +236,9 @@ test_create(hid_t file) * Open the dataset we created above and then close it. This is how * existing datasets are accessed. */ - if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; - if ((dataset = H5Dopen(file, DSET_DEFAULT_NAME)) < 0) goto error; - if (H5Dclose(dataset) < 0) goto error; + if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; + if((dataset = H5Dopen2(file, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; /* * Try opening a non-existent dataset. This should fail since new datasets @@ -243,9 +246,9 @@ test_create(hid_t file) * reporting. */ H5E_BEGIN_TRY { - dataset = H5Dopen(file, "does_not_exist"); + dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); } H5E_END_TRY; - if (dataset >= 0) { + if(dataset >= 0) { H5_FAILED(); puts(" Opened a non-existent dataset."); goto error; @@ -588,16 +591,16 @@ test_compact_io(hid_t fapl) /* * Open the file and check data */ - if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((dataset = H5Dopen(file, DSET_COMPACT_IO_NAME)) < 0) + if((dataset = H5Dopen2(file, DSET_COMPACT_IO_NAME, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR /* Check that the values read are the same as the values written */ - for (i = 0; i < 16; i++) { - for (j = 0; j < 8; j++) { + for(i = 0; i < 16; i++) + for(j = 0; j < 8; j++) if (rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -605,9 +608,7 @@ test_compact_io(hid_t fapl) printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; - } - } - } + } /* end if */ if(H5Dclose(dataset) < 0) TEST_ERROR if(H5Fclose(file) < 0) TEST_ERROR @@ -678,41 +679,39 @@ test_max_compact(hid_t fapl) assert(status >= 0); /* Create and write to a compact dataset */ - if((dataset = H5Dcreate(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, - plist)) < 0) + if((dataset = H5Dcreate(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, plist)) < 0) goto error; if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) goto error; /* Close file */ - H5Sclose(space); - H5Pclose(plist); - H5Dclose(dataset); - H5Fclose(file); + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(plist) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; /* * Open the file and check data */ - if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; - if((dataset = H5Dopen(file, DSET_COMPACT_MAX_NAME)) < 0) + if((dataset = H5Dopen2(file, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0) goto error; if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) goto error; - /* Check that the values read are the same as the values written */ - for (i = 0; i < (int)compact_size; i++) { - if (rbuf[i] != wbuf[i]) { + /* Check that the values read are the same as the values written */ + for(i = 0; i < (int)compact_size; i++) + if(rbuf[i] != wbuf[i]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d\n", i); goto error; - } - } + } /* end if */ - H5Dclose(dataset); - H5Fclose(file); + if(H5Dclose(dataset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; HDfree(wbuf); HDfree(rbuf); @@ -1505,16 +1504,16 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, */ TESTING(" filters (re-open)"); - if (H5Dclose (dataset) < 0) TEST_ERROR; - if ((dataset = H5Dopen (fid, name)) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if((dataset = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) TEST_ERROR; + if(status >= 0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; @@ -1523,28 +1522,28 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) TEST_ERROR; - } else { - if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) - TEST_ERROR; + if(status >= 0) TEST_ERROR; + } /* end if */ + else { + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { - if (points[i][j] != check[i][j]) { + for(i = 0; i < size[0]; i++) + for(j = 0; j < size[1]; j++) + if(points[i][j] != check[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; - } - } - } - } + } /* end if */ + } /* end else */ PASSED(); @@ -1668,21 +1667,20 @@ test_filter_noencoder(const char *dset_name, hid_t fapl) * Create the name of the file to open (in case we are using the --srcdir * option and the file is in a different directory from this test). */ - if (srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile)) ) - { + if(srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile))) { HDstrcpy(testfile, srcdir); HDstrcat(testfile, "/"); } HDstrcat(testfile, NOENCODER_FILENAME); file_id = H5Fopen(testfile, H5F_ACC_RDWR, fapl); - if (file_id < 0) goto error; + if(file_id < 0) goto error; - dset_id = H5Dopen(file_id, dset_name); - if (dset_id < 0) goto error; + dset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT); + if(dset_id < 0) goto error; space_id = H5Screate_simple(1, &dims, NULL); - if (space_id < 0) goto error; + if(space_id < 0) goto error; TESTING(" decoding without encoder"); @@ -2320,47 +2318,47 @@ test_missing_filter(hid_t file) /* Try reading existing dataset with deflate filter */ /* Compose the name of the file to open, using the srcdir, if appropriate */ - if (srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_DEFLATE_NAME) + 1) < sizeof(testfile))){ + if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_DEFLATE_NAME) + 1) < sizeof(testfile))){ HDstrcpy(testfile, srcdir); HDstrcat(testfile, "/"); } HDstrcat(testfile, FILE_DEFLATE_NAME); /* Open existing file */ - if((fid=H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { + if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open existing deflated file\n",__LINE__); + printf(" Line %d: Can't open existing deflated file\n", __LINE__); goto error; } /* end if */ /* Open dataset */ - if ((dsid = H5Dopen(fid, "Dataset1")) < 0) { + if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n",__LINE__); + printf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Read data (should fail, since deflate filter is missing) */ H5E_BEGIN_TRY { - ret=H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check); + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check); } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n",__LINE__); + printf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + printf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n",__LINE__); + printf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -4630,7 +4628,7 @@ test_multiopen (hid_t file) if(H5Pset_chunk(dcpl, 1, cur_size) < 0) goto error; if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; if((dset1 = H5Dcreate(file, "multiopen", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; - if((dset2 = H5Dopen(dset1, ".")) < 0) goto error; + if((dset2 = H5Dopen2(dset1, ".", H5P_DEFAULT)) < 0) goto error; if(H5Sclose(space) < 0) goto error; /* Extend with the first handle */ @@ -4644,7 +4642,7 @@ test_multiopen (hid_t file) H5_FAILED(); printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); goto error; - } + } /* end if */ if(H5Dclose(dset1) < 0) goto error; if(H5Dclose(dset2) < 0) goto error; @@ -5256,56 +5254,56 @@ test_set_local(hid_t fapl) /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + printf(" Line %d: Can't close dataspace\n", __LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + printf(" Line %d: Can't close dcpl\n", __LINE__); goto error; } /* end if */ /* Close file (flushes & empties cache) */ - if (H5Fclose(file) < 0) { + if(H5Fclose(file) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n",__LINE__); + printf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ /* Open file */ - if ((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n",__LINE__); + printf(" Line %d: Can't open file\n", __LINE__); goto error; } /* Re-open dataset */ - if ((dsid = H5Dopen(file, DSET_SET_LOCAL_NAME)) < 0) { + if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n",__LINE__); + printf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ - if((dset_size=H5Dget_storage_size(dsid))==0) { + if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + printf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ - if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) { + if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ - if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + printf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -5327,35 +5325,35 @@ test_set_local(hid_t fapl) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + printf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Re-open second dataset */ - if ((dsid = H5Dopen(file, DSET_SET_LOCAL_NAME_2)) < 0) { + if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME_2, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n",__LINE__); + printf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ - if((dset_size=H5Dget_storage_size(dsid))==0) { + if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + printf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ - if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) { + if((H5Tget_size(H5T_NATIVE_DOUBLE) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ - if (H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) { + if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + printf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -5636,45 +5634,44 @@ auxread_fdata(hid_t fid, const char *name) hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ int i; - if ((dset_id=H5Dopen(fid,name)) < 0) + if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto error; - if ((space_id=H5Dget_space(dset_id)) < 0) + if((space_id = H5Dget_space(dset_id)) < 0) goto error; - if ((ftype_id=H5Dget_type (dset_id)) < 0) + if((ftype_id = H5Dget_type(dset_id)) < 0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_id)) < 0) + if((dcpl_id = H5Dget_create_plist(dset_id)) < 0) goto error; - if ( (rank=H5Sget_simple_extent_ndims(space_id)) < 0) + if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) goto error; HDmemset(dims, 0, sizeof dims); - if ( H5Sget_simple_extent_dims(space_id,dims,NULL) < 0) + if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) goto error; - nelmts=1; - for (i=0; i<rank; i++) - nelmts*=dims[i]; - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT)) < 0) + nelmts = 1; + for(i = 0; i < rank; i++) + nelmts *= dims[i]; + if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0) goto error; - if ((msize=H5Tget_size(mtype_id))==0) + if((msize = H5Tget_size(mtype_id)) == 0) goto error; - if (nelmts) - { + if(nelmts) { buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { printf( "cannot read into memory\n" ); goto error; } - if (H5Dread(dset_id,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) + if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; } - if (H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto error; - if (H5Sclose(space_id) < 0) + if(H5Sclose(space_id) < 0) goto error; - if (H5Dclose(dset_id) < 0) + if(H5Dclose(dset_id) < 0) goto error; - if (buf) + if(buf) free(buf); return 0; @@ -5964,7 +5961,7 @@ error: return -1; } /* end test_zero_dims() */ - + /*------------------------------------------------------------------------- * Function: test_random_chunks * @@ -5989,7 +5986,7 @@ test_random_chunks(void) hid_t s=-1, m=-1, d=-1, dcpl=-1, file=-1; int wbuf[NPOINTS], rbuf[NPOINTS], - check[20][20]; + check2[20][20]; hsize_t coord[NPOINTS][2]; hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200}; hsize_t msize[1]={NPOINTS}; @@ -6023,66 +6020,66 @@ test_random_chunks(void) /* Initialization of check array for repeated coordinates */ for (i=0; i<dsize[0]/csize[0]; i++) for (j=0; j<dsize[1]/csize[1]; j++) - check[i][j] = 0; + check2[i][j] = 0; /* Generate random point coordinates. Only one point is selected per chunk */ for (i=0; i<NPOINTS; i++){ do { chunk_row = (int)HDrandom () % (dsize[0]/csize[0]); chunk_col = (int)HDrandom () % (dsize[1]/csize[1]); - } while (check[chunk_row][chunk_col]); + } while (check2[chunk_row][chunk_col]); - wbuf[i] = check[chunk_row][chunk_col] = chunk_row+chunk_col+1; + wbuf[i] = check2[chunk_row][chunk_col] = chunk_row+chunk_col+1; coord[i][0] = chunk_row * csize[0]; coord[i][1] = chunk_col * csize[1]; } /* Create dataspace for write buffer */ - if ((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + 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, 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; + if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; /* Close resources*/ - if (H5Sclose(s) < 0) TEST_ERROR; - if (H5Sclose(m) < 0) TEST_ERROR; - if (H5Pclose(dcpl) < 0) TEST_ERROR; - if (H5Dclose(d) < 0) TEST_ERROR; - if (H5Fclose(file) < 0) TEST_ERROR; + if(H5Sclose(s) < 0) TEST_ERROR; + if(H5Sclose(m) < 0) TEST_ERROR; + if(H5Pclose(dcpl) < 0) TEST_ERROR; + if(H5Dclose(d) < 0) TEST_ERROR; + if(H5Fclose(file) < 0) TEST_ERROR; /* Open file again */ - if ((file = H5Fopen(RC_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; + if((file = H5Fopen(RC_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; /* Open dataset */ - if ((d = H5Dopen(file, dname)) < 0) TEST_ERROR; + if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get dataset dataspace */ - if ((s = H5Dget_space(d)) < 0) TEST_ERROR; + if((s = H5Dget_space(d)) < 0) TEST_ERROR; /* Create dataspace for read buffer */ - if ((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + 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, 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; + if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; /* Verify that written and read data are the same */ - for (i=0; i<NPOINTS; i++) - if (rbuf[i]!=wbuf[i]){ + for(i = 0; i < NPOINTS; i++) + if(rbuf[i] != wbuf[i]){ printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ /* Close resources */ - if (H5Sclose(s) < 0) TEST_ERROR; - if (H5Sclose(m) < 0) TEST_ERROR; - if (H5Dclose(d) < 0) TEST_ERROR; - if (H5Fclose(file) < 0) TEST_ERROR; + if(H5Sclose(s) < 0) TEST_ERROR; + if(H5Sclose(m) < 0) TEST_ERROR; + if(H5Dclose(d) < 0) TEST_ERROR; + if(H5Fclose(file) < 0) TEST_ERROR; /* Remove file */ HDremove(RC_FILENAME); @@ -6115,66 +6112,66 @@ test_random_chunks(void) /* Initialize check buffer for repeated coordinates */ for(i = 0; i < nsize[0]/csize[0]; i++) for(j = 0; j < nsize[1] / csize[1]; j++) - check[i][j] = 0; + check2[i][j] = 0; /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ do { chunk_row = (int)HDrandom() % (nsize[0] / csize[0]); chunk_col = (int)HDrandom() % (nsize[1] / csize[1]); - } while (check[chunk_row][chunk_col]); + } while (check2[chunk_row][chunk_col]); - wbuf[i] = check[chunk_row][chunk_col] = chunk_row + chunk_col + 1; + wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1; coord[i][0] = chunk_row * csize[0]; coord[i][1] = chunk_col * csize[1]; } /* Create dataspace for write buffer */ - if ((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + 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, 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; + if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; /* Close resources */ - if (H5Sclose(s) < 0) TEST_ERROR; - if (H5Sclose(m) < 0) TEST_ERROR; - if (H5Pclose(dcpl) < 0) TEST_ERROR; - if (H5Dclose(d) < 0) TEST_ERROR; - if (H5Fclose(file) < 0) TEST_ERROR; + if(H5Sclose(s) < 0) TEST_ERROR; + if(H5Sclose(m) < 0) TEST_ERROR; + if(H5Pclose(dcpl) < 0) TEST_ERROR; + if(H5Dclose(d) < 0) TEST_ERROR; + if(H5Fclose(file) < 0) TEST_ERROR; /* Open file again */ - if ((file = H5Fopen(RC_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; + if((file = H5Fopen(RC_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; /* Open dataset */ - if ((d = H5Dopen(file, dname)) < 0) TEST_ERROR; + if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get dataset dataspace */ - if ((s = H5Dget_space(d)) < 0) TEST_ERROR; + if((s = H5Dget_space(d)) < 0) TEST_ERROR; /* Create dataspace for read buffer */ - if ((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + 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, 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; + if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; /* Verify that written and read data are the same */ - for (i=0; i<NPOINTS; i++) - if (rbuf[i]!=wbuf[i]){ + for(i = 0; i < NPOINTS; i++) + if(rbuf[i] != wbuf[i]){ printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ /* Close resources */ - if (H5Sclose(s) < 0) TEST_ERROR; - if (H5Sclose(m) < 0) TEST_ERROR; - if (H5Dclose(d) < 0) TEST_ERROR; - if (H5Fclose(file) < 0) TEST_ERROR; + if(H5Sclose(s) < 0) TEST_ERROR; + if(H5Sclose(m) < 0) TEST_ERROR; + if(H5Dclose(d) < 0) TEST_ERROR; + if(H5Fclose(file) < 0) TEST_ERROR; /* Remove file */ HDremove(RC_FILENAME); @@ -6193,6 +6190,159 @@ error: return -1; } /* end test_random_chunks() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/*------------------------------------------------------------------------- + * Function: test_deprec + * + * Purpose: Tests deprecated API symbols + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Monday, October 8, 2007 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_deprec(hid_t file) +{ + hid_t dataset, space, small_space, create_parms; + hsize_t dims[2], small_dims[2]; + herr_t status; + hsize_t csize[2]; + + TESTING("deprecated API routines"); + + /* Create the data space */ + dims[0] = 256; + dims[1] = 512; + space = H5Screate_simple(2, dims, NULL); + assert(space>=0); + + /* Create a small data space for compact dataset */ + small_dims[0] = 16; + small_dims[1] = 8; + small_space = H5Screate_simple(2, small_dims, NULL); + assert(space>=0); + + /* + * Create a dataset using the default dataset creation properties. We're + * not sure what they are, so we won't check. + */ + if(( dataset = H5Dcreate(file, DSET_DEPREC_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT)) < 0) goto error; + + /* Close the dataset */ + if(H5Dclose(dataset) < 0) goto error; + + /* + * Try creating a dataset that already exists. This should fail since a + * dataset can only be created once. Temporarily turn off error + * reporting. + */ + H5E_BEGIN_TRY { + dataset = H5Dcreate(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, + H5P_DEFAULT); + } H5E_END_TRY; + if(dataset >= 0) { + H5_FAILED(); + puts(" Library allowed overwrite of existing dataset."); + goto error; + } + + /* + * Open the dataset we created above and then close it. This is how + * existing datasets are accessed. + */ + if((dataset = H5Dopen1(file, DSET_DEPREC_NAME)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + + /* + * Try opening a non-existent dataset. This should fail since new datasets + * cannot be created with this function. Temporarily turn off error + * reporting. + */ + H5E_BEGIN_TRY { + dataset = H5Dopen1(file, "does_not_exist"); + } H5E_END_TRY; + if(dataset >= 0) { + H5_FAILED(); + puts(" Opened a non-existent dataset."); + goto error; + } + + /* + * Create a new dataset that uses chunked storage instead of the default + * layout. + */ + create_parms = H5Pcreate(H5P_DATASET_CREATE); + assert(create_parms >= 0); + + /* Attempt to create a dataset with invalid chunk sizes */ + csize[0] = dims[0]*2; + csize[1] = dims[1]*2; + status = H5Pset_chunk(create_parms, 2, csize); + assert(status >= 0); + H5E_BEGIN_TRY { + dataset = H5Dcreate(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, + create_parms); + } H5E_END_TRY; + if(dataset >= 0) { + H5_FAILED(); + puts(" Opened a dataset with incorrect chunking parameters."); + goto error; + } + + csize[0] = 5; + csize[1] = 100; + status = H5Pset_chunk(create_parms, 2, csize); + assert(status >= 0); + + if((dataset = H5Dcreate(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms)) < 0) goto error; + H5Pclose(create_parms); + + /* + * Close the chunked dataset. + */ + if (H5Dclose(dataset) < 0) goto error; + + + /* + * Open the dataset we created above and then close it. This is how + * existing datasets are accessed. + */ + if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_CHUNKED)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + + /* + * Create a compact dataset, then close it. + */ + create_parms = H5Pcreate(H5P_DATASET_CREATE); + assert(create_parms >= 0); + status = H5Pset_layout(create_parms, H5D_COMPACT); + assert(status >= 0); + status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY); + assert(status >= 0); + + if(( dataset = H5Dcreate(file, DSET_DEPREC_NAME_COMPACT, H5T_NATIVE_DOUBLE, small_space, create_parms)) < 0) goto error; + H5Pclose(create_parms); + if(H5Dclose(dataset) < 0) goto error; + + /* + * Open the dataset we created above and then close it. This is how + * existing datasets are accessed. + */ + if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + + PASSED(); + return 0; + + error: + return -1; +} /* end test_deprec() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -6278,40 +6428,43 @@ main(void) if(H5Gclose(grp) < 0) goto error; - nerrors += (test_create(file) < 0 ? 1: 0); - nerrors += (test_simple_io(my_fapl) < 0 ? 1: 0); - nerrors += (test_compact_io(my_fapl) < 0 ? 1: 0); - nerrors += (test_max_compact(my_fapl) < 0 ? 1: 0); - nerrors += (test_conv_buffer(file) < 0 ? 1: 0); - nerrors += (test_tconv(file) < 0 ? 1: 0); - nerrors += (test_filters(file, my_fapl) < 0 ? 1: 0); - nerrors += (test_onebyte_shuffle(file) < 0 ? 1: 0); - nerrors += (test_nbit_int(file) < 0 ? 1: 0); - nerrors += (test_nbit_float(file) < 0 ? 1: 0); - nerrors += (test_nbit_double(file) < 0 ? 1: 0); - nerrors += (test_nbit_array(file) < 0 ? 1: 0); - nerrors += (test_nbit_compound(file) < 0 ? 1: 0); - nerrors += (test_nbit_compound_2(file) < 0 ? 1: 0); - nerrors += (test_nbit_compound_3(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_int(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_int_2(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_float(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_float_2(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_double(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_double_2(file) < 0 ? 1: 0); - nerrors += (test_multiopen (file) < 0 ? 1: 0); - nerrors += (test_types(file) < 0 ? 1: 0); - nerrors += (test_userblock_offset(my_fapl) < 0 ? 1: 0); - nerrors += (test_missing_filter(file) < 0 ? 1: 0); - nerrors += (test_can_apply(file) < 0 ? 1: 0); - nerrors += (test_set_local(my_fapl) < 0 ? 1: 0); - nerrors += (test_can_apply_szip(file) < 0 ? 1: 0); - nerrors += (test_compare_dcpl(file) < 0 ? 1: 0); - nerrors += (test_filter_delete(file) < 0 ? 1: 0); - nerrors += (test_filters_endianess(my_fapl) < 0 ? 1: 0); - nerrors += (test_zero_dims(file) < 0 ? 1: 0); - nerrors += (test_missing_chunk(file) < 0 ? 1: 0); - nerrors += (test_random_chunks() < 0 ? 1: 0); + nerrors += (test_create(file) < 0 ? 1 : 0); + nerrors += (test_simple_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); + nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); + nerrors += (test_tconv(file) < 0 ? 1 : 0); + nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int(file) < 0 ? 1 : 0); + nerrors += (test_nbit_float(file) < 0 ? 1 : 0); + nerrors += (test_nbit_double(file) < 0 ? 1 : 0); + nerrors += (test_nbit_array(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); + nerrors += (test_multiopen (file) < 0 ? 1 : 0); + nerrors += (test_types(file) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(my_fapl) < 0 ? 1 : 0); + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + nerrors += (test_can_apply(file) < 0 ? 1 : 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); + nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); + nerrors += (test_filter_delete(file) < 0 ? 1 : 0); + nerrors += (test_filters_endianess(my_fapl) < 0 ? 1 : 0); + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); + nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); + nerrors += (test_random_chunks() < 0 ? 1 : 0); +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += (test_deprec(file) < 0 ? 1 : 0); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ if(H5Fclose(file) < 0) goto error; diff --git a/test/dtypes.c b/test/dtypes.c index b327344..d509a39 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -179,28 +179,28 @@ test_classes(void) /*------------------------------------------------------------- * Check class of some atomic types. *-----------------------------------------------------------*/ - if ((tcls=H5Tget_class(H5T_NATIVE_INT))<0) TEST_ERROR + if ((tcls=H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR if (H5T_INTEGER!=tcls) TEST_ERROR - if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE))<0) TEST_ERROR + if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR if (H5T_FLOAT!=tcls) TEST_ERROR /* Create a VL datatype of char. It should be a VL, not a string class. */ - if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR))<0) TEST_ERROR + if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ - if ((tcls=H5Tget_class(vlc_id))<0) TEST_ERROR + if ((tcls=H5Tget_class(vlc_id)) < 0) TEST_ERROR if (H5T_VLEN!=tcls) TEST_ERROR /* Make certain that an incorrect class is not detected */ if (H5T_STRING==tcls) TEST_ERROR /* Create a VL string. It should be a string, not a VL class. */ - if((vls_id=H5Tcopy(H5T_C_S1))<0) TEST_ERROR - if(H5Tset_size(vls_id, H5T_VARIABLE)<0) TEST_ERROR; + if((vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if(H5Tset_size(vls_id, H5T_VARIABLE) < 0) TEST_ERROR; /* Make certain that the correct classes can be detected */ - if ((tcls=H5Tget_class(vls_id))<0) TEST_ERROR + if ((tcls=H5Tget_class(vls_id)) < 0) TEST_ERROR if (H5T_STRING!=tcls) TEST_ERROR /* Make certain that an incorrect class is not detected */ @@ -210,31 +210,31 @@ test_classes(void) * Check class for member types of compound type. *-----------------------------------------------------------*/ /* Create a compound datatype and insert some complex types */ - if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex)))<0) TEST_ERROR - if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id)<0) TEST_ERROR - if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id)<0) TEST_ERROR + if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR + if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR + if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR nmembs = H5Tget_nmembers(cmpd_id); for (i=0;i<nmembs;i++) { /* Get member type ID */ - if((memb_id = H5Tget_member_type(cmpd_id, i))<0) TEST_ERROR + if((memb_id = H5Tget_member_type(cmpd_id, i)) < 0) TEST_ERROR /* Get member type class */ - if((memb_cls = H5Tget_member_class (cmpd_id, i))<0) TEST_ERROR + if((memb_cls = H5Tget_member_class (cmpd_id, i)) < 0) TEST_ERROR /* Verify member class */ - if(H5Tdetect_class (memb_id, memb_cls)<0) TEST_ERROR + if(H5Tdetect_class (memb_id, memb_cls) < 0) TEST_ERROR /* Close member type ID */ - if(H5Tclose(memb_id)<0) TEST_ERROR + if(H5Tclose(memb_id) < 0) TEST_ERROR } /* Close datatypes */ - if(H5Tclose(cmpd_id)<0) TEST_ERROR - if(H5Tclose(vlc_id)<0) TEST_ERROR - if(H5Tclose(vls_id)<0) TEST_ERROR + if(H5Tclose(cmpd_id) < 0) TEST_ERROR + if(H5Tclose(vlc_id) < 0) TEST_ERROR + if(H5Tclose(vls_id) < 0) TEST_ERROR PASSED(); return 0; @@ -349,12 +349,12 @@ test_detect(void) * Test class of a compound type with some atomic types as fields. *------------------------------------------------------------------------------*/ /* Create a compound datatype and insert some atomic types */ - if ((atom_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct atomic)))<0) TEST_ERROR - if (H5Tinsert(atom_cmpd_id, "i", HOFFSET(struct atomic, i), H5T_NATIVE_INT)<0) TEST_ERROR - if (H5Tinsert(atom_cmpd_id, "f", HOFFSET(struct atomic, f), H5T_NATIVE_FLOAT)<0) TEST_ERROR - if (H5Tinsert(atom_cmpd_id, "c", HOFFSET(struct atomic, c), H5T_NATIVE_CHAR)<0) TEST_ERROR - if (H5Tinsert(atom_cmpd_id, "d", HOFFSET(struct atomic, d), H5T_NATIVE_DOUBLE)<0) TEST_ERROR - if (H5Tinsert(atom_cmpd_id, "s", HOFFSET(struct atomic, s), H5T_NATIVE_SHORT)<0) TEST_ERROR + if ((atom_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct atomic))) < 0) TEST_ERROR + if (H5Tinsert(atom_cmpd_id, "i", HOFFSET(struct atomic, i), H5T_NATIVE_INT) < 0) TEST_ERROR + if (H5Tinsert(atom_cmpd_id, "f", HOFFSET(struct atomic, f), H5T_NATIVE_FLOAT) < 0) TEST_ERROR + if (H5Tinsert(atom_cmpd_id, "c", HOFFSET(struct atomic, c), H5T_NATIVE_CHAR) < 0) TEST_ERROR + if (H5Tinsert(atom_cmpd_id, "d", HOFFSET(struct atomic, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR + if (H5Tinsert(atom_cmpd_id, "s", HOFFSET(struct atomic, s), H5T_NATIVE_SHORT) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_cmpd_id,H5T_COMPOUND)!=TRUE) TEST_ERROR @@ -392,7 +392,7 @@ test_detect(void) if(H5Tdetect_class(atom_arr_id,H5T_INTEGER)!=FALSE) TEST_ERROR /* Create a VL datatype with an atomic base type of float*/ - if((atom_vlf_id=H5Tvlen_create(H5T_NATIVE_FLOAT))<0) TEST_ERROR + if((atom_vlf_id=H5Tvlen_create(H5T_NATIVE_FLOAT)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_vlf_id,H5T_VLEN)!=TRUE) TEST_ERROR @@ -404,7 +404,7 @@ test_detect(void) /* Create a VL datatype with an atomic base type of char. It should be a VL * but not a string class. */ - if((atom_vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR))<0) TEST_ERROR + if((atom_vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_vlc_id,H5T_VLEN)!=TRUE) TEST_ERROR @@ -414,8 +414,8 @@ test_detect(void) if(H5Tdetect_class(atom_vlc_id,H5T_STRING)!=FALSE) TEST_ERROR /* Create a VL string. It should be a string, not a VL class. */ - if((atom_vls_id=H5Tcopy(H5T_C_S1))<0) TEST_ERROR - if(H5Tset_size(atom_vls_id, H5T_VARIABLE)<0) TEST_ERROR; + if((atom_vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if(H5Tset_size(atom_vls_id, H5T_VARIABLE) < 0) TEST_ERROR; /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_vls_id,H5T_STRING)!=TRUE) TEST_ERROR @@ -427,12 +427,12 @@ test_detect(void) * Test class of a compound type with some complex types as fields. *------------------------------------------------------------------------------*/ /* Create a compound datatype and insert some complex types */ - if ((cplx_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex)))<0) TEST_ERROR - if (H5Tinsert(cplx_cmpd_id, "arr_r", HOFFSET(struct complex, arr_r), atom_arr_id)<0) TEST_ERROR - if (H5Tinsert(cplx_cmpd_id, "i", HOFFSET(struct complex, i), H5T_NATIVE_INT)<0) TEST_ERROR - if (H5Tinsert(cplx_cmpd_id, "vl_f", HOFFSET(struct complex, vl_f), atom_vlf_id)<0) TEST_ERROR - if (H5Tinsert(cplx_cmpd_id, "c", HOFFSET(struct complex, c), H5T_NATIVE_CHAR)<0) TEST_ERROR - if (H5Tinsert(cplx_cmpd_id, "s", HOFFSET(struct complex, s), H5T_NATIVE_SHORT)<0) TEST_ERROR + if ((cplx_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR + if (H5Tinsert(cplx_cmpd_id, "arr_r", HOFFSET(struct complex, arr_r), atom_arr_id) < 0) TEST_ERROR + if (H5Tinsert(cplx_cmpd_id, "i", HOFFSET(struct complex, i), H5T_NATIVE_INT) < 0) TEST_ERROR + if (H5Tinsert(cplx_cmpd_id, "vl_f", HOFFSET(struct complex, vl_f), atom_vlf_id) < 0) TEST_ERROR + if (H5Tinsert(cplx_cmpd_id, "c", HOFFSET(struct complex, c), H5T_NATIVE_CHAR) < 0) TEST_ERROR + if (H5Tinsert(cplx_cmpd_id, "s", HOFFSET(struct complex, s), H5T_NATIVE_SHORT) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(cplx_cmpd_id,H5T_COMPOUND)!=TRUE) TEST_ERROR @@ -448,22 +448,22 @@ test_detect(void) if(H5Tdetect_class(cplx_cmpd_id,H5T_STRING)!=FALSE) TEST_ERROR /* Close complex compound datatype */ - if(H5Tclose(cplx_cmpd_id)<0) TEST_ERROR + if(H5Tclose(cplx_cmpd_id) < 0) TEST_ERROR /* Close atomic VL datatype of float */ - if(H5Tclose(atom_vlf_id)<0) TEST_ERROR + if(H5Tclose(atom_vlf_id) < 0) TEST_ERROR /* Close atomic VL datatype of char */ - if(H5Tclose(atom_vlc_id)<0) TEST_ERROR + if(H5Tclose(atom_vlc_id) < 0) TEST_ERROR /* Close atomic VL string datatype */ - if(H5Tclose(atom_vls_id)<0) TEST_ERROR + if(H5Tclose(atom_vls_id) < 0) TEST_ERROR /* Close atomic array datatype */ - if(H5Tclose(atom_arr_id)<0) TEST_ERROR + if(H5Tclose(atom_arr_id) < 0) TEST_ERROR /* Close atomic compound datatype */ - if(H5Tclose(atom_cmpd_id)<0) TEST_ERROR + if(H5Tclose(atom_cmpd_id) < 0) TEST_ERROR PASSED(); return 0; @@ -507,7 +507,7 @@ test_compound_1(void) TESTING("compound datatypes"); /* Create the empty type */ - if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t)))<0) goto error; + if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0) goto error; /* Attempt to add the new compound datatype as a field within itself */ H5E_BEGIN_TRY { @@ -521,9 +521,9 @@ test_compound_1(void) /* Add a couple fields */ if (H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), - H5T_NATIVE_DOUBLE)<0) goto error; + H5T_NATIVE_DOUBLE) < 0) goto error; if (H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), - H5T_NATIVE_DOUBLE)<0) goto error; + H5T_NATIVE_DOUBLE) < 0) goto error; /* Test some functions that aren't supposed to work for compound type */ H5E_BEGIN_TRY { @@ -635,7 +635,7 @@ test_compound_1(void) goto error; } /* end if */ - if (H5Tclose (complex_id)<0) goto error; + if (H5Tclose (complex_id) < 0) goto error; PASSED(); return 0; @@ -700,27 +700,27 @@ test_compound_2(void) /* Build hdf5 datatypes */ array_dt = H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || - H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt)<0 || - H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0) + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || - H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 || - H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT)<0 || - H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt)<0 || - H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT)<0 || - H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0) + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || + H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); /* Perform the conversion */ - if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT) < 0) goto error; /* Compare results */ for (i=0; i<(int)nelmts; i++) { @@ -750,7 +750,7 @@ test_compound_2(void) free(buf); free(bkg); free(orig); - if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error; + if (H5Tclose(st) < 0 || H5Tclose(dt) < 0) goto error; PASSED(); reset_hdf5(); @@ -817,25 +817,25 @@ test_compound_3(void) /* Build hdf5 datatypes */ array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || - H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt)<0 || - H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0) + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || - H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 || - H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt)<0 || - H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0) + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || + H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); /* Perform the conversion */ - if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) + if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT) < 0) goto error; /* Compare results */ @@ -864,7 +864,7 @@ test_compound_3(void) free(buf); free(bkg); free(orig); - if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error; + if (H5Tclose(st) < 0 || H5Tclose(dt) < 0) goto error; PASSED(); reset_hdf5(); @@ -935,27 +935,27 @@ test_compound_4(void) /* Build hdf5 datatypes */ array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || - H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt)<0 || - H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 || - H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0) + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || - H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 || - H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT)<0 || - H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt)<0 || - H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT)<0 || - H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0) + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT) < 0 || + H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || + H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT) < 0 || + H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0) goto error; H5Tclose(array_dt); /* Perform the conversion */ - if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) + if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT) < 0) goto error; /* Compare results */ @@ -986,7 +986,7 @@ test_compound_4(void) free(buf); free(bkg); free(orig); - if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error; + if (H5Tclose(st) < 0 || H5Tclose(dt) < 0) goto error; PASSED(); reset_hdf5(); @@ -1157,22 +1157,22 @@ test_compound_6(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || - H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_SHORT)<0 || - H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_SHORT)<0) { + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_SHORT) < 0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_SHORT) < 0) { H5_FAILED(); goto error; } - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || - H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_LONG)<0 || - H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_LONG)<0) { + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_LONG) < 0 || + H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_LONG) < 0) { H5_FAILED(); goto error; } /* Perform the conversion */ - if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) { + if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT) < 0) { H5_FAILED(); goto error; } @@ -1197,7 +1197,7 @@ test_compound_6(void) free(buf); free(bkg); free(orig); - if (H5Tclose(st)<0 || H5Tclose(dt)<0) { + if (H5Tclose(st) < 0 || H5Tclose(dt) < 0) { H5_FAILED(); goto error; } @@ -1252,25 +1252,25 @@ test_compound_7(void) TESTING("compound element insertion"); - if((tid1= H5Tcreate( H5T_COMPOUND, sizeof(struct s1)))<0) { + if((tid1= H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_INT)<0) { + if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_INT) < 0) { H5_FAILED(); printf("Can't insert field 'a'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_FLOAT)<0) { + if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); printf("Can't insert field 'b'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1,"c",HOFFSET(struct s1,c),H5T_NATIVE_LONG)<0) { + if(H5Tinsert(tid1,"c",HOFFSET(struct s1,c),H5T_NATIVE_LONG) < 0) { H5_FAILED(); printf("Can't insert field 'c'\n"); goto error; @@ -1282,7 +1282,7 @@ test_compound_7(void) goto error; } /* end if */ - if((tid2= H5Tcopy(tid1))<0) { + if((tid2= H5Tcopy(tid1)) < 0) { H5_FAILED(); printf("Can't copy datatype\n"); goto error; @@ -1315,13 +1315,13 @@ test_compound_7(void) } /* end if */ /* Increase compound type size and try inserting field again */ - if(H5Tset_size(tid2, sizeof(struct s2))<0) { + if(H5Tset_size(tid2, sizeof(struct s2)) < 0) { H5_FAILED(); printf("Can't increase size for compound type\n"); goto error; } /* end if */ - if( H5Tinsert(tid2,"d",HOFFSET(struct s2,d),H5T_NATIVE_DOUBLE)<0) { + if( H5Tinsert(tid2,"d",HOFFSET(struct s2,d),H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); printf("Can't expand compound datatype\n"); goto error; @@ -1334,7 +1334,7 @@ test_compound_7(void) } /* end if */ /* Release resources */ - if (H5Tclose(tid1)<0 || H5Tclose(tid2)<0) { + if (H5Tclose(tid1) < 0 || H5Tclose(tid2) < 0) { H5_FAILED(); printf("Can't close datatypes\n"); goto error; @@ -1384,39 +1384,39 @@ test_compound_8(void) TESTING("packing compound datatypes"); /* Create first compound datatype */ - if((tid1 = H5Tcreate( H5T_COMPOUND, sizeof(struct s1)))<0) { + if((tid1 = H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_CHAR)<0) { + if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'a'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_INT)<0) { + if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'b'\n"); goto error; } /* end if */ /* Test H5Tpack for the first compound type */ - if(H5Tpack(tid1)<0) { + if(H5Tpack(tid1) < 0) { H5_FAILED(); AT(); printf("Can't pack the compound datatype\n"); goto error; } /* end if */ - if(H5Tlock(tid1)<0) { + if(H5Tlock(tid1) < 0) { H5_FAILED(); AT(); printf("Can't lock the compound datatype\n"); goto error; } /* end if */ /* If the type is already packed, packing a locked type is OK */ - if(H5Tpack(tid1)<0) { + if(H5Tpack(tid1) < 0) { H5_FAILED(); AT(); printf("Can't pack the compound datatype for second time\n"); goto error; @@ -1424,53 +1424,53 @@ test_compound_8(void) /* Create second compound datatype */ - if((tid2 = H5Tcreate( H5T_COMPOUND, sizeof(struct s2)))<0) { + if((tid2 = H5Tcreate( H5T_COMPOUND, sizeof(struct s2))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(tid2,"c",HOFFSET(struct s2,c),H5T_NATIVE_CHAR)<0) { + if(H5Tinsert(tid2,"c",HOFFSET(struct s2,c),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c'\n"); goto error; } /* end if */ - if(H5Tinsert(tid2,"d",HOFFSET(struct s2,d),tid1)<0) { + if(H5Tinsert(tid2,"d",HOFFSET(struct s2,d),tid1) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Make a copy of the type for later */ - if((tid3=H5Tcopy(tid2))<0) { + if((tid3=H5Tcopy(tid2)) < 0) { H5_FAILED(); AT(); printf("Can't copy type #2\n"); goto error; } /* end if */ /* Test H5Tpack for the second compound type */ - if(H5Tpack(tid2)<0) { + if(H5Tpack(tid2) < 0) { H5_FAILED(); AT(); printf("Can't pack the compound datatype\n"); goto error; } /* end if */ - if(H5Tlock(tid2)<0) { + if(H5Tlock(tid2) < 0) { H5_FAILED(); AT(); printf("Can't lock the compound datatype\n"); goto error; } /* end if */ /* If the type is already packed, packing a locked type is OK */ - if(H5Tpack(tid2)<0) { + if(H5Tpack(tid2) < 0) { H5_FAILED(); AT(); printf("Can't pack the compound datatype for second time\n"); goto error; } /* end if */ /* Lock unpacked type */ - if(H5Tlock(tid3)<0) { + if(H5Tlock(tid3) < 0) { H5_FAILED(); AT(); printf("Can't lock the compound datatype\n"); goto error; @@ -1534,27 +1534,27 @@ test_compound_9(void) /* Create File */ h5_fixname(FILENAME[3], 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(); AT(); printf("Can't create file!\n"); goto error; } /* end if */ /* Create first compound datatype */ - if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct)))<0) { + if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT)<0) { + if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i1'\n"); goto error; } /* end if */ str_id = H5Tcopy(H5T_C_S1); - if(H5Tset_size(str_id,H5T_VARIABLE)<0) { + if(H5Tset_size(str_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); printf("Can't set size for VL string\n"); goto error; @@ -1600,19 +1600,19 @@ test_compound_9(void) goto error; } /* end if */ - if((dset_id = H5Dcreate(file,"Dataset",dup_tid,space_id,H5P_DEFAULT))<0) { + if((dset_id = H5Dcreate(file,"Dataset",dup_tid,space_id,H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); printf("Can't create dataset\n"); goto error; } /* end if */ - if(H5Dwrite(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata)<0) { + if(H5Dwrite(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) { H5_FAILED(); AT(); printf("Can't write data\n"); goto error; } /* end if */ - if(H5Dread(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { + if(H5Dread(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) { H5_FAILED(); AT(); printf("Can't read data\n"); goto error; @@ -1624,39 +1624,39 @@ test_compound_9(void) goto error; } /* end if */ - if(H5Dclose(dset_id)<0) + if(H5Dclose(dset_id) < 0) goto error; - if(H5Tclose(cmpd_tid)<0) + if(H5Tclose(cmpd_tid) < 0) goto error; - if(H5Tclose(dup_tid)<0) + if(H5Tclose(dup_tid) < 0) goto error; - if(H5Tclose(str_id)<0) + if(H5Tclose(str_id) < 0) goto error; - if(H5Sclose(space_id)<0) + if(H5Sclose(space_id) < 0) goto error; - if(H5Fclose(file)<0) + if(H5Fclose(file) < 0) goto error; - if((file=H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT))<0) { + if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); printf("cannot open file\n"); goto error; } /* end if */ - if((dset_id = H5Dopen(file, "Dataset"))<0) { + if((dset_id = H5Dopen2(file, "Dataset", H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); printf("cannot open dataset\n"); goto error; } /* end if */ - if((cmpd_tid = H5Dget_type(dset_id))<0) { + if((cmpd_tid = H5Dget_type(dset_id)) < 0) { H5_FAILED(); AT(); printf("cannot open dataset\n"); goto error; } /* end if */ - if((dup_tid = H5Tcopy(cmpd_tid))<0) { + if((dup_tid = H5Tcopy(cmpd_tid)) < 0) { H5_FAILED(); AT(); printf("Can't copy datatype\n"); goto error; @@ -1665,7 +1665,7 @@ test_compound_9(void) rdata.i1 = rdata.i2 = 0; if(rdata.str) free(rdata.str); - if(H5Dread(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { + if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); printf("Can't read data\n"); goto error; @@ -1679,13 +1679,13 @@ test_compound_9(void) if(rdata.str) free(rdata.str); - if(H5Dclose(dset_id)<0) + if(H5Dclose(dset_id) < 0) goto error; - if(H5Tclose(cmpd_tid)<0) + if(H5Tclose(cmpd_tid) < 0) goto error; - if(H5Tclose(dup_tid)<0) + if(H5Tclose(dup_tid) < 0) goto error; - if(H5Fclose(file)<0) + if(H5Fclose(file) < 0) goto error; PASSED(); @@ -1751,52 +1751,52 @@ test_compound_10(void) /* Create File */ h5_fixname(FILENAME[4], 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(); AT(); printf("Can't create file!\n"); goto error; } /* end if */ /* Create first compound datatype */ - if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct)))<0) { + if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT)<0) { + if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i1'\n"); goto error; } /* end if */ cstr_id = H5Tcopy(H5T_C_S1); - if(H5Tset_size(cstr_id,H5T_VARIABLE)<0) { + if(H5Tset_size(cstr_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); printf("Can't set size for C string\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid,"c_string",HOFFSET(cmpd_struct,str),cstr_id)<0) { + if(H5Tinsert(cmpd_tid,"c_string",HOFFSET(cmpd_struct,str),cstr_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'str'\n"); goto error; } /* end if */ /* Create vl-string datatype */ - if((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR))<0) { + if((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) { H5_FAILED(); AT(); printf("Can't create VL string\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid, "vl_string",HOFFSET(cmpd_struct, text), vlstr_id)<0) { + if(H5Tinsert(cmpd_tid, "vl_string",HOFFSET(cmpd_struct, text), vlstr_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'text'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT)<0) { + if(H5Tinsert(cmpd_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i2'\n"); goto error; @@ -1810,25 +1810,25 @@ test_compound_10(void) } /* end if */ dim1[0] = 1; - if((space_id=H5Screate_simple(1,dim1,NULL))<0) { + if((space_id=H5Screate_simple(1,dim1,NULL)) < 0) { H5_FAILED(); AT(); printf("Can't create space\n"); goto error; } /* end if */ - if((dset_id = H5Dcreate(file,"Dataset",arr_tid,space_id,H5P_DEFAULT))<0) { + if((dset_id = H5Dcreate(file,"Dataset",arr_tid,space_id,H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); printf("Can't create dataset\n"); goto error; } /* end if */ - if(H5Dwrite(dset_id,arr_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata)<0) { + if(H5Dwrite(dset_id,arr_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) { H5_FAILED(); AT(); printf("Can't write data\n"); goto error; } /* end if */ - if(H5Dread(dset_id,arr_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { + if(H5Dread(dset_id,arr_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) { H5_FAILED(); AT(); printf("Can't read data\n"); goto error; @@ -1862,19 +1862,19 @@ test_compound_10(void) free(rdata[i].str); } /* end for */ - if(H5Dclose(dset_id)<0) + if(H5Dclose(dset_id) < 0) goto error; - if(H5Tclose(cmpd_tid)<0) + if(H5Tclose(cmpd_tid) < 0) goto error; - if(H5Tclose(arr_tid)<0) + if(H5Tclose(arr_tid) < 0) goto error; - if(H5Tclose(cstr_id)<0) + if(H5Tclose(cstr_id) < 0) goto error; - if(H5Tclose(vlstr_id)<0) + if(H5Tclose(vlstr_id) < 0) goto error; - if(H5Sclose(space_id)<0) + if(H5Sclose(space_id) < 0) goto error; - if(H5Fclose(file)<0) + if(H5Fclose(file) < 0) goto error; PASSED(); @@ -1933,25 +1933,25 @@ test_compound_11(void) TESTING("registering type conversion routine with compound conversions"); /* Create variable string type for use in both structs */ - if((var_string_tid=H5Tcopy(H5T_C_S1))<0) TEST_ERROR - if(H5Tset_size(var_string_tid,H5T_VARIABLE)<0) TEST_ERROR + if((var_string_tid=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if(H5Tset_size(var_string_tid,H5T_VARIABLE) < 0) TEST_ERROR /* Create type for 'big' struct */ - if((big_tid = H5Tcreate(H5T_COMPOUND, sizeof(big_t)))<0) TEST_ERROR + if((big_tid = H5Tcreate(H5T_COMPOUND, sizeof(big_t))) < 0) TEST_ERROR - if(H5Tinsert(big_tid, "d1", HOFFSET(big_t, d1), H5T_NATIVE_DOUBLE)<0) TEST_ERROR - if(H5Tinsert(big_tid, "i1", HOFFSET(big_t, i1), H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(big_tid, "s1", HOFFSET(big_t, s1), var_string_tid)<0) TEST_ERROR - if(H5Tinsert(big_tid, "i2", HOFFSET(big_t, i2), H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(big_tid, "d2", HOFFSET(big_t, d2), H5T_NATIVE_DOUBLE)<0) TEST_ERROR - if(H5Tinsert(big_tid, "d3", HOFFSET(big_t, d3), H5T_NATIVE_DOUBLE)<0) TEST_ERROR + if(H5Tinsert(big_tid, "d1", HOFFSET(big_t, d1), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR + if(H5Tinsert(big_tid, "i1", HOFFSET(big_t, i1), H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(big_tid, "s1", HOFFSET(big_t, s1), var_string_tid) < 0) TEST_ERROR + if(H5Tinsert(big_tid, "i2", HOFFSET(big_t, i2), H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(big_tid, "d2", HOFFSET(big_t, d2), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR + if(H5Tinsert(big_tid, "d3", HOFFSET(big_t, d3), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR /* Create type for 'little' struct (with "out of order" inserts) */ - if((little_tid = H5Tcreate(H5T_COMPOUND, sizeof(little_t)))<0) TEST_ERROR + if((little_tid = H5Tcreate(H5T_COMPOUND, sizeof(little_t))) < 0) TEST_ERROR - if(H5Tinsert(little_tid, "d1", HOFFSET(little_t, d1), H5T_NATIVE_DOUBLE)<0) TEST_ERROR - if(H5Tinsert(little_tid, "s1", HOFFSET(little_t, s1), var_string_tid)<0) TEST_ERROR - if(H5Tinsert(little_tid, "i1", HOFFSET(little_t, i1), H5T_NATIVE_INT)<0) TEST_ERROR + if(H5Tinsert(little_tid, "d1", HOFFSET(little_t, d1), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR + if(H5Tinsert(little_tid, "s1", HOFFSET(little_t, s1), var_string_tid) < 0) TEST_ERROR + if(H5Tinsert(little_tid, "i1", HOFFSET(little_t, i1), H5T_NATIVE_INT) < 0) TEST_ERROR /* Allocate buffers */ if((buf=HDmalloc(sizeof(big_t)*NTESTELEM))==NULL) TEST_ERROR @@ -1975,11 +1975,11 @@ test_compound_11(void) /* Make copies of the 'big' and 'little' datatypes, so the type * conversion routine doesn't use the same ones this time and next time */ - if((big_tid2=H5Tcopy(big_tid))<0) TEST_ERROR - if((little_tid2=H5Tcopy(little_tid))<0) TEST_ERROR + if((big_tid2=H5Tcopy(big_tid)) < 0) TEST_ERROR + if((little_tid2=H5Tcopy(little_tid)) < 0) TEST_ERROR /* Convert buffer from 'big' to 'little' struct */ - if(H5Tconvert(big_tid2,little_tid2,NTESTELEM,buf,bkg,H5P_DEFAULT)<0) TEST_ERROR + if(H5Tconvert(big_tid2,little_tid2,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { @@ -2007,19 +2007,19 @@ test_compound_11(void) } /* end for */ /* Build source and destination types for conversion routine */ - if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR - if(H5Tset_tag(opaq_src_tid, "opaque source type")<0) TEST_ERROR - if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR - if(H5Tset_tag(opaq_dst_tid, "opaque destination type")<0) TEST_ERROR + if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR + if(H5Tset_tag(opaq_src_tid, "opaque source type") < 0) TEST_ERROR + if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR + if(H5Tset_tag(opaq_dst_tid, "opaque destination type") < 0) TEST_ERROR /* Register new type conversion routine */ - if(H5Tregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque)<0) TEST_ERROR + if(H5Tregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR /* Recover the original buffer information */ HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM); /* Convert buffer from 'big' to 'little' struct */ - if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT)<0) TEST_ERROR + if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { @@ -2047,13 +2047,13 @@ test_compound_11(void) } /* end for */ /* Unregister the conversion routine */ - if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque)<0) TEST_ERROR + if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR /* Recover the original buffer information */ HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM); /* Convert buffer from 'big' to 'little' struct */ - if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT)<0) TEST_ERROR + if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { @@ -2083,16 +2083,16 @@ test_compound_11(void) /* Free everything */ for(u=0; u<NTESTELEM; u++) HDfree(((big_t *)buf_orig)[u].s1); - if(H5Tclose(opaq_dst_tid)<0) TEST_ERROR - if(H5Tclose(opaq_src_tid)<0) TEST_ERROR - if(H5Tclose(little_tid2)<0) TEST_ERROR - if(H5Tclose(big_tid2)<0) TEST_ERROR + if(H5Tclose(opaq_dst_tid) < 0) TEST_ERROR + if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR + if(H5Tclose(little_tid2) < 0) TEST_ERROR + if(H5Tclose(big_tid2) < 0) TEST_ERROR HDfree(bkg); HDfree(buf_orig); HDfree(buf); - if(H5Tclose(little_tid)<0) TEST_ERROR - if(H5Tclose(big_tid)<0) TEST_ERROR - if(H5Tclose(var_string_tid)<0) TEST_ERROR + if(H5Tclose(little_tid) < 0) TEST_ERROR + if(H5Tclose(big_tid) < 0) TEST_ERROR + if(H5Tclose(var_string_tid) < 0) TEST_ERROR PASSED(); return 0; @@ -2131,7 +2131,7 @@ test_compound_12(void) TESTING("adjust size of compound datatypes"); /* Create a compound type of minimal size */ - if ((complex_id = H5Tcreate(H5T_COMPOUND, 1))<0) goto error; + if ((complex_id = H5Tcreate(H5T_COMPOUND, 1)) < 0) goto error; /* Verify the size */ if((new_size=H5Tget_size(complex_id))==0) goto error; @@ -2141,25 +2141,25 @@ test_compound_12(void) offset = size; if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; size+=tmp_size; - if (H5Tset_size(complex_id, size)<0) goto error; + if (H5Tset_size(complex_id, size) < 0) goto error; if (H5Tinsert(complex_id, "real", offset, - H5T_NATIVE_DOUBLE)<0) goto error; + H5T_NATIVE_DOUBLE) < 0) goto error; offset = size; if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; size+=tmp_size; - if (H5Tset_size(complex_id, size)<0) goto error; + if (H5Tset_size(complex_id, size) < 0) goto error; if (H5Tinsert(complex_id, "imaginary", offset, - H5T_NATIVE_DOUBLE)<0) goto error; + H5T_NATIVE_DOUBLE) < 0) goto error; /* Increase and decrease the size. */ if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; size+=tmp_size; - if (H5Tset_size(complex_id, size)<0) goto error; + if (H5Tset_size(complex_id, size) < 0) goto error; if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; size-=tmp_size; - if (H5Tset_size(complex_id, size)<0) goto error; + if (H5Tset_size(complex_id, size) < 0) goto error; /* Verify the size */ if((new_size=H5Tget_size(complex_id))==0) goto error; @@ -2176,7 +2176,7 @@ test_compound_12(void) goto error; } - if (H5Tclose (complex_id)<0) goto error; + if (H5Tclose (complex_id) < 0) goto error; PASSED(); return 0; @@ -2223,63 +2223,63 @@ test_query(void) /* Create File */ h5_fixname(FILENAME[2], 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) goto error; /* Create a compound datatype */ - if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) { + if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT)<0) { + if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) { H5_FAILED(); printf("Can't insert field 'a'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT)<0) { + if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); printf("Can't insert field 'b'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG)<0) { + if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) { H5_FAILED(); printf("Can't insert field 'c'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE)<0) { + if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); printf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Create a enumerate datatype */ - if((tid2=H5Tcreate(H5T_ENUM, sizeof(short)))<0) { + if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) { H5_FAILED(); printf("Can't create enumerate type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "RED", (enum_val=10,&enum_val))<0) { + if(H5Tenum_insert(tid2, "RED", (enum_val=10,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "GREEN", (enum_val=11,&enum_val))<0) { + if(H5Tenum_insert(tid2, "GREEN", (enum_val=11,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "BLUE", (enum_val=12,&enum_val))<0) { + if(H5Tenum_insert(tid2, "BLUE", (enum_val=12,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "ORANGE", (enum_val=13,&enum_val))<0) { + if(H5Tenum_insert(tid2, "ORANGE", (enum_val=13,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "YELLOW", (enum_val=14,&enum_val))<0) { + if(H5Tenum_insert(tid2, "YELLOW", (enum_val=14,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; @@ -2364,7 +2364,7 @@ test_query(void) } /* end if */ /* Query member value by member name, for enumeration type */ - if(H5Tenum_valueof (tid2, "ORANGE", &enum_val)<0) { + if(H5Tenum_valueof (tid2, "ORANGE", &enum_val) < 0) { H5_FAILED(); printf("Can't get value for enumerate member\n"); goto error; @@ -2376,7 +2376,7 @@ test_query(void) } /* end if */ /* Query member value by member index, for enumeration type */ - if(H5Tget_member_value (tid2, 2, &enum_val)<0) { + if(H5Tget_member_value (tid2, 2, &enum_val) < 0) { H5_FAILED(); printf("Can't get value for enum member\n"); goto error; @@ -2389,7 +2389,7 @@ test_query(void) /* Query member name by member value, for enumeration type */ enum_val = 14; - if(H5Tenum_nameof(tid2, &enum_val, enum_name, 16)<0) { + if(H5Tenum_nameof(tid2, &enum_val, enum_name, 16) < 0) { H5_FAILED(); printf("Can't get name for enum member\n"); goto error; @@ -2401,18 +2401,18 @@ test_query(void) } /* end if */ /* Close datatype and file */ - if(H5Tclose(tid1)<0) { + if(H5Tclose(tid1) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(tid2)<0) { + if(H5Tclose(tid2) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Fclose(file)<0) { + if(H5Fclose(file) < 0) { H5_FAILED(); printf("Can't close file\n"); goto error; @@ -2458,10 +2458,10 @@ test_transient (hid_t fapl) TESTING("transient datatypes"); 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 ((space = H5Screate_simple (2, ds_size, ds_size))<0) goto error; + if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error; /* Predefined types cannot be modified or closed */ H5E_BEGIN_TRY { @@ -2482,8 +2482,8 @@ test_transient (hid_t fapl) } /* Copying a predefined type results in a modifiable copy */ - if ((type=H5Tcopy (H5T_NATIVE_INT))<0) goto error; - if (H5Tset_precision (type, 256)<0) goto error; + if ((type=H5Tcopy (H5T_NATIVE_INT)) < 0) goto error; + if (H5Tset_precision (type, 256) < 0) goto error; /* It should not be possible to create an attribute for a transient type */ H5E_BEGIN_TRY { @@ -2496,53 +2496,54 @@ test_transient (hid_t fapl) } /* Create a dataset from a transient datatype */ - if (H5Tclose (type)<0) goto error; - if ((type = H5Tcopy (H5T_NATIVE_INT))<0) goto error; - if ((dset=H5Dcreate (file, "dset1", type, space, H5P_DEFAULT))<0) + if(H5Tclose(type) < 0) goto error; + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error; + if((dset = H5Dcreate(file, "dset1", type, space, H5P_DEFAULT)) < 0) goto error; /* The type returned from a dataset should not be modifiable */ - if ((t2 = H5Dget_type (dset))<0) goto error; + if((t2 = H5Dget_type(dset)) < 0) goto error; H5E_BEGIN_TRY { - status = H5Tset_precision (t2, 256); + status = H5Tset_precision(t2, 256); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); HDputs (" Dataset datatypes should not be modifiable!"); goto error; } - if (H5Tclose (t2)<0) goto error; + if(H5Tclose(t2) < 0) goto error; /* * Close the dataset and reopen it, testing that it's type is still * read-only. */ - if (H5Dclose (dset)<0) goto error; - if ((dset=H5Dopen (file, "dset1"))<0) goto error; - if ((t2 = H5Dget_type (dset))<0) goto error; + if(H5Dclose(dset) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((t2 = H5Dget_type(dset)) < 0) goto error; H5E_BEGIN_TRY { - status = H5Tset_precision (t2, 256); + status = H5Tset_precision(t2, 256); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); HDputs (" Dataset datatypes should not be modifiable!"); goto error; } - if (H5Tclose (t2)<0) goto error; + if(H5Tclose(t2) < 0) goto error; /* * Get the dataset datatype by applying H5Tcopy() to the dataset. The * result should be modifiable. */ - if ((t2=H5Tcopy (dset))<0) goto error; - if (H5Tset_precision (t2, 256)<0) goto error; - if (H5Tclose (t2)<0) goto error; + if((t2=H5Tcopy(dset)) < 0) goto error; + if(H5Tset_precision(t2, 256) < 0) goto error; + if(H5Tclose(t2) < 0) goto error; + + if(H5Dclose(dset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; + if(H5Tclose(type) < 0) goto error; + if(H5Sclose(space) < 0) goto error; - H5Dclose (dset); - H5Fclose (file); - H5Tclose (type); - H5Sclose (space); PASSED(); return 0; @@ -2587,10 +2588,10 @@ test_named (hid_t fapl) TESTING("named datatypes"); 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 ((space = H5Screate_simple (2, ds_size, ds_size))<0) goto error; + if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error; /* Predefined types cannot be committed */ H5E_BEGIN_TRY { @@ -2684,7 +2685,7 @@ test_named (hid_t fapl) /* Close the dataset, then close its type, then reopen the dataset */ if(H5Dclose(dset) < 0) goto error; if(H5Tclose(t2) < 0) goto error; - if((dset = H5Dopen(file, "dset1")) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; /* Get the dataset's type and make sure it's named */ if((t2 = H5Dget_type(dset)) < 0) goto error; @@ -2705,7 +2706,7 @@ test_named (hid_t fapl) /* Reopen the second dataset and make sure the type is shared */ if(H5Tclose(t2) < 0) goto error; if(H5Dclose(dset) < 0) goto error; - if((dset = H5Dopen(file, "dset2")) < 0) goto error; + if((dset = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error; if((t2 = H5Dget_type(dset)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(!status) { @@ -2786,9 +2787,9 @@ mkstr(size_t len, H5T_str_t strpad) { hid_t t; - if ((t=H5Tcopy(H5T_C_S1))<0) return -1; - if (H5Tset_size(t, len)<0) return -1; - if (H5Tset_strpad(t, strpad)<0) return -1; + if ((t=H5Tcopy(H5T_C_S1)) < 0) return -1; + if (H5Tset_size(t, len) < 0) return -1; + if (H5Tset_strpad(t, strpad) < 0) return -1; return t; } @@ -2825,21 +2826,21 @@ test_conv_str_1(void) dst_type = mkstr(5, H5T_STR_NULLTERM); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", 20)) { H5_FAILED(); HDputs(" Truncated C-string test failed"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Extended C-string test failed"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Convert a null padded string to a shorter and then longer string. @@ -2848,21 +2849,21 @@ test_conv_str_1(void) dst_type = mkstr(5, H5T_STR_NULLPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) { H5_FAILED(); HDputs(" Truncated C buffer test failed"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Extended C buffer test failed"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Convert a space-padded string to a shorter and then longer string. @@ -2871,21 +2872,21 @@ test_conv_str_1(void) dst_type = mkstr(5, H5T_STR_SPACEPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) { H5_FAILED(); HDputs(" Truncated Fortran-string test failed"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde abcde ", 20)) { H5_FAILED(); HDputs(" Extended Fortran-string test failed"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * What happens if a null-terminated string is not null terminated? If @@ -2897,7 +2898,7 @@ test_conv_str_1(void) dst_type = mkstr(10, H5T_STR_NULLTERM); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) { H5_FAILED(); HDputs(" Non-terminated string test 1"); @@ -2906,22 +2907,22 @@ test_conv_str_1(void) H5Tclose(dst_type); dst_type = mkstr(5, H5T_STR_NULLTERM); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", 20)) { H5_FAILED(); HDputs(" Non-terminated string test 2"); goto error; } HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", 20); - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Non-terminated string test 2"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Test C string to Fortran and vice versa. @@ -2930,53 +2931,53 @@ test_conv_str_1(void) dst_type = mkstr(10, H5T_STR_SPACEPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghi abcdefghi ", 20)) { H5_FAILED(); HDputs(" C string to Fortran test 1"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", 20)) { H5_FAILED(); HDputs(" Fortran to C string test 1"); goto error; } - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(dst_type) < 0) goto error; dst_type = mkstr(5, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) { H5_FAILED(); HDputs(" C string to Fortran test 2"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Fortran to C string test 2"); goto error; } - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; src_type = mkstr(5, H5T_STR_NULLTERM); dst_type = mkstr(10, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd abcd ", 20)) { H5_FAILED(); HDputs(" C string to Fortran test 3"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) { H5_FAILED(); HDputs(" Fortran to C string test 3"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Test C buffer to Fortran and vice versa. @@ -2985,53 +2986,53 @@ test_conv_str_1(void) dst_type = mkstr(10, H5T_STR_SPACEPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) { H5_FAILED(); HDputs(" C buffer to Fortran test 1"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) { H5_FAILED(); HDputs(" Fortran to C buffer test 1"); goto error; } - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(dst_type) < 0) goto error; dst_type = mkstr(5, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) { H5_FAILED(); HDputs(" C buffer to Fortran test 2"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Fortran to C buffer test 2"); goto error; } - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; src_type = mkstr(5, H5T_STR_NULLPAD); dst_type = mkstr(10, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd abcd ", 20)) { H5_FAILED(); HDputs(" C buffer to Fortran test 3"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) { H5_FAILED(); HDputs(" Fortran to C buffer test 3"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; PASSED(); reset_hdf5(); @@ -3092,9 +3093,9 @@ test_conv_str_2(void) } printf("%-70s", s); HDfflush(stdout); - if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT)<0) + if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT)<0) + if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); } @@ -3156,11 +3157,11 @@ test_conv_str_3(void) if ((size=H5Tget_precision(type))==0) goto error; if ((size=H5Tget_size(type))==0) goto error; - if (H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE)<0) goto error; - if ((cset=H5Tget_cset(type))<0) goto error; - if (H5Tget_strpad(type)<0) goto error; - if (H5Tset_offset(type, 0)<0) goto error; - if (H5Tget_order(type)<0) goto error; + if (H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE) < 0) goto error; + if ((cset=H5Tget_cset(type)) < 0) goto error; + if (H5Tget_strpad(type) < 0) goto error; + if (H5Tset_offset(type, 0) < 0) goto error; + if (H5Tget_order(type) < 0) goto error; H5E_BEGIN_TRY { ret=H5Tset_precision(type, nelmts); @@ -3277,7 +3278,7 @@ test_conv_enum_1(void) } printf("%-70s", s); HDfflush(stdout); - if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); } @@ -3290,7 +3291,7 @@ test_conv_enum_1(void) } printf("%-70s", s); HDfflush(stdout); - if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); } ret_value = 0; @@ -3424,7 +3425,7 @@ test_conv_bitfield(void) dt = H5Tcopy(H5T_STD_B32LE); buf[0] = buf[1] = 0xAA; buf[2] = buf[3] = 0x55; /*irrelevant*/ - if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) { H5_FAILED(); printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", @@ -3443,7 +3444,7 @@ test_conv_bitfield(void) H5Tset_precision(dt, 12); H5Tset_offset(dt, 10); buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; - if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) { H5_FAILED(); printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", @@ -3457,7 +3458,7 @@ test_conv_bitfield(void) */ H5Tset_pad(dt, H5T_PAD_ONE, H5T_PAD_ONE); buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; - if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) { H5_FAILED(); printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", @@ -3512,18 +3513,18 @@ test_bitfield_funcs(void) /* * First create a bitfield type. */ - if((type = H5Tcopy(H5T_STD_B32LE))<0) goto error; + if((type = H5Tcopy(H5T_STD_B32LE)) < 0) goto error; /* * Offset a 12-byte value in the middle of a 16 and 32 byte * field. Pad unused bits with ones. * ____ ____ __10 1010 1010 10__ ____ ____ */ - if(H5Tset_precision(type, 12)<0) goto error; - if(H5Tset_offset(type, 10)<0) goto error; + if(H5Tset_precision(type, 12) < 0) goto error; + if(H5Tset_offset(type, 10) < 0) goto error; if(H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE)) goto error; if((size=H5Tget_size(type))==0) goto error; - if(H5Tset_order(type, H5T_ORDER_BE)<0) goto error; + if(H5Tset_order(type, H5T_ORDER_BE) < 0) goto error; H5E_BEGIN_TRY { size=H5Tget_ebias(type); @@ -3710,12 +3711,12 @@ opaque_check(int tag_it) saved = num_opaque_conversions_g = 0; /* Build source and destination types */ - if ((st=H5Tcreate(H5T_OPAQUE, 4))<0) goto error; - if (H5Tset_tag(st, "opaque source type")<0) goto error; + if ((st=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error; + if (H5Tset_tag(st, "opaque source type") < 0) goto error; - if ((dt=H5Tcreate(H5T_OPAQUE, 4))<0) goto error; + if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error; if (tag_it) { - if (H5Tset_tag(dt, "opaque destination type")<0) + if (H5Tset_tag(dt, "opaque destination type") < 0) goto error; } @@ -3730,11 +3731,11 @@ opaque_check(int tag_it) } /* Register a conversion function */ - if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque)<0) + if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) goto error; /* Try the conversion again, this time it should work */ - if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error; if (saved+1 != num_opaque_conversions_g) { H5_FAILED(); printf(" unexpected number of opaque conversions\n"); @@ -3742,7 +3743,7 @@ opaque_check(int tag_it) } /* Unregister conversion function */ - if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque)<0) + if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) goto error; H5Tclose(st); @@ -3781,7 +3782,7 @@ opaque_long(void) herr_t ret; /* Build opaque type */ - if ((dt=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR + if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR /* Create long tag */ long_tag = HDmalloc(16384+1); @@ -3839,8 +3840,8 @@ opaque_funcs(void) herr_t ret; /* Build opaque type */ - if ((type=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR - if (H5Tset_tag(type, "opaque source type")<0) TEST_ERROR + if ((type=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR + if (H5Tset_tag(type, "opaque source type") < 0) TEST_ERROR if ((size=H5Tget_size(type))==0) goto error; @@ -3973,7 +3974,7 @@ test_encode(void) /* Create File */ h5_fixname(FILENAME[5], 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) goto error; /*----------------------------------------------------------------------- @@ -3981,59 +3982,59 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Create a compound datatype */ - if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) { + if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT)<0) { + if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) { H5_FAILED(); printf("Can't insert field 'a'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT)<0) { + if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); printf("Can't insert field 'b'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG)<0) { + if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) { H5_FAILED(); printf("Can't insert field 'c'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE)<0) { + if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); printf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Create a enumerate datatype */ - if((tid2=H5Tcreate(H5T_ENUM, sizeof(short)))<0) { + if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) { H5_FAILED(); printf("Can't create enumerate type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val))<0) { + if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val))<0) { + if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val))<0) { + if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val))<0) { + if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val))<0) { + if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; @@ -4044,7 +4045,7 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Encode compound type in a buffer */ - if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4063,7 +4064,7 @@ test_encode(void) goto error; } - if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4094,7 +4095,7 @@ test_encode(void) /* Encode enumerate type in a buffer */ - if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { + if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; @@ -4103,14 +4104,14 @@ test_encode(void) if(enum_buf_size>0) enum_buf = (unsigned char*)calloc(1, enum_buf_size); - if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { + if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ - if((decoded_tid2=H5Tdecode(enum_buf))<0) { + if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); printf("Can't decode enumerate type\n"); goto error; @@ -4185,7 +4186,7 @@ test_encode(void) /* Encode compound type in a buffer */ - if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4194,7 +4195,7 @@ test_encode(void) if(cmpd_buf_size>0) cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size); - if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4228,7 +4229,7 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Encode enumerate type in a buffer */ - if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { + if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; @@ -4237,14 +4238,14 @@ test_encode(void) if(enum_buf_size>0) enum_buf = (unsigned char*)calloc(1, enum_buf_size); - if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { + if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ - if((decoded_tid2=H5Tdecode(enum_buf))<0) { + if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); printf("Can't decode enumerate type\n"); goto error; @@ -4274,29 +4275,29 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Close datatype and file */ - if(H5Tclose(tid1)<0) { + if(H5Tclose(tid1) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(tid2)<0) { + if(H5Tclose(tid2) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(decoded_tid1)<0) { + if(H5Tclose(decoded_tid1) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(decoded_tid2)<0) { + if(H5Tclose(decoded_tid2) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Fclose(file)<0) { + if(H5Fclose(file) < 0) { H5_FAILED(); printf("Can't close file\n"); goto error; diff --git a/test/external.c b/test/external.c index 0186d53..20ece60 100644 --- a/test/external.c +++ b/test/external.c @@ -106,42 +106,43 @@ test_1a(hid_t file) hsize_t file_size; /*sizeof external file segment */ TESTING("fixed-size data space, exact storage"); + /* Create the dataset */ - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; cur_size[0] = max_size[0] = 100; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int))) < 0) goto error; - if ((space = H5Screate_simple (1, cur_size, max_size)) < 0) goto error; - if ((dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT, space, dcpl)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int))) < 0) goto error; + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if((dset = H5Dcreate(file, "dset1", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; - if (H5Sclose (space) < 0) goto error; - if (H5Pclose (dcpl) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* Read dataset creation information */ - if ((dset = H5Dopen (file, "dset1")) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; /* Test dataset address. Should be undefined. */ - if (H5Dget_offset(dset)!=HADDR_UNDEF) goto error; + if(H5Dget_offset(dset) != HADDR_UNDEF) goto error; - if ((dcpl = H5Dget_create_plist (dset)) < 0) goto error; - if ((n=H5Pget_external_count (dcpl)) < 0) goto error; - if (1!=n) { + if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; + if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if(1 != n) { H5_FAILED(); puts(" Returned external count is wrong."); printf(" got: %d\n ans: 1\n", n); goto error; } - strcpy (name+sizeof(name)-4, "..."); - if (H5Pget_external (dcpl, 0, sizeof(name)-4, name, &file_offset, + HDstrcpy(name + sizeof(name) - 4, "..."); + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) goto error; - if (file_offset!=0) { + if(file_offset != 0) { H5_FAILED(); puts(" Wrong file offset."); printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } - if (file_size!=(max_size[0]*sizeof(int))) { + if(file_size != (max_size[0] * sizeof(int))) { H5_FAILED(); puts(" Wrong file size."); printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, @@ -358,44 +359,45 @@ test_1e(hid_t file) TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; cur_size[0] = 100; max_size[0] = H5S_UNLIMITED; - if ((space=H5Screate_simple(1, cur_size, max_size)) < 0) goto error; - if ((dset=H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl)) < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if((dset = H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; - if (H5Sclose (space) < 0) goto error; - if (H5Pclose (dcpl) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* Read dataset creation information */ - if ((dset = H5Dopen (file, "dset5")) < 0) goto error; - if ((dcpl = H5Dget_create_plist (dset)) < 0) goto error; - if ((n = H5Pget_external_count (dcpl)) < 0) goto error; - if (1!=n) { + if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; + if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if(1 != n) { H5_FAILED(); puts(" Returned external count is wrong."); printf(" got: %d\n ans: 1\n", n); goto error; } - strcpy (name+sizeof(name)-4, "..."); - if (H5Pget_external (dcpl, 0, sizeof(name)-4, name, &file_offset, + HDstrcpy(name + sizeof(name) - 4, "..."); + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) goto error; - if (file_offset!=0) { + if(file_offset != 0) { H5_FAILED(); puts(" Wrong file offset."); printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } - if (H5F_UNLIMITED!=file_size) { + if(H5F_UNLIMITED != file_size) { H5_FAILED(); puts(" Wrong file size."); printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); goto error; } - if (H5Pclose (dcpl) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + PASSED(); return 0; diff --git a/test/fillval.c b/test/fillval.c index 53ff8f3..2d4d136 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -183,19 +183,19 @@ test_getset(void) * Create the dataset creation property list and the data types that will * be used during this test. */ - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if ((type_ss=H5Tcreate(H5T_COMPOUND, sizeof fill_ss))<0 || + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((type_ss=H5Tcreate(H5T_COMPOUND, sizeof fill_ss)) < 0 || H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1), - H5T_NATIVE_SHORT)<0 || + H5T_NATIVE_SHORT) < 0 || H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2), - H5T_NATIVE_SHORT)<0) { + H5T_NATIVE_SHORT) < 0) { goto error; } - if ((type_si=H5Tcreate(H5T_COMPOUND, sizeof fill_si))<0 || + if((type_si=H5Tcreate(H5T_COMPOUND, sizeof fill_si)) < 0 || H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1), - H5T_NATIVE_INT)<0 || + H5T_NATIVE_INT) < 0 || H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2), - H5T_NATIVE_INT)<0) { + H5T_NATIVE_INT) < 0) { goto error; } @@ -206,7 +206,7 @@ test_getset(void) H5E_BEGIN_TRY { H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); } H5E_END_TRY; - if (fill_i != 0) { + if(fill_i != 0) { H5_FAILED(); puts(" H5Pget_fill_value() should return default 0"); goto error; @@ -217,13 +217,13 @@ test_getset(void) */ fill_ss.v1 = 1111; fill_ss.v2 = 2222; - if (H5Pset_fill_value(dcpl, type_ss, &fill_ss)<0) goto error; + if(H5Pset_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error; /* * Get the fill value using the same data type that was used to set it. */ - if (H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd)<0) goto error; - if (fill_ss.v1!=fill_ss_rd.v1 || fill_ss.v2!=fill_ss_rd.v2) { + if(H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd) < 0) goto error; + if(fill_ss.v1!=fill_ss_rd.v1 || fill_ss.v2!=fill_ss_rd.v2) { H5_FAILED(); puts(" Failed to get fill value using same data type that was "); puts(" used to set the fill value."); @@ -233,8 +233,8 @@ test_getset(void) /* * Get the fill value using some other data type. */ - if (H5Pget_fill_value(dcpl, type_si, &fill_si)<0) goto error; - if (fill_ss.v1!=fill_si.v1 || fill_ss.v2!=fill_si.v2) { + if(H5Pget_fill_value(dcpl, type_si, &fill_si) < 0) goto error; + if(fill_ss.v1!=fill_si.v1 || fill_ss.v2!=fill_si.v2) { H5_FAILED(); puts(" Failed to get fill value using a data type other than what"); puts(" was used to set the fill value."); @@ -244,18 +244,18 @@ test_getset(void) /* * Reset the fill value */ - if (H5Pset_fill_value(dcpl, type_si, &fill_si)<0) goto error; - if (H5Pget_fill_value(dcpl, type_ss, &fill_ss)<0) goto error; - if (fill_si.v1!=fill_ss.v1 || fill_si.v2!=fill_ss.v2) { + if(H5Pset_fill_value(dcpl, type_si, &fill_si) < 0) goto error; + if(H5Pget_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error; + if(fill_si.v1!=fill_ss.v1 || fill_si.v2!=fill_ss.v2) { H5_FAILED(); puts(" Resetting the fill value was unsuccessful."); goto error; } /* Success */ - if (H5Pclose(dcpl)<0) goto error; - if (H5Tclose(type_si)<0) goto error; - if (H5Tclose(type_ss)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Tclose(type_si) < 0) goto error; + if(H5Tclose(type_ss) < 0) goto error; PASSED(); return 0; @@ -333,7 +333,7 @@ test_getset_vl(hid_t fapl) /* Re-open file, group & dataset */ if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((datasetid = H5Dopen(fileid, "Dataset")) < 0) TEST_ERROR + if((datasetid = H5Dopen2(fileid, "Dataset", H5P_DEFAULT)) < 0) TEST_ERROR /* Get dataset's creation property list */ if((plistid = H5Dget_create_plist(datasetid)) < 0) TEST_ERROR @@ -397,9 +397,9 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) H5D_fill_time_t fill_time; comp_datatype rd_c, fill_ctype; - if (H5D_CHUNKED==layout) { + if(H5D_CHUNKED==layout) { TESTING("chunked dataset creation"); - } else if (H5D_COMPACT==layout) { + } else if(H5D_COMPACT==layout) { TESTING("compact dataset creation"); } else { TESTING("contiguous dataset creation"); @@ -409,18 +409,18 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) * Create a file. */ h5_fixname(base_name, 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 ((space=H5Screate_simple(5, cur_size, cur_size))<0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; - } else if (H5D_COMPACT==layout) { - if (H5Pset_layout(dcpl, H5D_COMPACT)<0) goto error; + if((space=H5Screate_simple(5, cur_size, cur_size)) < 0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + } else if(H5D_COMPACT==layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } /* Create a compound datatype */ - if((comp_type_id = create_compound_type())<0) goto error; + if((comp_type_id = create_compound_type()) < 0) goto error; /* I. Test cases for late space allocation except compact dataset */ @@ -429,10 +429,10 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; /* 1. Compound datatype test */ - if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; fill_ctype.y = 4444; - if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; - if((dset9 = H5Dcreate(file, "dset9", comp_type_id, space, dcpl))<0) + if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; + if((dset9 = H5Dcreate(file, "dset9", comp_type_id, space, dcpl)) < 0) goto error; /* The three datasets test three fill @@ -441,33 +441,33 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) */ /* 2. Small to large fill conversion */ #ifndef NO_FILLING - if (H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s) < 0) goto error; #endif - if ((dset1=H5Dcreate(file, "dset1", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset1=H5Dcreate(file, "dset1", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 3. Large to small fill conversion */ #ifndef NO_FILLING - if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; #endif - if ((dset2=H5Dcreate(file, "dset2", H5T_NATIVE_SHORT, space, dcpl))<0) + if((dset2=H5Dcreate(file, "dset2", H5T_NATIVE_SHORT, space, dcpl)) < 0) goto error; /* 4. No conversion */ #ifndef NO_FILLING - if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; #endif - if ((dset3=H5Dcreate(file, "dset3", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset3=H5Dcreate(file, "dset3", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 5. late space allocation and never write fill value */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if ((dset4=H5Dcreate(file, "dset4", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset4=H5Dcreate(file, "dset4", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 6. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate(file, "dset7", H5T_NATIVE_LONG, space, dcpl)!=FAIL) @@ -477,38 +477,38 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* II. Test early space allocation cases */ - if (H5Pclose(dcpl)<0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; - } else if (H5D_COMPACT==layout) { - if (H5Pset_layout(dcpl, H5D_COMPACT)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + } else if(H5D_COMPACT==layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error; /* 1. Compound datatype test */ - if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; fill_ctype.y = 4444; - if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; - if((dset8 = H5Dcreate(file, "dset8", comp_type_id, space, dcpl))<0) + if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; + if((dset8 = H5Dcreate(file, "dset8", comp_type_id, space, dcpl)) < 0) goto error; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; /* 2. Never write fill value */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if((dset5 = H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl))<0) + if((dset5 = H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; /* 3. Write fill value at space allocation time */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; - if((dset6 = H5Dcreate(file, "dset6", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset6 = H5Dcreate(file, "dset6", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate(file, "dset7", H5T_NATIVE_LONG, space, dcpl)!=FAIL) goto error; @@ -516,69 +516,69 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* Close everything */ if(H5D_COMPACT != layout) { - if (H5Dclose(dset1)<0) goto error; - if (H5Dclose(dset2)<0) goto error; - if (H5Dclose(dset3)<0) goto error; - if (H5Dclose(dset4)<0) goto error; - if (H5Dclose(dset9)<0) goto error; + if(H5Dclose(dset1) < 0) goto error; + if(H5Dclose(dset2) < 0) goto error; + if(H5Dclose(dset3) < 0) goto error; + if(H5Dclose(dset4) < 0) goto error; + if(H5Dclose(dset9) < 0) goto error; } - if (H5Dclose(dset5)<0) goto error; - if (H5Dclose(dset6)<0) goto error; - if (H5Dclose(dset8)<0) goto error; - if (H5Sclose(space)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; - if (H5Fclose(file)<0) goto error; + if(H5Dclose(dset5) < 0) goto error; + if(H5Dclose(dset6) < 0) goto error; + if(H5Dclose(dset8) < 0) goto error; + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Fclose(file) < 0) goto error; /* Open the file and get the dataset fill value from each dataset */ - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; /* I. Check cases for late space allocation except compact dataset */ if(H5D_COMPACT != layout) { /* 1. Large to small conversion */ - if ((dset1=H5Dopen(file, "dset1"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset1))<0) goto error; + if((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset1)) < 0) goto error; #ifndef NO_FILLING - if (H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s)<0) goto error; - if (rd_s!=fill_s) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0) goto error; + if(rd_s != fill_s) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %d, set %d\n", rd_s, fill_s); goto error; } #endif - if (H5Dclose(dset1)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset1) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 2. Small to large conversion */ - if ((dset2=H5Dopen(file, "dset2"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset2))<0) goto error; + if((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset2)) < 0) goto error; #ifndef NO_FILLING - if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l)<0) goto error; - if (rd_l!=fill_l) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; + if(rd_l!=fill_l) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } #endif - if (H5Dclose(dset2)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset2) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 3. No conversion */ - if ((dset3=H5Dopen(file, "dset3"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset3))<0) goto error; + if((dset3 = H5Dopen2(file, "dset3", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset3)) < 0) goto error; #ifndef NO_FILLING - if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l)<0) goto error; - if (rd_l!=fill_l) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; + if(rd_l != fill_l) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } #endif - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); @@ -589,21 +589,21 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset3)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset3) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 4. late space allocation and never write fill value */ - if ((dset4=H5Dopen(file, "dset4"))<0) goto error; - if (H5Dget_space_status(dset4, &allocation)<0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { + if((dset4 = H5Dopen2(file, "dset4", H5P_DEFAULT)) < 0) goto error; + if(H5Dget_space_status(dset4, &allocation) < 0) goto error; + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { H5_FAILED(); puts(" Got allocated space instead of unallocated."); printf(" Got %d\n", allocation); goto error; } - if ((dcpl=H5Dget_create_plist(dset4))<0) goto error; - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if((dcpl = H5Dget_create_plist(dset4)) < 0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); @@ -614,100 +614,101 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset4)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset4) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 5. Compound datatype test */ - if ((dset9=H5Dopen(file, "dset9"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset9))<0) goto error; - if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c)<0) goto error; + if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error; if( rd_c.a!=0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", rd_c.a, rd_c.y, rd_c.x, rd_c.z); } - if (H5Dclose(dset9)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset9) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; } /* II. Check early space allocation cases */ /* 1. Never write fill value */ - if ((dset5=H5Dopen(file, "dset5"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset5))<0) goto error; - if (H5Dget_space_status(dset5, &allocation)<0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { + if((dset5 = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset5)) < 0) goto error; + if(H5Dget_space_status(dset5, &allocation) < 0) goto error; + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); printf(" Got %d\n", allocation); goto error; } - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); printf(" Got %d\n", alloc_time); } - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset5)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset5) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 2. test writing fill value at space allocation time */ - if ((dset6=H5Dopen(file, "dset6"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset6))<0) goto error; - if (H5Dget_space_status(dset6, &allocation)<0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { + if((dset6 = H5Dopen2(file, "dset6", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset6)) < 0) goto error; + if(H5Dget_space_status(dset6, &allocation) < 0) goto error; + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); printf(" Got %d\n", allocation); goto error; } - if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l)<0) goto error; - if (rd_l!=fill_l) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; + if(rd_l != fill_l) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); printf(" Got %d\n", alloc_time); } - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset6)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset6) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 3. Compound datatype test */ - if ((dset8=H5Dopen(file, "dset8"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset8))<0) goto error; - if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c)<0) goto error; - if( rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') { + if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error; + if(rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') { H5_FAILED(); puts(" Got wrong fill value"); printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", rd_c.a, rd_c.y, rd_c.x, rd_c.z); } - if (H5Dclose(dset8)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset8) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + + if(H5Fclose(file) < 0) goto error; - if (H5Fclose(file)<0) goto error; PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(space); @@ -761,7 +762,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if (datatype==H5T_INTEGER) + if(datatype==H5T_INTEGER) fillval = *(int*)_fillval; else if(datatype==H5T_COMPOUND) { fill_c.a=((comp_datatype*)_fillval)->a; @@ -787,14 +788,14 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, for (i=0; i<1000; i++) { for (j=0; j<5; j++) hs_offset[j] = rand() % cur_size[j]; - if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, - one, NULL)<0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, + one, NULL) < 0) goto error; /* case for atomic datatype */ - if (datatype==H5T_INTEGER) { + if(datatype==H5T_INTEGER) { if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, - &val_rd)<0) goto error; - if (fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { + &val_rd) < 0) goto error; + if(fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " @@ -807,8 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* case for compound datatype */ } else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, - &rd_c)<0) goto error; - if (fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a || + &rd_c) < 0) goto error; + if(fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a || rd_c.x!=fill_c.x || rd_c.y!=fill_c.y || rd_c.z!=fill_c.z)) { H5_FAILED(); @@ -823,7 +824,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } } } - if (H5Sclose(mspace)<0) goto error; + if(H5Sclose(mspace) < 0) goto error; /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { @@ -832,9 +833,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hs_stride[i] = 2; nelmts *= hs_size[i]; } - if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error; - if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, - hs_size, NULL)<0) goto error; + if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, + hs_size, NULL) < 0) goto error; /* Read non-contiguous selection from empty dataset */ @@ -916,11 +917,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } /* Check if space is allocated */ - if (datatype==H5T_INTEGER && H5Dget_space_status(dset1, &allocation)<0) + if(datatype==H5T_INTEGER && H5Dget_space_status(dset1, &allocation) < 0) goto error; - if (datatype==H5T_COMPOUND && H5Dget_space_status(dset2, &allocation)<0) + if(datatype==H5T_COMPOUND && H5Dget_space_status(dset2, &allocation) < 0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); printf(" Got %d\n", allocation); @@ -947,7 +948,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; if(fill_time == H5D_FILL_TIME_ALLOC) { should_be = odd ? fillval : 9999; - if (val_rd!=should_be) { + if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " @@ -960,7 +961,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } else if(fill_time == H5D_FILL_TIME_NEVER && !odd) { should_be = 9999; - if (val_rd!=should_be) { + if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " @@ -1033,10 +1034,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, buf_c = NULL; } /* end if */ - if (H5Sclose(mspace)<0) goto error; - if (datatype==H5T_INTEGER && H5Dclose(dset1)<0) goto error; - if (datatype==H5T_COMPOUND && H5Dclose(dset2)<0) goto error; - if (H5Sclose(fspace)<0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(datatype==H5T_INTEGER && H5Dclose(dset1) < 0) goto error; + if(datatype==H5T_COMPOUND && H5Dclose(dset2) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; return 0; error: @@ -1079,25 +1080,25 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) int fillval = 0x4c70f1cd; comp_datatype fill_ctype={0,0,0,0}; - if (H5D_CHUNKED==layout) { + if(H5D_CHUNKED==layout) { TESTING("chunked dataset I/O"); - } else if (H5D_COMPACT==layout) { + } else if(H5D_COMPACT==layout) { TESTING("compact dataset I/O"); } else { TESTING("contiguous dataset I/O"); } h5_fixname(base_name, 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 ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; - } else if (H5D_COMPACT==layout) { - if (H5Pset_layout(dcpl, H5D_COMPACT)<0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + } else if(H5D_COMPACT==layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } - if ((ctype_id=create_compound_type())<0) goto error; + if((ctype_id=create_compound_type()) < 0) goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ @@ -1111,20 +1112,20 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1133,7 +1134,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1141,14 +1142,14 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fill_ctype.y = 4444.4444; - if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype)<0) goto error; + 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, layout, H5T_COMPOUND, ctype_id); - if (H5Pclose(dcpl)<0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; } } @@ -1163,20 +1164,20 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1185,7 +1186,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1193,16 +1194,16 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fill_ctype.y = 4444.4444; - if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype)<0) goto error; + 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, layout, H5T_COMPOUND, ctype_id); if(nerrors) goto error; - if (H5Pclose(dcpl)<0) goto error; - if (H5Tclose(ctype_id)<0) goto error; - if (H5Fclose(file)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Tclose(ctype_id) < 0) goto error; + if(H5Fclose(file) < 0) goto error; PASSED(); return 0; @@ -1859,7 +1860,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * first dimension can be extendible' as long as the test isn't skipped * below. */ - if (H5D_CONTIGUOUS==layout) { + if(H5D_CONTIGUOUS==layout) { max_size[0] = (max_size[0] * max_size[1] * max_size[2] * max_size[3] * max_size[4]) / (start_size[1] * start_size[2] * start_size[3] * start_size[4]); @@ -1877,14 +1878,14 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * `extendible contiguous non-external dataset' as long as the test isn't * skipped below. */ - if (H5D_CONTIGUOUS==layout) { + if(H5D_CONTIGUOUS==layout) { int fd; hsize_t nelmts; nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4]; - if ((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666))<0 || - close(fd)<0) goto error; - if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int))<0) + if((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0 || + close(fd) < 0) goto error; + if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0) goto error; } #endif @@ -1896,7 +1897,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * dimension. If it's removed prematurely then you'll get one of the * errors described above or `unable to select fill value region'. */ - if (H5D_CONTIGUOUS==layout) { + if(H5D_CONTIGUOUS==layout) { SKIPPED(); puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); goto skip; @@ -1978,20 +1979,20 @@ test_compatible(hid_t fapl) /* Generate correct name for test file by prepending the source path */ if(srcdir && ((strlen(srcdir) + strlen(FILE_COMPATIBLE) + 1) < sizeof(testfile))) { - strcpy(testfile, srcdir); - strcat(testfile, "/"); + HDstrcpy(testfile, srcdir); + HDstrcat(testfile, "/"); } - strcat(testfile, FILE_COMPATIBLE); + HDstrcat(testfile, FILE_COMPATIBLE); - if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, fapl))<0) { + if((file = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) { printf(" Could not open file %s. Try set $srcdir to point at the " "source directory of test\n", testfile); goto error; } - if((dset1=H5Dopen(file, "dset1"))<0) goto error; - if ((dcpl1=H5Dget_create_plist(dset1))<0) goto error; - if (H5Pfill_value_defined(dcpl1, &status)<0) goto error; + if((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((dcpl1 = H5Dget_create_plist(dset1)) < 0) goto error; + if(H5Pfill_value_defined(dcpl1, &status) < 0) goto error; if(status != H5D_FILL_VALUE_UNDEFINED) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); @@ -1999,34 +2000,34 @@ test_compatible(hid_t fapl) (long)status); goto error; } - if((fspace = H5Dget_space(dset1))<0) goto error; - if(H5Sget_simple_extent_dims(fspace, dims, NULL)<0) goto error; + if((fspace = H5Dget_space(dset1)) < 0) goto error; + if(H5Sget_simple_extent_dims(fspace, dims, NULL) < 0) goto error; if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } - if((mspace=H5Screate_simple(2, one, NULL))<0) goto error; - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL)<0) + if((mspace = H5Screate_simple(2, one, NULL)) < 0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) goto error; - if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd)<0) + if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) goto error; - if (val_rd != 0) { + if(val_rd != 0) { H5_FAILED(); puts(" Got a different value than what was set."); printf(" Got %ld, set 0\n", (long)val_rd); goto error; } - if(H5Pclose(dcpl1)<0) goto error; - if(H5Sclose(fspace)<0) goto error; - if(H5Sclose(mspace)<0) goto error; - if(H5Dclose(dset1)<0) goto error; + if(H5Pclose(dcpl1) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(H5Dclose(dset1) < 0) goto error; - if((dset2=H5Dopen(file, "dset2"))<0) goto error; - if ((dcpl2=H5Dget_create_plist(dset2))<0) goto error; - if (H5Pfill_value_defined(dcpl2, &status)<0) goto error; + if((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error; + if((dcpl2 = H5Dget_create_plist(dset2)) < 0) goto error; + if(H5Pfill_value_defined(dcpl2, &status) < 0) goto error; if(status != H5D_FILL_VALUE_USER_DEFINED) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); @@ -2034,40 +2035,40 @@ test_compatible(hid_t fapl) (long)status); goto error; } - if (H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill)<0) goto error; - if (rd_fill != fill_val) { + if(H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0) goto error; + if(rd_fill != fill_val) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val); goto error; } fspace = -1; - if((fspace = H5Dget_space(dset2))<0) goto error; + if((fspace = H5Dget_space(dset2)) < 0) goto error; dims[0] = dims[1] = (hsize_t)-1; - if(H5Sget_simple_extent_dims(fspace, dims, NULL)<0) goto error; + if(H5Sget_simple_extent_dims(fspace, dims, NULL) < 0) goto error; if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } - if((mspace=H5Screate_simple(2, one, NULL))<0) goto error; - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL)<0) + if((mspace=H5Screate_simple(2, one, NULL)) < 0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) goto error; - if(H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd)<0) + if(H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) goto error; - if (val_rd != fill_val) { + if(val_rd != fill_val) { H5_FAILED(); puts(" Got a different value than what was set."); printf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); goto error; } - if(H5Pclose(dcpl2)<0) goto error; - if(H5Sclose(fspace)<0) goto error; - if(H5Sclose(mspace)<0) goto error; - if(H5Dclose(dset2)<0) goto error; + if(H5Pclose(dcpl2) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(H5Dclose(dset2) < 0) goto error; - if(H5Fclose(file)<0) goto error; + if(H5Fclose(file) < 0) goto error; PASSED(); return 0; diff --git a/test/flush2.c b/test/flush2.c index 46f61da..dbb0a82 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -57,23 +57,23 @@ check_dset(hid_t file, const char* name) size_t i, j; /* Open the dataset */ - if ((dset=H5Dopen(file, name))<0) goto error; - if ((space=H5Dget_space(dset))<0) goto error; - if (H5Sget_simple_extent_dims(space, ds_size, NULL)<0) goto error; - assert(100==ds_size[0] && 100==ds_size[1]); + if((dset = H5Dopen2(file, name, H5P_DEFAULT)) < 0) goto error; + if((space = H5Dget_space(dset)) < 0) goto error; + if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error; + assert(100 == ds_size[0] && 100 == ds_size[1]); /* Read some data */ - if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, - the_data)<0) goto error; - for (i=0; i<(size_t)ds_size[0]; i++) { - for (j=0; j<(size_t)ds_size[1]; j++) { + if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, + the_data) < 0) goto error; + for(i = 0; i < (size_t)ds_size[0]; i++) + for(j = 0; j < (size_t)ds_size[1]; j++) { /* * The extra cast in the following statement is a bug workaround * for the Win32 version 5.0 compiler. * 1998-11-06 ptl */ - error = fabs(the_data[i][j]-(double)(hssize_t)i/((hssize_t)j+1)); - if (error>0.0001) { + error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); + if(error > 0.0001) { H5_FAILED(); printf(" dset[%lu][%lu] = %g\n", (unsigned long)i, (unsigned long)j, the_data[i][j]); @@ -82,8 +82,7 @@ check_dset(hid_t file, const char* name) goto error; } } - } - if (H5Dclose(dset)<0) goto error; + if(H5Dclose(dset) < 0) goto error; return 0; error: diff --git a/test/getname.c b/test/getname.c index 2f3a020..670489f 100644 --- a/test/getname.c +++ b/test/getname.c @@ -218,27 +218,27 @@ test_main(hid_t file_id, hid_t fapl) /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Dopen + * Test H5Iget_name with H5Dopen2 *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Dopen"); + TESTING("H5Iget_name with H5Dopen2"); /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "d1")) < 0) TEST_ERROR + if((dataset_id = H5Dopen2(file_id, "d1", H5P_DEFAULT)) < 0) TEST_ERROR /* Verify */ if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR /* Reopen the group */ if((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if((dataset_id = H5Dopen(group_id, "d1")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(group_id, "d1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR @@ -268,20 +268,20 @@ test_main(hid_t file_id, hid_t fapl) if((dataset_id = H5Dcreate(group3_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Sclose(space_id); - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "/g2/bar/baz/d1")) < 0) TEST_ERROR + if((dataset_id = H5Dopen2(file_id, "/g2/bar/baz/d1", H5P_DEFAULT)) < 0) TEST_ERROR /* Verify */ if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -356,14 +356,14 @@ test_main(hid_t file_id, hid_t fapl) /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Lmove and H5Dopen + * Test H5Iget_name with H5Lmove and H5Dopen2 *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Lmove and H5Dopen"); + TESTING("H5Iget_name with H5Lmove and H5Dopen2"); /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "/d1")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(file_id, "/d1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename dataset */ if(H5Lmove(file_id, "/d1", H5L_SAME_LOC, "/d1a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -679,10 +679,10 @@ test_main(hid_t file_id, hid_t fapl) if((group_id = H5Gcreate2(file_id, "/g12", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Create second file and dataset "d" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a dataspace */ if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR @@ -691,13 +691,13 @@ test_main(hid_t file_id, hid_t fapl) if((dataset_id = H5Dcreate(file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR /* Mount second file under "g12" in the first file */ if(H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT) < 0) TEST_ERROR /* Access dataset D in the first file under "/G/D" name */ - if((dataset_id = H5Dopen(file_id, "/g12/d")) < 0) TEST_ERROR + if((dataset_id = H5Dopen2(file_id, "/g12/d", H5P_DEFAULT)) < 0) TEST_ERROR /* Verify */ if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR @@ -705,9 +705,9 @@ test_main(hid_t file_id, hid_t fapl) if(H5Funmount(file_id, "/g12") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Fclose(file1_id); - H5Sclose(space_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -1008,7 +1008,7 @@ test_main(hid_t file_id, hid_t fapl) if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "/g17/d")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get datatype*/ if((type_id = H5Dget_type(dataset_id)) < 0) FAIL_STACK_ERROR @@ -1031,11 +1031,11 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with datasets that have two names"); /* Open dataset named "d"*/ - if((dataset_id = H5Dopen(file_id, "/g17/d")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create link to dataset named "link" */ if(H5Lcreate_hard(dataset_id, ".", file_id, "/g17/link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((dataset2_id = H5Dopen(file_id, "/g17/link")) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dopen2(file_id, "/g17/link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Make sure that the two IDs use two different names */ if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR @@ -1280,7 +1280,7 @@ test_main(hid_t file_id, hid_t fapl) /* Open the mounted group, dataset, and datatype through their new names */ if((group6_id = H5Gopen2(file1_id, "/g3/g4/g18/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((dataset2_id = H5Dopen(file1_id, "/g3/g4/g18/d2")) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dopen2(file1_id, "/g3/g4/g18/d2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((type2_id = H5Topen2(file1_id, "/g3/g4/g18/t2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify names */ @@ -2727,7 +2727,7 @@ test_reg_ref(hid_t fapl) TEST_ERROR /* Reopen the dataset with object references and read references to the buffer */ - if((dsetr_id = H5Dopen(file_id, REFREG_DSETNAMER)) , 0) + if((dsetr_id = H5Dopen2(file_id, REFREG_DSETNAMER, H5P_DEFAULT)) < 0) TEST_ERROR if((status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out)) < 0) diff --git a/test/links.c b/test/links.c index 1e9e8d4..487bcee 100644 --- a/test/links.c +++ b/test/links.c @@ -785,7 +785,7 @@ test_h5l_create(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Open dataset through root group and verify its data */ - if((dset_id = H5Dopen(file_id, "/group/inter_group/dataset")) < 0) TEST_ERROR + if((dset_id = H5Dopen2(file_id, "/group/inter_group/dataset", H5P_DEFAULT)) < 0) TEST_ERROR /* Read data from dataset */ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR @@ -3451,7 +3451,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* Test H5*open */ if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen(fid1, "elink/elink/elink/dataset1_moved")) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close objects */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if(H5Tclose(tid) < 0) FAIL_STACK_ERROR diff --git a/test/mount.c b/test/mount.c index 0009503..6330504 100644 --- a/test/mount.c +++ b/test/mount.c @@ -1197,7 +1197,7 @@ test_mount_after_close(hid_t fapl) if(H5Gclose(gidABT) < 0) FAIL_STACK_ERROR /* Open "normal" dataset in mounted file */ - if((didABMXYD = H5Dopen(gidAB, "M/X/Y/D")) < 0) FAIL_STACK_ERROR + if((didABMXYD = H5Dopen2(gidAB, "M/X/Y/D", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if(H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR diff --git a/test/mtime.c b/test/mtime.c index d49dd5a..d6eed1f 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -92,7 +92,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; if(H5Oget_info(file, "dset", &oi1, H5P_DEFAULT) < 0) TEST_ERROR; - if((dset = H5Dopen(file, "dset")) < 0) TEST_ERROR; + if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; if(H5Oget_info(dset, ".", &oi2, H5P_DEFAULT) < 0) TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; diff --git a/test/ntypes.c b/test/ntypes.c index dc1538b..2535ce1 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -89,39 +89,37 @@ test_atomic_dtype(hid_t file) TESTING("atomic datatype"); envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) + if(envval == NULL) envval = "nomatch"; - if (HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { + if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { /* Initialize the dataset */ - for (i = n = 0; i < DIM0; i++) { - for (j = 0; j < DIM1; j++) { + for(i = n = 0; i < DIM0; i++) + for(j = 0; j < DIM1; j++) ipoints2[i][j] = n++; - } - } /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /*------------------- Test data values ------------------------*/ /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ATOMIC_NAME_1))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ATOMIC_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -129,28 +127,28 @@ test_atomic_dtype(hid_t file) TEST_ERROR; if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I32BE)) TEST_ERROR; - if(H5T_INTEGER!=H5Tget_class(native_type)) + if(H5T_INTEGER != H5Tget_class(native_type)) TEST_ERROR; /* Read the dataset back. The temporary buffer is for special platforms * like Cray. */ - tmp = malloc((size_t)(DIM0*DIM1*H5Tget_size(native_type))); + tmp = malloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; /* Copy data from temporary buffer to destination buffer */ - memcpy(icheck2, tmp, (size_t)(DIM0*DIM1*H5Tget_size(native_type))); + memcpy(icheck2, tmp, (size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); free(tmp); /* Convert to the integer type */ - if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0*DIM1), icheck2, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0*DIM1), icheck2, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for (i = 0; i < DIM0; i++) { for (j = 0; j < DIM1; j++) { - if (ipoints2[i][j] != icheck2[i][j]) { + if(ipoints2[i][j] != icheck2[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d,%d\n", i, j); @@ -159,19 +157,19 @@ test_atomic_dtype(hid_t file) } } - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /*------------------ Test different data types ----------------*/ /* Create the dataset of H5T_STD_I64LE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -182,18 +180,18 @@ test_atomic_dtype(hid_t file) if(H5T_INTEGER!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Create the dataset of H5T_STD_I8LE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_ASCEND))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_ASCEND)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -204,18 +202,18 @@ test_atomic_dtype(hid_t file) if(H5T_INTEGER!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Create the dataset of H5T_IEEE_F32BE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -226,18 +224,18 @@ test_atomic_dtype(hid_t file) if(H5T_FLOAT!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Create the dataset of H5T_IEEE_F64BE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -248,13 +246,13 @@ test_atomic_dtype(hid_t file) if(H5T_FLOAT!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; PASSED(); } @@ -330,89 +328,89 @@ test_compound_dtype2(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ #if H5_SIZEOF_LONG==4 - if((tid2=H5Tcreate(H5T_COMPOUND, 6))<0) TEST_ERROR; - if((tid=H5Tcreate(H5T_COMPOUND, 19))<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, 6)) < 0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 19)) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG==8 - if((tid2=H5Tcreate(H5T_COMPOUND, 10))<0) TEST_ERROR; - if((tid=H5Tcreate(H5T_COMPOUND, 23))<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, 10)) < 0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 23)) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif /* Insert and pack members */ - if(H5Tinsert(tid2, "c2", 0, H5T_STD_I16BE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "c2", 0, H5T_STD_I16BE) < 0) TEST_ERROR; #if H5_SIZEOF_LONG==4 - if(H5Tinsert(tid2, "l2", 2, H5T_STD_I32LE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "l2", 2, H5T_STD_I32LE) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG==8 - if(H5Tinsert(tid2, "l2", 2, H5T_STD_I64LE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "l2", 2, H5T_STD_I64LE) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "i", 1, H5T_STD_I32LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "st", 5, tid2)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "i", 1, H5T_STD_I32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "st", 5, tid2) < 0) TEST_ERROR; #if H5_SIZEOF_LONG==4 - if(H5Tinsert(tid, "l", 11, H5T_STD_U64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "l", 11, H5T_STD_U64BE) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG==8 - if(H5Tinsert(tid, "l", 15, H5T_STD_U64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "l", 15, H5T_STD_U64BE) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_2, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_2, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for memory */ - if((tid_m2=H5Tcreate(H5T_COMPOUND, sizeof(s2)))<0) TEST_ERROR; - if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; + if((tid_m2=H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0) TEST_ERROR; + if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT)<0) TEST_ERROR; - if(H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_ULLONG)<0) TEST_ERROR; + if(H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT) < 0) TEST_ERROR; + if(H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_ULLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME_2))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_2, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ /* check the char member */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE)) TEST_ERROR; - if(H5T_INTEGER!=H5Tget_class(mem_id)) + if(H5T_INTEGER != H5Tget_class(mem_id)) TEST_ERROR; H5Tclose(mem_id); /* check the integer member */ - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_INT)) TEST_ERROR; @@ -423,7 +421,7 @@ test_compound_dtype2(hid_t file) H5Tclose(mem_id); /* check the long long member */ - if((mem_id = H5Tget_member_type(native_type, 3))<0) + if((mem_id = H5Tget_member_type(native_type, 3)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_ULLONG)) TEST_ERROR; @@ -434,10 +432,10 @@ test_compound_dtype2(hid_t file) H5Tclose(mem_id); /* check the nested compound member */ - if((nest_mem_id = H5Tget_member_type(native_type, 2))<0) + if((nest_mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; - if((mem_id = H5Tget_member_type(nest_mem_id, 0))<0) + if((mem_id = H5Tget_member_type(nest_mem_id, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SHORT)) TEST_ERROR; @@ -447,7 +445,7 @@ test_compound_dtype2(hid_t file) TEST_ERROR; H5Tclose(mem_id); - if((mem_id = H5Tget_member_type(nest_mem_id, 1))<0) + if((mem_id = H5Tget_member_type(nest_mem_id, 1)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LONG)) TEST_ERROR; @@ -468,13 +466,13 @@ test_compound_dtype2(hid_t file) if((bkg=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; free(bkg); @@ -482,7 +480,7 @@ test_compound_dtype2(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->st.c2 != temp_check->st.c2 || temp_point->st.l2 != temp_check->st.l2 || @@ -496,9 +494,9 @@ test_compound_dtype2(hid_t file) } /* Close temporary datatypes */ - if(H5Tclose(tid2)<0) TEST_ERROR; - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid_m2)<0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid_m2) < 0) TEST_ERROR; /* Close HDF5 objects */ H5Dclose(dataset); @@ -575,47 +573,47 @@ test_compound_dtype(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "i", 1, H5T_STD_U32LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "l", 5, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "i", 1, H5T_STD_U32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid2, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_UINT)<0) TEST_ERROR; - if(H5Tinsert(tid2, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; @@ -625,7 +623,7 @@ test_compound_dtype(hid_t file) TEST_ERROR; H5Tclose(mem_id); - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UINT)) TEST_ERROR; @@ -635,7 +633,7 @@ test_compound_dtype(hid_t file) TEST_ERROR; H5Tclose(mem_id); - if((mem_id = H5Tget_member_type(native_type, 2))<0) + if((mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) TEST_ERROR; @@ -650,13 +648,13 @@ test_compound_dtype(hid_t file) tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); bkg = calloc(sizeof(s1),DIM0*DIM1); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid2, (DIM0*DIM1), check, bkg, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid2, (DIM0*DIM1), check, bkg, H5P_DEFAULT) < 0) TEST_ERROR; free(bkg); @@ -664,7 +662,7 @@ test_compound_dtype(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); @@ -676,7 +674,7 @@ test_compound_dtype(hid_t file) } /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; H5Dclose(dataset); H5Tclose(dtype); @@ -750,58 +748,58 @@ test_compound_dtype3(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create array datatype */ if((tid2 = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid=H5Tcreate(H5T_COMPOUND, 29))<0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 29)) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "a", 1, tid2)<0) TEST_ERROR; - if(H5Tinsert(tid, "l", 21, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "a", 1, tid2) < 0) TEST_ERROR; + if(H5Tinsert(tid, "l", 21, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_3, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_3, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype */ if((tid_m2 = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "a", HOFFSET(s1, a), tid_m2)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "a", HOFFSET(s1, a), tid_m2) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid2)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME_3))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_3, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ /* check the char member */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; @@ -812,11 +810,11 @@ test_compound_dtype3(hid_t file) H5Tclose(mem_id); /* check the array member */ - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5T_ARRAY!=H5Tget_class(mem_id)) TEST_ERROR; - if((nest_mem_id = H5Tget_super(mem_id))<0) + if((nest_mem_id = H5Tget_super(mem_id)) < 0) TEST_ERROR; if(H5Tget_order(nest_mem_id) != H5Tget_order(H5T_NATIVE_INT)) TEST_ERROR; @@ -828,7 +826,7 @@ test_compound_dtype3(hid_t file) H5Tclose(mem_id); /* check the long long member */ - if((mem_id = H5Tget_member_type(native_type, 2))<0) + if((mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) TEST_ERROR; @@ -844,13 +842,13 @@ test_compound_dtype3(hid_t file) if((bkg=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; free(bkg); @@ -858,7 +856,7 @@ test_compound_dtype3(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -949,56 +947,56 @@ test_compound_opaque(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create opaque datatype */ - if((tid2=H5Tcreate(H5T_OPAQUE, sizeof(temp_point->o)))<0) TEST_ERROR; - if(H5Tset_tag(tid2, "testing opaque field")<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_OPAQUE, sizeof(temp_point->o))) < 0) TEST_ERROR; + if(H5Tset_tag(tid2, "testing opaque field") < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid=H5Tcreate(H5T_COMPOUND, 14))<0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 14)) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "o", 1, tid2)<0) TEST_ERROR; - if(H5Tinsert(tid, "l", 6, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "o", 1, tid2) < 0) TEST_ERROR; + if(H5Tinsert(tid, "l", 6, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_4, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_4, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "o", HOFFSET(s1, o), tid2)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "o", HOFFSET(s1, o), tid2) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid2)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME_4))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_4, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ /* check the char member */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; @@ -1009,7 +1007,7 @@ test_compound_opaque(hid_t file) H5Tclose(mem_id); /* check the array member */ - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5T_OPAQUE!=H5Tget_class(mem_id)) TEST_ERROR; @@ -1018,7 +1016,7 @@ test_compound_opaque(hid_t file) H5Tclose(mem_id); /* check the long long member */ - if((mem_id = H5Tget_member_type(native_type, 2))<0) + if((mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) TEST_ERROR; @@ -1034,13 +1032,13 @@ test_compound_opaque(hid_t file) if((bkg=HDcalloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; HDmemcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); HDfree(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; HDfree(bkg); @@ -1048,7 +1046,7 @@ test_compound_opaque(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -1130,67 +1128,67 @@ test_enum_dtype(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Construct enum type based on native type */ - if((tid=H5Tenum_create(H5T_STD_I16LE))<0) TEST_ERROR; + if((tid=H5Tenum_create(H5T_STD_I16LE)) < 0) TEST_ERROR; for (i = 0; i < 8; i++) { sub_colors[i*2]=i; sub_colors[i*2+1]=0; - if(H5Tenum_insert(tid, mname[i], &(sub_colors[i*2]))<0) TEST_ERROR; + if(H5Tenum_insert(tid, mname[i], &(sub_colors[i*2])) < 0) TEST_ERROR; } /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ENUM_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ENUM_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Construct enum type based on native type in memory */ - if((tid_m=H5Tenum_create(H5T_NATIVE_SHORT))<0) TEST_ERROR; + if((tid_m = H5Tenum_create(H5T_NATIVE_SHORT)) < 0) TEST_ERROR; - for (i = 0; i < 8; i++) { + for(i = 0; i < 8; i++) { colors[i] = i; - if(H5Tenum_insert(tid_m, mname[i], &(colors[i]))<0) TEST_ERROR; + if(H5Tenum_insert(tid_m, mname[i], &(colors[i])) < 0) TEST_ERROR; } /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ENUM_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ENUM_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; - memcpy(scheck2, tmp, DIM0*DIM1*H5Tget_size(native_type)); + memcpy(scheck2, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), scheck2, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), scheck2, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for (i = 0; i < DIM0; i++) { for (j = 0; j < DIM1; j++) { - if (spoints2[i][j] != scheck2[i][j]) { + if(spoints2[i][j] != scheck2[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d,%d\n", i, j); @@ -1265,72 +1263,72 @@ test_array_dtype(hid_t file) /* Create the data space */ space_dims[0] = DIM0; space_dims[1] = DIM1; - if ((space = H5Screate_simple(2, space_dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid2=H5Tcreate(H5T_COMPOUND, 13))<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, 13)) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid2, "c", 0, H5T_STD_U8BE)<0) TEST_ERROR; - if(H5Tinsert(tid2, "i", 1, H5T_STD_U32LE)<0) TEST_ERROR; - if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "c", 0, H5T_STD_U8BE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "i", 1, H5T_STD_U32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create array datatype for disk storage */ if((tid = H5Tarray_create(tid2, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ARRAY_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ARRAY_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid3=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid3, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid3, "i", HOFFSET(s1, i), H5T_NATIVE_UINT)<0) TEST_ERROR; - if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid3=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid3, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid3, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0) TEST_ERROR; + if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Create array datatype for memory */ if((tid_m = H5Tarray_create(tid3, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid2)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ARRAY_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ARRAY_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; - memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); + memcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++) { for (k = 0; k < 5; k++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); @@ -1346,8 +1344,8 @@ test_array_dtype(hid_t file) if(H5Dclose(dataset)) TEST_ERROR; if(H5Tclose(native_type)) TEST_ERROR; if(H5Tclose(dtype)) TEST_ERROR; - if(H5Tclose(tid_m)<0) TEST_ERROR; - if(H5Tclose(tid3)<0) TEST_ERROR; + if(H5Tclose(tid_m) < 0) TEST_ERROR; + if(H5Tclose(tid3) < 0) TEST_ERROR; /* Free memory for test data */ free(points); @@ -1401,51 +1399,51 @@ test_array_dtype2(hid_t file) /* Create the data space */ space_dims[0] = DIM0; space_dims[1] = DIM1; - if ((space = H5Screate_simple(2, space_dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR; /* Create array datatype for disk storage */ if((tid = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ARRAY2_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ARRAY2_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype for memory */ if((tid_m = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ARRAY2_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ARRAY2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; - memcpy(icheck3, tmp, DIM0*DIM1*H5Tget_size(native_type)); + memcpy(icheck3, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), icheck3, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), icheck3, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1466,7 +1464,7 @@ test_array_dtype2(hid_t file) if(H5Dclose(dataset)) TEST_ERROR; if(H5Tclose(native_type)) TEST_ERROR; if(H5Tclose(dtype)) TEST_ERROR; - if(H5Tclose(tid_m)<0) TEST_ERROR; + if(H5Tclose(tid_m) < 0) TEST_ERROR; PASSED(); return 0; @@ -1530,61 +1528,61 @@ test_vl_dtype(hid_t file) } /* end for */ /* Create dataspace for datasets */ - if((space = H5Screate_simple(SPACE1_RANK, dims1, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR; /* Create the base VL type */ - if((tid2 = H5Tvlen_create (H5T_STD_U32LE))<0) TEST_ERROR; + if((tid2 = H5Tvlen_create (H5T_STD_U32LE)) < 0) TEST_ERROR; /* Create a VL datatype for disk storage */ - tid = H5Tvlen_create (tid2); + if((tid = H5Tvlen_create(tid2)) < 0) TEST_ERROR /* Create a dataset */ - if((dataset=H5Dcreate(file, DSET_VL_NAME, tid, space, H5P_DEFAULT))<0) + if((dataset = H5Dcreate(file, DSET_VL_NAME, tid, space, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create a base VL datatype for memory */ - if((tid_m2 = H5Tvlen_create (H5T_NATIVE_UINT))<0) TEST_ERROR; + if((tid_m2 = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) TEST_ERROR; /* Create a VL datatype for memory */ - if((tid_m = H5Tvlen_create (tid_m2))<0) TEST_ERROR; + if((tid_m = H5Tvlen_create (tid_m2)) < 0) TEST_ERROR; /* Write dataset to disk */ - if(H5Dwrite(dataset,tid_m,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid2)<0) TEST_ERROR; - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; /* Open a dataset */ - if((dataset=H5Dopen(file, DSET_VL_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_VL_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get native datatype for dataset */ - if((dtype = H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Also get native base type for this nested VL type. Should be an integer type. */ - if((nat_super_type=H5Tget_super(native_type))<0) + if((nat_super_type = H5Tget_super(native_type)) < 0) TEST_ERROR; - if((nat_super_type=H5Tget_super(nat_super_type))<0) + if((nat_super_type = H5Tget_super(nat_super_type)) < 0) TEST_ERROR; /* Read dataset from disk */ - if(H5Dread(dataset,native_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - if(wdata[i].len!=rdata[i].len) { + for(i = 0; i < SPACE1_DIM1; i++) { + if(wdata[i].len != rdata[i].len) { H5_FAILED(); printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { - if(t1->len!=t2->len) { + for(t1 = wdata[i].p, t2 = rdata[i].p, j = 0; j<rdata[i].len; j++, t1++, t2++) { + if(t1->len != t2->len) { H5_FAILED(); printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; @@ -1595,7 +1593,7 @@ test_vl_dtype(hid_t file) tmp=malloc(t2->len*sizeof(unsigned int)); memcpy(tmp, t2->p, t2->len*H5Tget_size(nat_super_type)); - if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) + if(H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) TEST_ERROR; for(k=0; k<t2->len; k++) { @@ -1612,23 +1610,23 @@ test_vl_dtype(hid_t file) } /* end for */ /* Reclaim the read VL data */ - if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,rdata) < 0) TEST_ERROR; /* Reclaim the write VL data */ - if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; - if(H5Tclose(tid_m)<0) TEST_ERROR; - if(H5Tclose(tid_m2)<0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Tclose(tid_m) < 0) TEST_ERROR; + if(H5Tclose(tid_m2) < 0) TEST_ERROR; /* Close disk dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; PASSED(); return 0; @@ -1674,32 +1672,32 @@ test_vlstr_dtype(hid_t file) TESTING("variable length string datatype"); /* Create dataspace for datasets */ - if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL))<0) TEST_ERROR; + if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR; /* Create a datatype to refer to */ - if((tid1 = H5Tcopy (H5T_C_S1))<0) TEST_ERROR; + if((tid1 = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR; - if(H5Tset_size (tid1,H5T_VARIABLE)<0) TEST_ERROR; - if(H5T_STRING!=H5Tget_class(tid1) || !H5Tis_variable_str(tid1)) + if(H5Tset_size(tid1,H5T_VARIABLE) < 0) TEST_ERROR; + if(H5T_STRING != H5Tget_class(tid1) || !H5Tis_variable_str(tid1)) TEST_ERROR; /* Create a dataset */ - if((dataset=H5Dcreate(file,DSET_VLSTR_NAME,tid1,sid1,H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file,DSET_VLSTR_NAME,tid1,sid1,H5P_DEFAULT)) < 0) TEST_ERROR; /* Write dataset to disk */ - if(H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Open a dataset */ - if((dataset=H5Dopen(file, DSET_VLSTR_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_VLSTR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get datatype for dataset */ - if((dtype = H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; /* Construct native type */ - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Check if the data type is equal */ @@ -1707,17 +1705,17 @@ test_vlstr_dtype(hid_t file) TEST_ERROR; /* Read dataset from disk */ - if(H5Dread(dataset,native_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - if(strlen(wdata[i])!=strlen(rdata[i])) { + for(i = 0; i < SPACE1_DIM1; i++) { + if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { H5_FAILED(); printf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); goto error; } /* end if */ - if( strcmp(wdata[i],rdata[i]) != 0 ) { + if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { H5_FAILED(); printf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i,wdata[i],(int)i,rdata[i]); @@ -1726,14 +1724,14 @@ test_vlstr_dtype(hid_t file) } /* end for */ /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid1)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; + if(H5Tclose(tid1) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; /* Close disk dataspace */ - if(H5Sclose(sid1)<0) TEST_ERROR; + if(H5Sclose(sid1) < 0) TEST_ERROR; /* Free memory for rdata */ for(i=0; i<SPACE1_DIM1; i++) { @@ -1784,32 +1782,31 @@ test_str_dtype(hid_t file) TESTING("fixed-length string datatype"); /* Create dataspace for datasets */ - if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL))<0) TEST_ERROR; + if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR; /* Create a datatype to refer to */ - if((tid1 = H5Tcopy (H5T_C_S1))<0) TEST_ERROR; + if((tid1 = H5Tcopy (H5T_C_S1)) < 0) TEST_ERROR; - if(H5Tset_size (tid1,4)<0) TEST_ERROR; - if(H5T_STRING!=H5Tget_class(tid1)) - TEST_ERROR; + if(H5Tset_size(tid1, 4) < 0) TEST_ERROR; + if(H5T_STRING != H5Tget_class(tid1)) TEST_ERROR; /* Create a dataset */ - if((dataset=H5Dcreate(file,DSET_STR_NAME,tid1,sid1,H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_STR_NAME, tid1, sid1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write dataset to disk */ - if(H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Open a dataset */ - if((dataset=H5Dopen(file, DSET_STR_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_STR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get datatype for dataset */ - if((dtype = H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; /* Construct native type */ - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Check if the data type is equal */ @@ -1817,17 +1814,17 @@ test_str_dtype(hid_t file) TEST_ERROR; /* Read dataset from disk */ - if(H5Dread(dataset,native_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - if(strlen(wdata[i])!=strlen(rdata[i])) { + for(i = 0; i < SPACE1_DIM1; i++) { + if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { H5_FAILED(); printf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); goto error; } /* end if */ - if( strcmp(wdata[i],rdata[i]) != 0 ) { + if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { H5_FAILED(); printf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i,wdata[i],(int)i,rdata[i]); @@ -1836,14 +1833,14 @@ test_str_dtype(hid_t file) } /* end for */ /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid1)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; + if(H5Tclose(tid1) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; /* Close disk dataspace */ - if(H5Sclose(sid1)<0) TEST_ERROR; + if(H5Sclose(sid1) < 0) TEST_ERROR; PASSED(); return 0; @@ -1894,9 +1891,9 @@ test_refer_dtype(hid_t file) /* Output message about test being performed */ TESTING("reference datatype"); envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) + if(envval == NULL) envval = "nomatch"; - if (HDstrcmp(envval, "multi")) { + if(HDstrcmp(envval, "multi")) { H5O_type_t obj_type; /* Object type */ /* Allocate write & read buffers */ @@ -1904,18 +1901,18 @@ test_refer_dtype(hid_t file) rbuf=HDmalloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t))); /* Create dataspace for datasets */ - if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL))<0) + if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR; /* Create a group */ if((group = H5Gcreate2(file, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a datatype to refer to */ - if((tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) + if((tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t))) < 0) TEST_ERROR; /* Insert fields */ - if(H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) + if(H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT) < 0) TEST_ERROR; if(H5Tinsert (tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0) @@ -1949,28 +1946,28 @@ test_refer_dtype(hid_t file) TEST_ERROR; /* Write selection to disk */ - if(H5Dwrite(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf)<0) + if(H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; /* Close disk dataspace */ - if(H5Sclose(sid1)<0) + if(H5Sclose(sid1) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Open the dataset */ - if((dataset=H5Dopen(file,"/Dataset3"))<0) + if((dataset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR; /* Get datatype for dataset */ - if((dtype = H5Dget_type(dataset))<0) + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; /* Construct native type */ - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Check if the data type is equal */ @@ -1978,26 +1975,26 @@ test_refer_dtype(hid_t file) TEST_ERROR; /* Read selection from disk */ - if(H5Dread(dataset,native_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; /* Open datatype object */ - if((tid1 = H5Rdereference(dataset,H5R_OBJECT,rbuf))<0) + if((tid1 = H5Rdereference(dataset, H5R_OBJECT, rbuf)) < 0) TEST_ERROR; /* Verify correct datatype */ - if(H5Tget_class(tid1)!=H5T_COMPOUND) + if(H5Tget_class(tid1) != H5T_COMPOUND) TEST_ERROR; if(H5Tget_nmembers(tid1)!=3) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid1)<0) + if(H5Tclose(tid1) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Free memory buffers */ @@ -2065,22 +2062,22 @@ test_refer_dtype2(hid_t file) drbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Create dataspace for datasets */ - if((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL))<0) + if((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) TEST_ERROR; /* Create a dataset */ - if((dset2=H5Dcreate(file,"Dataset2",H5T_STD_U8LE,sid2,H5P_DEFAULT))<0) + if((dset2=H5Dcreate(file,"Dataset2",H5T_STD_U8LE,sid2,H5P_DEFAULT)) < 0) TEST_ERROR; for(tu8=dwbuf,i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++) *tu8++=i*3; /* Write selection to disk */ - if(H5Dwrite(dset2,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf)<0) + if(H5Dwrite(dset2,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dset2)<0) + if(H5Dclose(dset2) < 0) TEST_ERROR; @@ -2133,7 +2130,7 @@ test_refer_dtype2(hid_t file) /* Open the dataset */ - if((dset1 = H5Dopen(file, "/Dataset1")) < 0) + if((dset1 = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR; /* Get datatype for dataset */ @@ -2244,47 +2241,45 @@ test_opaque_dtype(hid_t file) /* opaque_1 */ nelmts = sizeof(wbuf); - if ((type=H5Tcreate(H5T_OPAQUE, 1))<0 || - H5Tset_tag(type, "testing 1-byte opaque type")<0 || - (space=H5Screate_simple(1, &nelmts, NULL))<0 || - (dset=H5Dcreate(file, DSET_OPAQUE_NAME, type, space, H5P_DEFAULT))<0) + if((type = H5Tcreate(H5T_OPAQUE, 1)) < 0 || + H5Tset_tag(type, "testing 1-byte opaque type") < 0 || + (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset = H5Dcreate(file, DSET_OPAQUE_NAME, type, space, H5P_DEFAULT)) < 0) TEST_ERROR; - for (i=0; i<sizeof(wbuf); i++) + for(i = 0; i < sizeof(wbuf); i++) wbuf[i] = (unsigned char)0xff ^ (unsigned char)i; - if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf)<0) - TEST_ERROR; - if (H5Sclose(space)<0) TEST_ERROR; - if (H5Dclose(dset)<0) TEST_ERROR; + if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; + if(H5Dclose(dset) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_OPAQUE_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_OPAQUE_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; if(!H5Tequal(native_type, type)) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; - for(i=0; i<sizeof(rbuf); i++) { - if (rbuf[i] != wbuf[i]) { + for(i = 0; i < sizeof(rbuf); i++) + if(rbuf[i] != wbuf[i]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %u\n", (unsigned)i); goto error; - } - } + } /* end if */ - if (H5Tclose(type)<0) TEST_ERROR; - if (H5Tclose(dtype)<0) TEST_ERROR; - if (H5Tclose(native_type)<0) TEST_ERROR; - if (H5Dclose(dataset)<0) TEST_ERROR; + if(H5Tclose(type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; PASSED(); return 0; @@ -2323,37 +2318,36 @@ test_bitfield_dtype(hid_t file) /* opaque_1 */ nelmts = sizeof(wbuf); - if ((type=H5Tcopy(H5T_STD_B8LE))<0 || - (space=H5Screate_simple(1, &nelmts, NULL))<0 || - (dset=H5Dcreate(file, DSET_BITFIELD_NAME, type, space, H5P_DEFAULT))<0) + if((type = H5Tcopy(H5T_STD_B8LE)) < 0 || + (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset = H5Dcreate(file, DSET_BITFIELD_NAME, type, space, H5P_DEFAULT)) < 0) TEST_ERROR; - for (i=0; i<sizeof(wbuf); i++) + for(i = 0; i < sizeof(wbuf); i++) wbuf[i] = (unsigned char)0xff ^ (unsigned char)i; - if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf)<0) - TEST_ERROR; - if (H5Sclose(space)<0) TEST_ERROR; - if (H5Dclose(dset)<0) TEST_ERROR; + if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; + if(H5Dclose(dset) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_BITFIELD_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; H5E_BEGIN_TRY { - native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT); + native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT); } H5E_END_TRY; - if(native_type>0) { + if(native_type > 0) { H5_FAILED(); puts(" Bit field isn't supported. Should have failed."); TEST_ERROR; - } + } /* end if */ - if (H5Tclose(type)<0) TEST_ERROR; - if (H5Tclose(dtype)<0) TEST_ERROR; - if (H5Dclose(dataset)<0) TEST_ERROR; + if(H5Tclose(type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; PASSED(); return 0; @@ -2362,9 +2356,6 @@ error: return -1; } /* test_bitfield_dtype */ - - - /*------------------------------------------------------------------------- * Function: test_ninteger @@ -2414,27 +2405,27 @@ test_ninteger(void) *------------------------------------------------------------------------- */ /* create a file using default properties */ - if ((fid1=H5Fcreate("tstint1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) + if((fid1=H5Fcreate("tstint1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) goto error; /* create a data space */ - if ((sid1 = H5Screate_simple(rank,dims,NULL))<0) goto error; + if((sid1 = H5Screate_simple(rank,dims,NULL)) < 0) goto error; /* create dcpl */ - if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; + if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* create a dataset */ - if ((did1 = H5Dcreate(fid1,"dset",H5T_NATIVE_INT,sid1,dcpl1)) <0) goto error; + if((did1 = H5Dcreate(fid1, "dset", H5T_NATIVE_INT, sid1, dcpl1)) < 0) goto error; /* write */ - if(H5Dwrite(did1,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; /* close */ - if (H5Sclose (sid1)<0) goto error; - if (H5Pclose (dcpl1)<0) goto error; - if (H5Dclose (did1)<0) goto error; - if (H5Fclose (fid1)<0) goto error; + if(H5Sclose(sid1) < 0) goto error; + if(H5Pclose(dcpl1) < 0) goto error; + if(H5Dclose(did1) < 0) goto error; + if(H5Fclose(fid1) < 0) goto error; /*------------------------------------------------------------------------- * step 2: open and create another file copying the data from file1 @@ -2442,73 +2433,64 @@ test_ninteger(void) */ /* open */ - if ((fid1=H5Fopen("tstint1.h5",H5F_ACC_RDONLY,H5P_DEFAULT))<0) - goto error; + if((fid1 = H5Fopen("tstint1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto error; /* open dataset */ - if ((did1=H5Dopen(fid1,"dset"))<0) - goto error; + if((did1 = H5Dopen2(fid1, "dset", H5P_DEFAULT)) < 0) goto error; - if ((sid1=H5Dget_space(did1))<0) - goto error; + if((sid1 = H5Dget_space(did1)) < 0) goto error; /* get dcpl */ - if ((dcpl1=H5Dget_create_plist(did1))<0) - goto error; + if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; /* get file datatype */ - if ((tid1=H5Dget_type (did1))<0) - goto error; + if((tid1 = H5Dget_type(did1)) < 0) goto error; /* get native datatype */ - if ((nid1=H5Tget_native_type(tid1,H5T_DIR_DEFAULT))<0) - goto error; + if((nid1 = H5Tget_native_type(tid1, H5T_DIR_DEFAULT)) < 0) goto error; /* get size */ - if (H5Tget_size(nid1)==0) - goto error; + if(H5Tget_size(nid1) == 0) goto error; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid1))<0) - goto error; + if((rank = H5Sget_simple_extent_ndims(sid1)) < 0) goto error; HDmemset(dims, 0, sizeof dims); /* get dimension */ - if (H5Sget_simple_extent_dims(sid1,dims,NULL)<0) - goto error; - nelmts=1; - for (i=0; i<rank; i++) - nelmts*=dims[i]; + if(H5Sget_simple_extent_dims(sid1, dims, NULL) < 0) goto error; + nelmts = 1; + for(i = 0; i < rank; i++) + nelmts *= dims[i]; /* read */ - if (H5Dread(did1,nid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,chk)<0) + if(H5Dread(did1, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0) goto error; /* create a file using default properties */ - if ((fid2=H5Fcreate("tstint2.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) + if((fid2=H5Fcreate("tstint2.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) goto error; /* create a dataset using the native type */ - if ((did2 = H5Dcreate(fid2,"dset",nid1,sid1,dcpl1)) <0) goto error; + if((did2 = H5Dcreate(fid2,"dset",nid1,sid1,dcpl1)) <0) goto error; /* write */ - if(H5Dwrite(did2,nid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,chk)<0) + if(H5Dwrite(did2,nid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,chk) < 0) goto error; /* get dcpl */ - if ((dcpl2=H5Dget_create_plist(did2))<0) + if((dcpl2=H5Dget_create_plist(did2)) < 0) goto error; /* get file datatype */ - if ((tid2=H5Dget_type (did2))<0) + if((tid2=H5Dget_type (did2)) < 0) goto error; /* get native datatype */ - if ((nid2=H5Tget_native_type(tid2,H5T_DIR_DEFAULT))<0) + if((nid2=H5Tget_native_type(tid2,H5T_DIR_DEFAULT)) < 0) goto error; /* check */ - if (H5Tget_precision(nid1)!=H5Tget_precision(nid2)) { + if(H5Tget_precision(nid1)!=H5Tget_precision(nid2)) { printf(" Precision differ.\n"); goto error; } @@ -2521,7 +2503,7 @@ test_ninteger(void) /* check */ for (i = 0; i < DIM3; i++) { - if (buf[i] != chk[i]) { + if(buf[i] != chk[i]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d\n", i); @@ -2530,17 +2512,17 @@ test_ninteger(void) } /* close */ - if (H5Sclose (sid1)<0) goto error; - if (H5Pclose (dcpl1)<0) goto error; - if (H5Pclose (dcpl2)<0) goto error; - if (H5Tclose (tid1)<0) goto error; - if (H5Tclose (tid2)<0) goto error; - if (H5Tclose (nid1)<0) goto error; - if (H5Tclose (nid2)<0) goto error; - if (H5Dclose (did1)<0) goto error; - if (H5Dclose (did2)<0) goto error; - if (H5Fclose (fid1)<0) goto error; - if (H5Fclose (fid2)<0) goto error; + if(H5Sclose (sid1) < 0) goto error; + if(H5Pclose (dcpl1) < 0) goto error; + if(H5Pclose (dcpl2) < 0) goto error; + if(H5Tclose (tid1) < 0) goto error; + if(H5Tclose (tid2) < 0) goto error; + if(H5Tclose (nid1) < 0) goto error; + if(H5Tclose (nid2) < 0) goto error; + if(H5Dclose (did1) < 0) goto error; + if(H5Dclose (did2) < 0) goto error; + if(H5Fclose (fid1) < 0) goto error; + if(H5Fclose (fid2) < 0) goto error; PASSED(); @@ -2588,28 +2570,28 @@ main(void) fapl = h5_fileaccess(); 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; - nerrors += test_atomic_dtype(file)<0 ?1:0; - nerrors += test_compound_dtype(file)<0 ?1:0; - nerrors += test_compound_dtype2(file)<0 ?1:0; - nerrors += test_compound_dtype3(file)<0 ?1:0; - nerrors += test_compound_opaque(file)<0 ?1:0; - nerrors += test_enum_dtype(file)<0 ?1:0; - nerrors += test_array_dtype(file)<0 ?1:0; - nerrors += test_array_dtype2(file)<0 ?1:0; - nerrors += test_vl_dtype(file)<0 ?1:0; - nerrors += test_vlstr_dtype(file)<0 ?1:0; - nerrors += test_str_dtype(file)<0 ?1:0; - nerrors += test_refer_dtype(file)<0 ?1:0; - nerrors += test_refer_dtype2(file)<0 ?1:0; - nerrors += test_opaque_dtype(file)<0 ?1:0; - nerrors += test_bitfield_dtype(file)<0 ?1:0; - nerrors += test_ninteger()<0 ?1:0; - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + nerrors += test_atomic_dtype(file) < 0 ?1:0; + nerrors += test_compound_dtype(file) < 0 ?1:0; + nerrors += test_compound_dtype2(file) < 0 ?1:0; + nerrors += test_compound_dtype3(file) < 0 ?1:0; + nerrors += test_compound_opaque(file) < 0 ?1:0; + nerrors += test_enum_dtype(file) < 0 ?1:0; + nerrors += test_array_dtype(file) < 0 ?1:0; + nerrors += test_array_dtype2(file) < 0 ?1:0; + nerrors += test_vl_dtype(file) < 0 ?1:0; + nerrors += test_vlstr_dtype(file) < 0 ?1:0; + nerrors += test_str_dtype(file) < 0 ?1:0; + nerrors += test_refer_dtype(file) < 0 ?1:0; + nerrors += test_refer_dtype2(file) < 0 ?1:0; + nerrors += test_opaque_dtype(file) < 0 ?1:0; + nerrors += test_bitfield_dtype(file) < 0 ?1:0; + nerrors += test_ninteger() < 0 ?1:0; + + if(H5Fclose(file) < 0) goto error; + if(nerrors) goto error; printf("All native datatype tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/objcopy.c b/test/objcopy.c index be6d236..d35db59 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1743,10 +1743,10 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -1850,10 +1850,10 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR @@ -1980,10 +1980,10 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_COMPOUND, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -2108,10 +2108,10 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -2225,10 +2225,10 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR @@ -2363,10 +2363,10 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR @@ -2493,13 +2493,13 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ - if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR @@ -2624,10 +2624,10 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_COMPACT)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_COMPACT, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_COMPACT)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -2751,10 +2751,10 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_EXTERNAL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -2869,13 +2869,13 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ - if(H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -3543,10 +3543,10 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -3681,10 +3681,10 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -3818,10 +3818,10 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -3938,10 +3938,10 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the attributes are equal */ @@ -4081,10 +4081,10 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR @@ -5100,10 +5100,10 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset through the soft link for copy */ - if((did = H5Dopen(fid_src, NAME_LINK_SOFT)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_LINK_SOFT, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -5231,10 +5231,10 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset through the external link */ - if((did = H5Dopen(fid_ext, NAME_LINK_EXTERN)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -5478,10 +5478,10 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SUB_SUB)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -5637,10 +5637,10 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_OLD_FORMAT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the source dataset */ - if((did = H5Dopen(fid_src, NAME_OLD_FORMAT)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_OLD_FORMAT, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR @@ -5770,10 +5770,10 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -5910,10 +5910,10 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -6058,10 +6058,10 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -6208,10 +6208,10 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -6364,10 +6364,10 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -6518,10 +6518,10 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -6672,10 +6672,10 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR @@ -6829,10 +6829,10 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the dataset for copy */ - if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* open the destination dataset */ - if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR + if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR /* Check if the datasets are equal */ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index 02691c0..0ff5ac0 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -286,7 +286,7 @@ main(void) TEST_ERROR /* Open the dataset with the unknown header message, but no extra flags */ - if((dset = H5Dopen(file2, "/Dataset1")) < 0) + if((dset = H5Dopen2(file2, "/Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(dset) < 0) TEST_ERROR @@ -297,7 +297,7 @@ main(void) /* Attempt to open the dataset with the unknown header message, and "fail if unknown" flag */ H5E_BEGIN_TRY { - dset = H5Dopen(file2, "/Dataset2"); + dset = H5Dopen2(file2, "/Dataset2", H5P_DEFAULT); } H5E_END_TRY; if(dset >= 0) { H5Dclose(dset); @@ -321,7 +321,7 @@ main(void) TEST_ERROR /* Open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen(file, "/Dataset3")) < 0) + if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR /* Check that the "unknown" message was _NOT_ marked */ @@ -341,7 +341,7 @@ main(void) TEST_ERROR /* Open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen(file, "/Dataset3")) < 0) + if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(dset) < 0) TEST_ERROR @@ -355,7 +355,7 @@ main(void) TEST_ERROR /* Re-open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen(file, "/Dataset3")) < 0) + if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR /* Check that the "unknown" message was marked */ diff --git a/test/reserved.c b/test/reserved.c index df30b5c..f719545 100755 --- a/test/reserved.c +++ b/test/reserved.c @@ -68,8 +68,7 @@ rsrv_heap(void) /* Write datasets until the file is full, at which point HDF5 * should throw an error. */ - for (i = 0; i < 200; i++) - { + for(i = 0; i < 200; i++) { H5E_BEGIN_TRY { dataspace_id = H5Screate_simple(1, dims, dims); } H5E_END_TRY @@ -87,9 +86,9 @@ rsrv_heap(void) H5Dwrite(dataset_id, H5T_NATIVE_INT, dataspace_id, dataspace_id, H5P_DEFAULT, &i); } H5E_END_TRY - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Sclose(dataspace_id) < 0) TEST_ERROR; - } + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Sclose(dataspace_id) < 0) TEST_ERROR; + } /* end for */ /* The loop should have broken before completing--the file should not have had * enough address space to hold 200 datasets (or this test needs to be updated!). @@ -98,20 +97,20 @@ rsrv_heap(void) TEST_ERROR; /* Close the file, property lists, and library */ - if( H5Fclose(file_id) < 0) TEST_ERROR; - if( H5Pclose(fapl) < 0) TEST_ERROR; - if( H5Pclose(fcpl) < 0) TEST_ERROR; - if( H5close() < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Pclose(fapl) < 0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; + if(H5close() < 0) TEST_ERROR; /* Re-open the library and try to read a dataset from the file we created */ - if( H5open() < 0) TEST_ERROR; + if(H5open() < 0) TEST_ERROR; sprintf(dset_name, "Dset %d", i - 2); file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); - if( file_id < 0) TEST_ERROR; + if(file_id < 0) TEST_ERROR; - dataset_id = H5Dopen(file_id, dset_name); + dataset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT); /* If we can read a dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). @@ -119,22 +118,22 @@ rsrv_heap(void) if(dataset_id == H5I_BADID) TEST_ERROR; - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; PASSED(); return 0; - error: - /* Close everything we can and exit */ - H5E_BEGIN_TRY { +error: + /* Close everything we can and exit */ + H5E_BEGIN_TRY { H5Dclose(dataset_id); H5Sclose(dataspace_id); H5Pclose(fcpl); H5Pclose(fapl); H5Fclose(file_id); - } H5E_END_TRY - return 1; + } H5E_END_TRY + return 1; } /*------------------------------------------------------------------------- @@ -219,22 +218,22 @@ rsrv_ohdr(void) TEST_ERROR; /* End access to the dataset and dataspace and release resources. */ - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Pclose (fapl) < 0) TEST_ERROR; - if( H5Pclose (fcpl) < 0) TEST_ERROR; - if( H5Sclose(dataspace_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Pclose(fapl) < 0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; + if(H5Sclose(dataspace_id) < 0) TEST_ERROR; /* Close the file and the library. */ - if( H5Fclose(file_id) < 0) TEST_ERROR; - if( H5close() < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5close() < 0) TEST_ERROR; /* Re-open the library and try to read a dataset from the file we created */ - if( H5open() < 0) TEST_ERROR; + if(H5open() < 0) TEST_ERROR; file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); - if( file_id < 0) TEST_ERROR; + if(file_id < 0) TEST_ERROR; - dataset_id = H5Dopen(file_id, "/dset"); + dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT); /* If we can read the dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). @@ -242,22 +241,22 @@ rsrv_ohdr(void) if(dataset_id == H5I_BADID) TEST_ERROR; - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; PASSED(); return 0; - error: - /* Close everything we can and exit */ - H5E_BEGIN_TRY { +error: + /* Close everything we can and exit */ + H5E_BEGIN_TRY { H5Dclose(dataset_id); H5Sclose(dataspace_id); H5Pclose(fcpl); H5Pclose(fapl); H5Fclose(file_id); - } H5E_END_TRY - return 1; + } H5E_END_TRY + return 1; } /*------------------------------------------------------------------------- @@ -360,24 +359,24 @@ rsrv_vlen(void) TEST_ERROR; /* End access to the dataset and dataspace and release resources. */ - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Pclose(fcpl) < 0) TEST_ERROR; - if( H5Pclose(fapl) < 0) TEST_ERROR; - if( H5Sclose(dataspace_id) < 0) TEST_ERROR; - if( H5Tclose(type_id) < 0) TEST_ERROR; - if( H5Sclose(mem_space_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; + if(H5Pclose(fapl) < 0) TEST_ERROR; + if(H5Sclose(dataspace_id) < 0) TEST_ERROR; + if(H5Tclose(type_id) < 0) TEST_ERROR; + if(H5Sclose(mem_space_id) < 0) TEST_ERROR; /* Close the file and the library. */ - if( H5Fclose(file_id) < 0) TEST_ERROR; - if( H5close() < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5close() < 0) TEST_ERROR; /* Re-open the library and try to read a dataset from the file we created */ - if( H5open() < 0) TEST_ERROR; + if(H5open() < 0) TEST_ERROR; file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); - if( file_id < 0) TEST_ERROR; + if(file_id < 0) TEST_ERROR; - dataset_id = H5Dopen(file_id, "/dset"); + dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT); /* If we can read the dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). @@ -385,15 +384,15 @@ rsrv_vlen(void) if(dataset_id == H5I_BADID) TEST_ERROR; - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; PASSED(); return 0; - error: - /* Close everything we can and exit */ - H5E_BEGIN_TRY { +error: + /* Close everything we can and exit */ + H5E_BEGIN_TRY { H5Dclose(dataset_id); H5Sclose(dataspace_id); H5Sclose(mem_space_id); @@ -401,8 +400,8 @@ rsrv_vlen(void) H5Pclose(fcpl); H5Pclose(fapl); H5Fclose(file_id); - } H5E_END_TRY - return 1; + } H5E_END_TRY + return 1; } #endif /* BROKEN */ diff --git a/test/set_extent.c b/test/set_extent.c index c4c3ed0..40beda4 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -68,17 +68,17 @@ int main( void ) /* Create a new file using default properties. */ - if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) TEST_ERROR; + if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT )) < 0) TEST_ERROR; TESTING("extend dataset create with fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if ((space_id = H5Screate_simple( RANK, dims, maxdims )) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) TEST_ERROR; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE )) < 0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk ) < 0) TEST_ERROR; + if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue ) < 0) TEST_ERROR; /*------------------------------------------------------------------------- @@ -87,10 +87,10 @@ int main( void ) */ /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id )) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data ) < 0) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; shrink it @@ -98,13 +98,13 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims_new ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims_new[0] ) TEST_ERROR; if ( dims_out[1] != dims_new[1] ) TEST_ERROR; @@ -116,7 +116,7 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ @@ -183,12 +183,12 @@ int main( void ) TESTING("extend dataset create without fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if ((space_id = H5Screate_simple( RANK, dims, maxdims )) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) TEST_ERROR; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE )) < 0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk ) < 0) TEST_ERROR; + if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC) < 0) TEST_ERROR; /*------------------------------------------------------------------------- * Create and write one dataset @@ -196,10 +196,10 @@ int main( void ) */ /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id )) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data ) < 0) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; shrink it @@ -207,13 +207,13 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims_new ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims_new[0] ) TEST_ERROR; @@ -224,7 +224,7 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ @@ -239,13 +239,13 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims[0] ) TEST_ERROR; @@ -256,7 +256,7 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { @@ -292,64 +292,65 @@ int main( void ) */ /* Create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE))<0) TEST_ERROR; + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR; /* Set non-default indexed storage B-tree internal 'K' value */ - if(H5Pset_istore_k(fcpl,ISTORE_IK)<0) TEST_ERROR; + if(H5Pset_istore_k(fcpl,ISTORE_IK) < 0) TEST_ERROR; /* Create a new file using properties. */ - if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT ))<0) TEST_ERROR; + if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT )) < 0) TEST_ERROR; /* Close property list */ - if(H5Pclose(fcpl)<0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; TESTING("extend dataset read with fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) TEST_ERROR; + if((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + if(H5Pset_chunk(plist_id, RANK, dims_chunk) < 0) TEST_ERROR; + if(H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR; /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id)) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if(H5Dwrite(dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; /* Close/release resources. */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(plist_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) TEST_ERROR; + if((file_id = H5Fopen("set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset1" ))<0) TEST_ERROR; + if((dataset_id = H5Dopen2(file_id , "Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR; /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) TEST_ERROR; + if(H5Dset_extent(dataset_id, dims_new) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if((space_id = H5Dget_space(dataset_id)) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if(H5Sget_simple_extent_dims(space_id, dims_out, NULL) < 0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) TEST_ERROR; + if(dims_out[0] != dims_new[0]) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if(H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) TEST_ERROR; /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) TEST_ERROR; + for(i = 0; i < (int)dims_out[0]; i++) + for(j = 0; j < (int)dims_out[1]; j++) + if(buf1[i][j] != data[i][j]) + TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; expand it again @@ -357,18 +358,18 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { @@ -397,50 +398,51 @@ int main( void ) TESTING("extend dataset read without fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) TEST_ERROR; + if((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + if(H5Pset_chunk(plist_id, RANK, dims_chunk) < 0) TEST_ERROR; + if(H5Pset_fill_time(plist_id, H5D_FILL_TIME_ALLOC) < 0) TEST_ERROR; /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id)) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if(H5Dwrite(dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; /* Close/release resources. */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(plist_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) TEST_ERROR; + if((file_id = H5Fopen("set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset2" ))<0) TEST_ERROR; + if((dataset_id = H5Dopen2(file_id , "Dataset2", H5P_DEFAULT)) < 0) TEST_ERROR; /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) TEST_ERROR; + if(H5Dset_extent(dataset_id, dims_new) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if((space_id = H5Dget_space(dataset_id)) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if(H5Sget_simple_extent_dims(space_id, dims_out, NULL) < 0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) TEST_ERROR; + if(dims_out[0] != dims_new[0]) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if(H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) TEST_ERROR; /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) TEST_ERROR; + for(i = 0; i < (int)dims_out[0]; i++) + for(j = 0; j < (int)dims_out[1]; j++) + if(buf1[i][j] != data[i][j]) + TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; expand it again @@ -448,18 +450,18 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { diff --git a/test/stream_test.c b/test/stream_test.c index 3051d3b..7cd8267 100644 --- a/test/stream_test.c +++ b/test/stream_test.c @@ -321,25 +321,23 @@ static int receiver (void) * the sender should have created. */ tempfile = fopen (TEMPFILENAME, "r"); - if (tempfile == NULL) - { - fprintf (stderr, "receiver: couldn't open temporary file to read " + if(tempfile == NULL) { + fprintf(stderr, "receiver: couldn't open temporary file to read " "\"hostname:port\" information\n"); - H5Pclose (fapl); - return (-3); + H5Pclose(fapl); + return(-3); } - fgets (filename, sizeof (filename) - 1, tempfile); - fclose (tempfile); - unlink (TEMPFILENAME); + fgets(filename, sizeof (filename) - 1, tempfile); + fclose(tempfile); + unlink(TEMPFILENAME); /* * Open the streamed HDF5 file for reading. */ - printf (" receiver: opening file '%s' for reading...\n", filename); - file = H5Fopen (filename, H5F_ACC_RDONLY, fapl); - H5Pclose (fapl); - if (file < 0) - { + printf(" receiver: opening file '%s' for reading...\n", filename); + file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + H5Pclose(fapl); + if(file < 0) { fprintf (stderr, "receiver: couldn't open file from '%s'\n", filename); return (-4); } @@ -348,9 +346,8 @@ static int receiver (void) * Open the file and the dataset. */ printf (" receiver: reading dataset '%s'...\n", DATASETNAME); - dataset = H5Dopen (file, DATASETNAME); - if (dataset < 0) - { + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); + if(dataset < 0) { fprintf (stderr, "receiver: couldn't open dataset '%s'\n", DATASETNAME); return (-5); } @@ -358,27 +355,25 @@ static int receiver (void) /* * Get dataset class, order, and size information */ - datatype = H5Dget_type (dataset); - if (H5Tget_class (datatype) == H5T_INTEGER) - { - printf (" receiver: dataset is of type INTEGER\n"); - } - printf (" receiver: datatype size is %d bytes\n", + datatype = H5Dget_type(dataset); + if(H5Tget_class(datatype) == H5T_INTEGER) + printf(" receiver: dataset is of type INTEGER\n"); + printf(" receiver: datatype size is %d bytes\n", (int) H5Tget_size (datatype)); - printf (" receiver: byte ordering is %s endian\n", + printf(" receiver: byte ordering is %s endian\n", H5Tget_order (datatype) == H5T_ORDER_LE ? "little" : "big"); H5Tclose(datatype); /* * Get dataset dimensions */ - dataspace = H5Dget_space (dataset); - rank = H5Sget_simple_extent_ndims (dataspace); - dims = (hsize_t *) malloc (rank * sizeof (hsize_t)); - H5Sget_simple_extent_dims (dataspace, dims, NULL); - H5Sclose (dataspace); + dataspace = H5Dget_space(dataset); + rank = H5Sget_simple_extent_ndims(dataspace); + dims = (hsize_t *)malloc(rank * sizeof (hsize_t)); + H5Sget_simple_extent_dims(dataspace, dims, NULL); + H5Sclose(dataspace); - printf (" receiver: rank %d, dimensions %u", rank, (unsigned int) dims[0]); + printf(" receiver: rank %d, dimensions %u", rank, (unsigned int)dims[0]); nelems = dims[0]; for (i = 1; i < rank; i++) { diff --git a/test/tarray.c b/test/tarray.c index 8c7e6c8..a0e2b10 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -80,9 +80,9 @@ test_array_atomic_1d(void) MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n")); /* Allocate and initialize array data to write */ - for(i=0; i<SPACE1_DIM1; i++) - for(j=0; j<ARRAY1_DIM1; j++) - wdata[i][j]=i*10+j; + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY1_DIM1; j++) + wdata[i][j] = i * 10 + j; /* Create file */ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -97,11 +97,11 @@ test_array_atomic_1d(void) CHECK(tid1, FAIL, "H5Tarray_create"); /* Create a dataset */ - dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); + dataset = H5Dcreate(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -126,41 +126,39 @@ test_array_atomic_1d(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the datatype */ tid1 = H5Dget_type (dataset); CHECK(tid1, FAIL, "H5Dget_type"); /* Check the array rank */ - ndims=H5Tget_array_ndims(tid1); - VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); + ndims = H5Tget_array_ndims(tid1); + VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid1, rdims1, NULL); + ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ - for(i=0; i<ndims; i++) - if(rdims1[i]!=tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + for(i = 0; i < ndims; i++) + if(rdims1[i] != tdims1[i]) { + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); continue; } /* end if */ /* Read dataset from disk */ - ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - for(j=0; j<ARRAY1_DIM1; j++) { - if(wdata[i][j]!=rdata[i][j]) { - TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n",(int)i,(int)j,(int)wdata[i][j],(int)i,(int)j,(int)rdata[i][j]); + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY1_DIM1; j++) + if(wdata[i][j] != rdata[i][j]) { + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n", (int)i, (int)j, (int)wdata[i][j], (int)i, (int)j, (int)rdata[i][j]); continue; } /* end if */ - } /* end for */ - } /* end for */ /* Close Datatype */ ret = H5Tclose(tid1); @@ -173,7 +171,6 @@ test_array_atomic_1d(void) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); - } /* end test_array_atomic_1d() */ /**************************************************************** @@ -260,11 +257,11 @@ test_array_atomic_3d(void) MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n")); /* Allocate and initialize array data to write */ - for(i=0; i<SPACE1_DIM1; i++) - for(j=0; j<ARRAY2_DIM1; j++) - for(k=0; k<ARRAY2_DIM2; k++) - for(l=0; l<ARRAY2_DIM3; l++) - wdata[i][j][k][l]=i*1000+j*100+k*10+l; + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY2_DIM1; j++) + for(k = 0; k < ARRAY2_DIM2; k++) + for(l = 0; l < ARRAY2_DIM3; l++) + wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l; /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -279,11 +276,11 @@ test_array_atomic_3d(void) CHECK(tid, FAIL, "H5Tarray_create"); /* Create a dataset */ - dataset=H5Dcreate(fid,"Dataset1",tid,sid,H5P_DEFAULT); + dataset = H5Dcreate(fid, "Dataset1", tid, sid, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -308,45 +305,41 @@ test_array_atomic_3d(void) CHECK(fid, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the datatype */ tid = H5Dget_type (dataset); CHECK(tid, FAIL, "H5Dget_type"); /* Check the array rank */ - ndims=H5Tget_array_ndims(tid); - VERIFY(ndims,ARRAY2_RANK,"H5Tget_array_ndims"); + ndims = H5Tget_array_ndims(tid); + VERIFY(ndims, ARRAY2_RANK, "H5Tget_array_ndims"); /* Get the array dimensions */ ret = H5Tget_array_dims(tid, rdims2, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ - for(i=0; i<ndims; i++) - if(rdims2[i]!=tdims2[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims2[i]); + for(i = 0; i < ndims; i++) + if(rdims2[i] != tdims2[i]) { + TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n", (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]); continue; } /* end if */ /* Read dataset from disk */ - ret=H5Dread(dataset,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - for(j=0; j<ARRAY2_DIM1; j++) { - for(k=0; k<ARRAY2_DIM2; k++) { - for(l=0; l<ARRAY2_DIM3; l++) { - if(wdata[i][j][k][l]!=rdata[i][j][k][l]) { - TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l,(int)wdata[i][j][k][l],(int)i,(int)j,(int)k,(int)l,(int)rdata[i][j][k][l]); + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY2_DIM1; j++) + for(k = 0; k < ARRAY2_DIM2; k++) + for(l = 0; l < ARRAY2_DIM3; l++) + if(wdata[i][j][k][l] != rdata[i][j][k][l]) { + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n", (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j, (int)k, (int)l, (int)rdata[i][j][k][l]); continue; } /* end if */ - } /* end for */ - } /* end for */ - } /* end for */ - } /* end for */ /* Close Datatype */ ret = H5Tclose(tid); @@ -392,11 +385,11 @@ test_array_array_atomic(void) MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n")); /* Allocate and initialize array data to write */ - for(i=0; i<SPACE1_DIM1; i++) - for(j=0; j<ARRAY1_DIM1; j++) - for(k=0; k<ARRAY3_DIM1; k++) - for(l=0; l<ARRAY3_DIM2; l++) - wdata[i][j][k][l]=i*1000+j*100+k*10+l; + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY1_DIM1; j++) + for(k = 0; k < ARRAY3_DIM1; k++) + for(l = 0; l < ARRAY3_DIM2; l++) + wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l; /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -415,11 +408,11 @@ test_array_array_atomic(void) CHECK(tid1, FAIL, "H5Tarray_create"); /* Create a dataset */ - dataset=H5Dcreate(fid,"Dataset1",tid1,sid,H5P_DEFAULT); + dataset = H5Dcreate(fid, "Dataset1", tid1, sid, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -446,64 +439,60 @@ test_array_array_atomic(void) CHECK(fid, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the 1-D datatype */ - tid1 = H5Dget_type (dataset); + tid1 = H5Dget_type(dataset); CHECK(tid1, FAIL, "H5Dget_type"); /* Check the 1-D array rank */ ndims1 = H5Tget_array_ndims(tid1); - VERIFY(ndims1,ARRAY1_RANK,"H5Tget_array_ndims"); + VERIFY(ndims1, ARRAY1_RANK, "H5Tget_array_ndims"); /* Get the 1-D array dimensions */ ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ - for(i=0; i<ndims1; i++) - if(rdims1[i]!=tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + for(i = 0; i < ndims1; i++) + if(rdims1[i] != tdims1[i]) { + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); continue; } /* end if */ /* Get the 2-D datatype */ - tid2 = H5Tget_super (tid1); + tid2 = H5Tget_super(tid1); CHECK(tid2, FAIL, "H5Tget_super"); /* Check the 2-D array rank */ - ndims2=H5Tget_array_ndims(tid2); - VERIFY(ndims2,ARRAY3_RANK,"H5Tget_array_ndims"); + ndims2 = H5Tget_array_ndims(tid2); + VERIFY(ndims2, ARRAY3_RANK, "H5Tget_array_ndims"); /* Get the 2-D array dimensions */ ret = H5Tget_array_dims(tid2, rdims2, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ - for(i=0; i<ndims2; i++) - if(rdims2[i]!=tdims2[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims2[i]); + for(i = 0; i < ndims2; i++) + if(rdims2[i] != tdims2[i]) { + TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n", (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]); continue; } /* end if */ /* Read dataset from disk */ - ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - for(j=0; j<ARRAY1_DIM1; j++) { - for(k=0; k<ARRAY3_DIM1; k++) { - for(l=0; l<ARRAY3_DIM2; l++) { - if(wdata[i][j][k][l]!=rdata[i][j][k][l]) { - TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l,(int)wdata[i][j][k][l],(int)i,(int)j,(int)k,(int)l,(int)rdata[i][j][k][l]); + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY1_DIM1; j++) + for(k = 0; k < ARRAY3_DIM1; k++) + for(l = 0; l < ARRAY3_DIM2; l++) + if(wdata[i][j][k][l] != rdata[i][j][k][l]) { + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n", (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j, (int)k, (int)l, (int)rdata[i][j][k][l]); continue; } /* end if */ - } /* end for */ - } /* end for */ - } /* end for */ - } /* end for */ /* Close Datatypes */ ret = H5Tclose(tid1); @@ -518,7 +507,6 @@ test_array_array_atomic(void) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - } /* end test_array_array_atomic() */ /**************************************************************** @@ -556,10 +544,10 @@ test_array_compound_atomic(void) MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n")); /* Initialize array data to write */ - for(i=0; i<SPACE1_DIM1; i++) - for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].i=i*10+j; - wdata[i][j].f=(float)(i*2.5+j); + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY1_DIM1; j++) { + wdata[i][j].i = i * 10 + j; + wdata[i][j].f = (float)(i * 2.5 + j); } /* end for */ /* Create file */ @@ -575,11 +563,11 @@ test_array_compound_atomic(void) CHECK(tid2, FAIL, "H5Tcreate"); /* Insert integer field */ - ret = H5Tinsert (tid2, "i", HOFFSET(s1_t,i), H5T_NATIVE_INT); + ret = H5Tinsert(tid2, "i", HOFFSET(s1_t, i), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); /* Insert float field */ - ret = H5Tinsert (tid2, "f", HOFFSET(s1_t,f), H5T_NATIVE_FLOAT); + ret = H5Tinsert(tid2, "f", HOFFSET(s1_t, f), H5T_NATIVE_FLOAT); CHECK(ret, FAIL, "H5Tinsert"); /* Create an array datatype to refer to */ @@ -587,15 +575,15 @@ test_array_compound_atomic(void) CHECK(tid1, FAIL, "H5Tarray_create"); /* Close compound datatype */ - ret=H5Tclose(tid2); + ret = H5Tclose(tid2); CHECK(ret, FAIL, "H5Tclose"); /* Create a dataset */ - dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); + dataset = H5Dcreate(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -620,15 +608,15 @@ test_array_compound_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the datatype */ - tid1 = H5Dget_type (dataset); + tid1 = H5Dget_type(dataset); CHECK(tid1, FAIL, "H5Dget_type"); /* Check the array rank */ - ndims=H5Tget_array_ndims(tid1); + ndims = H5Tget_array_ndims(tid1); VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ @@ -636,9 +624,9 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ - for(i=0; i<ndims; i++) - if(rdims1[i]!=tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + for(i = 0; i < ndims; i++) + if(rdims1[i] != tdims1[i]) { + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); continue; } /* end if */ @@ -647,45 +635,45 @@ test_array_compound_atomic(void) CHECK(tid2, FAIL, "H5Tget_super"); /* Check the number of members */ - nmemb=H5Tget_nmembers(tid2); + nmemb = H5Tget_nmembers(tid2); VERIFY(nmemb,2,"H5Tget_nmembers"); /* Check the 1st field's name */ - mname=H5Tget_member_name(tid2,0); + mname = H5Tget_member_name(tid2, 0); CHECK(mname, NULL, "H5Tget_member_name"); - if(HDstrcmp(mname,"i")!=0) - TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); + if(HDstrcmp(mname, "i") != 0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); free(mname); /* Check the 1st field's offset */ - off=H5Tget_member_offset(tid2,0); - VERIFY(off, HOFFSET(s1_t,i), "H5Tget_member_offset"); + off = H5Tget_member_offset(tid2, 0); + VERIFY(off, HOFFSET(s1_t, i), "H5Tget_member_offset"); /* Check the 1st field's datatype */ - mtid=H5Tget_member_type(tid2,0); + mtid = H5Tget_member_type(tid2, 0); CHECK(mtid, FAIL, "H5Tget_member_type"); - if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) - TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); - ret=H5Tclose(mtid); + if((ret = H5Tequal(mtid,H5T_NATIVE_INT)) <= 0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret); + ret = H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Check the 2nd field's name */ - mname=H5Tget_member_name(tid2,1); + mname = H5Tget_member_name(tid2, 1); CHECK(mname, NULL, "H5Tget_member_name"); - if(HDstrcmp(mname,"f")!=0) - TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); + if(HDstrcmp(mname, "f") != 0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); free(mname); /* Check the 2nd field's offset */ - off=H5Tget_member_offset(tid2,1); - VERIFY(off, HOFFSET(s1_t,f), "H5Tget_member_offset"); + off = H5Tget_member_offset(tid2, 1); + VERIFY(off, HOFFSET(s1_t, f), "H5Tget_member_offset"); /* Check the 2nd field's datatype */ - mtid=H5Tget_member_type(tid2,1); + mtid = H5Tget_member_type(tid2, 1); CHECK(mtid, FAIL, "H5Tget_member_type"); - if((ret=H5Tequal(mtid,H5T_NATIVE_FLOAT))<=0) - TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); - ret=H5Tclose(mtid); + if((ret = H5Tequal(mtid, H5T_NATIVE_FLOAT)) <= 0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret); + ret = H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Close Compound Datatype */ @@ -693,22 +681,21 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Tclose"); /* Read dataset from disk */ - ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - for(j=0; j<ARRAY1_DIM1; j++) { - if(wdata[i][j].i!=rdata[i][j].i) { - TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i); + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < ARRAY1_DIM1; j++) { + if(wdata[i][j].i != rdata[i][j].i) { + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i, (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i); continue; } /* end if */ if(!FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) { - TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n",(int)i,(int)j,wdata[i][j].f,(int)i,(int)j,rdata[i][j].f); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i, (int)j, wdata[i][j].f, (int)i, (int)j, rdata[i][j].f); continue; } /* end if */ } /* end for */ - } /* end for */ /* Close Datatype */ ret = H5Tclose(tid1); @@ -721,7 +708,6 @@ test_array_compound_atomic(void) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); - } /* end test_array_compound_atomic() */ /**************************************************************** @@ -834,8 +820,8 @@ test_array_compound_array(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the datatype */ tid1 = H5Dget_type (dataset); @@ -1117,8 +1103,8 @@ test_array_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the dataspace */ sid1 = H5Dget_space (dataset); @@ -1337,8 +1323,8 @@ test_array_vlen_array(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get the dataspace */ sid1 = H5Dget_space (dataset); @@ -1678,8 +1664,8 @@ test_array_bkg(void) fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); - dataset = H5Dopen(fid, FIELDNAME ); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, FIELDNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); type = H5Tcreate(H5T_COMPOUND, sizeof(fld_t)); CHECK(type, FAIL, "H5Tcreate"); @@ -1758,8 +1744,8 @@ test_array_bkg(void) fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); - dataset = H5Dopen(fid, FIELDNAME ); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, FIELDNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); type = H5Dget_type(dataset); CHECK(type, FAIL, "H5Dget_type"); @@ -1866,8 +1852,8 @@ test_compat(void) /* Only try to proceed if the file is around */ if (fid1 >= 0){ /* Open the first dataset (with no array fields) */ - dataset = H5Dopen(fid1, "Dataset1"); - CHECK_I(dataset, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK_I(dataset, "H5Dopen2"); /* Get the datatype */ tid1=H5Dget_type(dataset); @@ -1948,8 +1934,8 @@ test_compat(void) /* Open the second dataset (with array fields) */ - dataset = H5Dopen(fid1, "Dataset2"); - CHECK_I(dataset, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT); + CHECK_I(dataset, "H5Dopen2"); /* Get the datatype */ tid1=H5Dget_type(dataset); diff --git a/test/tattr.c b/test/tattr.c index 3e1110c..4f1e211 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -406,8 +406,8 @@ test_attr_basic_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -777,8 +777,8 @@ test_attr_compound_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -980,8 +980,8 @@ test_attr_scalar_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1182,8 +1182,8 @@ test_attr_mult_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1457,8 +1457,8 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Open existing dataset w/attributes */ - dataset = H5Dopen(file, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1504,8 +1504,8 @@ test_attr_delete(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1729,8 +1729,8 @@ test_attr_dtype_shared(hid_t fapl) CHECK(file_id, FAIL, "H5Fopen"); /* Open dataset */ - dset_id = H5Dopen(file_id, DSET1_NAME); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, DSET1_NAME, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Open attribute */ attr_id = H5Aopen(dset_id, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT); @@ -2232,8 +2232,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Delete attributes until the attributes revert to compact storage again */ for(u--; u >= min_dense; u--) { @@ -2414,8 +2414,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify renamed attributes */ for(u = 0; u < (max_compact * 2); u++) { @@ -3151,8 +3151,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Open first attribute */ @@ -3299,8 +3299,8 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get number of attributes */ @@ -3515,8 +3515,8 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset created */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ is_empty = H5O_is_attr_empty_test(dataset); @@ -3680,12 +3680,12 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { @@ -3907,12 +3907,12 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { @@ -4190,12 +4190,12 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { @@ -4352,12 +4352,12 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { diff --git a/test/testmeta.c b/test/testmeta.c index 74e9aa8..7d67af2 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -133,8 +133,7 @@ int main(void) sprintf(name, "DataArray%06d", i); dataset_id = H5Dcreate(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT); - if(dataset_id < 0) - { + if(dataset_id < 0) { fprintf(stderr, "Failed to create DataArray dataset.\n"); status = H5Fclose(file_id); return -1; @@ -143,8 +142,7 @@ int main(void) /* Write the data array data */ status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); - if(status < 0) - { + if(status < 0) { fprintf(stderr, "Failed to write DataArray dataset.\n"); status = H5Fclose(file_id); return -1; @@ -156,9 +154,8 @@ int main(void) } /* Open NumDataObj dataset */ - dataset_id = H5Dopen(file_id, "/NumDataObj"); - if(dataset_id < 0) - { + dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT); + if(dataset_id < 0) { fprintf(stderr, "Failed to open NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; @@ -168,8 +165,7 @@ int main(void) numdataobj = j + 1; status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); - if(status < 0) - { + if(status < 0) { fprintf(stderr, "Failed to write NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; @@ -183,7 +179,7 @@ int main(void) for(i = 0; i < NEXTARRAYS; i++) { /* Open extendable dataset */ sprintf(name, "/ExtArray%06d", i); - dataset_id = H5Dopen(file_id, name); + dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT); if(dataset_id < 0) { fprintf(stderr, "Failed to open ExtArray dataset.\n"); status = H5Fclose(file_id); diff --git a/test/tfile.c b/test/tfile.c index 4766838..a940277 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -422,8 +422,8 @@ test_file_open(void) VERIFY(intent, H5F_ACC_RDONLY, "H5Fget_intent"); /* Open dataset */ - did = H5Dopen(fid1, F2_DSET); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid1, F2_DSET, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Check that the intent works even if NULL is passed in */ ret = H5Fget_intent(fid1, NULL); @@ -1392,15 +1392,15 @@ test_file_open_dot(void) /* Open a dataset with no name using the file ID */ H5E_BEGIN_TRY { - did = H5Dopen(fid, "."); + did = H5Dopen2(fid, ".", H5P_DEFAULT); } H5E_END_TRY; - VERIFY(did, FAIL, "H5Dopen"); + VERIFY(did, FAIL, "H5Dopen2"); /* Open a dataset with no name using the group ID */ H5E_BEGIN_TRY { - did = H5Dopen(gid, "."); + did = H5Dopen2(gid, ".", H5P_DEFAULT); } H5E_END_TRY; - VERIFY(did, FAIL, "H5Dopen"); + VERIFY(did, FAIL, "H5Dopen2"); /* Make a copy of a datatype to use for creating a named datatype */ tid = H5Tcopy(H5T_NATIVE_INT); @@ -1777,8 +1777,8 @@ test_file_double_dataset_open(void) dset1_id = H5Dcreate(file1_id, DSET_NAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT); CHECK(dset1_id, FAIL, "H5Dcreate"); - dset2_id = H5Dopen(file2_id, DSET_NAME); - CHECK(dset2_id, FAIL, "H5Dopen"); + dset2_id = H5Dopen2(file2_id, DSET_NAME, H5P_DEFAULT); + CHECK(dset2_id, FAIL, "H5Dopen2"); /* Close "supporting" dataspace */ ret = H5Sclose(space_id); diff --git a/test/th5o.c b/test/th5o.c index a1843ea..eb18515 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -217,8 +217,8 @@ test_h5o_close(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "group/datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Oclose(grp); CHECK(ret, FAIL, "H5Oclose"); @@ -482,8 +482,8 @@ test_h5o_refcount(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info"); @@ -520,8 +520,8 @@ test_h5o_refcount(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info"); @@ -710,8 +710,8 @@ test_h5o_plist(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); /* Retrieve each object's creation property list */ gcpl = H5Gget_create_plist(grp); diff --git a/test/th5s.c b/test/th5s.c index 46f7110..3c872ca 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -188,8 +188,8 @@ test_h5s_basic(void) fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); if (fid1 >= 0){ - dset1 = H5Dopen(fid1, "dset"); - VERIFY(dset1, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); + VERIFY(dset1, FAIL, "H5Dopen2"); ret = H5Fclose(fid1); CHECK_I(ret, "H5Fclose"); } @@ -462,8 +462,8 @@ test_h5s_null(void) CHECK(fid, FAIL, "H5Fopen"); /* Reopen the dataset */ - did = H5Dopen(fid, NULLDATASET); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, NULLDATASET, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the space of the dataset */ dset_sid = H5Dget_space(did); @@ -783,10 +783,10 @@ test_h5s_scalar_read(void) CHECK(fid1, FAIL, "H5Fopen"); /* Create a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); - sid1=H5Dget_space(dataset); + sid1 = H5Dget_space(dataset); CHECK(sid1, FAIL, "H5Dget_space"); n = H5Sget_simple_extent_npoints(sid1); @@ -928,10 +928,10 @@ test_h5s_compound_scalar_read(void) CHECK(fid1, FAIL, "H5Fopen"); /* Create a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); - sid1=H5Dget_space(dataset); + sid1 = H5Dget_space(dataset); CHECK(sid1, FAIL, "H5Dget_space"); n = H5Sget_simple_extent_npoints(sid1); @@ -1034,22 +1034,22 @@ test_h5s_chunk(void) CHECK(status, FAIL, "H5Fclose"); /* Reset/initialize the data arrays to read in */ - HDmemset(chunk_data_dbl,0,sizeof(double)*50000*3); - HDmemset(chunk_data_flt,0,sizeof(float)*50000*3); + HDmemset(chunk_data_dbl, 0, sizeof(double) * 50000 * 3); + HDmemset(chunk_data_flt, 0, sizeof(float) * 50000 * 3); - fileID = H5Fopen(DATAFILE,H5F_ACC_RDONLY,H5P_DEFAULT); + fileID = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fileID, FAIL, "H5Fopen"); - dsetID = H5Dopen(fileID,"coords"); - CHECK(dsetID, FAIL, "H5Dopen"); + dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT); + CHECK(dsetID, FAIL, "H5Dopen2"); - status= H5Dread (dsetID,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,chunk_data_dbl); + status= H5Dread (dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl); CHECK(status, FAIL, "H5Dread"); - status= H5Dread (dsetID,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,chunk_data_flt); + status= H5Dread (dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); CHECK(status, FAIL, "H5Dread"); - status=H5Dclose(dsetID); + status = H5Dclose(dsetID); CHECK(status, FAIL, "H5Dclose"); - status=H5Fclose(fileID); + status = H5Fclose(fileID); CHECK(status, FAIL, "H5Fclose"); for(i=0; i<50000; i++) { diff --git a/test/titerate.c b/test/titerate.c index f7938e5..9aef367 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -434,8 +434,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); CHECK(file, FAIL, "H5Fopen"); - dataset = H5Dopen(file, "Dataset"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, "Dataset", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Test invalid indices for starting iteration */ info.command = RET_ZERO; diff --git a/test/tmisc.c b/test/tmisc.c index 959c7a8..41feb80 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -357,8 +357,8 @@ test_misc1(void) dataspace = H5Screate(H5S_SCALAR); CHECK(dataspace, FAIL, "H5Screate"); - dataset = H5Dopen(file, MISC1_DSET_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, MISC1_DSET_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &i_check); CHECK(ret, FAIL, "H5Dread"); @@ -924,24 +924,24 @@ test_misc5(void) /* Read the dataset back in & verify it */ - loc_id=H5Fopen(MISC5_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(loc_id,FAIL,"H5Fopen"); + loc_id = H5Fopen(MISC5_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(loc_id, FAIL, "H5Fopen"); /* Open dataset again */ - dataset_id=H5Dopen(loc_id, MISC5_DSETNAME); - CHECK(dataset_id,FAIL,"H5Dopen"); + dataset_id = H5Dopen2(loc_id, MISC5_DSETNAME, H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dopen2"); /* Get the dataset's datatype */ - mem_type_id=H5Dget_type(dataset_id); - CHECK(mem_type_id,FAIL,"H5Dget_type"); + mem_type_id = H5Dget_type(dataset_id); + CHECK(mem_type_id, FAIL, "H5Dget_type"); /* Get the dataset's dataspace */ - space_id=H5Dget_space(dataset_id); - CHECK(space_id,FAIL,"H5Dget_space"); + space_id = H5Dget_space(dataset_id); + CHECK(space_id, FAIL, "H5Dget_space"); /* Read the data back in */ - ret=H5Dread(dataset_id, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf); - CHECK(ret,FAIL,"H5Dread"); + ret = H5Dread(dataset_id, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf); + CHECK(ret, FAIL, "H5Dread"); /* Verify the correct information was read in */ for(i=0; i<(buf.len); i++) { @@ -1036,8 +1036,8 @@ test_misc6(void) /* Open first dataset */ - dataset_id = H5Dopen(loc_id, MISC6_DSETNAME1); - CHECK(dataset_id, FAIL, "H5Dopen"); + dataset_id = H5Dopen2(loc_id, MISC6_DSETNAME1, H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dopen2"); /* Add attribute to dataset */ attr_id = H5Acreate2(dataset_id, ".", attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -1053,8 +1053,8 @@ test_misc6(void) /* Open second dataset */ - dataset_id = H5Dopen(loc_id, MISC6_DSETNAME2); - CHECK(dataset_id, FAIL, "H5Dopen"); + dataset_id = H5Dopen2(loc_id, MISC6_DSETNAME2, H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dopen2"); /* Add attribute to dataset */ attr_id = H5Acreate2(dataset_id, ".", attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -1730,8 +1730,8 @@ test_misc10(void) fcpl = H5Fget_create_plist(file); CHECK(fcpl, FAIL, "H5Fget_create_plist"); - dataset = H5Dopen(file, MISC10_DSETNAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, MISC10_DSETNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); dcpl = H5Dget_create_plist(dataset); CHECK(dcpl, FAIL, "H5Dget_create_plist"); space = H5Dget_space(dataset); @@ -2112,8 +2112,8 @@ verify_dataset(hid_t loc_id, const char *name) herr_t ret; /* Generic return value */ /* Open the contiguous dataset in the root group */ - dsid = H5Dopen(loc_id, name); - CHECK(dsid, FAIL, "H5Dopen"); + dsid = H5Dopen2(loc_id, name, H5P_DEFAULT); + CHECK(dsid, FAIL, "H5Dopen2"); /* Read the data */ ret = H5Dread(dsid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, m13_rdata); @@ -3458,8 +3458,8 @@ test_misc20(void) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset with big dimensions */ - did = H5Dopen(fid, MISC20_DSET_NAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, MISC20_DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); @@ -3476,8 +3476,8 @@ test_misc20(void) CHECK(ret, FAIL, "H5Dclose"); /* Open dataset with small dimensions */ - did = H5Dopen(fid, MISC20_DSET2_NAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, MISC20_DSET2_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); @@ -3513,8 +3513,8 @@ test_misc20(void) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset with small dimensions */ - did = H5Dopen(fid, MISC20_DSET_NAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, MISC20_DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); @@ -3715,8 +3715,8 @@ test_misc22(void) ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - dsid = H5Dopen(fid, MISC22_DSET_NAME); - CHECK(dsid, FAIL, "H5Dopen"); + dsid = H5Dopen2(fid, MISC22_DSET_NAME, H5P_DEFAULT); + CHECK(dsid, FAIL, "H5Dopen2"); dcpl2 = H5Dget_create_plist(dsid); CHECK(dcpl2, FAIL, "H5Dget_create_plist"); @@ -4078,14 +4078,14 @@ test_misc24(void) /* Attempt to open each kind of object with wrong API, including using soft links */ H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_NAME); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_LINK); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); @@ -4128,14 +4128,14 @@ test_misc24(void) VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_NAME); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_LINK); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); /* Try again, with the object already open through valid call */ /* Open group */ @@ -4143,14 +4143,14 @@ test_misc24(void) CHECK(group_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_NAME); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_LINK); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); @@ -4166,8 +4166,8 @@ test_misc24(void) CHECK(ret, FAIL, "H5Gclose"); /* Open dataset */ - dset_id = H5Dopen(file_id, MISC24_DATASET_NAME); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); @@ -4207,14 +4207,14 @@ test_misc24(void) VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_NAME); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_LINK); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); ret = H5Tclose(type_id); CHECK(ret, FAIL, "H5Tclose"); diff --git a/test/trefer.c b/test/trefer.c index 2b2c96e..baa0bcd 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -216,8 +216,8 @@ test_reference_obj(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, "/Dataset3"); - CHECK(ret, FAIL, "H5Dcreate"); + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -442,8 +442,8 @@ test_reference_region(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dset1 = H5Dopen(fid1,"/Dataset1"); - CHECK(dset1, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -714,8 +714,8 @@ test_reference_region_1D(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dset1 = H5Dopen(fid1, "/Dataset1"); - CHECK(dset1, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -920,8 +920,8 @@ test_reference_obj_deleted(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, "/Dataset2"); - CHECK(ret, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "/Dataset2", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ HDmemset(&oref, 0, sizeof(hobj_ref_t)); @@ -1065,8 +1065,8 @@ test_reference_group(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open dataset */ - did = H5Dopen(fid, DSETNAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Read in the reference */ ret = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rref); @@ -1296,8 +1296,8 @@ test_reference_compat(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the object reference dataset */ - dataset = H5Dopen(fid1, "/Dataset3"); - CHECK(ret, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_obj); @@ -1326,8 +1326,8 @@ test_reference_compat(void) /* Open the dataset region reference dataset */ - dataset = H5Dopen(fid1, "/Dataset4"); - CHECK(ret, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg); diff --git a/test/tselect.c b/test/tselect.c index 45b8c88..a6b885f 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -2921,34 +2921,34 @@ test_select_hyper_union_stagger(void) /* Close things */ error=H5Sclose(dataspace); CHECK(error, FAIL, "H5Sclose"); - error=H5Dclose(dset_id); + error = H5Dclose(dset_id); CHECK(error, FAIL, "H5Dclose"); - error=H5Fclose(file_id); + error = H5Fclose(file_id); CHECK(error, FAIL, "H5Fclose"); /* Initialize intput buffer */ - memset(data_out,0,7*7*sizeof(int)); + memset(data_out, 0, 7 * 7 * sizeof(int)); /* Open file */ - file_id=H5Fopen(FILENAME,H5F_ACC_RDONLY,H5P_DEFAULT); + file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file_id, FAIL, "H5Fopen"); /* Open dataset */ - dset_id=H5Dopen(file_id,"IntArray"); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, "IntArray", H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Get the dataspace */ - dataspace=H5Dget_space(dset_id); + dataspace = H5Dget_space(dset_id); CHECK(dataspace, FAIL, "H5Dget_space"); /* Select the hyperslabs */ - error=H5Sselect_hyperslab(dataspace,H5S_SELECT_SET,offset,stride,count,block); + error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); CHECK(error, FAIL, "H5Sselect_hyperslab"); - tmp_space=H5Scombine_hyperslab(dataspace,H5S_SELECT_OR,offset2,stride,count2,block); + tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, offset2, stride, count2, block); CHECK(tmp_space, FAIL, "H5Scombine_hyperslab"); /* Copy the file dataspace and select hyperslab */ - tmp2_space=H5Scopy(dataspace); + tmp2_space = H5Scopy(dataspace); CHECK(tmp2_space, FAIL, "H5Scopy"); error=H5Sselect_hyperslab(tmp2_space,H5S_SELECT_SET,offset3,stride,count3,block); CHECK(error, FAIL, "H5Sselect_hyperslab"); @@ -4068,16 +4068,16 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) /* * Open the file and the dataset. */ - file = H5Fopen (FILENAME, H5F_ACC_RDONLY, fapl_plist); + file = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl_plist); CHECK(file, FAIL, "H5Fopen"); - dataset = H5Dopen (file, DATASETNAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); - dataspace = H5Dget_space (dataset); /* dataspace handle */ + dataspace = H5Dget_space(dataset); /* dataspace handle */ CHECK(dataspace, FAIL, "H5Dget_space"); - rank = H5Sget_simple_extent_ndims (dataspace); + rank = H5Sget_simple_extent_ndims(dataspace); VERIFY(rank, 3, "H5Sget_simple_extent_ndims"); - status_n = H5Sget_simple_extent_dims (dataspace, dims_out, NULL); + status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL); CHECK(status_n, FAIL, "H5Sget_simple_extent_dims"); VERIFY(dims_out[0], dimsf[0], "Dataset dimensions"); VERIFY(dims_out[1], dimsf[1], "Dataset dimensions"); @@ -4301,48 +4301,48 @@ test_select_point_chunk(void) CHECK(ret, FAIL, "H5Dwrite"); /* Close everything (except selections) */ - ret=H5Pclose (dcpl); + ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - ret=H5Sclose (dataspace); + ret = H5Sclose(dataspace); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Dclose (dataset); + ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Fclose (file); + ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); /* Re-open file & dataset */ - file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + file = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); - dataset = H5Dopen (file, DATASETNAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Read data using 1st point selection for file and hyperslab for memory */ - ret=H5Dread(dataset,H5T_NATIVE_UINT,hyp1_space,pnt1_space,H5P_DEFAULT,data_out); + ret = H5Dread(dataset, H5T_NATIVE_UINT, hyp1_space, pnt1_space, H5P_DEFAULT, data_out); CHECK(ret, FAIL, "H5Dread"); /* Verify data (later) */ /* Read data using 2nd hyperslab selection for file and point for memory */ - ret=H5Dread(dataset,H5T_NATIVE_UINT,pnt2_space,hyp2_space,H5P_DEFAULT,data_out); + ret = H5Dread(dataset, H5T_NATIVE_UINT, pnt2_space, hyp2_space, H5P_DEFAULT, data_out); CHECK(ret, FAIL, "H5Dread"); /* Verify data (later) */ /* Close everything (inclusing selections) */ - ret=H5Sclose (pnt1_space); + ret = H5Sclose(pnt1_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose (pnt2_space); + ret = H5Sclose(pnt2_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose (hyp1_space); + ret = H5Sclose(hyp1_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose (hyp2_space); + ret = H5Sclose(hyp2_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Dclose (dataset); + ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Fclose (file); + ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - free (data); + free(data); free (data_out); } /* test_select_point_chunk() */ diff --git a/test/tsohm.c b/test/tsohm.c index 350e9b8..c0b9848 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -418,22 +418,22 @@ make_dtype_1(void) hid_t str_id = -1; /* Create compound datatype. */ - if((dtype1_id = H5Tcreate( H5T_COMPOUND, sizeof(struct dtype1_struct)))<0) TEST_ERROR + 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(struct 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,"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(H5Tclose(str_id) < 0) TEST_ERROR @@ -584,21 +584,21 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos /* 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 = H5Dcreate(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR /* Test writing and reading */ - if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata)<0) TEST_ERROR + if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) TEST_ERROR - if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) TEST_ERROR + if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) TEST_ERROR if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); printf("incorrect read data\n"); goto error; } /* end if */ - if(H5Dclose(dset_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR /* Close and re-open the file if requested*/ if(test_file_closing) { @@ -606,94 +606,90 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos } /* Create more datasets with the same datatype */ - if((dset_id = H5Dcreate(file,DSETNAME[1],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[1],dtype1_id,space_id,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((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR } - if((dset_id = H5Dcreate(file,DSETNAME[2],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[2],dtype1_id,space_id,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((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR } - if((dset_id = H5Dcreate(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR /* Write data to dataset 3 for later */ - if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata)<0) TEST_ERROR + if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR - if(H5Tclose(dtype1_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + if(H5Tclose(dtype1_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 - } /* Make sure the data has been written successfully */ - if((dset_id = H5Dopen(file, DSETNAME[0]))<0) TEST_ERROR - - if((dtype1_id = H5Dget_type(dset_id))<0) TEST_ERROR + 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; - strcpy(rdata.str, "\0"); + HDstrcpy(rdata.str, "\0"); /* Read data back again */ - if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { + if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); printf("Can't read data\n"); goto error; } /* end if */ - if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(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; } /* end if */ - if(H5Dclose(dset_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR /* Create several copies of the dataset (this increases the amount of space saved by sharing the datatype message) */ - for(x=0; x<SOHM_HELPER_NUM_EX_DSETS; x++) { - if((dset_id = H5Dcreate(file,EXTRA_DSETNAME[x],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR + for(x = 0; x < SOHM_HELPER_NUM_EX_DSETS; x++) { + if((dset_id = H5Dcreate(file, EXTRA_DSETNAME[x], dtype1_id, space_id, 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 - } - } + } /* end for */ - if(H5Tclose(dtype1_id)<0) TEST_ERROR - if(H5Sclose(space_id)<0) TEST_ERROR + if(H5Tclose(dtype1_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) TEST_ERROR /* Ensure that we can still read data back from dataset 3 */ - if((dset_id = H5Dopen(file, DSETNAME[3]))<0) TEST_ERROR - - if((dtype1_id = H5Dget_type(dset_id))<0) TEST_ERROR + 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 */ - if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { + if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); printf("Can't read data\n"); goto error; } /* end if */ - if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(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; } /* end if */ - if(H5Dclose(dset_id)<0) TEST_ERROR - if(H5Tclose(dtype1_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + if(H5Tclose(dtype1_id) < 0) TEST_ERROR return file; error: @@ -1759,9 +1755,9 @@ static void size2_verify(void) /* Verify property lists and dataspaces */ /* Get property lists from first batch of datasets */ - for(x=0; x<NUM_DATASETS; ++x) { - dset_id = H5Dopen(file_id, DSETNAME[x]); - CHECK_I(dset_id, "H5Dopen"); + for(x = 0; x < NUM_DATASETS; ++x) { + dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); plist_id = H5Dget_create_plist(dset_id); CHECK_I(plist_id, "H5Dget_create_plist"); size2_verify_plist1(plist_id); @@ -1773,7 +1769,7 @@ static void size2_verify(void) ndims = H5Sget_simple_extent_dims(space_id, dims, NULL); CHECK_I(ndims, "H5Sget_simple_extent_dims"); VERIFY(ndims, SIZE2_RANK1, "H5Sget_simple_extent_dims"); - for(y=0; y<ndims; ++y) + for(y = 0; y < ndims; ++y) VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims"); ret = H5Sclose(space_id); @@ -1786,10 +1782,9 @@ static void size2_verify(void) /* Get property lists from second batch of datasets */ group1_id = H5Gopen2(file_id, "group", H5P_DEFAULT); CHECK_I(group1_id, "H5Gopen2"); - for(x=0; x<NUM_DATASETS; ++x) - { - dset_id = H5Dopen(group1_id, DSETNAME[x]); - CHECK_I(dset_id, "H5Dopen"); + for(x = 0; x < NUM_DATASETS; ++x) { + dset_id = H5Dopen2(group1_id, DSETNAME[x], H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); plist_id = H5Dget_create_plist(dset_id); CHECK_I(plist_id, "H5Dget_create_plist"); size2_verify_plist2(plist_id); @@ -1801,7 +1796,7 @@ static void size2_verify(void) ndims = H5Sget_simple_extent_dims(space_id, dims, NULL); CHECK_I(ndims, "H5Sget_simple_extent_dims"); VERIFY(ndims, SIZE2_RANK2, "H5Sget_simple_extent_dims"); - for(y=0; y<ndims; ++y) + for(y = 0; y < ndims; ++y) VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims"); ret = H5Sclose(space_id); @@ -1809,7 +1804,7 @@ static void size2_verify(void) ret = H5Dclose(dset_id); CHECK_I(ret, "H5Dclose"); - } + } /* end for */ ret = H5Gclose(group1_id); CHECK_I(ret, "H5Gclose"); @@ -1818,8 +1813,8 @@ static void size2_verify(void) CHECK_I(group1_id, "H5Gopen2"); for(x = 0; x < NUM_DATASETS; x += 2) { /* First "type 1" dataset */ - dset_id = H5Dopen(group1_id, DSETNAME[x]); - CHECK_I(dset_id, "H5Dopen"); + dset_id = H5Dopen2(group1_id, DSETNAME[x], H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); plist_id = H5Dget_create_plist(dset_id); CHECK_I(plist_id, "H5Dget_create_plist"); size2_verify_plist1(plist_id); @@ -1831,7 +1826,7 @@ static void size2_verify(void) ndims = H5Sget_simple_extent_dims(space_id, dims, NULL); CHECK_I(ndims, "H5Sget_simple_extent_dims"); VERIFY(ndims, SIZE2_RANK1, "H5Sget_simple_extent_dims"); - for(y=0; y<ndims; ++y) + for(y = 0; y < ndims; ++y) VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims"); ret = H5Sclose(space_id); @@ -1841,8 +1836,8 @@ static void size2_verify(void) CHECK_I(ret, "H5Dclose"); /* Second "type 2" dataset */ - dset_id = H5Dopen(group1_id, DSETNAME[x+1]); - CHECK_I(dset_id, "H5Dopen"); + dset_id = H5Dopen2(group1_id, DSETNAME[x + 1], H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); plist_id = H5Dget_create_plist(dset_id); CHECK_I(plist_id, "H5Dget_create_plist"); size2_verify_plist2(plist_id); @@ -1854,7 +1849,7 @@ static void size2_verify(void) ndims = H5Sget_simple_extent_dims(space_id, dims, NULL); CHECK_I(ndims, "H5Sget_simple_extent_dims"); VERIFY(ndims, SIZE2_RANK2, "H5Sget_simple_extent_dims"); - for(y=0; y<ndims; ++y) + for(y = 0; y < ndims; ++y) VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims"); ret = H5Sclose(space_id); @@ -1862,7 +1857,7 @@ static void size2_verify(void) ret = H5Dclose(dset_id); CHECK_I(ret, "H5Dclose"); - } + } /* end for */ ret = H5Gclose(group1_id); CHECK_I(ret, "H5Gclose"); @@ -2608,8 +2603,8 @@ static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) herr_t ret; /* Open dataset */ - dset_id = H5Dopen(file_id, DSETNAME[x]); - CHECK_I(dset_id, "H5Dcreate"); + dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); /* Read */ rdata = '\0'; @@ -3108,8 +3103,8 @@ static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id) */ dst_file_id = H5Fopen(FILENAME_DST, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(dst_file_id, "H5Fopen"); - dset_id = H5Dopen(dst_file_id, "dataset"); - CHECK_I(dset_id, "H5Dopen"); + dset_id = H5Dopen2(dst_file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); /* Cleanup */ ret = H5Dclose(dset_id); @@ -3216,8 +3211,8 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); } /* Create another dataset starting with the same dataspace */ @@ -3235,10 +3230,10 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); } /* Create a third dataset with the same dataspace */ @@ -3258,12 +3253,12 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); - dset3_id = H5Dopen(file_id, "dataset3"); - CHECK_I(dset3_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); + CHECK_I(dset3_id, "H5Dopen2"); } /* Extend the first dataset */ @@ -3282,12 +3277,12 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); - dset3_id = H5Dopen(file_id, "dataset3"); - CHECK_I(dset3_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); + CHECK_I(dset3_id, "H5Dopen2"); } /* Get the dataspaces from the datasets */ @@ -3344,12 +3339,12 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); - dset3_id = H5Dopen(file_id, "dataset3"); - CHECK_I(dset3_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); + CHECK_I(dset3_id, "H5Dopen2"); } /* Get the dataspaces from the datasets */ @@ -3406,12 +3401,12 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); - dset3_id = H5Dopen(file_id, "dataset3"); - CHECK_I(dset3_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); + CHECK_I(dset3_id, "H5Dopen2"); } /* Get the dataspaces from the datasets */ @@ -3481,8 +3476,8 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); } /* Extend the first dataset */ @@ -3497,8 +3492,8 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); } /* Create the second dataset. Its dataspace will be unshared and then @@ -3517,10 +3512,10 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); } /* Extend the second dataset */ @@ -3537,10 +3532,10 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); } /* Create the third dataset. Its dataspace will be unshared and then @@ -3561,12 +3556,12 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); - dset3_id = H5Dopen(file_id, "dataset3"); - CHECK_I(dset3_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); + CHECK_I(dset3_id, "H5Dopen2"); } /* Extend the third dataset */ @@ -3585,12 +3580,12 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen(file_id, "dataset"); - CHECK_I(dset1_id, "H5Dopen"); - dset2_id = H5Dopen(file_id, "dataset2"); - CHECK_I(dset2_id, "H5Dopen"); - dset3_id = H5Dopen(file_id, "dataset3"); - CHECK_I(dset3_id, "H5Dopen"); + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset1_id, "H5Dopen2"); + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); + CHECK_I(dset2_id, "H5Dopen2"); + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); + CHECK_I(dset3_id, "H5Dopen2"); } /* Get the dataspaces from the datasets */ diff --git a/test/ttime.c b/test/ttime.c index 37e0b5e..87e57dc 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -174,8 +174,8 @@ test_time_io(void) fid = H5Fopen(DATAFILE, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); - dsid = H5Dopen(fid, DATASETNAME); - CHECK(dsid, FAIL, "H5Dopen"); + dsid = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT); + CHECK(dsid, FAIL, "H5Dopen2"); tid = H5Dget_type(dsid); CHECK(tid, FAIL, "H5Dget_type"); diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 00c6657..92eff41 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -101,7 +101,7 @@ void tts_cancel(void) ret=pthread_cancel(childthread); assert(ret==0); - dataset = H5Dopen(cancel_file, DATASETNAME); + dataset = H5Dopen2(cancel_file, DATASETNAME, H5P_DEFAULT); assert(dataset>=0); ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); assert(ret>=0); diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index 5ed4181..4faf2bc 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -110,51 +110,51 @@ void tts_dcreate(void) * creation plist and default file access plist */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(file>=0); + assert(file >= 0); /* simultaneously create a large number of datasets within the file */ - for (i = 0; i < NUM_THREAD; i++) { + for(i = 0; i < NUM_THREAD; i++) { thread_out[i].id = i; thread_out[i].file = file; thread_out[i].dsetname = dsetname[i]; ret=pthread_create(&threads[i], NULL, tts_dcreate_creator, &thread_out[i]); assert(ret==0); - } + } /* end for */ - for (i = 0;i < NUM_THREAD; i++) { - ret=pthread_join(threads[i], NULL); - assert(ret==0); + for(i = 0;i < NUM_THREAD; i++) { + ret = pthread_join(threads[i], NULL); + assert(ret == 0); } /* end for */ /* compare data to see if it is written correctly */ - for (i = 0; i < NUM_THREAD; i++) { - if ((dataset = H5Dopen(file,dsetname[i])) < 0) { + for(i = 0; i < NUM_THREAD; i++) { + if((dataset = H5Dopen2(file, dsetname[i], H5P_DEFAULT)) < 0) { TestErrPrintf("Dataset name not found - test failed\n"); H5Fclose(file); return; } else { - ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); - assert(ret>=0); + ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + assert(ret >= 0); - if (datavalue != i) { + if(datavalue != i) { TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n", datavalue, dsetname[i]); - ret=H5Dclose(dataset); - assert(ret>=0); - ret=H5Fclose(file); - assert(ret>=0); + ret = H5Dclose(dataset); + assert(ret >= 0); + ret = H5Fclose(file); + assert(ret >= 0); return; } - ret=H5Dclose(dataset); - assert(ret>=0); + ret = H5Dclose(dataset); + assert(ret >= 0); } } /* close remaining resources */ - ret=H5Fclose(file); - assert(ret>=0); + ret = H5Fclose(file); + assert(ret >= 0); /* Destroy the thread attribute */ ret=pthread_attr_destroy(&attribute); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 657b68b..3989e73 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -139,8 +139,8 @@ void tts_error(void) if (error_count != NUM_THREAD - 1) TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1); - dataset = H5Dopen(error_file, DATASETNAME); - assert(dataset>=0); + dataset = H5Dopen2(error_file, DATASETNAME, H5P_DEFAULT); + assert(dataset >= 0); ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); assert(ret>=0); diff --git a/test/tunicode.c b/test/tunicode.c index 6898857..f34e19f 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -413,18 +413,18 @@ void test_objnames(hid_t fid, const char* string) space_id = H5Screate_simple(RANK, &dims, NULL); CHECK(space_id, FAIL, "H5Screate_simple"); - dset_id=H5Dcreate(grp1_id, string, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + dset_id = H5Dcreate(grp1_id, string, H5T_NATIVE_INT, space_id, H5P_DEFAULT); CHECK(dset_id, FAIL, "H5Dcreate"); /* Make sure that dataset can be opened again */ - ret=H5Dclose(dset_id); + ret = H5Dclose(dset_id); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Sclose(space_id); + ret = H5Sclose(space_id); CHECK(ret, FAIL, "H5Sclose"); - dset_id=H5Dopen(grp1_id, string); - CHECK(ret, FAIL, "H5Dopen"); - ret=H5Dclose(dset_id); + dset_id = H5Dopen2(grp1_id, string, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); + ret = H5Dclose(dset_id); CHECK(ret, FAIL, "H5Dclose"); ret = H5Gclose(grp1_id); CHECK(ret, FAIL, "H5Gclose"); diff --git a/test/tvlstr.c b/test/tvlstr.c index c9acba0..b1ba48e 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -728,7 +728,7 @@ static void write_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, c hid_t dset; herr_t ret; - dset = H5Dcreate (file, name, type, space, H5P_DEFAULT); + dset = H5Dcreate(file, name, type, space, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate"); ret = H5Dwrite(dset, type, space, space, H5P_DEFAULT, &data); @@ -745,8 +745,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch herr_t ret; char *data_read; - dset = H5Dopen (file, name); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(file, name, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Dread(dset, type, space, space, H5P_DEFAULT, &data_read); CHECK(ret, FAIL, "H5Dread"); diff --git a/test/tvltypes.c b/test/tvltypes.c index ac6e0e5..eeadc45 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -350,7 +350,7 @@ test_vltypes_vlen_atomic(void) TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); /* Write data to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -375,8 +375,8 @@ test_vltypes_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -387,21 +387,21 @@ test_vltypes_vlen_atomic(void) CHECK(tid1, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + VERIFY(size,((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ - ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dread"); /* Make certain the correct amount of memory has been used */ @@ -423,11 +423,11 @@ test_vltypes_vlen_atomic(void) } /* end for */ /* Reclaim the read VL data */ - ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata); + ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Make certain the VL memory has been freed */ - VERIFY(mem_used,0,"H5Dvlen_reclaim"); + VERIFY(mem_used, 0, "H5Dvlen_reclaim"); /* Close Dataset */ ret = H5Dclose(dataset); @@ -447,8 +447,8 @@ test_vltypes_vlen_atomic(void) /* Open second dataset */ - dataset=H5Dopen(fid1,"Dataset2"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -463,19 +463,19 @@ test_vltypes_vlen_atomic(void) CHECK(sid2, FAIL, "H5Screate"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { - ret=H5Dvlen_get_buf_size(dataset,tid1,sid2,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -570,11 +570,11 @@ rewrite_vltypes_vlen_atomic(void) MESSAGE(5, ("Check Memory Leak for Basic Atomic VL Datatype Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=HDmalloc((i+increment)*sizeof(unsigned int)); - wdata[i].len=i+increment; - for(j=0; j<(i+increment); j++) - ((unsigned int *)wdata[i].p)[j]=i*20+j; + for(i = 0; i < SPACE1_DIM1; i++) { + wdata[i].p = HDmalloc((i + increment) * sizeof(unsigned int)); + wdata[i].len = i + increment; + for(j = 0; j < (i + increment); j++) + ((unsigned int *)wdata[i].p)[j] = i * 20 + j; } /* end for */ /* Open file created in test_vltypes_vlen_atomic() */ @@ -582,8 +582,8 @@ rewrite_vltypes_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset created in test_vltypes_vlen_atomic() */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Open dataspace for dataset */ sid1 = H5Dget_space(dataset); @@ -594,7 +594,7 @@ rewrite_vltypes_vlen_atomic(void) CHECK(tid1, FAIL, "H5Dget_type"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -619,8 +619,8 @@ rewrite_vltypes_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -631,26 +631,26 @@ rewrite_vltypes_vlen_atomic(void) CHECK(tid1, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 22 elements allocated = 4+5+6+7 elements for each array position */ - VERIFY(size,22*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + VERIFY(size, 22 * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ - ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dread"); /* Make certain the correct amount of memory has been used */ /* 22 elements allocated = 4+5+6+7 elements for each array position */ - VERIFY(mem_used,22*sizeof(unsigned int),"H5Dread"); + VERIFY(mem_used, 22 * sizeof(unsigned int), "H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -877,12 +877,12 @@ rewrite_vltypes_vlen_compound(void) MESSAGE(5, ("Check Memory Leak for Basic Compound VL Datatype Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=HDmalloc((i+increment)*sizeof(s1)); - wdata[i].len=i+increment; - for(j=0; j<(i+increment); j++) { - ((s1 *)wdata[i].p)[j].i=i*40+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*60+j)/3.0); + for(i = 0; i < SPACE1_DIM1; i++) { + wdata[i].p = HDmalloc((i + increment) * sizeof(s1)); + wdata[i].len = i + increment; + for(j = 0; j < (i + increment); j++) { + ((s1 *)wdata[i].p)[j].i = i * 40 + j; + ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0); } /* end for */ } /* end for */ @@ -894,9 +894,9 @@ rewrite_vltypes_vlen_compound(void) tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1)); CHECK(tid2, FAIL, "H5Tcreate"); - ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); + ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); - ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); + ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); CHECK(ret, FAIL, "H5Tinsert"); /* Create a datatype to refer to */ @@ -904,30 +904,30 @@ rewrite_vltypes_vlen_compound(void) CHECK(tid1, FAIL, "H5Tvlen_create"); /* Create a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Create dataspace for datasets */ sid1 = H5Dget_space(dataset); CHECK(sid1, FAIL, "H5Dget_space"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 22 elements allocated = 4 + 5 + 6 + 7 elements for each array position */ - VERIFY(size,22*sizeof(s1),"H5Dvlen_get_buf_size"); + VERIFY(size, 22 * sizeof(s1), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata); @@ -1055,19 +1055,19 @@ test_vltypes_compound_vlen_vlen(void) CHECK(tid2, FAIL, "H5Tcreate"); /* Insert fields */ - ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); + ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); - ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); + ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); CHECK(ret, FAIL, "H5Tinsert"); - ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); + ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); CHECK(ret, FAIL, "H5Tinsert"); /* Create a dataset */ - dataset=H5Dcreate(fid1,"Dataset1",tid2,sid1,H5P_DEFAULT); + dataset = H5Dcreate(fid1, "Dataset1", tid2, sid1, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -1084,16 +1084,16 @@ test_vltypes_compound_vlen_vlen(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Read dataset from disk */ - ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; i<SPACE3_DIM1; i++) { - if(wdata[i].i!=rdata[i].i) { + for(i = 0; i < SPACE3_DIM1; i++) { + if(wdata[i].i != rdata[i].i) { TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ @@ -1102,13 +1102,13 @@ test_vltypes_compound_vlen_vlen(void) continue; } /* end if */ - if(wdata[i].v.len!=rdata[i].v.len) { + if(wdata[i].v.len != rdata[i].v.len) { TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); continue; } /* end if */ for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) { - if(t1->len!=t2->len) { + if(t1->len != t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; } /* end if */ @@ -1329,20 +1329,20 @@ test_vltypes_compound_vlstr(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dset2=H5Dopen(fid1,"Dataset1"); - CHECK(dset2, FAIL, "H5Dopen"); + dset2 = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); /* Get the data type */ tid2 = H5Dget_type(dset2); CHECK(tid2, FAIL, "H5Dget_type"); /* Read dataset from disk */ - ret=H5Dread(dset2,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dset2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; i<SPACE1_DIM1; i++) { - if(wdata[i].v.len!=rdata[i].v.len) { + for(i = 0; i < SPACE1_DIM1; i++) { + if(wdata[i].v.len != rdata[i].v.len) { TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); continue; } /* end if */ @@ -1700,13 +1700,13 @@ rewrite_vltypes_compound_vlen_atomic(void) MESSAGE(5, ("Checking memory leak for compound datatype with VL Atomic Datatype Component Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].i=i*40; - wdata[i].f=(float)((i*50)/3.0); - wdata[i].v.p=HDmalloc((i+increment)*sizeof(unsigned int)); - wdata[i].v.len=i+increment; - for(j=0; j<(i+increment); j++) - ((unsigned int *)wdata[i].v.p)[j]=i*60+j; + for(i = 0; i < SPACE1_DIM1; i++) { + wdata[i].i = i * 40; + wdata[i].f = (float)((i * 50) / 3.0); + wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int)); + wdata[i].v.len = i + increment; + for(j = 0; j < (i + increment); j++) + ((unsigned int *)wdata[i].v.p)[j] = i * 60 + j; } /* end for */ /* Create file */ @@ -1714,7 +1714,7 @@ rewrite_vltypes_compound_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Create a VL datatype to refer to */ - tid1 = H5Tvlen_create (H5T_NATIVE_UINT); + tid1 = H5Tvlen_create(H5T_NATIVE_UINT); CHECK(tid1, FAIL, "H5Tvlen_create"); /* Create the base compound type */ @@ -1722,34 +1722,34 @@ rewrite_vltypes_compound_vlen_atomic(void) CHECK(tid2, FAIL, "H5Tcreate"); /* Insert fields */ - ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); + ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); - ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); + ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); CHECK(ret, FAIL, "H5Tinsert"); - ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); + ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); CHECK(ret, FAIL, "H5Tinsert"); /* Create a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Create dataspace for datasets */ sid1 = H5Dget_space(dataset); CHECK(sid1, FAIL, "H5Dget_space"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 22 elements allocated = 4+5+6+7 elements for each array position */ @@ -1941,40 +1941,40 @@ test_vltypes_vlen_vlen_atomic(void) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a VL datatype to refer to */ - tid1 = H5Tvlen_create (H5T_NATIVE_UINT); + tid1 = H5Tvlen_create(H5T_NATIVE_UINT); CHECK(tid1, FAIL, "H5Tvlen_create"); /* Create the base VL type */ - tid2 = H5Tvlen_create (tid1); + tid2 = H5Tvlen_create(tid1); CHECK(tid2, FAIL, "H5Tvlen_create"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory was used */ - ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ - ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata); + ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dread"); /* Make certain the correct amount of memory has been used */ /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread"); + VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2060,22 +2060,22 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) MESSAGE(5, ("Check memory leak for VL Datatypes with VL Atomic Datatype Component Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=HDmalloc((i+increment)*sizeof(hvl_t)); - if(wdata[i].p==NULL) { + for(i = 0; i < SPACE1_DIM1; i++) { + wdata[i].p = HDmalloc((i + increment) * sizeof(hvl_t)); + if(wdata[i].p == NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i); return; } /* end if */ - wdata[i].len=i+increment; - for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) { - t1->p=HDmalloc((j+1)*sizeof(unsigned int)); - if(t1->p==NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); + wdata[i].len = i + increment; + for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) { + t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); + if(t1->p == NULL) { + TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); return; } /* end if */ - t1->len=j+1; - for(k=0; k<(j+1); k++) - ((unsigned int *)t1->p)[k]=i*1000+j*100+k*10; + t1->len = j + 1; + for(k = 0; k < (j + 1); k++) + ((unsigned int *)t1->p)[k] = i * 1000 + j * 100 + k * 10; } /* end for */ } /* end for */ @@ -2084,8 +2084,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2096,7 +2096,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -2121,8 +2121,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2133,22 +2133,22 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory was used */ - ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 18 hvl_t elements allocated = 3 + 4 + 5 + 6 elements for each array position */ /* 52 unsigned int elements allocated = 6 + 10 + 15 + 21 elements */ - /*VERIFY(size,18*sizeof(hvl_t)+52*sizeof(unsigned int),"H5Dvlen_get_buf_size");*/ + /*VERIFY(size, 18 * sizeof(hvl_t) + 52 * sizeof(unsigned int), "H5Dvlen_get_buf_size");*/ /* Read dataset from disk */ - ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata); + ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dread"); /* Make certain the correct amount of memory has been used */ @@ -2260,8 +2260,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2272,7 +2272,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -2297,8 +2297,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2309,19 +2309,19 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory was used */ - ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata); @@ -2709,8 +2709,8 @@ test_vltypes_fill_value(void) } /* end switch */ /* Open first data set */ - dset_id = H5Dopen(file_id, dset_name1); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name1, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Read in the entire 'empty' dataset of fill value */ ret = H5Dread(dset_id, dtype1_id, dset_dspace_id, dset_dspace_id, xfer_pid, rbuf); @@ -2774,8 +2774,8 @@ test_vltypes_fill_value(void) /* Open the second data set to check the value of data */ - dset_id = H5Dopen(file_id, dset_name2); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Read in the entire 'empty' dataset of fill value */ ret = H5Dread(dset_id, dtype1_id, dset_dspace_id, dset_dspace_id, xfer_pid, rbuf); @@ -2913,8 +2913,8 @@ test_vltypes_fill_value(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Open first data set */ - dset_id = H5Dopen(file_id, dset_name1); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name1, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Write one element in the dataset */ ret = H5Dwrite(dset_id, dtype1_id, scalar_dspace_id, single_dspace_id, xfer_pid, &wdata); @@ -3009,8 +3009,8 @@ test_vltypes_fill_value(void) /* Open the second data set to check the value of data */ - dset_id = H5Dopen(file_id, dset_name2); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Write one element in the dataset */ ret = H5Dwrite(dset_id, dtype1_id, scalar_dspace_id, single_dspace_id, xfer_pid, &wdata); diff --git a/test/unlink.c b/test/unlink.c index fad41ae..1248063 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -1873,7 +1873,7 @@ test_resurrect_dataset(hid_t fapl) if((f = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Attempt to open the dataset under the new name */ - if((d = H5Dopen(f,DATASET2NAME)) < 0) FAIL_STACK_ERROR + if((d = H5Dopen2(f, DATASET2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close things */ if(H5Dclose(d) < 0) FAIL_STACK_ERROR @@ -232,80 +232,77 @@ test_direct(void) /* Initialize the dset1 */ p1 = points; - for (i = n = 0; i < DSET1_DIM1; i++) - for (j = 0; j < DSET1_DIM2; j++) + for(i = n = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; dims1[1] = DSET1_DIM2; - if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0) + if((space1 = H5Screate_simple(2, dims1, NULL)) < 0) TEST_ERROR; /* Create the dset1 */ - if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) + if((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset1=H5Dopen(file, DSET1_NAME)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; - for (i = 0; i < DSET1_DIM1; i++) { - for (j = 0; j < DSET1_DIM2; j++) { - if (*p1++ != *p2++) { + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } - } - } + } /* end if */ /* Create the data space2. For data set 2, memory address and data size are not aligned. */ dims2[0] = DSET2_DIM; - if ((space2 = H5Screate_simple(1, dims2, NULL)) < 0) + if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) TEST_ERROR; /* Create the dset2 */ - if ((dset2 = H5Dcreate(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0) + if((dset2 = H5Dcreate(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) + if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; if(H5Dclose(dset2) < 0) TEST_ERROR; - if((dset2=H5Dopen(file, DSET2_NAME)) < 0) + if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if (H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) + if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i = 0; i < DSET2_DIM; i++) { - if (wdata2[i] != rdata2[i]) { + for(i = 0; i < DSET2_DIM; i++) + if(wdata2[i] != rdata2[i]) { H5_FAILED(); printf(" Read different values than written in data set 2.\n"); printf(" At index %d\n", i); TEST_ERROR; - } - } + } /* end if */ if(H5Sclose(space1) < 0) TEST_ERROR; @@ -430,47 +427,45 @@ test_core(void) /* Initialize the dset1 */ p1 = points; - for (i = n = 0; i < DSET1_DIM1; i++) - for (j = 0; j < DSET1_DIM2; j++) + for(i = n = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; dims1[1] = DSET1_DIM2; - if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0) + if((space1 = H5Screate_simple(2, dims1, NULL)) < 0) TEST_ERROR; /* Create the dset1 */ - if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) + if((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset1=H5Dopen(file, DSET1_NAME)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; - for (i = 0; i < DSET1_DIM1; i++) { - for (j = 0; j < DSET1_DIM2; j++) { - if (*p1++ != *p2++) { + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } - } - } + } /* end if */ if(H5Dclose(dset1) < 0) TEST_ERROR; @@ -483,46 +478,44 @@ test_core(void) if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Create the dset1 */ - if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) + if((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset1=H5Dopen(file, DSET1_NAME)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Reallocate memory for reading buffer. */ if(check) free(check); - check=(int*)malloc(DSET1_DIM1*DSET1_DIM2*sizeof(int)); + check = (int*)malloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); /* Read the data back from dset1 */ - if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; - for (i = 0; i < DSET1_DIM1; i++) { - for (j = 0; j < DSET1_DIM2; j++) { - if (*p1++ != *p2++) { + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } - } - } + } /* end if */ /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) |