diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-07-18 00:18:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-07-18 00:18:42 (GMT) |
commit | bb19817c9fd5d46cdc1ab5a396f38f0561dfa167 (patch) | |
tree | 69498cabeabf6f68faa23b835e24cb7ef4f80563 /test | |
parent | c8f4641507bf4ca85c70c39c786c07f8ef4a24ed (diff) | |
download | hdf5-bb19817c9fd5d46cdc1ab5a396f38f0561dfa167.zip hdf5-bb19817c9fd5d46cdc1ab5a396f38f0561dfa167.tar.gz hdf5-bb19817c9fd5d46cdc1ab5a396f38f0561dfa167.tar.bz2 |
[svn-r30189] Description:
Clean up more warnings: drop the warning count from ~1310 down to ~940,
with only 31 types of warnings in 148 files (down from 38 types in 167 files).
Tested on:
MacOSX/64 10.11.5 (amazon) w/serial & parallel
(h5committest forthcoming)
Diffstat (limited to 'test')
-rw-r--r-- | test/cmpd_dset.c | 185 | ||||
-rw-r--r-- | test/dsets.c | 659 | ||||
-rw-r--r-- | test/file_image.c | 1 | ||||
-rw-r--r-- | test/filter_fail.c | 1 | ||||
-rw-r--r-- | test/freespace.c | 16 | ||||
-rw-r--r-- | test/getname.c | 89 | ||||
-rw-r--r-- | test/links.c | 1 | ||||
-rw-r--r-- | test/mtime.c | 2 | ||||
-rw-r--r-- | test/ohdr.c | 1 | ||||
-rw-r--r-- | test/set_extent.c | 6 | ||||
-rw-r--r-- | test/testframe.c | 4 | ||||
-rw-r--r-- | test/tmeta.c | 2 | ||||
-rw-r--r-- | test/tvltypes.c | 94 | ||||
-rw-r--r-- | test/vds.c | 1 |
14 files changed, 597 insertions, 465 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 22bf3a2..311b9bb 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -102,15 +102,18 @@ typedef struct { float f, g, h[16], i, j; double k, l, m, n; } stype1; + typedef struct { int a, b, c[8], d, e; float f, g, h[16], i, j; double k, l, m, n; long o, p, q; } stype2; + typedef struct { int a, b, c[8], d, e; } stype3; + typedef struct { int a, b, c[8], d, e; float f, g, h[16], i, j; @@ -147,7 +150,7 @@ typedef struct { * Moved this part of code from MAIN to TEST_COMPOUND function. *------------------------------------------------------------------------- */ -static int +static unsigned test_compound (char *filename, hid_t fapl) { /* First dataset */ @@ -868,31 +871,31 @@ error: *------------------------------------------------------------------------- */ static void -initialize_stype1(unsigned char *buf, const size_t num) +initialize_stype1(unsigned char *buf, size_t num) { int i, j; stype1 *s_ptr; - for (i=0; i<(int)num; i++) { - s_ptr = (stype1*)buf + i; - s_ptr->a = i*8+0; - s_ptr->b = i*8+1; - for(j=0; j<8; j++) - s_ptr->c[j] = i*8+j; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; - - s_ptr->f = i*2/3; - s_ptr->g = i*2/3+1; - for(j=0; j<16; j++) - s_ptr->h[j] = i*j/5+j; - s_ptr->i = i*2/3+2; - s_ptr->j = i*2/3+3; - - s_ptr->k = i/7+1; - s_ptr->l = i/7+2; - s_ptr->m = i/7+3; - s_ptr->n = i/7+4; + for(i = 0; i < (int)num; i++) { + s_ptr = (stype1 *)buf + i; + s_ptr->a = i * 8 + 0; + s_ptr->b = i * 8 + 1; + for(j = 0; j < 8; j++) + s_ptr->c[j] = i * 8 + j; + s_ptr->d = i * 8 + 6; + s_ptr->e = i * 8 + 7; + + s_ptr->f = (float)(i * 2 / 3); + s_ptr->g = (float)(i * 2 / 3 + 1); + for(j = 0; j < 16; j++) + s_ptr->h[j] = (float)(i * j / 5 + j); + s_ptr->i = (float)(i * 2 / 3 + 2); + s_ptr->j = (float)(i * 2 / 3 + 3); + + s_ptr->k = i / 7 + 1; + s_ptr->l = i / 7 + 2; + s_ptr->m = i / 7 + 3; + s_ptr->n = i / 7 + 4; } } @@ -911,35 +914,35 @@ initialize_stype1(unsigned char *buf, const size_t num) *------------------------------------------------------------------------- */ static void -initialize_stype2(unsigned char *buf, const size_t num) +initialize_stype2(unsigned char *buf, size_t num) { size_t i, j; stype2 *s_ptr; - for (i=0; i<num; i++) { - s_ptr = (stype2*)buf + i; - s_ptr->a = i*8+0; - s_ptr->b = i*8+1; - for(j=0; j<8; j++) - s_ptr->c[j] = i*8+j; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; - - s_ptr->f = i*2/3; - s_ptr->g = i*2/3+1; - for(j=0; j<16; j++) - s_ptr->h[j] = i*j/5+j; - s_ptr->i = i*2/3+2; - s_ptr->j = i*2/3+3; - - s_ptr->k = i/7+1; - s_ptr->l = i/7+2; - s_ptr->m = i/7+3; - s_ptr->n = i/7+4; - - s_ptr->o = i*3+0; - s_ptr->p = i*3+1; - s_ptr->q = i*3+2; + for(i = 0; i < num; i++) { + s_ptr = (stype2 *)buf + i; + s_ptr->a = (int)(i * 8 + 0); + s_ptr->b = (int)(i * 8 + 1); + for(j = 0; j < 8; j++) + s_ptr->c[j] = (int)(i * 8 + j); + s_ptr->d = (int)(i * 8 + 6); + s_ptr->e = (int)(i * 8 + 7); + + s_ptr->f = (float)(i * 2 / 3); + s_ptr->g = (float)(i * 2 / 3 + 1); + for(j = 0; j < 16; j++) + s_ptr->h[j] = (float)(i * j / 5 + j); + s_ptr->i = (float)(i * 2 / 3 + 2); + s_ptr->j = (float)(i * 2 / 3 + 3); + + s_ptr->k = (double)(i / 7 + 1); + s_ptr->l = (double)(i / 7 + 2); + s_ptr->m = (double)(i / 7 + 3); + s_ptr->n = (double)(i / 7 + 4); + + s_ptr->o = (long)(i * 3 + 0); + s_ptr->p = (long)(i * 3 + 1); + s_ptr->q = (long)(i * 3 + 2); } } @@ -958,19 +961,19 @@ initialize_stype2(unsigned char *buf, const size_t num) *------------------------------------------------------------------------- */ static void -initialize_stype3(unsigned char *buf, const size_t num) +initialize_stype3(unsigned char *buf, size_t num) { int i, j; stype3 *s_ptr; - for (i=0; i<(int)num; i++) { - s_ptr = (stype3*)buf + i; - s_ptr->a = i*8+0; - s_ptr->b = i*8+1; - for(j=0; j<8; j++) - s_ptr->c[j] = i*8+j; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; + for(i = 0; i < (int)num; i++) { + s_ptr = (stype3 *)buf + i; + s_ptr->a = i * 8 + 0; + s_ptr->b = i * 8 + 1; + for(j = 0; j < 8; j++) + s_ptr->c[j] = i * 8 + j; + s_ptr->d = i * 8 + 6; + s_ptr->e = i * 8 + 7; } } @@ -989,39 +992,39 @@ initialize_stype3(unsigned char *buf, const size_t num) *------------------------------------------------------------------------- */ static void -initialize_stype4(unsigned char *buf, const size_t num) +initialize_stype4(unsigned char *buf, size_t num) { size_t i, j; stype4 *s_ptr; - for (i=0; i<num; i++) { - s_ptr = (stype4*)buf + i; - s_ptr->a = i*8+0; - s_ptr->b = i*8+1; - for(j=0; j<8; j++) - s_ptr->c[j] = i*8+j; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; - - s_ptr->f = i*2/3; - s_ptr->g = i*2/3+1; - for(j=0; j<16; j++) - s_ptr->h[j] = i*j/5+j; - s_ptr->i = i*2/3+2; - s_ptr->j = i*2/3+3; - - s_ptr->k = i/7+1; - s_ptr->l = i/7+2; - s_ptr->m = i/7+3; - s_ptr->n = i/7+4; - - s_ptr->o = i*3+0; - s_ptr->p = i*3+1; - s_ptr->q = i*3+2; - - s_ptr->r = i*5+1; - s_ptr->s = i*5+2; - s_ptr->t = i*5+3; + for(i = 0; i < num; i++) { + s_ptr = (stype4 *)buf + i; + s_ptr->a = (int)(i * 8 + 0); + s_ptr->b = (int)(i * 8 + 1); + for(j = 0; j < 8; j++) + s_ptr->c[j] = (int)(i * 8 + j); + s_ptr->d = (int)(i * 8 + 6); + s_ptr->e = (int)(i * 8 + 7); + + s_ptr->f = (float)(i * 2 / 3); + s_ptr->g = (float)(i * 2 / 3 + 1); + for(j = 0; j < 16; j++) + s_ptr->h[j] = (float)(i * j / 5 + j); + s_ptr->i = (float)(i * 2 / 3 + 2); + s_ptr->j = (float)(i * 2 / 3 + 3); + + s_ptr->k = (double)(i / 7 + 1); + s_ptr->l = (double)(i / 7 + 2); + s_ptr->m = (double)(i / 7 + 3); + s_ptr->n = (double)(i / 7 + 4); + + s_ptr->o = (long)(i * 3 + 0); + s_ptr->p = (long)(i * 3 + 1); + s_ptr->q = (long)(i * 3 + 2); + + s_ptr->r = (long long)(i * 5 + 1); + s_ptr->s = (long long)(i * 5 + 2); + s_ptr->t = (long long)(i * 5 + 3); } } @@ -1349,7 +1352,7 @@ error: * Modifications: *------------------------------------------------------------------------- */ -static int +static unsigned test_hdf5_src_subset(char *filename, hid_t fapl) { hid_t file; @@ -1554,7 +1557,7 @@ error: * Modifications: *------------------------------------------------------------------------- */ -static int +static unsigned test_hdf5_dst_subset(char *filename, hid_t fapl) { hid_t file; @@ -1763,7 +1766,7 @@ error: * Modifications: *------------------------------------------------------------------------- */ -static int +static unsigned test_pack_ooo(void) { hid_t cmpd, sub_cmpd; /* Datatype IDs */ @@ -1788,7 +1791,7 @@ test_pack_ooo(void) for(i=0; i<PACK_NMEMBS; i++) { /* Generate index into free_order array */ num_free = PACK_NMEMBS - i; - j = HDrand() % num_free; + j = (unsigned)HDrandom() % num_free; /* Update order array at the randomly generated (but guaranteed to be * free) location */ @@ -1800,7 +1803,7 @@ test_pack_ooo(void) } /* end for */ /* Generate order to insert inner compound type */ - sub_cmpd_order = HDrand() % PACK_NMEMBS; + sub_cmpd_order = (unsigned)HDrandom() % PACK_NMEMBS; for(extra_space=0; extra_space<2; extra_space ++) { if(extra_space) @@ -1995,7 +1998,7 @@ error: * Modifications: *------------------------------------------------------------------------- */ -static int +static unsigned test_ooo_order(char *filename) { hid_t file = -1; /* File ID */ diff --git a/test/dsets.c b/test/dsets.c index bca57e5..fe6a0c0 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -2952,25 +2952,34 @@ test_nbit_float(hid_t file) /* Define user-defined single-precision floating-point type for dataset */ datatype = H5Tcopy(H5T_IEEE_F32BE); - if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error; + if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) + FAIL_STACK_ERROR offset = 7; - if(H5Tset_offset(datatype,offset) < 0) goto error; + if(H5Tset_offset(datatype,offset) < 0) + FAIL_STACK_ERROR precision = 20; - if(H5Tset_precision(datatype,precision) < 0) goto error; - if(H5Tset_size(datatype, (size_t)4) < 0) goto error; - if(H5Tset_ebias(datatype, (size_t)31) < 0) goto error; + if(H5Tset_precision(datatype,precision) < 0) + FAIL_STACK_ERROR + if(H5Tset_size(datatype, (size_t)4) < 0) + FAIL_STACK_ERROR + if(H5Tset_ebias(datatype, (size_t)31) < 0) + FAIL_STACK_ERROR /* Create the data space */ - if((space = H5Screate_simple(2, size, NULL)) < 0) goto error; + if((space = H5Screate_simple(2, size, NULL)) < 0) + FAIL_STACK_ERROR /* Use nbit filter */ - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error; - if(H5Pset_nbit(dc) < 0) goto error; + if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dc, 2, chunk_size) < 0) + FAIL_STACK_ERROR + if(H5Pset_nbit(dc) < 0) + FAIL_STACK_ERROR /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, - space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR PASSED(); /*---------------------------------------------------------------------- @@ -2980,9 +2989,8 @@ test_nbit_float(hid_t file) */ TESTING(" nbit float (write)"); - if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data) < 0) - goto error; + if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + FAIL_STACK_ERROR PASSED(); @@ -2993,17 +3001,17 @@ test_nbit_float(hid_t file) TESTING(" nbit float (read)"); /* Read the dataset back */ - if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data) < 0) - goto error; + if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + FAIL_STACK_ERROR /* Check that the values read are the same as the values written * Assume size of int = size of float */ - for(i=0; i<(size_t)size[0]; i++) { - for(j=0; j<(size_t)size[1]; j++) { - if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */ - if(new_data[i][j] != orig_data[i][j]) { + for(i = 0; i < (size_t)size[0]; i++) { + for(j = 0; j < (size_t)size[1]; j++) { + if(!(orig_data[i][j] == orig_data[i][j])) + continue; /* skip if value is NaN */ + if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -3016,10 +3024,14 @@ test_nbit_float(hid_t file) * Cleanup *---------------------------------------------------------------------- */ - if(H5Tclose(datatype) < 0) goto error; - if(H5Pclose(dc) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + if(H5Tclose(datatype) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dc) < 0) + FAIL_STACK_ERROR + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) + FAIL_STACK_ERROR PASSED(); @@ -3077,25 +3089,34 @@ test_nbit_double(hid_t file) /* Define user-defined doule-precision floating-point type for dataset */ datatype = H5Tcopy(H5T_IEEE_F64BE); - if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) goto error; + if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) + FAIL_STACK_ERROR offset = 5; - if(H5Tset_offset(datatype,offset) < 0) goto error; + if(H5Tset_offset(datatype,offset) < 0) + FAIL_STACK_ERROR precision = 51; - if(H5Tset_precision(datatype,precision) < 0) goto error; - if(H5Tset_size(datatype, (size_t)8) < 0) goto error; - if(H5Tset_ebias(datatype, (size_t)255) < 0) goto error; + if(H5Tset_precision(datatype,precision) < 0) + FAIL_STACK_ERROR + if(H5Tset_size(datatype, (size_t)8) < 0) + FAIL_STACK_ERROR + if(H5Tset_ebias(datatype, (size_t)255) < 0) + FAIL_STACK_ERROR /* Create the data space */ - if((space = H5Screate_simple(2, size, NULL)) < 0) goto error; + if((space = H5Screate_simple(2, size, NULL)) < 0) + FAIL_STACK_ERROR /* Use nbit filter */ - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error; - if(H5Pset_nbit(dc) < 0) goto error; + if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dc, 2, chunk_size) < 0) + FAIL_STACK_ERROR + if(H5Pset_nbit(dc) < 0) + FAIL_STACK_ERROR /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, - space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR PASSED(); @@ -3106,9 +3127,8 @@ test_nbit_double(hid_t file) */ TESTING(" nbit double (write)"); - if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data) < 0) - goto error; + if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + FAIL_STACK_ERROR PASSED(); /*---------------------------------------------------------------------- @@ -3118,17 +3138,17 @@ test_nbit_double(hid_t file) TESTING(" nbit double (read)"); /* Read the dataset back */ - if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data) < 0) - goto error; + if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + FAIL_STACK_ERROR /* Check that the values read are the same as the values written * Assume size of long long = size of double */ - for(i=0; i<(size_t)size[0]; i++) { - for(j=0; j<(size_t)size[1]; j++) { - if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */ - if(new_data[i][j] != orig_data[i][j]) { + for(i = 0; i < (size_t)size[0]; i++) { + for(j = 0; j < (size_t)size[1]; j++) { + if(!(orig_data[i][j] == orig_data[i][j])) + continue; /* skip if value is NaN */ + if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -3141,10 +3161,14 @@ test_nbit_double(hid_t file) * Cleanup *---------------------------------------------------------------------- */ - if(H5Tclose(datatype) < 0) goto error; - if(H5Pclose(dc) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + if(H5Tclose(datatype) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dc) < 0) + FAIL_STACK_ERROR + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) + FAIL_STACK_ERROR PASSED(); @@ -3330,73 +3354,103 @@ test_nbit_compound(hid_t file) TESTING(" nbit compound (setup)"); /* Define datatypes of members of compound datatype */ - i_tid=H5Tcopy(H5T_NATIVE_INT); - c_tid=H5Tcopy(H5T_NATIVE_CHAR); - s_tid=H5Tcopy(H5T_NATIVE_SHORT); - f_tid=H5Tcopy(H5T_IEEE_F32BE); + if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + FAIL_STACK_ERROR + if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0) + FAIL_STACK_ERROR + if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0) + FAIL_STACK_ERROR + if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0) + FAIL_STACK_ERROR /* Set precision and offset etc. */ - if(H5Tset_precision(i_tid,precision[0]) < 0) goto error; - if(H5Tset_offset(i_tid,offset[0]) < 0) goto error; + if(H5Tset_precision(i_tid,precision[0]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(i_tid,offset[0]) < 0) + FAIL_STACK_ERROR - if(H5Tset_precision(c_tid,precision[1]) < 0) goto error; - if(H5Tset_offset(c_tid,offset[1]) < 0) goto error; + if(H5Tset_precision(c_tid,precision[1]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(c_tid,offset[1]) < 0) + FAIL_STACK_ERROR - if(H5Tset_precision(s_tid,precision[2]) < 0) goto error; - if(H5Tset_offset(s_tid,offset[2]) < 0) goto error; + if(H5Tset_precision(s_tid,precision[2]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(s_tid,offset[2]) < 0) + FAIL_STACK_ERROR - if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error; - if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error; - if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error; - if(H5Tset_size(f_tid, (size_t)4) < 0) goto error; - if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error; + if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(f_tid, (size_t)7) < 0) + FAIL_STACK_ERROR + if(H5Tset_precision(f_tid, (size_t)20) < 0) + FAIL_STACK_ERROR + if(H5Tset_size(f_tid, (size_t)4) < 0) + FAIL_STACK_ERROR + if(H5Tset_ebias(f_tid, (size_t)31) < 0) + FAIL_STACK_ERROR /* Create a memory compound datatype before setting the order */ - mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); - if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error; + if((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) + FAIL_STACK_ERROR /* Create a dataset compound datatype and insert some atomic types */ - cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); - if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error; + if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) + FAIL_STACK_ERROR /* Set order of dataset compound datatype */ - if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error; + if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) + FAIL_STACK_ERROR /* Create the data space */ - if((space = H5Screate_simple(2, size, NULL)) < 0) goto error; + if((space = H5Screate_simple(2, size, NULL)) < 0) + FAIL_STACK_ERROR /* Use nbit filter */ - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error; - if(H5Pset_nbit(dc) < 0) goto error; + if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dc, 2, chunk_size) < 0) + FAIL_STACK_ERROR + if(H5Pset_nbit(dc) < 0) + FAIL_STACK_ERROR /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, - space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* Initialize data, assuming size of long long >= size of member datatypes */ - for(i= 0;i< (size_t)size[0]; i++) - for(j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0F, (double)(precision[0]-1)); - orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0F, (double)(precision[1]-1)); - orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2]-1)); - orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); - orig_data[i][j].f = float_val[i][j]; - - /* some even-numbered integer values are negtive */ - if((i*size[1]+j+1)%2 == 0) { - orig_data[i][j].i = -orig_data[i][j].i; - orig_data[i][j].s = (short)-orig_data[i][j].s; + for(i = 0; i < (size_t)size[0]; i++) + for(j = 0; j < (size_t)size[1]; j++) { + power = HDpow(2.0F, (double)(precision[0]-1)); + orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); + power = HDpow(2.0F, (double)(precision[1]-1)); + orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); + power = HDpow(2.0F, (double)(precision[2]-1)); + orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); + orig_data[i][j].f = float_val[i][j]; + + /* some even-numbered integer values are negtive */ + if((i * size[1] + j + 1) % 2 == 0) { + orig_data[i][j].i = -orig_data[i][j].i; + orig_data[i][j].s = (short)-orig_data[i][j].s; + } } - } PASSED(); @@ -3407,9 +3461,8 @@ test_nbit_compound(hid_t file) */ TESTING(" nbit compound (write)"); - if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data) < 0) - goto error; + if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + FAIL_STACK_ERROR PASSED(); /*---------------------------------------------------------------------- @@ -3419,9 +3472,8 @@ test_nbit_compound(hid_t file) TESTING(" nbit compound (read)"); /* Read the dataset back */ - if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data) < 0) - goto error; + if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + FAIL_STACK_ERROR /* Check that the values read are the same as the values written * Use mask for checking the significant bits, ignoring the padding bits @@ -3429,12 +3481,12 @@ test_nbit_compound(hid_t file) i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]); c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]); s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]); - for(i=0; i<size[0]; i++) { - for(j=0; j<size[1]; j++) { + for(i = 0; i < size[0]; i++) { + for(j = 0; j < size[1]; j++) { if(((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) || ((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) || ((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) || - (orig_data[i][j].f==orig_data[i][j].f && new_data[i][j].f != orig_data[i][j].f)) + (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f))) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -3448,15 +3500,24 @@ test_nbit_compound(hid_t file) * Cleanup *---------------------------------------------------------------------- */ - if(H5Tclose(i_tid) < 0) goto error; - if(H5Tclose(c_tid) < 0) goto error; - if(H5Tclose(s_tid) < 0) goto error; - if(H5Tclose(f_tid) < 0) goto error; - if(H5Tclose(cmpd_tid) < 0) goto error; - if(H5Tclose(mem_cmpd_tid) < 0) goto error; - if(H5Pclose(dc) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + if(H5Tclose(i_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(c_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(s_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(f_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(cmpd_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(mem_cmpd_tid) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dc) < 0) + FAIL_STACK_ERROR + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) + FAIL_STACK_ERROR PASSED(); @@ -3525,119 +3586,169 @@ test_nbit_compound_2(hid_t file) TESTING(" nbit compound complex (setup)"); /* Define datatypes of members of compound datatype */ - i_tid=H5Tcopy(H5T_NATIVE_INT); - c_tid=H5Tcopy(H5T_NATIVE_CHAR); - s_tid=H5Tcopy(H5T_NATIVE_SHORT); - v_tid=H5Tcopy(H5T_NATIVE_UINT); - f_tid=H5Tcopy(H5T_IEEE_F32BE); + if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + FAIL_STACK_ERROR + if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0) + FAIL_STACK_ERROR + if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0) + FAIL_STACK_ERROR + if((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0) + FAIL_STACK_ERROR + if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0) + FAIL_STACK_ERROR /* Set precision and offset etc. of atomic compound datatype members */ - if(H5Tset_precision(i_tid,precision[0]) < 0) goto error; - if(H5Tset_offset(i_tid,offset[0]) < 0) goto error; + if(H5Tset_precision(i_tid,precision[0]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(i_tid,offset[0]) < 0) + FAIL_STACK_ERROR - if(H5Tset_precision(c_tid,precision[1]) < 0) goto error; - if(H5Tset_offset(c_tid,offset[1]) < 0) goto error; + if(H5Tset_precision(c_tid,precision[1]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(c_tid,offset[1]) < 0) + FAIL_STACK_ERROR - if(H5Tset_precision(s_tid,precision[2]) < 0) goto error; - if(H5Tset_offset(s_tid,offset[2]) < 0) goto error; + if(H5Tset_precision(s_tid,precision[2]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(s_tid,offset[2]) < 0) + FAIL_STACK_ERROR - if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error; - if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error; - if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error; - if(H5Tset_size(f_tid, (size_t)4) < 0) goto error; - if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error; + if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(f_tid, (size_t)7) < 0) + FAIL_STACK_ERROR + if(H5Tset_precision(f_tid, (size_t)20) < 0) + FAIL_STACK_ERROR + if(H5Tset_size(f_tid, (size_t)4) < 0) + FAIL_STACK_ERROR + if(H5Tset_ebias(f_tid, (size_t)31) < 0) + FAIL_STACK_ERROR /* Create a memory atomic compound datatype before setting the order */ - mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); - if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error; + if((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) + FAIL_STACK_ERROR /* Create a dataset atomic compound datatype and insert some atomic types */ - cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); - if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error; + if((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) + FAIL_STACK_ERROR /* Set order of dataset compound datatype */ - if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error; + if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) + FAIL_STACK_ERROR /* Set precision and offset of the other data member */ - if(H5Tset_precision(v_tid,precision[3]) < 0) goto error; - if(H5Tset_offset(v_tid,offset[3]) < 0) goto error; + if(H5Tset_precision(v_tid,precision[3]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(v_tid,offset[3]) < 0) + FAIL_STACK_ERROR /* Create the simple array datatype */ - base_tid = H5Tcopy(H5T_NATIVE_CHAR); - if(H5Tset_precision(base_tid,precision[4]) < 0) goto error; - if(H5Tset_offset(base_tid,offset[4]) < 0) goto error; - array_tid = H5Tarray_create2(base_tid, 2, array_dims); + if((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0) + FAIL_STACK_ERROR + if(H5Tset_precision(base_tid,precision[4]) < 0) + FAIL_STACK_ERROR + if(H5Tset_offset(base_tid,offset[4]) < 0) + FAIL_STACK_ERROR + if((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0) + FAIL_STACK_ERROR /* Create the complex memory and dataset array datatype */ - array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims); - mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims); + if((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0) + FAIL_STACK_ERROR + if((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0) + FAIL_STACK_ERROR /* Create a memory complex compound datatype before setting the order */ - mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex)); - if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error; - if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0) goto error; + if((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0) + FAIL_STACK_ERROR /* Set order of dataset other complex compound member datatype */ - if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0) goto error; + if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0) + FAIL_STACK_ERROR /* Create a dataset complex compound datatype and insert members */ - cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex)); - if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0) goto error; - if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error; - if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0) goto error; + if((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) + FAIL_STACK_ERROR + if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0) + FAIL_STACK_ERROR /* Create the data space */ - if((space = H5Screate_simple(2, size, NULL)) < 0) goto error; + if((space = H5Screate_simple(2, size, NULL)) < 0) + FAIL_STACK_ERROR /* Use nbit filter */ - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error; - if(H5Pset_nbit(dc) < 0) goto error; + if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dc, 2, chunk_size) < 0) + FAIL_STACK_ERROR + if(H5Pset_nbit(dc) < 0) + FAIL_STACK_ERROR /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, - space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* Initialize data, assuming size of long long >= size of member datatypes */ for(i= 0;i< (size_t)size[0]; i++) - for(j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0F, (double)(precision[0]-1)); - orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0F, (double)(precision[1]-1)); - orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2]-1)); - orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]); - orig_data[i][j].a.f = float_val[i][j]; - - power = HDpow(2.0F, (double)precision[3]); - orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]); - - for(m = 0; m < (size_t)array_dims[0]; m++) - for(n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0F, (double)(precision[4]-1)); - orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]); - } /* end for */ - - for(m = 0; m < (size_t)array_dims[0]; m++) - for(n = 0; n < (size_t)array_dims[1]; n++) { + for(j = 0; j < (size_t)size[1]; j++) { power = HDpow(2.0F, (double)(precision[0]-1)); - orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]); + orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); power = HDpow(2.0F, (double)(precision[1]-1)); - orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); + orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); power = HDpow(2.0F, (double)(precision[2]-1)); - orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); - orig_data[i][j].d[m][n].f = float_val[i][j]; - } /* end for */ - } /* end for */ + orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]); + orig_data[i][j].a.f = float_val[i][j]; + + power = HDpow(2.0F, (double)precision[3]); + orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]); + + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) { + power = HDpow(2.0F, (double)(precision[4]-1)); + orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]); + } /* end for */ + + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) { + power = HDpow(2.0F, (double)(precision[0]-1)); + orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]); + power = HDpow(2.0F, (double)(precision[1]-1)); + orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); + power = HDpow(2.0F, (double)(precision[2]-1)); + orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); + orig_data[i][j].d[m][n].f = float_val[i][j]; + } /* end for */ + } /* end for */ PASSED(); @@ -3648,9 +3759,8 @@ test_nbit_compound_2(hid_t file) */ TESTING(" nbit compound complex (write)"); - if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data) < 0) - goto error; + if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + FAIL_STACK_ERROR PASSED(); /*---------------------------------------------------------------------- @@ -3660,9 +3770,8 @@ test_nbit_compound_2(hid_t file) TESTING(" nbit compound complex (read)"); /* Read the dataset back */ - if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data) < 0) - goto error; + if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + FAIL_STACK_ERROR /* Check that the values read are the same as the values written * Use mask for checking the significant bits, ignoring the padding bits @@ -3683,63 +3792,77 @@ test_nbit_compound_2(hid_t file) s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]); b_mask = ~((unsigned)~0 << (precision[4] + offset[4])) & ((unsigned)~0 << offset[4]); for(i=0; i<(size_t)size[0]; i++) { - for(j=0; j<(size_t)size[1]; j++) { - b_failed = 0; - d_failed = 0; + for(j=0; j<(size_t)size[1]; j++) { + b_failed = 0; + d_failed = 0; - for(m = 0; m < (size_t)array_dims[0]; m++) - for(n = 0; n < (size_t)array_dims[1]; n++) - if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) { + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) + if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) { b_failed = 1; goto out; - } - - for(m = 0; m < (size_t)array_dims[0]; m++) - for(n = 0; n < (size_t)array_dims[1]; n++) - if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)|| - ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)|| - ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)|| - (new_data[i][j].d[m][n].f==new_data[i][j].d[m][n].f && - new_data[i][j].d[m][n].f != new_data[i][j].d[m][n].f)) { - d_failed = 1; - goto out; - } - - out: - if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)|| - ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)|| - ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)|| - (new_data[i][j].a.f==new_data[i][j].a.f && - new_data[i][j].a.f != new_data[i][j].a.f)|| - new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); - goto error; + } + + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) + if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)|| + ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)|| + ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)|| + (new_data[i][j].d[m][n].f == new_data[i][j].d[m][n].f && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) { + d_failed = 1; + goto out; + } + +out: + if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)|| + ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)|| + ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)|| + (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) || + new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } } - } } /*---------------------------------------------------------------------- * Cleanup *---------------------------------------------------------------------- */ - if(H5Tclose(i_tid) < 0) goto error; - if(H5Tclose(c_tid) < 0) goto error; - if(H5Tclose(s_tid) < 0) goto error; - if(H5Tclose(f_tid) < 0) goto error; - if(H5Tclose(v_tid) < 0) goto error; - if(H5Tclose(cmpd_tid2) < 0) goto error; - if(H5Tclose(cmpd_tid1) < 0) goto error; - if(H5Tclose(mem_cmpd_tid2) < 0) goto error; - if(H5Tclose(mem_cmpd_tid1) < 0) goto error; - if(H5Tclose(array_tid) < 0) goto error; - if(H5Tclose(base_tid) < 0) goto error; - if(H5Tclose(array_cmplx_tid) < 0) goto error; - if(H5Tclose(mem_array_cmplx_tid) < 0) goto error; - if(H5Pclose(dc) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + if(H5Tclose(i_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(c_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(s_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(f_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(v_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(cmpd_tid2) < 0) + FAIL_STACK_ERROR + if(H5Tclose(cmpd_tid1) < 0) + FAIL_STACK_ERROR + if(H5Tclose(mem_cmpd_tid2) < 0) + FAIL_STACK_ERROR + if(H5Tclose(mem_cmpd_tid1) < 0) + FAIL_STACK_ERROR + if(H5Tclose(array_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(base_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(array_cmplx_tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(mem_array_cmplx_tid) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dc) < 0) + FAIL_STACK_ERROR + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) + FAIL_STACK_ERROR PASSED(); @@ -3832,7 +3955,7 @@ test_nbit_compound_3(hid_t file) for(i = 0; i < (size_t)size[0]; i++) { power = HDpow(2.0F, 17.0F - 1.0F); HDmemset(&orig_data[i], 0, sizeof(orig_data[i])); - orig_data[i].i = HDrandom() % (long)power; + orig_data[i].i = (int)(HDrandom() % (long)power); HDstrcpy(orig_data[i].str, "fixed-length C string"); orig_data[i].vl_str = HDstrdup("variable-length C string"); @@ -4203,7 +4326,7 @@ test_nbit_flt_size(hid_t file) */ for (i=0; i < DSET_DIM1; i++) for (j=0; j < DSET_DIM2; j++) - orig_data[i][j] = (rand() % 1234567) / 2; + orig_data[i][j] = (float)(HDrandom() % 1234567) / 2; /* Describe the dataspace. */ @@ -4587,7 +4710,7 @@ test_scaleoffset_float(hid_t file) /* Initialize data */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F); + orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F; /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -4718,10 +4841,10 @@ test_scaleoffset_float_2(hid_t file) /* Initialize data of hyperslab */ for(j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F); + orig_data[0][j] = (float)(HDrandom() % 100000) / 1000.0F; /* even-numbered values are negtive */ - if((j+1)%2 == 0) + if((j + 1) % 2 == 0) orig_data[0][j] = -orig_data[0][j]; } @@ -4829,10 +4952,10 @@ test_scaleoffset_double(hid_t file) /* Initialize data */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F; + orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F; /* even-numbered values are negtive */ - if((i*size[1]+j+1)%2 == 0) + if((i* size[1] + j + 1) % 2 == 0) orig_data[i][j] = -orig_data[i][j]; } @@ -4960,10 +5083,10 @@ test_scaleoffset_double_2(hid_t file) /* Initialize data of hyperslab */ for(j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F; + orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F; /* even-numbered values are negtive */ - if((j+1)%2 == 0) + if((j + 1) % 2 == 0) orig_data[0][j] = -orig_data[0][j]; } @@ -5958,7 +6081,7 @@ test_set_local(hid_t fapl) for(j=0; j<dims[1]; j++) { /* If the difference between two values is greater than 0.001%, they're * considered not equal. */ - if(!H5_DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) { + if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) { H5_FAILED(); printf(" Line %d: Read different values than written.\n",__LINE__); printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); @@ -6717,7 +6840,7 @@ test_missing_chunk(hid_t file) /* Initialize data for 2-D dataset */ for(i = 0; i < MISSING_CHUNK_DIM; i++) { for(j = 0; j < MISSING_CHUNK_DIM; j++) { - wdata2[i][j] = (int)j + (i * MISSING_CHUNK_DIM); + wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM)); rdata2[i][j] = 911; } } /* end for */ @@ -7635,7 +7758,7 @@ test_chunk_cache(hid_t fapl) /* Set new rdcc settings on fapl */ nslots_2 = nslots_1 * 2; nbytes_2 = nbytes_1 * 2; - w0_2 = w0_1 / 2.0F; + w0_2 = w0_1 / (double)2.0F; if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR h5_fixname(FILENAME[8], fapl, filename, sizeof filename); @@ -8074,7 +8197,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_chunk_fast(const char *env_h5_driver, hid_t fapl) +test_chunk_fast(hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = -1; /* File ID */ @@ -8135,7 +8258,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { unsigned ndims; /* Current # of dims to test */ /* Loop over dataspace ranks to test */ @@ -8435,7 +8558,7 @@ test_reopen_chunk_fast(hid_t fapl) h5_fixname(FILENAME[10], fapl, filename, sizeof filename); /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -8566,7 +8689,7 @@ test_chunk_fast_bug1(hid_t fapl) if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9192,7 +9315,7 @@ test_fixed_array(hid_t fapl) #endif /* H5_HAVE_FILTER_DEFLATE */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9564,10 +9687,10 @@ test_single_chunk(hid_t fapl) TEST_ERROR for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++) - wbuf[i] = n++; + wbuf[i] = (int)n++; for(i = n = 0; i < (50* 100); i++) - t_wbuf[i] = n++; + t_wbuf[i] = (int)n++; #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ @@ -9575,7 +9698,7 @@ test_single_chunk(hid_t fapl) #endif /* H5_HAVE_FILTER_DEFLATE */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9866,7 +9989,7 @@ test_unfiltered_edge_chunks(hid_t fapl) /* Initialize write buffer */ for(i=0; i<dim[0]; i++) for(j=0; j<dim[1]; j++) - wbuf[i][j] = (char)(2 * i) - (char)j; + wbuf[i][j] = (char)((2 * i) - j); /* Reset byte counts */ count_nbytes_read = (size_t)0; @@ -11944,7 +12067,7 @@ main(void) nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0); nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); diff --git a/test/file_image.c b/test/file_image.c index 6d1845f..ef7adb8 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -22,7 +22,6 @@ *************************************************************/ #include "h5test.h" -#include "H5srcdir.h" #include "H5Fprivate.h" /* required to test property removals */ #define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0) diff --git a/test/filter_fail.c b/test/filter_fail.c index 0b92abb..c7248cc 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -22,7 +22,6 @@ */ #include "h5test.h" -#include "H5srcdir.h" #define DSET_NAME "dset_fail" #define H5Z_FILTER_FAIL_TEST 312 diff --git a/test/freespace.c b/test/freespace.c index 6e680c3..1c28bc2 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -455,7 +455,7 @@ test_fs_create(hid_t fapl) h5_stat_size_t file_size, empty_size; /* File size */ frspace_state_t state; /* State of free space*/ H5FS_create_t cparam, test_cparam; /* creation parameters */ - size_t nclasses; + uint16_t nclasses; unsigned init_flags=0; TESTING("the creation/close/reopen/deletion of the free-space manager"); @@ -589,7 +589,7 @@ test_fs_sect_add(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ frspace_state_t state; /* State of free space*/ @@ -921,7 +921,7 @@ test_fs_sect_find(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ frspace_state_t state; /* State of free space*/ @@ -1302,7 +1302,7 @@ test_fs_sect_merge(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ frspace_state_t state; /* State of free space*/ @@ -1768,7 +1768,7 @@ test_fs_sect_shrink(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ frspace_state_t state; /* State of free space*/ @@ -2106,7 +2106,7 @@ test_fs_sect_change_class(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ frspace_state_t state; /* State of free space*/ @@ -2396,7 +2396,7 @@ test_fs_sect_extend(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ frspace_state_t state; /* State of free space*/ TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL; @@ -2744,7 +2744,7 @@ test_fs_sect_iterate(hid_t fapl) H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ haddr_t fs_addr=HADDR_UNDEF; /* address of free space */ - size_t nclasses; + uint16_t nclasses; H5FS_create_t cparam; /* creation parameters */ TEST_free_section_t *sect_node=NULL; diff --git a/test/getname.c b/test/getname.c index 2700b49..e6d26ce 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2433,6 +2433,7 @@ test_obj_ref(hid_t fapl) hsize_t dims1[] = {SPACE1_DIM1}; hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */ int tu32[SPACE1_DIM1]; /* Int data */ + ssize_t namelen; /* Length of the name */ int i; /* counting variables */ char buf[100]; @@ -2575,104 +2576,104 @@ test_obj_ref(hid_t fapl) TESTING("getting path to normal dataset in root group"); if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR + if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR *buf = '\0'; /* Check H5Rget_name returns the correct length of the name when name is NULL */ - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0); - if(i != 9) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0); + if(namelen != 9) TEST_ERROR /* Make sure size parameter is ignored */ - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200); - if(i != 9) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200); + if(namelen != 9) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to dataset in /Group1"); if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to /Group1"); if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(group, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(group, (char*)buf, sizeof(buf)); if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to datatype in /Group1"); if((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(tid1, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(tid1, (char*)buf, sizeof(buf)); if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to dataset in nested group"); if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to nested group"); if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(group, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(group, (char*)buf, sizeof(buf)); if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to dataset created via hard link"); if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to root group"); if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(group, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(group, (char*)buf, sizeof(buf)); if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR + if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR PASSED() /* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */ @@ -2682,12 +2683,12 @@ test_obj_ref(hid_t fapl) TESTING("getting path to dataset hidden by a mounted file"); if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR *buf = '\0'; - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR - if(i != 0) TEST_ERROR + if(namelen != 0) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf)); - if(i != 0) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf)); + if(namelen != 0) TEST_ERROR PASSED() /* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */ @@ -2698,12 +2699,12 @@ test_obj_ref(hid_t fapl) TESTING("getting path to dataset that has been unlinked"); *buf = '\0'; - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR - if(i != 0) TEST_ERROR + if(namelen != 0) TEST_ERROR *buf = '\0'; - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf)); - if(i != 0) TEST_ERROR + namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf)); + if(namelen != 0) TEST_ERROR PASSED() /* Close disk dataspace */ diff --git a/test/links.c b/test/links.c index dcea7ce..f60a88a 100644 --- a/test/links.c +++ b/test/links.c @@ -7335,7 +7335,6 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) hid_t dtid = -1; /* Dataset's datatype ID */ hid_t dcpl = -1; /* Dataset creation property list */ int wdata = 99; /* Attribute data written */ - int rdata = 0; /* Attribute data read */ int wbuf[60]; /* Data buffer for writing */ int rbuf[60]; /* Data buffer for reading */ int i; /* Local index variable */ diff --git a/test/mtime.c b/test/mtime.c index 0c0c923..88ed31c 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -114,7 +114,7 @@ main(void) puts(" Modification times will be mantained in the file but"); puts(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; - } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) { + } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) { H5_FAILED(); tm = HDlocaltime(&(oi1.ctime)); HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); diff --git a/test/ohdr.c b/test/ohdr.c index aa1ac85..5642c41 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -17,7 +17,6 @@ * Tuesday, November 24, 1998 */ #include "h5test.h" -#include "H5srcdir.h" #include "H5Iprivate.h" /* diff --git a/test/set_extent.c b/test/set_extent.c index fd3270b..a992419 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -348,11 +348,9 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) /* Iterate over different index types, but only if using the new format */ - for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; - index_type++) { + for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) { /* Standard test */ - if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, - FALSE, index_type) < 0) { + if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4") printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" diff --git a/test/testframe.c b/test/testframe.c index 1c56f88..df5abe0 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -26,9 +26,9 @@ /* * Definitions for the testing structure. */ -#define MAXNUMOFTESTS 60 +#define MAXNUMOFTESTS 24 #define MAXTESTNAME 16 -#define MAXTESTDESC 64 +#define MAXTESTDESC 32 typedef struct TestStruct { int NumErrors; diff --git a/test/tmeta.c b/test/tmeta.c index e69c057..43fdeac 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -123,7 +123,7 @@ test_metadata(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +H5_ATTR_PURE H5_ATTR_CONST void cleanup_metadata(void) { /* no file to clean */ diff --git a/test/tvltypes.c b/test/tvltypes.c index b7bbaee..f8a6a91 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -169,7 +169,7 @@ static void test_vltypes_funcs(void) { hid_t type; /* Datatype ID */ - int size; + size_t size; H5T_pad_t inpad; H5T_norm_t norm; H5T_cset_t cset; @@ -183,16 +183,16 @@ test_vltypes_funcs(void) type = H5Tvlen_create (H5T_IEEE_F32BE); CHECK(type, FAIL, "H5Tvlen_create"); - size=H5Tget_precision(type); - CHECK(size, FAIL, "H5Tget_precision"); + size = H5Tget_precision(type); + CHECK(size, 0, "H5Tget_precision"); - size=H5Tget_size(type); - CHECK(size, FAIL, "H5Tget_size"); + size = H5Tget_size(type); + CHECK(size, 0, "H5Tget_size"); - size=H5Tget_ebias(type); - CHECK(size, FAIL, "H5Tget_ebias"); + size = H5Tget_ebias(type); + CHECK(size, 0, "H5Tget_ebias"); - ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); + ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); CHECK(ret, FAIL, "H5Tset_pad"); inpad = H5Tget_inpad(type); @@ -558,7 +558,7 @@ rewrite_vltypes_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=4; + unsigned increment=4; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -730,8 +730,8 @@ test_vltypes_vlen_compound(void) wdata[i].p=HDmalloc((i+1)*sizeof(s1)); wdata[i].len=i+1; for(j=0; j<(i+1); j++) { - ((s1 *)wdata[i].p)[j].i=i*10+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F); + ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j); + ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F; } /* end for */ } /* end for */ @@ -865,7 +865,7 @@ rewrite_vltypes_vlen_compound(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=4; + unsigned increment=4; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -876,8 +876,8 @@ rewrite_vltypes_vlen_compound(void) 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.0F); + ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j); + ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F; } /* end for */ } /* end for */ @@ -1016,17 +1016,17 @@ test_vltypes_compound_vlen_vlen(void) MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE3_DIM1; i++) { - wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0F); - wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t)); - wdata[i].v.len=i+L1_INCM; - for(t1=(hvl_t *)((wdata[i].v).p),j=0; j<(i+L1_INCM); j++, t1++) { - t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int)); - t1->len=j+L2_INCM; - for(k=0; k<j+L2_INCM; k++) - ((unsigned int*)t1->p)[k] = i*100 + j*10 + k; - } + for(i = 0; i < SPACE3_DIM1; i++) { + wdata[i].i = (int)(i * 10); + wdata[i].f = (float)(i * 20) / 3.0F; + wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t)); + wdata[i].v.len = i + L1_INCM; + for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) { + t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int)); + t1->len = j + L2_INCM; + for(k = 0; k < j + L2_INCM; k++) + ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k; + } /* end for */ } /* end for */ /* Create file */ @@ -1477,13 +1477,13 @@ test_vltypes_compound_vlen_atomic(void) MESSAGE(5, ("Testing Compound Datatypes 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*10; - wdata[i].f=(float)((i*20)/3.0F); - wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); - wdata[i].v.len=i+1; - for(j=0; j<(i+1); j++) - ((unsigned int *)wdata[i].v.p)[j]=i*10+j; + for(i = 0; i < SPACE1_DIM1; i++) { + wdata[i].i = (int)(i * 10); + wdata[i].f = (float)(i * 20) / 3.0F; + wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int)); + wdata[i].v.len = i + 1; + for(j = 0; j < (i + 1); j++) + ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j; } /* end for */ /* Create file */ @@ -1688,7 +1688,7 @@ rewrite_vltypes_compound_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=4; + unsigned increment=4; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1696,8 +1696,8 @@ rewrite_vltypes_compound_vlen_atomic(void) /* 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.0F); + wdata[i].i = (int)(i * 40); + wdata[i].f = (float)(i * 50) / 3.0F; wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int)); wdata[i].v.len = i + increment; for(j = 0; j < (i + increment); j++) @@ -1960,7 +1960,7 @@ test_vltypes_vlen_vlen_atomic(void) /* 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, (hsize_t)(((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); @@ -1969,7 +1969,7 @@ test_vltypes_vlen_vlen_atomic(void) /* 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, (size_t)(((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++) { @@ -2048,7 +2048,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j,k; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=1; + unsigned increment=1; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2224,7 +2224,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j,k; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=1; + unsigned increment=1; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2316,7 +2316,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) /* 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, (hsize_t)(((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); @@ -2325,7 +2325,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) /* 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, (size_t)(((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++) { @@ -2597,6 +2597,10 @@ test_vltypes_fill_value(void) } break; + case H5D_VIRTUAL: + assert(0 && "Invalid layout type!"); + break; + case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: @@ -2700,6 +2704,10 @@ test_vltypes_fill_value(void) dset_elmts = SPACE4_DIM_LARGE; break; + case H5D_VIRTUAL: + assert(0 && "Invalid layout type!"); + break; + case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: @@ -2897,6 +2905,10 @@ test_vltypes_fill_value(void) dset_elmts = SPACE4_DIM_LARGE; break; + case H5D_VIRTUAL: + assert(0 && "Invalid layout type!"); + break; + case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: @@ -19,7 +19,6 @@ * Purpose: Tests datasets with virtual layout. */ #include "h5test.h" -#include "H5srcdir.h" #include "H5Dprivate.h" /* For H5D_VIRTUAL_DEF_LIST_SIZE */ typedef enum { |