diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-01-23 20:46:34 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-01-23 20:46:34 (GMT) |
commit | 56e3f667d6e3e265ac044f3faf1b17137556e0f7 (patch) | |
tree | 70f04688f0596ca5be22dd4e9260f601ee77bbd8 /test | |
parent | b09695738a95d8f1fb823894d1880f28dc16669c (diff) | |
download | hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.zip hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.tar.gz hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.tar.bz2 |
[svn-r11886] Purpose:
Code cleanup
Description:
Check in some of the code cleanups from working on the external link
support. (This doesn't include any of the external link features)
Platforms tested:
FreeBSD 4.11 (sleipnir)
Mac OSX.4 (amazon)
Linux 2.4
Diffstat (limited to 'test')
-rw-r--r-- | test/b+tree.c | 3 | ||||
-rw-r--r-- | test/cache.c | 2 | ||||
-rw-r--r-- | test/dsets.c | 36 | ||||
-rw-r--r-- | test/dt_arith.c | 20 | ||||
-rw-r--r-- | test/error_test.c | 6 | ||||
-rw-r--r-- | test/tattr.c | 1 | ||||
-rw-r--r-- | test/trefstr.c | 2 | ||||
-rw-r--r-- | test/unlink.c | 18 |
8 files changed, 45 insertions, 43 deletions
diff --git a/test/b+tree.c b/test/b+tree.c index 1c756b8..b29c192 100644 --- a/test/b+tree.c +++ b/test/b+tree.c @@ -108,6 +108,7 @@ error: * *------------------------------------------------------------------------- */ +#ifdef QAK static int test_insert_basic(hid_t fapl) { @@ -116,7 +117,6 @@ test_insert_basic(hid_t fapl) H5F_t *f=NULL; char *record; /* Record to insert into tree */ haddr_t bpt_addr; /* Address of B+ tree created */ - herr_t ret; /* Generic error return value */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -153,6 +153,7 @@ error: } H5E_END_TRY; return 1; } /* test_insert_basic() */ +#endif /* QAK */ /*------------------------------------------------------------------------- diff --git a/test/cache.c b/test/cache.c index 84943ee..fbe93a5 100644 --- a/test/cache.c +++ b/test/cache.c @@ -1917,7 +1917,7 @@ static void insert_entry(H5C_t * cache_ptr, int32_t type, int32_t idx, - hbool_t dirty, + hbool_t UNUSED dirty, unsigned int flags) { herr_t result; diff --git a/test/dsets.c b/test/dsets.c index 3d6fab3..8555168 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -2573,7 +2573,7 @@ test_nbit_int(hid_t file) for (i= 0;i< size[0]; i++) for (j = 0; j < size[1]; j++) { orig_data[i][j] = (int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision - 1)) << offset); + (long_long)HDpow(2.0, (double)(precision - 1))) << offset); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -2987,7 +2987,7 @@ test_nbit_array(hid_t file) for (m = 0; m < adims[0]; m++) for (n = 0; n < adims[1]; n++) orig_data[i][j][m][n] = (unsigned int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision)) << offset); + (long_long)HDpow(2.0, (double)precision)) << offset); PASSED(); #else SKIPPED(); @@ -3167,11 +3167,11 @@ test_nbit_compound(hid_t file) for (i= 0;i< size[0]; i++) for (j = 0; j < size[1]; j++) { orig_data[i][j].i = (int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[0]-1)) << offset[0]); + (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].c = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[1]-1)) << offset[1]); + (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].s = (short)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[2]-1)) << offset[2]); + (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].f = float_val[i][j]; /* some even-numbered integer values are negtive */ @@ -3414,29 +3414,29 @@ test_nbit_compound_2(hid_t file) for (i= 0;i< size[0]; i++) for (j = 0; j < size[1]; j++) { orig_data[i][j].a.i = (int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[0]-1)) << offset[0]); + (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].a.c = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[1]-1)) << offset[1]); + (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].a.s = (short)(-((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[2]-1)) << offset[2]); + (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].a.f = float_val[i][j]; orig_data[i][j].v = (unsigned int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[3])) << offset[3]); + (long_long)HDpow(2.0, (double)precision[3])) << offset[3]); for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) orig_data[i][j].b[m][n] = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[4]-1)) << offset[4]); + (long_long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]); for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) { orig_data[i][j].d[m][n].i = (int)(-((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[0]-1)) << offset[0]); + (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].d[m][n].c = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[1]-1)) << offset[1]); + (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].d[m][n].s = (short)(((long_long)HDrandom() % - (long_long)HDpow(2.0, precision[2]-1)) << offset[2]); + (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; } } @@ -3639,7 +3639,7 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for(i = 0; i < size[0]; i++) { - orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17-1); + orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0); strcpy(orig_data[i].str, "fixed-length C string"); orig_data[i].vl_str = strdup("variable-length C string"); @@ -4131,7 +4131,7 @@ test_scaleoffset_float(hid_t file) /* Check that the values read are the same as the values written */ for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { - if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3)) { + if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4281,7 +4281,7 @@ test_scaleoffset_float_2(hid_t file) /* Check that the values read are the same as the values written */ for (j=0; j<size[1]; j++) { - if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3)) { + if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -4411,7 +4411,7 @@ test_scaleoffset_double(hid_t file) /* Check that the values read are the same as the values written */ for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { - if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7)) { + if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4561,7 +4561,7 @@ test_scaleoffset_double_2(hid_t file) /* Check that the values read are the same as the values written */ for (j=0; j<size[1]; j++) { - if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7)) { + if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); diff --git a/test/dt_arith.c b/test/dt_arith.c index 36ca72c..86aca82 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -372,7 +372,7 @@ static int without_hardware_g = 0; void some_dummy_func(float x); static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits); static int my_isnan(dtype_t type, void *val); -static int my_isinf(dtype_t type, int endian, unsigned char *val, size_t size, +static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize); /*------------------------------------------------------------------------- @@ -708,14 +708,14 @@ static int test_particular_fp_integer(void) signed char dst_c; unsigned char *buf1, *buf2; unsigned char *saved_buf1, *saved_buf2; - unsigned int src_size1, src_size2; - unsigned int dst_size1, dst_size2; + size_t src_size1, src_size2; + size_t dst_size1, dst_size2; float src_f = (float)INT_MAX; int dst_i; int fill_value = 13; int endian; /*endianess */ unsigned int fails_this_test = 0; - int j; + size_t j; TESTING("hard particular floating number -> integer conversions"); @@ -2681,12 +2681,12 @@ my_isnan(dtype_t type, void *val) *------------------------------------------------------------------------- */ static int -my_isinf(dtype_t type, int endian, unsigned char *val, size_t size, +my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize) { unsigned char *bits; int retval = 0; - int i; + size_t i; ssize_t ret1=0, ret2=0; bits = (unsigned char*)calloc(1, size); @@ -3088,7 +3088,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) continue; /* all underflowed, no error */ - if (overflow && my_isinf(dst_type, endian, buf+j*sizeof(float), + if (overflow && my_isinf(endian, buf+j*sizeof(float), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) continue; /* all overflowed, no error */ check_mant[0] = HDfrexpf(x, check_expo+0); @@ -3099,7 +3099,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) continue; /* all underflowed, no error */ - if (overflow && my_isinf(dst_type, endian, buf+j*sizeof(double), + if (overflow && my_isinf(endian, buf+j*sizeof(double), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) continue; /* all overflowed, no error */ check_mant[0] = HDfrexp(x, check_expo+0); @@ -4389,8 +4389,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if(run_test==TEST_NORMAL) return MAX((int)fails_all_tests, 1); - else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL) + else { + HDassert(run_test==TEST_DENORM || run_test==TEST_SPECIAL); return 1; + } } diff --git a/test/error_test.c b/test/error_test.c index b7994a0..ad3dd11 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -303,8 +303,8 @@ error_stack(void) * *------------------------------------------------------------------------- */ -herr_t -long_desc_cb(unsigned n, const H5E_error_t *err_desc, void* client_data) +static herr_t +long_desc_cb(unsigned UNUSED n, const H5E_error_t *err_desc, void* client_data) { char *real_desc = (char *)client_data; @@ -335,7 +335,7 @@ long_desc_cb(unsigned n, const H5E_error_t *err_desc, void* client_data) static herr_t test_long_desc(void) { - char *format="Testing very long description string, %s"; + const char *format="Testing very long description string, %s"; char *long_desc; char *full_desc; size_t u; diff --git a/test/tattr.c b/test/tattr.c index 2363401..6f41225 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -472,7 +472,6 @@ test_attr_plist(void) hid_t sid1,sid2; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hid_t plist; /* Property list ID */ - char *attr_name=NULL; /* name of attribute */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {ATTR1_DIM1}; H5T_cset_t cset; /* Character set for attributes */ diff --git a/test/trefstr.c b/test/trefstr.c index eca4aaf..4ba6df5 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -300,7 +300,7 @@ test_refstr_own(void) MESSAGE(5, ("Testing Transferring Ref-Counted Strings\n")); /* Initialize buffer */ - s = H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1); + s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1); HDstrcpy(s, "foo"); /* Transfer ownership of dynamically allocated string to ref-counted string */ diff --git a/test/unlink.c b/test/unlink.c index 37bd55b..607f89f 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -1504,7 +1504,7 @@ test_unlink_rightleaf(hid_t fid) ngroups = 150; /* Number of groups to create */ char name[256]; /* Name of object to create */ - TESTING("Deleting right-most child in non-leaf B-tree node"); + TESTING("deleting right-most child in non-leaf B-tree node"); /* Allocate space for the group IDs */ gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t)); @@ -1568,7 +1568,7 @@ test_unlink_rightnode(hid_t fid) ngroups = 150; /* Number of groups to create */ char name[256]; /* Name of object to create */ - TESTING("Deleting right-most child in non-leaf B-tree node"); + TESTING("deleting right-most child in non-leaf B-tree node"); /* Allocate space for the group IDs */ gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t)); @@ -1632,7 +1632,7 @@ test_unlink_middlenode(hid_t fid) ngroups = 250; /* Number of groups to create */ char name[256]; /* Name of object to create */ - TESTING("Deleting right-most child in non-leaf B-tree node"); + TESTING("deleting right-most child in non-leaf B-tree node"); /* Allocate space for the group IDs */ gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t)); @@ -1836,7 +1836,7 @@ test_resurrect_dataset(void) hid_t f=-1, s=-1, d=-1, fapl=-1; char filename[1024]; - TESTING("Resurrecting dataset after deletion"); + TESTING("resurrecting dataset after deletion"); /* Create file */ fapl = h5_fileaccess(); @@ -1910,7 +1910,7 @@ test_resurrect_datatype(void) hid_t file=-1, type=-1, fapl=-1; char filename[1024]; - TESTING("Resurrecting datatype after deletion"); + TESTING("resurrecting datatype after deletion"); /* Create file */ fapl = h5_fileaccess(); @@ -1980,7 +1980,7 @@ test_resurrect_group(void) hid_t file=-1, group=-1, fapl=-1; char filename[1024]; - TESTING("Resurrecting group after deletion"); + TESTING("resurrecting group after deletion"); /* Create file */ fapl = h5_fileaccess(); @@ -2055,11 +2055,11 @@ test_unlink_chunked_dataset(void) hsize_t chunk_dims[FILESPACE_NDIMS]={FILESPACE_CHUNK0,FILESPACE_CHUNK1,FILESPACE_CHUNK2}; char filename[1024]; - TESTING("Unlinking chunked dataset"); + TESTING("unlinking chunked dataset"); /* Create file */ fapl_id = h5_fileaccess(); - h5_fixname(FILENAME[7], fapl_id, filename, sizeof filename); + h5_fixname(FILENAME[9], fapl_id, filename, sizeof filename); /* Create the file */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR; @@ -2092,7 +2092,7 @@ test_unlink_chunked_dataset(void) if(H5Fclose(file_id)<0) TEST_ERROR; /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT))<0) TEST_ERROR; + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id))<0) TEST_ERROR; /* Delete the dataset */ if(H5Gunlink(file_id, DATASETNAME)<0) TEST_ERROR; |