summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-05-07 19:37:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-05-07 19:37:48 (GMT)
commitbbe03d73613afbcdeca14c045c8b90fac37e0fe8 (patch)
tree6c6468ecf923ad7f1101e0719d2af1894e63ad64 /test
parentc952661afbac41d4bf2622899bf2a4c2c02b07b5 (diff)
downloadhdf5-bbe03d73613afbcdeca14c045c8b90fac37e0fe8.zip
hdf5-bbe03d73613afbcdeca14c045c8b90fac37e0fe8.tar.gz
hdf5-bbe03d73613afbcdeca14c045c8b90fac37e0fe8.tar.bz2
[svn-r10736] Purpose:
Code cleanup Description: Clean up some compiler warnings Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
Diffstat (limited to 'test')
-rw-r--r--test/bittests.c32
-rw-r--r--test/dsets.c26
-rw-r--r--test/dt_atomic.c40
-rw-r--r--test/testmeta.c6
4 files changed, 47 insertions, 57 deletions
diff --git a/test/bittests.c b/test/bittests.c
index cb038f7..872a01a 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -174,9 +174,9 @@ test_copy (void)
TESTING("bit copy operations");
for (i=0; i<NTESTS; i++) {
- s_offset = rand() % (8*sizeof v1);
- d_offset = rand() % (8*sizeof v2);
- size = (unsigned)rand() % MIN (8*sizeof(v1), 8*sizeof(v2));
+ s_offset = HDrand() % (8*sizeof v1);
+ d_offset = HDrand() % (8*sizeof v2);
+ size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2));
size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset);
memset (v1, 0xff, sizeof v1);
memset (v2, 0x00, sizeof v2);
@@ -296,11 +296,11 @@ test_shift (void)
TESTING("bit shift operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- shift_dist = rand() % size;
+ shift_dist = HDrand() % size;
/*-------- LEFT-shift some bits and make sure something was shifted --------*/
memset (vector, 0x00, sizeof vector);
@@ -429,8 +429,8 @@ test_increment (void)
TESTING("bit increment operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
@@ -516,8 +516,8 @@ test_decrement (void)
TESTING("bit decrement operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
@@ -588,8 +588,8 @@ test_negate (void)
TESTING("bit negate operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
@@ -688,8 +688,8 @@ test_set (void)
TESTING("bit set operations");
for (i=0; i<NTESTS; i++) {
- d_offset = rand() % (8*sizeof v2);
- size = (unsigned)rand() % (8*sizeof(v2));
+ d_offset = HDrand() % (8*sizeof v2);
+ size = (unsigned)HDrand() % (8*sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
memset (v2, 0x00, sizeof v2);
@@ -805,8 +805,8 @@ test_clear (void)
TESTING("bit clear operations");
for (i=0; i<NTESTS; i++) {
- d_offset = rand() % (8*sizeof v2);
- size = (unsigned)rand() % (8*sizeof(v2));
+ d_offset = HDrand() % (8*sizeof v2);
+ size = (unsigned)HDrand() % (8*sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
memset (v2, 0xff, sizeof v2);
diff --git a/test/dsets.c b/test/dsets.c
index e49d51b..b444e0e 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2942,7 +2942,6 @@ test_nbit_array(hid_t file)
const hsize_t chunk_size[2] = {2,5};
unsigned int orig_data[2][5][3][2];
unsigned int new_data[2][5][3][2];
- unsigned int mask;
size_t precision, offset;
hsize_t i, j, m, n;
#else /* H5_HAVE_FILTER_NBIT */
@@ -3026,9 +3025,7 @@ test_nbit_array(hid_t file)
goto error;
/* Check that the values read are the same as the values written
- * Use mask for checking the significant bits, ignoring the padding bits
*/
- mask = ~(~0 << (precision + offset)) & (~0 << offset);
for (i=0; i<size[0]; i++)
for (j=0; j<size[1]; j++)
for (m = 0; m < adims[0]; m++)
@@ -3319,7 +3316,7 @@ test_nbit_compound_2(hid_t file)
5.2045898}, {-49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000}};
complex orig_data[2][5];
complex new_data[2][5];
- unsigned int i_mask, s_mask, c_mask, v_mask, b_mask;
+ unsigned int i_mask, s_mask, c_mask, b_mask;
hsize_t i, j, m, n, b_failed, d_failed;
#else /* H5_HAVE_FILTER_NBIT */
@@ -3485,7 +3482,6 @@ test_nbit_compound_2(hid_t file)
i_mask = ~(~0 << (precision[0] + offset[0])) & (~0 << offset[0]);
c_mask = ~(~0 << (precision[1] + offset[1])) & (~0 << offset[1]);
s_mask = ~(~0 << (precision[2] + offset[2])) & (~0 << offset[2]);
- v_mask = ~(~0 << (precision[3] + offset[3])) & (~0 << offset[3]);
b_mask = ~(~0 << (precision[4] + offset[4])) & (~0 << offset[4]);
for (i=0; i<size[0]; i++) {
for (j=0; j<size[1]; j++) {
@@ -3587,7 +3583,7 @@ test_nbit_compound_3(hid_t file)
} atomic;
hid_t i_tid, str_tid, vl_str_tid, v_tid, o_tid;
hid_t cmpd_tid; /* atomic compound datatype */
- hid_t dataset, space, dc, obj_ref_dataset;
+ hid_t dataset, space, dc, obj_ref_dataset = -1;
const hsize_t size[1] = {5};
const hsize_t chunk_size[1] = {5};
atomic orig_data[5];
@@ -3739,6 +3735,7 @@ test_nbit_compound_3(hid_t file)
if (H5Tclose(cmpd_tid)<0) goto error;
if (H5Pclose(dc)<0) goto error;
if (H5Sclose(space)<0) goto error;
+ if (H5Dclose(obj_ref_dataset)<0) goto error;
if (H5Dclose(dataset)<0) goto error;
PASSED();
@@ -3910,7 +3907,7 @@ test_scaleoffset_int_2(hid_t file)
const hsize_t chunk_size[2] = {2,5};
int orig_data[2][5];
int new_data[2][5];
- hssize_t start[2]; /* Start of hyperslab */
+ hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
@@ -4006,7 +4003,7 @@ test_scaleoffset_int_2(hid_t file)
if (new_data[0][j] != orig_data[0][j]) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", 0, (unsigned long)j);
+ printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4190,7 +4187,7 @@ test_scaleoffset_float_2(hid_t file)
float orig_data[2][5];
float new_data[2][5];
float fillval;
- hssize_t start[2]; /* Start of hyperslab */
+ hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
@@ -4287,7 +4284,7 @@ test_scaleoffset_float_2(hid_t file)
if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10, -3)) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", 0, (unsigned long)j);
+ printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4470,7 +4467,7 @@ test_scaleoffset_double_2(hid_t file)
double orig_data[2][5];
double new_data[2][5];
double fillval;
- hssize_t start[2]; /* Start of hyperslab */
+ hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
@@ -4567,7 +4564,7 @@ test_scaleoffset_double_2(hid_t file)
if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10, -7)) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", 0, (unsigned long)j);
+ printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -5982,7 +5979,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
hid_t file, grp, fapl;
int mdc_nelmts;
@@ -5996,7 +5994,7 @@ int main(void)
fapl = h5_fileaccess();
/* Set the random # seed */
- HDsrandom((unsigned long)HDtime(NULL));
+ HDsrandom((unsigned long)HDtime(NULL));
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
diff --git a/test/dt_atomic.c b/test/dt_atomic.c
index 7348a9f..31a7c76 100644
--- a/test/dt_atomic.c
+++ b/test/dt_atomic.c
@@ -275,7 +275,7 @@ static int without_hardware_g = 0;
#define INIT_FP_SPECIAL(SRC_SIZE, SRC_PREC, SRC_ORDR, SRC_MANT_DIG, DST_SIZE, \
BUF, SAVED, NELMTS) \
{ \
- unsigned char *buf_p, *saved_p; \
+ unsigned char *buf_p; \
unsigned char *value; \
int n; \
\
@@ -291,7 +291,6 @@ static int without_hardware_g = 0;
value = (unsigned char*)calloc(SRC_SIZE, sizeof(unsigned char)); \
\
buf_p = BUF; \
- saved_p = SAVED; \
\
/* +0 */ \
H5T_bit_set(value, 0, SRC_PREC, FALSE); \
@@ -562,8 +561,7 @@ test_derived_flt(void)
hid_t file=-1, tid1=-1, tid2=-1;
hid_t dxpl_id=-1;
char filename[1024];
- size_t precision, spos, epos, esize, mpos, msize, size, ebias;
- int offset;
+ size_t spos, epos, esize, mpos, msize, size;
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
int *aligned=NULL;
@@ -679,12 +677,12 @@ test_derived_flt(void)
goto error;
}
- if((precision = H5Tget_precision(tid1))!=42) {
+ if(H5Tget_precision(tid1)!=42) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid1))!=3) {
+ if(H5Tget_offset(tid1)!=3) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
@@ -694,7 +692,7 @@ test_derived_flt(void)
printf("Can't get size or wrong size\n");
goto error;
}
- if((ebias = H5Tget_ebias(tid1))!=511) {
+ if(H5Tget_ebias(tid1)!=511) {
H5_FAILED();
printf("Can't get exponent bias or wrong bias\n");
goto error;
@@ -841,12 +839,12 @@ test_derived_flt(void)
goto error;
}
- if((precision = H5Tget_precision(tid2))!=24) {
+ if(H5Tget_precision(tid2)!=24) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid2))!=0) {
+ if(H5Tget_offset(tid2)!=0) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
@@ -856,7 +854,7 @@ test_derived_flt(void)
printf("Can't get size or wrong size\n");
goto error;
}
- if((ebias = H5Tget_ebias(tid2))!=63) {
+ if(H5Tget_ebias(tid2)!=63) {
H5_FAILED();
printf("Can't get exponent bias or wrong bias\n");
goto error;
@@ -1003,10 +1001,6 @@ test_derived_integer(void)
hid_t file=-1, tid1=-1, tid2=-1;
hid_t dxpl_id=-1;
char filename[1024];
- size_t precision, size;
- int offset;
- H5T_order_t order;
- H5T_sign_t sign;
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
int *aligned=NULL;
@@ -1099,22 +1093,22 @@ test_derived_integer(void)
goto error;
}
- if((precision = H5Tget_precision(tid1))!=24) {
+ if(H5Tget_precision(tid1)!=24) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid1))!=0) {
+ if(H5Tget_offset(tid1)!=0) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
}
- if((size = H5Tget_size(tid1))!=3) {
+ if(H5Tget_size(tid1)!=3) {
H5_FAILED();
printf("Can't get size or wrong size\n");
goto error;
}
- if((order = H5Tget_order(tid1))!=H5T_ORDER_BE) {
+ if(H5Tget_order(tid1)!=H5T_ORDER_BE) {
H5_FAILED();
printf("Can't get order or wrong order\n");
goto error;
@@ -1164,22 +1158,22 @@ test_derived_integer(void)
goto error;
}
- if((precision = H5Tget_precision(tid2))!=48) {
+ if(H5Tget_precision(tid2)!=48) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid2))!=10) {
+ if(H5Tget_offset(tid2)!=10) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
}
- if((size = H5Tget_size(tid2))!=8) {
+ if(H5Tget_size(tid2)!=8) {
H5_FAILED();
printf("Can't get size or wrong size\n");
goto error;
}
- if((sign = H5Tget_sign(tid2))!=H5T_SGN_2) {
+ if(H5Tget_sign(tid2)!=H5T_SGN_2) {
H5_FAILED();
printf("Can't get sign or wrong sign\n");
goto error;
@@ -4476,13 +4470,11 @@ int
main(void)
{
unsigned long nerrors = 0;
- hid_t fapl=-1;
/* Set the random # seed */
HDsrandom((unsigned long)HDtime(NULL));
reset_hdf5();
- fapl = h5_fileaccess();
if (ALIGNMENT)
printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
diff --git a/test/testmeta.c b/test/testmeta.c
index c7edafc..03fd841 100644
--- a/test/testmeta.c
+++ b/test/testmeta.c
@@ -41,8 +41,8 @@
int main(void)
{
hid_t file_id, prop_id, memspace_id, type_id;
- hid_t group_id, access_plist;
- hid_t dataset_id, dataspace_id, s_dataspace_id;
+ hid_t group_id;
+ hid_t dataset_id, dataspace_id;
herr_t status;
hsize_t dims[1];
hsize_t maxdims[1];
@@ -51,7 +51,7 @@ int main(void)
unsigned numdataobj = 0;
unsigned i, j;
char name[80];
- hssize_t start[1] = {0};
+ hsize_t start[1] = {0};
hsize_t stride[1] = {1};
hsize_t count[1] = {1};