summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-18 04:10:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-18 04:10:09 (GMT)
commit0a29514b9dd967deb64b53b39e12d6b55177b76c (patch)
treea0a2fce3c7a13fcdf1deed6c022a47bfb5a2cbf1 /test
parent432f394cbbc6f77861501f91dc2fc5c209f3811f (diff)
downloadhdf5-0a29514b9dd967deb64b53b39e12d6b55177b76c.zip
hdf5-0a29514b9dd967deb64b53b39e12d6b55177b76c.tar.gz
hdf5-0a29514b9dd967deb64b53b39e12d6b55177b76c.tar.bz2
[svn-r8383] Purpose:
Code cleanup Description: Clean up lots of warnings based on those reported from the SGI compilers as well as gcc. Platforms tested: SGI O3900, IRIX64 6.5 (Cheryl's SGI machine) FreeBSD 4.9 (sleipnir) w/ & w/o parallel h5committest
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c34
-rw-r--r--test/dtypes.c6
-rw-r--r--test/error_test.c10
-rw-r--r--test/hyperslab.c10
-rw-r--r--test/istore.c8
-rw-r--r--test/testframe.c2
-rw-r--r--test/tfile.c1
-rw-r--r--test/theap.c2
-rw-r--r--test/titerate.c6
-rw-r--r--test/unlink.c4
10 files changed, 40 insertions, 43 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 7cd26c3..deaba61 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -1409,7 +1409,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
for (i=0; i<size[0]; i++) {
for (j=0; j<size[1]/2; j++) {
- points[i][j] = HDrandom ();
+ points[i][j] = (int)HDrandom ();
}
}
if (H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, points)<0)
@@ -1515,7 +1515,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
for (i=0; i<hs_size[0]; i++) {
for (j=0; j<hs_size[1]; j++) {
- points[hs_offset[0]+i][hs_offset[1]+j] = HDrandom();
+ points[hs_offset[0]+i][hs_offset[1]+j] = (int)HDrandom();
}
}
if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
@@ -2135,7 +2135,7 @@ test_onebyte_shuffle(hid_t file)
for (i= 0;i< 10; i++)
for (j = 0; j < 20; j++)
- orig_data[i][j] = HDrandom();
+ orig_data[i][j] = (unsigned char)HDrandom();
PASSED();
#else
@@ -3096,10 +3096,10 @@ static herr_t
test_filter_delete(hid_t file)
{
H5Z_filter_t filtn; /* filter identification number */
- hid_t dsid; /* dataset ID */
- hid_t sid; /* dataspace ID */
- hid_t dcpl; /* dataset creation property list ID */
- hid_t dcpl1; /* dataset creation property list ID */
+ hid_t dsid=-1; /* dataset ID */
+ hid_t sid=-1; /* dataspace ID */
+ hid_t dcpl=-1; /* dataset creation property list ID */
+ hid_t dcpl1=-1; /* dataset creation property list ID */
hsize_t dims[2]={20,20}; /* dataspace dimensions */
hsize_t chunk_dims[2]={10,10}; /* chunk dimensions */
int nfilters; /* number of filters in DCPL */
@@ -3213,11 +3213,11 @@ error:
static herr_t
auxread_fdata(hid_t fid, const char *name)
{
- hid_t dset_id; /* dataset ID */
- hid_t dcpl_id; /* dataset creation property list ID */
- hid_t space_id; /* space ID */
- hid_t ftype_id; /* file data type ID */
- hid_t mtype_id; /* memory data type ID */
+ hid_t dset_id=-1; /* dataset ID */
+ hid_t dcpl_id=-1; /* dataset creation property list ID */
+ hid_t space_id=-1; /* space ID */
+ hid_t ftype_id=-1; /* file data type ID */
+ hid_t mtype_id=-1; /* memory data type ID */
size_t msize; /* memory size of memory type */
void *buf=NULL; /* data buffer */
hsize_t nelmts; /* number of elements in dataset */
@@ -3300,10 +3300,10 @@ error:
static herr_t
test_filters_endianess(void)
{
- hid_t fid; /* file ID */
- hid_t dsid; /* dataset ID */
- hid_t sid; /* dataspace ID */
- hid_t dcpl; /* dataset creation property list ID */
+ hid_t fid=-1; /* file ID */
+ hid_t dsid=-1; /* dataset ID */
+ hid_t sid=-1; /* dataspace ID */
+ hid_t dcpl=-1; /* dataset creation property list ID */
hsize_t dims[1]={2}; /* dataspace dimensions */
hsize_t chunk_dims[1]={2}; /* chunk dimensions */
int buf[2];
@@ -3446,7 +3446,7 @@ main(void)
#endif
/* Set the random # seed */
- HDsrandom((unsigned long)time(NULL));
+ HDsrandom((unsigned long)HDtime(NULL));
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) {
diff --git a/test/dtypes.c b/test/dtypes.c
index 41c5d19..17fdc33 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -4664,7 +4664,7 @@ overflows(unsigned char *origin_bits, dtype_t src_dtype, size_t src_size_bytes,
indx = H5T_bit_find((uint8_t *)&sig, 0, 8*sizeof(hsize_t), H5T_BIT_MSB, 1);
- if(indx>=dst_num_bits)
+ if((size_t)indx>=dst_num_bits)
ret_value=TRUE;
done:
@@ -4789,7 +4789,6 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
int uflow=0; /*underflow debug counters*/
size_t i, j, k; /*counters */
int endian; /*machine endianess */
- size_t src_ebias; /* Source type's exponent bias */
size_t dst_ebias; /* Destination type's exponent bias */
size_t src_epos; /* Source type's exponent position */
size_t src_esize; /* Source type's exponent size */
@@ -4881,7 +4880,6 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
/* Get "interesting" values */
src_size = H5Tget_size(src);
dst_size = H5Tget_size(dst);
- src_ebias=H5Tget_ebias(src);
dst_ebias=H5Tget_ebias(dst);
H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL);
H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,NULL,&dst_msize);
@@ -5094,7 +5092,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
/* Special check for denormalized values */
if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) {
int expo_diff=check_expo[0]-check_expo[1];
- int valid_bits=((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
+ int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
double epsilon=1.0;
/* Re-scale the mantissas based on any exponent difference */
diff --git a/test/error_test.c b/test/error_test.c
index 7e45f3d..ebe0b7e 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -186,11 +186,11 @@ test_error(hid_t file)
static herr_t
init_error(void)
{
- ssize_t cls_size = strlen(ERR_CLS_NAME)+1;
- char *cls_name = malloc(strlen(ERR_CLS_NAME)+1);
- ssize_t msg_size = strlen(ERR_MIN_SUBROUTINE_MSG) + 1;
- char *msg = malloc(strlen(ERR_MIN_SUBROUTINE_MSG)+1);
- H5E_type_t *msg_type= malloc(sizeof(H5E_type_t));
+ ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME)+1;
+ char *cls_name = HDmalloc(strlen(ERR_CLS_NAME)+1);
+ ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1;
+ char *msg = HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1);
+ H5E_type_t *msg_type= HDmalloc(sizeof(H5E_type_t));
if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS))<0)
TEST_ERROR;
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 556d2f0..f28da01 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -1077,7 +1077,7 @@ test_array_fill(size_t lo, size_t hi)
/* Setup */
for(u=0; u<ARRAY_FILL_SIZE; u++)
- src[u]=u;
+ src[u]=(char)u;
/* Fill */
for(w=lo; w<=hi; w++) {
@@ -1147,9 +1147,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
/* Check offsets */
for(u=0; u<n; u++) {
/* Get random coordinate */
- coords[0] = HDrandom() % z;
- coords[1] = HDrandom() % y;
- coords[2] = HDrandom() % x;
+ coords[0] = (hssize_t)(HDrandom() % z);
+ coords[1] = (hssize_t)(HDrandom() % y);
+ coords[2] = (hssize_t)(HDrandom() % x);
/* Get offset of coordinate */
off=H5V_array_offset(ARRAY_OFFSET_NDIMS,dims,coords);
@@ -1227,7 +1227,7 @@ main(int argc, char *argv[])
printf("\n");
/* Set the random # seed */
- HDsrandom((unsigned long)time(NULL));
+ HDsrandom((unsigned long)HDtime(NULL));
/*
* Open the library explicitly for thread-safe builds, so per-thread
diff --git a/test/istore.c b/test/istore.c
index 7de1d90..0830ff4 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -492,9 +492,9 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
if((mspace=H5Screate_simple(ndims,size,NULL))<0) TEST_ERROR;
for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = HDrandom() % (TEST_SPARSE_SIZE-nx);
- offset[1] = HDrandom() % (TEST_SPARSE_SIZE-ny);
- offset[2] = HDrandom() % (TEST_SPARSE_SIZE-nz);
+ offset[0] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx));
+ offset[1] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny));
+ offset[2] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz));
/* Select region in file dataspace */
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL)<0) TEST_ERROR;
@@ -599,7 +599,7 @@ main(int argc, char *argv[])
printf("\n");
/* Set the random # seed */
- HDsrandom((unsigned long)time(NULL));
+ HDsrandom((unsigned long)HDtime(NULL));
/* Reset library */
h5_reset();
diff --git a/test/testframe.c b/test/testframe.c
index 3411b95..b00bff0 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -173,7 +173,7 @@ void TestInfo(const char *ProgName)
void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
{
int CLLoop; /* Command Line Loop */
- int Loop, Loop1;
+ int Loop;
for (CLLoop = 1; CLLoop < argc; CLLoop++) {
if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) ||
diff --git a/test/tfile.c b/test/tfile.c
index 6799968..e2ad1f2 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -836,7 +836,6 @@ test_get_file_id(void)
hid_t plist;
hsize_t dims[F2_RANK];
herr_t ret;
- int numb;
/* Create a file */
fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/theap.c b/test/theap.c
index 86e0893..8e5105a 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -95,7 +95,7 @@ test_heap_init(void)
HDsrandom((unsigned long)curr_time);
for(u=0; u<NUM_ELEMS; u++)
/* Generate random numbers from -1000 to 1000 */
- rand_num[u].val=(HDrandom()%2001)-1001;
+ rand_num[u].val=(int)(HDrandom()%2001)-1001;
/* Sort random numbers into increasing order */
HDmemcpy(inc_sort_num,rand_num,sizeof(test_obj)*NUM_ELEMS);
diff --git a/test/titerate.c b/test/titerate.c
index 7aaaf5f..5396bc7 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -199,7 +199,7 @@ static void test_iter_group(void)
for(i=0; i< (int)num_membs; i++) {
H5G_obj_t obj_type; /* Type of object in file */
- ret = H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
+ ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
@@ -227,7 +227,7 @@ static void test_iter_group(void)
for(i=0; i< (int)num_membs; i++) {
H5G_obj_t obj_type; /* Type of object in file */
- ret = H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN);
+ ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN);
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
obj_type = H5Gget_objtype_by_idx(file, (hsize_t)i);
@@ -779,7 +779,7 @@ static void test_grp_memb_funcs(void)
name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
- ret = H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
+ ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
/* Double-check that the length is the same */
diff --git a/test/unlink.c b/test/unlink.c
index f6f95cd..80ccd59 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -747,7 +747,7 @@ test_filespace(void)
/* Set buffer to different random numbers each time */
for (v=0, tmp_data=data; v<(FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2); v++)
- *tmp_data++ = HDrandom();
+ *tmp_data++ = (int)HDrandom();
/* Write the buffer to the dataset */
if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data)<0) TEST_ERROR;
@@ -1826,7 +1826,7 @@ main(void)
double rdcc_w0;
/* Set the random # seed */
- HDsrandom((unsigned long)time(NULL));
+ HDsrandom((unsigned long)HDtime(NULL));
/* Open */
h5_reset();