summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-08 21:43:02 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-08 21:43:02 (GMT)
commitc01750fa740943c0083711b353278143c79d50a3 (patch)
treefd475b7c7a3639c05b30625b43547850d687b948 /test
parent68fa66bf8130d6a6e607e233da8cc61a154bf172 (diff)
downloadhdf5-c01750fa740943c0083711b353278143c79d50a3.zip
hdf5-c01750fa740943c0083711b353278143c79d50a3.tar.gz
hdf5-c01750fa740943c0083711b353278143c79d50a3.tar.bz2
[svn-r338] Changes since 19980407
---------------------- ./src/H5B.c ./src/H5D.c ./src/H5Dprivate.h ./src/H5Dpublic.h ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fpublic.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5HG.c ./src/H5HL.c ./src/H5MF.c ./src/H5MFprivate.h ./src/H5O.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Olayout.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5Ppublic.h ./src/H5S.c ./src/H5Sprivate.h ./src/H5Spublic.h ./src/H5Ssimp.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./src/H5Vprivate.h ./src/H5private.h ./src/H5public.h ./src/h5ls.c ./test/cmpd_dset.c ./test/dsets.c ./test/extend.c ./test/external.c ./test/hyperslab.c ./test/iopipe.c ./test/istore.c ./test/shtype.c ./test/tfile.c ./test/th5s.c Anything having to do with the size of a dataset now uses the types `hsize_t' and `hssize_t' which must be the same size and at least as large as `size_t'. This isn't fully tested yet, so hsize_t and hssize_t are defined as size_t and ssize_t in H5public.h. Setting them to larger values will trip up gcc versions less than 2.8.1 on x86 platforms. Documented unused function formals with `__unused__' before the formal name. This also has the effect of supressing warning messages for gcc since it's defined to be `__attribute__((unused))' in the H5private.h file. ./src/debug.c ./src/h5ls.c If the file name contains a `%' then the file is opened as a file family with H5P_DEFAULT for the file member access property list. ./src/h5ls.c The group name is optional, defaulting to `/'. ./src/hdf5.h Added some missing public header files.
Diffstat (limited to 'test')
-rw-r--r--test/.distdep89
-rw-r--r--test/cmpd_dset.c39
-rw-r--r--test/dsets.c13
-rw-r--r--test/extend.c20
-rw-r--r--test/external.c80
-rw-r--r--test/hyperslab.c170
-rw-r--r--test/iopipe.c33
-rw-r--r--test/istore.c767
-rw-r--r--test/shtype.c11
-rw-r--r--test/tfile.c114
-rw-r--r--test/th5s.c64
11 files changed, 733 insertions, 667 deletions
diff --git a/test/.distdep b/test/.distdep
index 5cbdc57..45b0ac7 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -136,6 +136,7 @@ dtypes.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
@@ -146,15 +147,7 @@ dtypes.o: \
../src/H5Iprivate.h \
../src/H5private.h \
../src/H5Tprivate.h \
- ../src/H5Gprivate.h \
- ../src/H5Bprivate.h
-hyperslab.o: \
- hyperslab.c \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5MMprivate.h \
- ../src/H5MMpublic.h
+ ../src/H5Gprivate.h
istore.o: \
istore.c \
../src/H5private.h \
@@ -192,6 +185,7 @@ dsets.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
@@ -199,8 +193,8 @@ dsets.o: \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
-cmpd_dset.o: \
- cmpd_dset.c \
+extend.o: \
+ extend.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -211,14 +205,15 @@ cmpd_dset.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Spublic.h
-extend.o: \
- extend.c \
+iopipe.o: \
+ iopipe.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -229,12 +224,32 @@ extend.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
- ../src/H5Opublic.h
-external.o: \
- external.c \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
+gheap.o: \
+ gheap.c \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h \
+ ../src/H5Bprivate.h \
+ ../src/H5Bpublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h
+shtype.o: \
+ shtype.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -245,15 +260,22 @@ external.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h
-iopipe.o: \
- iopipe.c \
+ ../src/H5Spublic.h
+hyperslab.o: \
+ hyperslab.c \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5MMprivate.h \
+ ../src/H5MMpublic.h
+external.o: \
+ external.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -264,6 +286,7 @@ iopipe.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
@@ -271,24 +294,8 @@ iopipe.o: \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
-gheap.o: \
- gheap.c \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
- ../src/H5Ipublic.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
- ../src/H5Gprivate.h \
- ../src/H5Gpublic.h \
- ../src/H5Bprivate.h \
- ../src/H5Bpublic.h \
- ../src/H5HGprivate.h \
- ../src/H5HGpublic.h
-shtype.o: \
- shtype.c \
+cmpd_dset.o: \
+ cmpd_dset.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -299,7 +306,11 @@ shtype.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
- ../src/H5Opublic.h
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index eae78d9..2e22206 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -125,11 +125,10 @@ main (void)
int ndims;
hid_t file, dataset, space, PRESERVE;
herr_t status;
- static size_t dim[] = {NX, NY};
- size_t f_offset[2]; /*offset of hyperslab in file */
- int f_temp_offset[2];
- size_t h_size[2]; /*size of hyperslab */
- size_t h_sample[2]; /*hyperslab sampling */
+ static hsize_t dim[] = {NX, NY};
+ hssize_t f_offset[2]; /*offset of hyperslab in file */
+ hsize_t h_size[2]; /*size of hyperslab */
+ hsize_t h_sample[2]; /*hyperslab sampling */
/* Create the file */
file = H5Fcreate ("cmpd_dset.h5", H5F_ACC_TRUNC,
@@ -398,9 +397,7 @@ STEP 8: Read middle third hyperslab into memory array.\n");
h_size[1] = 2*NY/3 - f_offset[1];
h_sample[0] = 1;
h_sample[1] = 1;
- f_temp_offset[0] = (int)(f_offset[0]);
- f_temp_offset[1] = (int)(f_offset[1]);
- status = H5Sset_hyperslab (s8_f_sid, f_temp_offset, h_size, h_sample);
+ status = H5Sset_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
assert (status>=0);
/* Create memory data space */
@@ -408,7 +405,7 @@ STEP 8: Read middle third hyperslab into memory array.\n");
assert (s8_m_sid>=0);
/* Read the dataset */
- s8 = calloc (h_size[0]*h_size[1], sizeof(s1_t));
+ s8 = calloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t));
assert (s8);
status = H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8);
assert (status>=0);
@@ -454,8 +451,10 @@ STEP 9: Read middle third of hyperslab into middle third of memory array.\n");
for (j=0; j<NY; j++) {
s1_t *ps1 = s1 + i*NY + j;
s2_t *ps2 = s2 + i*NY + j;
- if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
+ if ((hssize_t)i>=f_offset[0] &&
+ (hsize_t)i<f_offset[0]+h_size[0] &&
+ (hssize_t)j>=f_offset[1] &&
+ (hsize_t)j<f_offset[1]+h_size[1]) {
assert (ps2->a == ps1->a);
assert (ps2->b == ps1->b);
assert (ps2->c == ps1->c);
@@ -496,8 +495,10 @@ STEP 10: Read middle third of hyperslab into middle third of memory array\n\
for (j=0; j<NY; j++) {
s1_t *ps1 = s1 + i*NY + j;
s5_t *ps5 = s5 + i*NY + j;
- if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
+ if ((hssize_t)i>=f_offset[0] &&
+ (hsize_t)i<f_offset[0]+h_size[0] &&
+ (hssize_t)j>=f_offset[1] &&
+ (hsize_t)j<f_offset[1]+h_size[1]) {
assert (ps5->pre == (unsigned)(-1));
assert (ps5->a == ps1->a);
assert (ps5->b == ps1->b);
@@ -532,11 +533,9 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
fflush (stdout);
/* Create the memory array and initialize all fields to zero */
- f_temp_offset[0] = (int)(f_offset[0]);
- f_temp_offset[1] = (int)(f_offset[1]);
- ndims = H5Sget_hyperslab (s8_f_sid, f_temp_offset, h_size, h_sample);
+ ndims = H5Sget_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
assert (ndims==2);
- s11 = malloc (h_size[0]*h_size[1]*sizeof(s4_t));
+ s11 = malloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t));
assert (s11);
/* Initialize */
@@ -560,8 +559,10 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
assert (ps1->a == 5*(i*NY+j)+0);
assert (ps1->c == 5*(i*NY+j)+2);
assert (ps1->e == 5*(i*NY+j)+4);
- if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
+ if ((hssize_t)i>=f_offset[0] &&
+ (hsize_t)i<f_offset[0]+h_size[0] &&
+ (hssize_t)j>=f_offset[1] &&
+ (hsize_t)j<f_offset[1]+h_size[1]) {
assert (ps1->b == (unsigned)(-1));
assert (ps1->d == (unsigned)(-1));
} else {
diff --git a/test/dsets.c b/test/dsets.c
index 6f294f2..bf4b75f 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -18,6 +18,9 @@
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
#ifndef HAVE_FUNCTION
@@ -51,7 +54,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data __attribute__((unused)))
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -79,9 +82,9 @@ static herr_t
test_create(hid_t file)
{
hid_t dataset, space, create_parms;
- size_t dims[2];
+ hsize_t dims[2];
herr_t status;
- size_t csize[2];
+ hsize_t csize[2];
herr_t (*func)(void*) = NULL;
void *client_data = NULL;
@@ -195,7 +198,7 @@ test_simple_io(hid_t file)
herr_t status;
int points[100][200], check[100][200];
int i, j, n;
- size_t dims[2];
+ hsize_t dims[2];
void *tconv_buf = NULL;
printf("%-70s", "Testing simple I/O");
@@ -277,7 +280,7 @@ test_tconv(hid_t file)
{
char *out=NULL, *in=NULL;
int i;
- size_t dims[1];
+ hsize_t dims[1];
hid_t space, dataset, type;
herr_t status;
diff --git a/test/extend.c b/test/extend.c
index 7b6ba60..cbdf734 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -33,16 +33,16 @@
int
main (void)
{
- hid_t file, dataset, mem_space, file_space, cparms;
- herr_t status;
- int i, j, k, m;
- static int buf1[NY][NX], buf2[NX/2][NY/2];
- static const size_t dims[2] = {NX, NY};
- static const size_t half_dims[2] = {NX/2, NY/2};
- static const size_t chunk_dims[2] = {NX/2, NY/2};
- static size_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- static size_t size[2];
- int offset[2];
+ hid_t file, dataset, mem_space, file_space, cparms;
+ herr_t status;
+ int i, j, k, m;
+ static int buf1[NY][NX], buf2[NX/2][NY/2];
+ static const hsize_t dims[2] = {NX, NY};
+ static const hsize_t half_dims[2] = {NX/2, NY/2};
+ static const hsize_t chunk_dims[2] = {NX/2, NY/2};
+ static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ static hsize_t size[2];
+ hssize_t offset[2];
/* Initialize buffer and space */
for (i=0; i<NX; i++) {
diff --git a/test/external.c b/test/external.c
index 7f0ff23..0694430 100644
--- a/test/external.c
+++ b/test/external.c
@@ -19,6 +19,9 @@
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
static int nerrors_g = 0;
@@ -41,7 +44,7 @@ static int nerrors_g = 0;
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data __attribute__((unused)))
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -117,7 +120,7 @@ test_1 (void)
{
hid_t file, plist, space, dset, grp;
herr_t status;
- size_t size[2], max_size[2];
+ hsize_t size[2], max_size[2];
herr_t (*func)(void*) = NULL;
void *client_data = NULL;
int n;
@@ -141,7 +144,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 400);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)400);
assert (status>=0);
size[0] = max_size[0] = 100;
@@ -165,7 +168,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 399);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)399);
assert (status>=0);
size[0] = max_size[0] = 100;
@@ -198,7 +201,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 800);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)800);
assert (status>=0);
size[0] = 100;
@@ -225,7 +228,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 799);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)799);
assert (status>=0);
size[0] = 100;
@@ -281,8 +284,8 @@ test_1 (void)
*/
do {
char name[256];
- size_t file_offset;
- size_t file_size;
+ off_t file_offset;
+ hsize_t file_size;
printf ("%-70s", "...opening a dataset and reading the storage info");
fflush (stdout);
@@ -328,8 +331,8 @@ test_1 (void)
*/
do {
char name[256];
- size_t file_offset;
- size_t file_size;
+ off_t file_offset;
+ hsize_t file_size;
printf ("%-70s", "...opening an unlimited dataset and reading the "
"storage info");
@@ -378,13 +381,13 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 100);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)100);
assert (status>=0);
- status = H5Pset_external (plist, "ext2.data", 0, 100);
+ status = H5Pset_external (plist, "ext2.data", 0, (hsize_t)100);
assert (status>=0);
- status = H5Pset_external (plist, "ext3.data", 0, 100);
+ status = H5Pset_external (plist, "ext3.data", 0, (hsize_t)100);
assert (status>=0);
- status = H5Pset_external (plist, "ext4.data", 0, 100);
+ status = H5Pset_external (plist, "ext4.data", 0, (hsize_t)100);
assert (status>=0);
size[0] = max_size[0] = 100;
@@ -414,7 +417,7 @@ test_1 (void)
/* Next function should fail */
H5Eget_auto (&func, &client_data);
H5Eset_auto (NULL, NULL);
- status = H5Pset_external (plist, "ext2.data", 0, 100);
+ status = H5Pset_external (plist, "ext2.data", 0, (hsize_t)100);
H5Eset_auto (func, client_data);
if (status>=0) {
puts ("*FAILED*");
@@ -451,7 +454,7 @@ test_1 (void)
/* Next function should fail */
H5Eget_auto (&func, &client_data);
H5Eset_auto (NULL, NULL);
- status = H5Pset_external (plist, "ext2.data", 0, 100);
+ status = H5Pset_external (plist, "ext2.data", 0, (hsize_t)100);
H5Eset_auto (func, client_data);
if (status>=0) {
puts ("*FAILED*");
@@ -490,22 +493,22 @@ test_2 (void)
hid_t file, plist, space, dset, grp;
herr_t status;
int fd;
- unsigned i, j;
- ssize_t n;
+ hsize_t i, j;
+ hssize_t n;
char fname[64];
int part[25], whole[100];
- size_t size;
+ hsize_t size;
/* Write the data to external files */
for (i=0; i<4; i++) {
for (j=0; j<25; j++) {
- part[j] = i*25+j;
+ part[j] = (int)(i*25+j);
}
- sprintf (fname, "extern_%d.raw", i+1);
+ sprintf (fname, "extern_%lu.raw", (unsigned long)i+1);
fd = open (fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
assert (fd>=0);
- n = lseek (fd, (ssize_t)(i*10), SEEK_SET);
+ n = lseek (fd, (off_t)(i*10), SEEK_SET);
assert (n>=0 && (size_t)n==i*10);
n = write (fd, part, sizeof(part));
assert (n==sizeof(part));
@@ -525,13 +528,17 @@ test_2 (void)
/* Create the external file list */
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "extern_1.raw", 0, sizeof(part));
+ status = H5Pset_external (plist, "extern_1.raw", 0,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_2.raw", 10, sizeof(part));
+ status = H5Pset_external (plist, "extern_2.raw", 10,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_3.raw", 20, sizeof(part));
+ status = H5Pset_external (plist, "extern_3.raw", 20,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_4.raw", 30, sizeof(part));
+ status = H5Pset_external (plist, "extern_4.raw", 30,
+ (hsize_t)sizeof(part));
assert (status>=0);
/* Create the data space */
@@ -577,8 +584,8 @@ test_2 (void)
*/
do {
hid_t hs_space;
- int hs_start = 30;
- size_t hs_count = 25;
+ hssize_t hs_start = 30;
+ hsize_t hs_count = 25;
/* Read from the dataset */
printf ("%-70s", "...reading partial dataset");
@@ -644,8 +651,9 @@ test_3 (void)
herr_t status;
unsigned i;
int fd;
- int part[25], whole[100], hs_start=100;
- size_t size=100, max_size=200, hs_count=100;
+ int part[25], whole[100];
+ hssize_t hs_start=100;
+ hsize_t size=100, max_size=200, hs_count=100;
/*
* Create another file
@@ -656,13 +664,17 @@ test_3 (void)
/* Create the external file list */
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "extern_1b.raw", 0, sizeof(part));
+ status = H5Pset_external (plist, "extern_1b.raw", 0,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_2b.raw", 10, sizeof(part));
+ status = H5Pset_external (plist, "extern_2b.raw", 10,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_3b.raw", 20, sizeof(part));
+ status = H5Pset_external (plist, "extern_3b.raw", 20,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_4b.raw", 30, H5F_UNLIMITED);
+ status = H5Pset_external (plist, "extern_4b.raw", 30,
+ H5F_UNLIMITED);
assert (status>=0);
/* Make sure the output files are fresh*/
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 01e4fa6..b1d3deb 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -149,9 +149,9 @@ test_fill(size_t nx, size_t ny, size_t nz,
size_t ddx, size_t ddy, size_t ddz)
{
uint8 *dst = NULL; /*destination array */
- size_t hs_size[3]; /*hyperslab size */
- size_t dst_size[3]; /*destination total size */
- size_t dst_offset[3]; /*offset of hyperslab in dest */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hssize_t dst_offset[3]; /*offset of hyperslab in dest */
uintn ref_value; /*reference value */
uintn acc; /*accumulator */
size_t i, j, k, dx, dy, dz; /*counters */
@@ -197,9 +197,9 @@ test_fill(size_t nx, size_t ny, size_t nz,
dst_size[0] = nx;
dst_size[1] = ny;
dst_size[2] = nz;
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
+ dst_offset[0] = (hssize_t)i;
+ dst_offset[1] = (hssize_t)j;
+ dst_offset[2] = (hssize_t)k;
hs_size[0] = dx;
hs_size[1] = dy;
hs_size[2] = dz;
@@ -314,15 +314,15 @@ test_copy(int mode,
{
uint8 *src = NULL; /*source array */
uint8 *dst = NULL; /*destination array */
- size_t hs_size[3]; /*hyperslab size */
- size_t dst_size[3]; /*destination total size */
- size_t src_size[3]; /*source total size */
- size_t dst_offset[3]; /*offset of hyperslab in dest */
- size_t src_offset[3]; /*offset of hyperslab in source */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t src_size[3]; /*source total size */
+ hssize_t dst_offset[3]; /*offset of hyperslab in dest */
+ hssize_t src_offset[3]; /*offset of hyperslab in source */
uintn ref_value; /*reference value */
uintn acc; /*accumulator */
- size_t i, j, k, dx, dy, dz; /*counters */
- size_t u, v, w;
+ hsize_t i, j, k, dx, dy, dz; /*counters */
+ hsize_t u, v, w;
int ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
const char *sub;
@@ -406,25 +406,25 @@ test_copy(int mode,
dst_offset[0] = 0;
dst_offset[1] = 0;
dst_offset[2] = 0;
- src_offset[0] = i;
- src_offset[1] = j;
- src_offset[2] = k;
+ src_offset[0] = (hssize_t)i;
+ src_offset[1] = (hssize_t)j;
+ src_offset[2] = (hssize_t)k;
break;
case VARIABLE_DST:
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
+ dst_offset[0] = (hssize_t)i;
+ dst_offset[1] = (hssize_t)j;
+ dst_offset[2] = (hssize_t)k;
src_offset[0] = 0;
src_offset[1] = 0;
src_offset[2] = 0;
break;
case VARIABLE_BOTH:
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
- src_offset[0] = i;
- src_offset[1] = j;
- src_offset[2] = k;
+ dst_offset[0] = (hssize_t)i;
+ dst_offset[1] = (hssize_t)j;
+ dst_offset[2] = (hssize_t)k;
+ src_offset[0] = (hssize_t)i;
+ src_offset[1] = (hssize_t)j;
+ src_offset[2] = (hssize_t)k;
break;
default:
abort();
@@ -492,9 +492,14 @@ test_copy(int mode,
*/
AT();
printf(" acc != ref_value\n");
- printf(" i=%d, j=%d, k=%d, "
- "dx=%d, dy=%d, dz=%d\n",
- i, j, k, dx, dy, dz);
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz);
print_ref(nx, ny, nz);
printf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
@@ -524,9 +529,14 @@ test_copy(int mode,
AT();
printf(" acc != ref_value + nx*ny*nz - "
"dx*dy*dz\n");
- printf(" i=%d, j=%d, k=%d, "
- "dx=%d, dy=%d, dz=%d\n",
- i, j, k, dx, dy, dz);
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz);
print_ref(nx, ny, nz);
printf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
@@ -573,10 +583,10 @@ test_copy(int mode,
static herr_t
test_multifill(size_t nx)
{
- size_t i, j;
- size_t size;
- ssize_t src_stride;
- ssize_t dst_stride;
+ hsize_t i, j;
+ hsize_t size;
+ hssize_t src_stride;
+ hssize_t dst_stride;
char s[64];
struct a_struct {
@@ -618,7 +628,7 @@ test_multifill(size_t nx)
* Copy the fill value into each element
*/
size = nx;
- H5V_stride_copy(1, sizeof(double), &size,
+ H5V_stride_copy(1, (hsize_t)sizeof(double), &size,
&dst_stride, &(dst[0].mid), &src_stride, &(fill.mid));
/*
@@ -627,11 +637,11 @@ test_multifill(size_t nx)
s[0] = '\0';
for (i = 0; i < nx; i++) {
if (dst[i].left != 3333333) {
- sprintf(s, "bad dst[%d].left", i);
+ sprintf(s, "bad dst[%lu].left", (unsigned long)i);
} else if (dst[i].mid != fill.mid) {
- sprintf(s, "bad dst[%d].mid", i);
+ sprintf(s, "bad dst[%lu].mid", (unsigned long)i);
} else if (dst[i].right != 4444444) {
- sprintf(s, "bad dst[%d].right", i);
+ sprintf(s, "bad dst[%lu].right", (unsigned long)i);
}
if (s[0]) {
puts("*FAILED*");
@@ -642,8 +652,9 @@ test_multifill(size_t nx)
for (j = 0; j < sizeof(fill); j++) {
printf(" %02x", ((uint8 *) &fill)[j]);
}
- printf("\n dst[%d]={%d,%g,%d}\n ",
- i, dst[i].left, dst[i].mid, dst[i].right);
+ printf("\n dst[%lu]={%d,%g,%d}\n ",
+ (unsigned long)i,
+ dst[i].left, dst[i].mid, dst[i].right);
for (j = 0; j < sizeof(dst[i]); j++) {
printf(" %02x", ((uint8 *) (dst + i))[j]);
}
@@ -687,10 +698,10 @@ test_endian(size_t nx)
{
uint8 *src = NULL; /*source array */
uint8 *dst = NULL; /*destination array */
- ssize_t src_stride[2]; /*source strides */
- ssize_t dst_stride[2]; /*destination strides */
- size_t size[2]; /*size vector */
- size_t i, j;
+ hssize_t src_stride[2]; /*source strides */
+ hssize_t dst_stride[2]; /*destination strides */
+ hsize_t size[2]; /*size vector */
+ hsize_t i, j;
printf("%-70s", "Testing endian conversion by stride");
fflush(stdout);
@@ -709,7 +720,7 @@ test_endian(size_t nx)
size[1] = 4;
/* Copy the array */
- H5V_stride_copy(2, 1, size, dst_stride, dst + 3, src_stride, src);
+ H5V_stride_copy(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
/* Compare */
for (i = 0; i < nx; i++) {
@@ -722,7 +733,8 @@ test_endian(size_t nx)
* to a terminal.
*/
AT();
- printf(" i=%d, j=%d\n", i, j);
+ printf(" i=%lu, j=%lu\n",
+ (unsigned long)i, (unsigned long)j);
printf(" Source array is:\n");
print_array(src, nx, 4, 1);
printf("\n Result is:\n");
@@ -766,9 +778,9 @@ test_transpose(size_t nx, size_t ny)
{
intn *src = NULL;
intn *dst = NULL;
- size_t i, j;
- ssize_t src_stride[2], dst_stride[2];
- size_t size[2];
+ hsize_t i, j;
+ hssize_t src_stride[2], dst_stride[2];
+ hsize_t size[2];
char s[256];
sprintf(s, "Testing 2d transpose by stride %4lux%-lud",
@@ -795,11 +807,11 @@ test_transpose(size_t nx, size_t ny)
/* Copy and transpose */
if (nx == ny) {
- H5V_stride_copy(2, sizeof(*src), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
dst_stride, dst,
src_stride, src);
} else {
- H5V_stride_copy(2, sizeof(*src), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
dst_stride, dst,
src_stride, src);
}
@@ -811,10 +823,11 @@ test_transpose(size_t nx, size_t ny)
puts("*FAILED*");
if (!isatty(1)) {
AT();
- printf(" diff at i=%d, j=%d\n", i, j);
+ printf(" diff at i=%lu, j=%lu\n",
+ (unsigned long)i, (unsigned long)j);
printf(" Source is:\n");
for (i = 0; i < nx; i++) {
- printf("%3d:", i);
+ printf("%3lu:", (unsigned long)i);
for (j = 0; j < ny; j++) {
printf(" %6d", src[i * ny + j]);
}
@@ -822,7 +835,7 @@ test_transpose(size_t nx, size_t ny)
}
printf("\n Destination is:\n");
for (i = 0; i < ny; i++) {
- printf("%3d:", i);
+ printf("%3lu:", (unsigned long)i);
for (j = 0; j < nx; j++) {
printf(" %6d", dst[i * nx + j]);
}
@@ -870,10 +883,10 @@ test_sub_super(size_t nx, size_t ny)
uint8 *full = NULL; /*original image */
uint8 *half = NULL; /*image at 1/2 resolution */
uint8 *twice = NULL; /*2x2 pixels */
- ssize_t src_stride[4]; /*source stride info */
- ssize_t dst_stride[4]; /*destination stride info */
- size_t size[4]; /*number of sample points */
- size_t i, j;
+ hssize_t src_stride[4]; /*source stride info */
+ hssize_t dst_stride[4]; /*destination stride info */
+ hsize_t size[4]; /*number of sample points */
+ hsize_t i, j;
char s[256];
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
@@ -897,7 +910,7 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[1] = 1;
/* Copy */
- H5V_stride_copy(2, sizeof(uint8), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(uint8), size,
dst_stride, half, src_stride, full);
/* Check */
@@ -907,8 +920,11 @@ test_sub_super(size_t nx, size_t ny)
puts("*FAILED*");
if (!isatty(1)) {
AT();
- printf(" full[%d][%d] != half[%d][%d]\n",
- i*2, j*2, i, j);
+ printf(" full[%lu][%lu] != half[%lu][%lu]\n",
+ (unsigned long)i*2,
+ (unsigned long)j*2,
+ (unsigned long)i,
+ (unsigned long)j);
printf(" full is:\n");
print_array(full, 2 * nx, 2 * ny, 1);
printf("\n half is:\n");
@@ -945,7 +961,7 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[3] = sizeof(uint8);
/* Copy */
- H5V_stride_copy(4, sizeof(uint8), size,
+ H5V_stride_copy(4, (hsize_t)sizeof(uint8), size,
dst_stride, twice, src_stride, half);
/* Check */
@@ -953,17 +969,29 @@ test_sub_super(size_t nx, size_t ny)
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
if (half[i*ny+j] != twice[4*i*ny + 2*j]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i, 2 * j);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2,
+ (unsigned long)j*2);
} else if (half[i*ny + j] != twice[4*i*ny + 2*j + 1]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i, 2 * j + 1);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2,
+ (unsigned long)j*2+1);
} else if (half[i*ny + j] != twice[(2*i +1)*2*ny + 2*j]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i + 1, 2 * j);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2+1,
+ (unsigned long)j*2);
} else if (half[i*ny + j] != twice[(2*i+1)*2*ny + 2*j+1]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i + 1, 2 * j + 1);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2+1,
+ (unsigned long)j*2+1);
}
if (s[0]) {
puts("*FAILED*");
diff --git a/test/iopipe.c b/test/iopipe.c
index 640b2d3..ced3807 100644
--- a/test/iopipe.c
+++ b/test/iopipe.c
@@ -133,7 +133,7 @@ synchronize (void)
int
main (void)
{
- static size_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
+ static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
static int nread=NREAD_REQUESTS, nwrite=NWRITE_REQUESTS;
unsigned char *the_data = NULL;
@@ -142,10 +142,10 @@ main (void)
struct rusage r_start, r_stop;
struct timeval t_start, t_stop;
int i, fd;
- ssize_t n;
+ hssize_t n;
off_t offset;
- int start[2];
- size_t count[2];
+ hssize_t start[2];
+ hsize_t count[2];
printf ("I/O request size is %1.1fMB\n",
((double)(size[0])*(double)(size[1]))/(1024.0*1024));
@@ -162,8 +162,9 @@ main (void)
assert (file_space>=0);
dset = H5Dcreate (file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT);
assert (dset>=0);
- the_data = malloc (size[0]*size[1]);
- memset (the_data, 0xAA, size[0]*size[1]); /*initial fill for lazy malloc*/
+ the_data = malloc ((size_t)(size[0]*size[1]));
+ /*initial fill for lazy malloc*/
+ memset (the_data, 0xAA, (size_t)(size[0]*size[1]));
/* Fill raw */
synchronize ();
@@ -173,14 +174,14 @@ main (void)
for (i=0; i<nwrite; i++) {
putc (PROGRESS, stderr);
fflush (stderr);
- memset (the_data, 0xAA, size[0]*size[1]);
+ memset (the_data, 0xAA, (size_t)(size[0]*size[1]));
}
getrusage (RUSAGE_SELF, &r_stop);
gettimeofday (&t_stop, NULL);
putc ('\n', stderr);
print_stats ("fill raw",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Fill hdf5 */
@@ -200,7 +201,7 @@ main (void)
putc ('\n', stderr);
print_stats ("fill hdf5",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Write the raw dataset */
synchronize ();
@@ -212,7 +213,7 @@ main (void)
fflush (stderr);
offset = lseek (fd, 0, SEEK_SET);
assert (0==offset);
- n = write (fd, the_data, size[0]*size[1]);
+ n = write (fd, the_data, (size_t)(size[0]*size[1]));
assert (n>=0 && (size_t)n==size[0]*size[1]);
}
getrusage (RUSAGE_SELF, &r_stop);
@@ -220,7 +221,7 @@ main (void)
putc ('\n', stderr);
print_stats ("out raw",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Write the hdf5 dataset */
synchronize ();
@@ -239,7 +240,7 @@ main (void)
putc ('\n', stderr);
print_stats ("out hdf5",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Read the raw dataset */
synchronize ();
@@ -251,7 +252,7 @@ main (void)
fflush (stderr);
offset = lseek (fd, 0, SEEK_SET);
assert (0==offset);
- n = read (fd, the_data, size[0]*size[1]);
+ n = read (fd, the_data, (size_t)(size[0]*size[1]));
assert (n>=0 && (size_t)n==size[0]*size[1]);
}
getrusage (RUSAGE_SELF, &r_stop);
@@ -259,7 +260,7 @@ main (void)
putc ('\n', stderr);
print_stats ("in raw",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Read the hdf5 dataset */
@@ -279,7 +280,7 @@ main (void)
putc ('\n', stderr);
print_stats ("in hdf5",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Read hyperslab */
assert (size[0]>20 && size[1]>20);
@@ -303,7 +304,7 @@ main (void)
putc ('\n', stderr);
print_stats ("in hdf5 partial",
&r_start, &r_stop, &t_start, &t_stop,
- nread*count[0]*count[1]);
+ (size_t)(nread*count[0]*count[1]));
diff --git a/test/istore.c b/test/istore.c
index 9a906cc..fa90b55 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -1,11 +1,11 @@
/*
* Copyright (C) 1997 NCSA
- * All rights reserved.
+ * All rights reserved.
*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Wednesday, October 15, 1997
*
- * Purpose: Tests various aspects of indexed raw data storage.
+ * Purpose: Tests various aspects of indexed raw data storage.
*/
#include <H5private.h>
#include <H5Iprivate.h>
@@ -17,41 +17,41 @@
#include <H5Vprivate.h>
#if 1
-# define FILETYPE H5F_LOW_DFLT
-# define FILENAME "istore.h5"
+# define FILETYPE H5F_LOW_DFLT
+# define FILENAME "istore.h5"
#elif 0
-# define FILETYPE H5F_LOW_FAM
-# define FILENAME "istore-%05d.h5"
-# define TEST_FAMILY 1
+# define FILETYPE H5F_LOW_FAM
+# define FILENAME "istore-%05d.h5"
+# define TEST_FAMILY 1
#else
-# define FILETYPE H5F_LOW_SPLIT
-# define FILENAME "istore-split"
+# define FILETYPE H5F_LOW_SPLIT
+# define FILENAME "istore-split"
#endif
-#define TEST_SMALL 0x0001
-#define TEST_MEDIUM 0x0002
-#define TEST_LARGE 0x0004
+#define TEST_SMALL 0x0001
+#define TEST_MEDIUM 0x0002
+#define TEST_LARGE 0x0004
#ifndef HAVE_FUNCTION
#undef __FUNCTION__
#define __FUNCTION__ ""
#endif
-#define AT() printf (" at %s:%d in %s()...\n", \
- __FILE__, __LINE__, __FUNCTION__);
+#define AT() printf (" at %s:%d in %s()...\n", \
+ __FILE__, __LINE__, __FUNCTION__);
-size_t align_g[3] = {50, 50, 50};
-size_t zero[H5O_LAYOUT_NDIMS];
+hsize_t align_g[3] = {50, 50, 50};
+hssize_t zero[H5O_LAYOUT_NDIMS];
/*-------------------------------------------------------------------------
- * Function: print_array
+ * Function: print_array
*
- * Purpose: Prints the values in an array
+ * Purpose: Prints the values in an array
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
* Modifications:
*
@@ -63,37 +63,37 @@ print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
size_t i, j, k;
for (i = 0; i < nx; i++) {
- if (nz > 1) {
- printf("i=%d:\n", i);
- } else {
- printf("%03d:", i);
- }
-
- for (j = 0; j < ny; j++) {
- if (nz > 1)
- printf("%03d:", j);
- for (k = 0; k < nz; k++) {
- printf(" %3d", *array++);
- }
- if (nz > 1)
- printf("\n");
- }
- printf("\n");
+ if (nz > 1) {
+ printf("i=%d:\n", i);
+ } else {
+ printf("%03d:", i);
+ }
+
+ for (j = 0; j < ny; j++) {
+ if (nz > 1)
+ printf("%03d:", j);
+ for (k = 0; k < nz; k++) {
+ printf(" %3d", *array++);
+ }
+ if (nz > 1)
+ printf("\n");
+ }
+ printf("\n");
}
}
/*-------------------------------------------------------------------------
- * Function: new_object
+ * Function: new_object
*
- * Purpose: Creates a new object that refers to a indexed storage of raw
- * data. No raw data is stored.
+ * Purpose: Creates a new object that refers to a indexed storage of raw
+ * data. No raw data is stored.
*
- * Return: Success: Handle to a new open object.
+ * Return: Success: Handle to a new open object.
*
- * Failure: NULL, error message printed.
+ * Failure: NULL, error message printed.
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -102,45 +102,45 @@ print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
static int
new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
{
- H5O_layout_t layout;
- intn i;
+ H5O_layout_t layout;
+ intn i;
/* Create the object header */
if (H5O_create(f, 64, ent)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" H5O_create() = NULL\n");
- }
- return -1;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" H5O_create() = NULL\n");
+ }
+ return -1;
}
/* create chunked storage */
layout.type = H5D_CHUNKED;
layout.ndims = ndims;
for (i = 0; i < ndims; i++) {
- if (i < (int)NELMTS(align_g)) {
- layout.dim[i] = align_g[i];
- } else {
- layout.dim[i] = 2;
- }
+ if (i < (int)NELMTS(align_g)) {
+ layout.dim[i] = align_g[i];
+ } else {
+ layout.dim[i] = 2;
+ }
}
H5F_arr_create(f, &layout/*in,out*/);
if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout) < 0) {
- printf("*FAILED*\n");
- if (!isatty(1)) {
- AT();
- printf(" H5O_modify istore message failure\n");
- }
- return -1;
+ printf("*FAILED*\n");
+ if (!isatty(1)) {
+ AT();
+ printf(" H5O_modify istore message failure\n");
+ }
+ return -1;
}
/* Give the object header a name */
if (H5G_insert(H5G_getcwg(f), name, ent) < 0) {
- printf("*FAILED*\n");
- if (!isatty(1)) {
- AT();
- printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name);
- }
- return -1;
+ printf("*FAILED*\n");
+ if (!isatty(1)) {
+ AT();
+ printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name);
+ }
+ return -1;
}
/* Close the header */
H5O_close(ent);
@@ -149,17 +149,17 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
}
/*-------------------------------------------------------------------------
- * Function: test_create
+ * Function: test_create
*
- * Purpose: Creates a named object that refers to indexed storage of raw
- * data. No raw data is stored.
+ * Purpose: Creates a named object that refers to indexed storage of raw
+ * data. No raw data is stored.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -168,16 +168,16 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
static herr_t
test_create(H5F_t *f, const char *prefix)
{
- H5G_entry_t handle;
- intn i;
- char name[256];
+ H5G_entry_t handle;
+ intn i;
+ char name[256];
printf("%-70s", "Testing istore create");
for (i = 1; i <= H5O_LAYOUT_NDIMS; i++) {
- sprintf(name, "%s_%02d", prefix, i);
- if (new_object(f, name, i, &handle) < 0)
- return FAIL;
+ sprintf(name, "%s_%02d", prefix, i);
+ if (new_object(f, name, i, &handle) < 0)
+ return FAIL;
}
puts(" PASSED");
@@ -185,18 +185,18 @@ test_create(H5F_t *f, const char *prefix)
}
/*-------------------------------------------------------------------------
- * Function: test_extend
+ * Function: test_extend
*
- * Purpose: Creates an empty object and then writes to it in such a way
- * as to always extend the object's domain without creating
- * holes and without causing the object to become concave.
+ * Purpose: Creates an empty object and then writes to it in such a way
+ * as to always extend the object's domain without creating
+ * holes and without causing the object to become concave.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -204,34 +204,34 @@ test_create(H5F_t *f, const char *prefix)
*/
static herr_t
test_extend(H5F_t *f, const char *prefix,
- size_t nx, size_t ny, size_t nz)
+ size_t nx, size_t ny, size_t nz)
{
- H5G_entry_t handle;
- size_t i, j, k, ctr;
+ H5G_entry_t handle;
+ hsize_t i, j, k, ctr;
int ndims;
- uint8 *buf = NULL, *check = NULL, *whole = NULL;
- char dims[64], s[256], name[256];
- size_t offset[3];
- size_t max_corner[3];
- size_t size[3];
- size_t whole_size[3];
- size_t nelmts;
- H5O_layout_t layout;
+ uint8 *buf = NULL, *check = NULL, *whole = NULL;
+ char dims[64], s[256], name[256];
+ hssize_t offset[3];
+ hssize_t max_corner[3];
+ hsize_t size[3];
+ hsize_t whole_size[3];
+ hsize_t nelmts;
+ H5O_layout_t layout;
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dims, "%lu", (unsigned long) nx);
+ } else {
+ ndims = 2;
+ nz = 1;
+ sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ }
} else {
- ndims = 3;
- sprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ ndims = 3;
+ sprintf(dims, "%lux%lux%lu",
+ (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
}
sprintf(s, "Testing istore extend: %s", dims);
@@ -243,27 +243,27 @@ test_extend(H5F_t *f, const char *prefix,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
- if (!isatty(1)) {
- AT();
- printf(" Cannot create %d-d object `%s'\n", ndims, name);
- }
- goto error;
+ if (!isatty(1)) {
+ AT();
+ printf(" Cannot create %d-d object `%s'\n", ndims, name);
+ }
+ goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Unable to read istore message\n");
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Unable to read istore message\n");
+ }
+ goto error;
}
if (ndims != layout.ndims) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Header read error: istore.ndims != %d\n", ndims);
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Header read error: istore.ndims != %d\n", ndims);
+ }
+ goto error;
}
whole_size[0] = nx;
whole_size[1] = ny;
@@ -272,124 +272,128 @@ test_extend(H5F_t *f, const char *prefix,
max_corner[1] = 0;
max_corner[2] = 0;
- for (ctr = 0; H5V_vector_lt(ndims, max_corner, whole_size); ctr++) {
-
- /* Size and location */
- if (0 == ctr) {
- offset[0] = offset[1] = offset[2] = 0;
- size[0] = size[1] = size[2] = 1;
- nelmts = 1;
- } else {
- for (i=0, nelmts=1; i<(size_t)ndims; i++) {
- if (ctr % ndims == i) {
- offset[i] = max_corner[i];
- size[i] = MIN(1, whole_size[i] - offset[i]);
- } else {
- offset[i] = 0;
- size[i] = max_corner[i];
- }
- nelmts *= size[i];
- }
- }
+ for (ctr = 0; H5V_vector_lt_s(ndims, max_corner, whole_size); ctr++) {
+
+ /* Size and location */
+ if (0 == ctr) {
+ offset[0] = offset[1] = offset[2] = 0;
+ size[0] = size[1] = size[2] = 1;
+ nelmts = 1;
+ } else {
+ for (i=0, nelmts=1; i<(size_t)ndims; i++) {
+ if (ctr % ndims == i) {
+ offset[i] = max_corner[i];
+ size[i] = MIN(1, whole_size[i] - offset[i]);
+ } else {
+ offset[i] = 0;
+ size[i] = max_corner[i];
+ }
+ nelmts *= size[i];
+ }
+ }
#if 0
- if (0 == ctr)
- printf("\n");
- printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]);
- if (ndims > 1)
- printf(",%d", offset[1]);
- if (ndims > 2)
- printf(",%d", offset[2]);
- printf("), size=(%d", size[0]);
- if (ndims > 1)
- printf(",%d", size[1]);
- if (ndims > 2)
- printf(",%d", size[2]);
- printf("), %d element%s", nelmts, 1 == nelmts ? "" : "s");
- if (0 == nelmts)
- printf(" *SKIPPED*");
- printf("\n");
+ if (0 == ctr)
+ printf("\n");
+ printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]);
+ if (ndims > 1)
+ printf(",%d", offset[1]);
+ if (ndims > 2)
+ printf(",%d", offset[2]);
+ printf("), size=(%d", size[0]);
+ if (ndims > 1)
+ printf(",%d", size[1]);
+ if (ndims > 2)
+ printf(",%d", size[2]);
+ printf("), %d element%s", nelmts, 1 == nelmts ? "" : "s");
+ if (0 == nelmts)
+ printf(" *SKIPPED*");
+ printf("\n");
#endif
- /* Fill the source array */
- if (0 == nelmts) continue;
- memset(buf, (signed)(128+ctr), nelmts);
-
- /* Write to disk */
- if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Write failed: ctr=%d\n", ctr);
- }
- goto error;
- }
- /* Read from disk */
- memset(check, 0xff, nelmts);
- if (H5F_arr_read(f, &layout, NULL, size, size, zero, offset,
+ /* Fill the source array */
+ if (0 == nelmts) continue;
+ memset(buf, (signed)(128+ctr), (size_t)nelmts);
+
+ /* Write to disk */
+ if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
+ }
+ goto error;
+ }
+ /* Read from disk */
+ memset(check, 0xff, (size_t)nelmts);
+ if (H5F_arr_read(f, &layout, NULL, size, size, zero, offset,
check)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Read failed: ctr=%d\n", ctr);
- }
- goto error;
- }
- if (memcmp(buf, check, nelmts)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Read check failed: ctr=%d\n", ctr);
- printf(" Wrote:\n");
- print_array(buf, size[0], size[1], size[2]);
- printf(" Read:\n");
- print_array(check, size[0], size[1], size[2]);
- }
- goto error;
- }
- /* Write to `whole' buffer for later checking */
- H5V_hyper_copy(ndims, size,
- whole_size, offset, whole, /*dst */
- size, H5V_ZERO, buf); /*src */
-
- /* Update max corner */
- for (i=0; i<(size_t)ndims; i++) {
- max_corner[i] = MAX(max_corner[i], offset[i] + size[i]);
- }
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Read failed: ctr=%lu\n", (unsigned long)ctr);
+ }
+ goto error;
+ }
+ if (memcmp(buf, check, (size_t)nelmts)) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Read check failed: ctr=%lu\n", (unsigned long)ctr);
+ printf(" Wrote:\n");
+ print_array(buf, (size_t)size[0], (size_t)size[1],
+ (size_t)size[2]);
+ printf(" Read:\n");
+ print_array(check, (size_t)size[0], (size_t)size[1],
+ (size_t)size[2]);
+ }
+ goto error;
+ }
+ /* Write to `whole' buffer for later checking */
+ H5V_hyper_copy(ndims, size,
+ whole_size, offset, whole, /*dst */
+ size, H5V_ZERO, buf); /*src */
+
+ /* Update max corner */
+ for (i=0; i<(size_t)ndims; i++) {
+ max_corner[i] = MAX(max_corner[i], offset[i]+(hssize_t)size[i]);
+ }
}
/* Now read the entire array back out and check it */
memset(buf, 0xff, nx * ny * nz);
if (H5F_arr_read(f, &layout, NULL, whole_size, whole_size, zero, zero,
buf)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Read failed for whole array\n");
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Read failed for whole array\n");
+ }
+ goto error;
}
for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- for (k = 0; k < nz; k++) {
- if (whole[i * ny * nz + j * nz + k] != buf[i * ny * nz + j * nz + k]) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Check failed at i=%d", i);
- if (ndims > 1)
- printf(", j=%d", j);
- if (ndims > 2)
- printf(", k=%d", k);
- printf("\n Check array is:\n");
- print_array(whole, nx, ny, nz);
- printf(" Value read is:\n");
- print_array(buf, nx, ny, nz);
- }
- goto error;
- }
- }
- }
+ for (j = 0; j < ny; j++) {
+ for (k = 0; k < nz; k++) {
+ if (whole[i * ny * nz + j * nz + k] != buf[i * ny * nz + j * nz + k]) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Check failed at i=%lu", (unsigned long)i);
+ if (ndims > 1) {
+ printf(", j=%lu", (unsigned long)j);
+ }
+ if (ndims > 2) {
+ printf(", k=%lu", (unsigned long)k);
+ }
+ printf("\n Check array is:\n");
+ print_array(whole, nx, ny, nz);
+ printf(" Value read is:\n");
+ print_array(buf, nx, ny, nz);
+ }
+ goto error;
+ }
+ }
+ }
}
puts(" PASSED");
@@ -406,17 +410,17 @@ test_extend(H5F_t *f, const char *prefix,
}
/*-------------------------------------------------------------------------
- * Function: test_sparse
+ * Function: test_sparse
*
- * Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
- * blocks each of size NX,NY,NZ.
+ * Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
+ * blocks each of size NX,NY,NZ.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -424,30 +428,31 @@ test_extend(H5F_t *f, const char *prefix,
*/
static herr_t
test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
- size_t nx, size_t ny, size_t nz)
+ size_t nx, size_t ny, size_t nz)
{
- intn ndims;
- size_t ctr;
- char dims[64], s[256], name[256];
- size_t offset[3], size[3], total = 0;
- H5G_entry_t handle;
- H5O_layout_t layout;
- uint8 *buf = NULL;
+ intn ndims;
+ hsize_t ctr;
+ char dims[64], s[256], name[256];
+ hssize_t offset[3];
+ hsize_t size[3], total = 0;
+ H5G_entry_t handle;
+ H5O_layout_t layout;
+ uint8 *buf = NULL;
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dims, "%lu", (unsigned long) nx);
+ } else {
+ ndims = 2;
+ nz = 1;
+ sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ }
} else {
- ndims = 3;
- sprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ ndims = 3;
+ sprintf(dims, "%lux%lux%lu",
+ (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
}
sprintf(s, "Testing istore sparse: %s", dims);
@@ -457,55 +462,55 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
- if (!isatty(1)) {
- AT();
- printf(" Cannot create %d-d object `%s'\n", ndims, name);
- }
- goto error;
+ if (!isatty(1)) {
+ AT();
+ printf(" Cannot create %d-d object `%s'\n", ndims, name);
+ }
+ goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Unable to read istore message\n");
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Unable to read istore message\n");
+ }
+ goto error;
}
for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = rand() % 1000000;
- offset[1] = rand() % 1000000;
- offset[2] = rand() % 1000000;
- size[0] = nx;
- size[1] = ny;
- size[2] = nz;
- memset(buf, (signed)(128+ctr), nx * ny * nz);
-
- /* write to disk */
- if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Write failed: ctr=%d\n", ctr);
- printf(" offset=(%lu", (unsigned long) (offset[0]));
- if (ndims > 1)
- printf(",%lu", (unsigned long) (offset[1]));
- if (ndims > 2)
- printf(",%lu", (unsigned long) (offset[2]));
- printf("), size=(%lu", (unsigned long) (size[0]));
- if (ndims > 1)
- printf(",%lu", (unsigned long) (size[1]));
- if (ndims > 2)
- printf(",%lu", (unsigned long) (size[2]));
- printf(")\n");
- }
- goto error;
- }
- total += nx * ny * nz;
+ offset[0] = rand() % 1000000;
+ offset[1] = rand() % 1000000;
+ offset[2] = rand() % 1000000;
+ size[0] = nx;
+ size[1] = ny;
+ size[2] = nz;
+ memset(buf, (signed)(128+ctr), nx * ny * nz);
+
+ /* write to disk */
+ if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
+ printf(" offset=(%lu", (unsigned long) (offset[0]));
+ if (ndims > 1)
+ printf(",%lu", (unsigned long) (offset[1]));
+ if (ndims > 2)
+ printf(",%lu", (unsigned long) (offset[2]));
+ printf("), size=(%lu", (unsigned long) (size[0]));
+ if (ndims > 1)
+ printf(",%lu", (unsigned long) (size[1]));
+ if (ndims > 2)
+ printf(",%lu", (unsigned long) (size[2]));
+ printf(")\n");
+ }
+ goto error;
+ }
+ total += nx * ny * nz;
#if 0
- printf("ctr: ctr=%d, total=%lu\n", ctr, (unsigned long) total);
+ printf("ctr: ctr=%d, total=%lu\n", ctr, (unsigned long) total);
#endif
- /* We don't test reading yet.... */
+ /* We don't test reading yet.... */
}
puts(" PASSED");
@@ -518,16 +523,16 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
}
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Tests indexed storage stuff.
+ * Purpose: Tests indexed storage stuff.
*
- * Return: Success: exit(0)
+ * Return: Success: exit(0)
*
- * Failure: exit(non-zero)
+ * Failure: exit(non-zero)
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -536,43 +541,43 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
int
main(int argc, char *argv[])
{
- H5F_t *f;
- herr_t status;
- int nerrors = 0;
- uintn size_of_test;
- hid_t template_id;
- H5F_create_t *creation_template = NULL;
- H5G_t *dir = NULL;
+ H5F_t *f;
+ herr_t status;
+ int nerrors = 0;
+ uintn size_of_test;
+ hid_t template_id;
+ H5F_create_t *creation_template = NULL;
+ H5G_t *dir = NULL;
setbuf(stdout, NULL);
/* Parse arguments or assume `small' */
if (1 == argc) {
- size_of_test = TEST_SMALL;
+ size_of_test = TEST_SMALL;
} else {
- intn i;
- for (i = 1, size_of_test = 0; i < argc; i++) {
- if (!strcmp(argv[i], "small")) {
- size_of_test |= TEST_SMALL;
- } else if (!strcmp(argv[i], "medium")) {
- size_of_test |= TEST_MEDIUM;
- } else if (!strcmp(argv[i], "large")) {
- size_of_test |= TEST_LARGE;
- } else {
- printf("unrecognized argument: %s\n", argv[i]);
+ intn i;
+ for (i = 1, size_of_test = 0; i < argc; i++) {
+ if (!strcmp(argv[i], "small")) {
+ size_of_test |= TEST_SMALL;
+ } else if (!strcmp(argv[i], "medium")) {
+ size_of_test |= TEST_MEDIUM;
+ } else if (!strcmp(argv[i], "large")) {
+ size_of_test |= TEST_LARGE;
+ } else {
+ printf("unrecognized argument: %s\n", argv[i]);
#if 0
- exit(1);
+ exit(1);
#endif
- }
- }
+ }
+ }
}
printf("Test sizes: ");
if (size_of_test & TEST_SMALL)
- printf(" SMALL");
+ printf(" SMALL");
if (size_of_test & TEST_MEDIUM)
- printf(" MEDIUM");
+ printf(" MEDIUM");
if (size_of_test & TEST_LARGE)
- printf(" LARGE");
+ printf(" LARGE");
printf("\n");
/*
@@ -584,21 +589,21 @@ main(int argc, char *argv[])
/* Create the test file */
if (NULL == (f = H5F_open(FILENAME,
- (H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
- H5F_ACC_DEBUG),
- creation_template, NULL))) {
- printf("Cannot create file %s; test aborted\n", FILENAME);
- exit(1);
+ (H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
+ H5F_ACC_DEBUG),
+ creation_template, NULL))) {
+ printf("Cannot create file %s; test aborted\n", FILENAME);
+ exit(1);
}
#ifdef TEST_FAMILY
{
- /*
- * For testing file families, fool the library into thinking it already
- * allocated a whole bunch of data.
- */
- haddr_t addr;
- addr.offset = 8 * ((uint64) 1 << 30); /*8 GB */
- H5F_low_seteof(f->shared->lf, &addr);
+ /*
+ * For testing file families, fool the library into thinking it already
+ * allocated a whole bunch of data.
+ */
+ haddr_t addr;
+ addr.offset = 8 * ((uint64) 1 << 30); /*8 GB */
+ H5F_low_seteof(f->shared->lf, &addr);
}
#endif
@@ -618,51 +623,51 @@ main(int argc, char *argv[])
nerrors += status < 0 ? 1 : 0;
if (size_of_test & TEST_SMALL) {
- status = test_extend(f, "extend", 10, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 10, 10, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 10, 10, 10);
- nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 10, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 10, 10);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_MEDIUM) {
- status = test_extend(f, "extend", 10000, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 2500, 10, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 10, 400, 10);
- nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10000, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 2500, 10, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 400, 10);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_SMALL) {
- status = test_sparse(f, "sparse", 100, 5, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 100, 3, 4, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 100, 2, 3, 4);
- nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 100, 5, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 100, 3, 4, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 100, 2, 3, 4);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_MEDIUM) {
- status = test_sparse(f, "sparse", 1000, 30, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 2000, 7, 3, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 2000, 4, 2, 3);
- nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 1000, 30, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 2000, 7, 3, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 2000, 4, 2, 3);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_LARGE) {
- status = test_sparse(f, "sparse", 800, 50, 50, 50);
- nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 800, 50, 50, 50);
+ nerrors += status < 0 ? 1 : 0;
}
/* Close the test file and exit */
H5F_close(f);
if (nerrors) {
- printf("***** %d I-STORE TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
- if (isatty(1)) {
- printf("(Redirect output to a pager or a file to see "
- "debug output)\n");
- }
- exit(1);
+ printf("***** %d I-STORE TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ if (isatty(1)) {
+ printf("(Redirect output to a pager or a file to see "
+ "debug output)\n");
+ }
+ exit(1);
}
printf("All i-store tests passed.\n");
return 0;
diff --git a/test/shtype.c b/test/shtype.c
index 944941b..243ab5c 100644
--- a/test/shtype.c
+++ b/test/shtype.c
@@ -14,6 +14,9 @@
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
@@ -34,7 +37,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data __attribute__((unused)))
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -64,7 +67,7 @@ static int
test_1 (void)
{
hid_t f, d1, d2, s1, t1, t2;
- size_t size[1] = {1};
+ hsize_t size[1] = {1};
printf ("%-70s", "...creating/quering datasets with shared type");
fflush (stdout);
@@ -121,7 +124,7 @@ static int
test_2 (void)
{
hid_t f1, f2, t1, t2, s1, d1, d2;
- size_t size[1] = {1};
+ hsize_t size[1] = {1};
char buf[32];
int i;
@@ -192,7 +195,7 @@ static int
test_3 (void)
{
hid_t f1, s1, t1, d1;
- size_t size[1] = {1};
+ hsize_t size[1] = {1};
herr_t status, (*ef)(void*)=NULL;
void *ed = NULL;
diff --git a/test/tfile.c b/test/tfile.c
index 7afc184..bfdf21f 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1,24 +1,24 @@
/****************************************************************************
- * NCSA HDF *
- * Software Development Group *
- * National Center for Supercomputing Applications *
- * University of Illinois at Urbana-Champaign *
- * 605 E. Springfield, Champaign IL 61820 *
- * *
- * For conditions of distribution and use, see the accompanying *
- * hdf/COPYING file. *
- * *
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
****************************************************************************/
#ifdef RCSID
-static char RcsId[] = "$Revision$";
+static char RcsId[] = "$Revision$";
#endif
/* $Id$ */
/***********************************************************
*
-* Test program: tfile
+* Test program: tfile
*
* Test the low-level file I/O features.
*
@@ -30,26 +30,26 @@ static char RcsId[] = "$Revision$";
#include <H5Bprivate.h>
#include <H5Pprivate.h>
-#define F1_USERBLOCK_SIZE 0
-#define F1_OFFSET_SIZE sizeof(size_t)
-#define F1_LENGTH_SIZE sizeof(size_t)
-#define F1_SYM_LEAF_K 4
-#define F1_SYM_INTERN_K 16
-#define FILE1 "tfile1.h5"
-
-#define F2_USERBLOCK_SIZE 512
-#define F2_OFFSET_SIZE 8
-#define F2_LENGTH_SIZE 8
-#define F2_SYM_LEAF_K 8
-#define F2_SYM_INTERN_K 32
-#define FILE2 "tfile2.h5"
-
-#define F3_USERBLOCK_SIZE 0
-#define F3_OFFSET_SIZE F2_OFFSET_SIZE
-#define F3_LENGTH_SIZE F2_LENGTH_SIZE
-#define F3_SYM_LEAF_K F2_SYM_LEAF_K
-#define F3_SYM_INTERN_K F2_SYM_INTERN_K
-#define FILE3 "tfile3.h5"
+#define F1_USERBLOCK_SIZE (hsize_t)0
+#define F1_OFFSET_SIZE sizeof(hsize_t)
+#define F1_LENGTH_SIZE sizeof(hsize_t)
+#define F1_SYM_LEAF_K 4
+#define F1_SYM_INTERN_K 16
+#define FILE1 "tfile1.h5"
+
+#define F2_USERBLOCK_SIZE (hsize_t)512
+#define F2_OFFSET_SIZE 8
+#define F2_LENGTH_SIZE 8
+#define F2_SYM_LEAF_K 8
+#define F2_SYM_INTERN_K 32
+#define FILE2 "tfile2.h5"
+
+#define F3_USERBLOCK_SIZE (hsize_t)0
+#define F3_OFFSET_SIZE F2_OFFSET_SIZE
+#define F3_LENGTH_SIZE F2_LENGTH_SIZE
+#define F3_SYM_LEAF_K F2_SYM_LEAF_K
+#define F3_SYM_INTERN_K F2_SYM_INTERN_K
+#define FILE3 "tfile3.h5"
/****************************************************************
**
@@ -59,12 +59,13 @@ static char RcsId[] = "$Revision$";
static void
test_file_create(void)
{
- hid_t fid1, fid2, fid3; /* HDF5 File IDs */
- hid_t tmpl1, tmpl2; /* File creation templates */
- size_t parm; /* File-creation parameters */
- size_t parm2; /* File-creation parameters */
- int iparm, iparm2;
- herr_t ret; /* Generic return value */
+ hid_t fid1, fid2, fid3; /* HDF5 File IDs */
+ hid_t tmpl1, tmpl2; /*file creation templates */
+ hsize_t ublock; /*sizeof userblock */
+ size_t parm; /*file-creation parameters */
+ size_t parm2; /*file-creation parameters */
+ int iparm, iparm2;
+ herr_t ret; /*generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Creation I/O\n"));
@@ -82,9 +83,9 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F1_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F1_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -136,9 +137,9 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F2_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -178,9 +179,9 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F3_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F3_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -207,7 +208,7 @@ test_file_create(void)
/* Close third file */
ret = H5Fclose(fid3);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_file_create() */
+} /* test_file_create() */
/****************************************************************
**
@@ -217,12 +218,13 @@ test_file_create(void)
static void
test_file_open(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t tmpl1; /* File creation templates */
- size_t parm; /* File-creation parameters */
- size_t parm2; /* File-creation parameters */
- int iparm, iparm2;
- herr_t ret; /* Generic return value */
+ hid_t fid1; /*HDF5 File IDs */
+ hid_t tmpl1; /*file creation templates */
+ hsize_t ublock; /*sizeof user block */
+ size_t parm; /*file-creation parameters */
+ size_t parm2; /*file-creation parameters */
+ int iparm, iparm2;
+ herr_t ret; /*generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Opening I/O\n"));
@@ -236,9 +238,9 @@ test_file_open(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F2_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -257,7 +259,7 @@ test_file_open(void)
/* Close first file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_file_open() */
+} /* test_file_open() */
/****************************************************************
**
@@ -270,6 +272,6 @@ test_file(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File I/O\n"));
- test_file_create(); /* Test file creation (also creation templates) */
- test_file_open(); /* Test file opening */
-} /* test_file() */
+ test_file_create(); /* Test file creation (also creation templates) */
+ test_file_open(); /* Test file opening */
+} /* test_file() */
diff --git a/test/th5s.c b/test/th5s.c
index 4431fef..9b2561b 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -1,24 +1,24 @@
/****************************************************************************
- * NCSA HDF *
- * Software Development Group *
- * National Center for Supercomputing Applications *
- * University of Illinois at Urbana-Champaign *
- * 605 E. Springfield, Champaign IL 61820 *
- * *
- * For conditions of distribution and use, see the accompanying *
- * hdf/COPYING file. *
- * *
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
****************************************************************************/
#ifdef RCSID
-static char RcsId[] = "$Revision$";
+static char RcsId[] = "$Revision$";
#endif
/* $Id$ */
/***********************************************************
*
-* Test program: th5p
+* Test program: th5p
*
* Test the dataspace functionality
*
@@ -35,18 +35,18 @@ static char RcsId[] = "$Revision$";
/* 3-D dataset with fixed dimensions */
#define SPACE1_NAME "Space1"
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* 4-D dataset with one unlimited dimension */
#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 4
-#define SPACE2_DIM1 0
-#define SPACE2_DIM2 15
-#define SPACE2_DIM3 13
-#define SPACE2_DIM4 23
+#define SPACE2_RANK 4
+#define SPACE2_DIM1 0
+#define SPACE2_DIM2 15
+#define SPACE2_DIM3 13
+#define SPACE2_DIM4 23
/****************************************************************
**
@@ -56,15 +56,15 @@ static char RcsId[] = "$Revision$";
static void
test_h5p_basic(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t sid1, sid2; /* Dataspace ID */
- uint32 rank; /* Logical rank of dataspace */
- size_t dims1[] =
- {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}, /* dataspace dim sizes */
- dims2[] =
- {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4}, tdims[4]; /* Dimension array to test with */
- size_t n; /* number of dataspace elements */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t sid1, sid2; /* Dataspace ID */
+ uint32 rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3,
+ SPACE2_DIM4};
+ hsize_t tdims[4]; /* Dimension array to test with */
+ size_t n; /* Number of dataspace elements */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Datatype Manipulation\n"));
@@ -112,7 +112,7 @@ test_h5p_basic(void)
/* Close first file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5p_basic() */
+} /* test_h5p_basic() */
/****************************************************************
**
@@ -125,5 +125,5 @@ test_h5p(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5p_basic(); /* Test basic H5S code */
-} /* test_h5p() */
+ test_h5p_basic(); /* Test basic H5S code */
+} /* test_h5p() */