From 25f3bf9011ad0876998a1db37f21eb7a214b93d4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 30 Oct 2006 10:58:46 -0500 Subject: [svn-r12828] Description: Clean up compiler warnings... Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) --- src/H5FD.c | 28 ++++++++++-------- src/H5HFsection.c | 3 +- src/H5Tconv.c | 78 +++++++++++++++++++++++++------------------------- test/cache_common.c | 10 +++++-- test/gen_filters.c | 48 +++++++++++++++---------------- test/gen_new_fill.c | 81 ++++++++++++++++++++++++++-------------------------- test/gen_noencoder.c | 74 ++++++++++++++++++++++++----------------------- test/gen_udlinks.c | 4 +-- test/theap.c | 31 ++++++++++---------- 9 files changed, 185 insertions(+), 172 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index 58e6188..d49192b 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -3746,20 +3746,22 @@ done: * *-------------------------------------------------------------------------- */ -herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) +herr_t +H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) { herr_t ret_value; FUNC_ENTER_API(H5FDget_vfd_handle, FAIL) /* Check arguments */ - assert(file); - assert(file_handle); - ret_value=H5FD_get_vfd_handle(file, fapl, file_handle); + HDassert(file); + HDassert(file_handle); + + ret_value = H5FD_get_vfd_handle(file, fapl, file_handle); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDget_vfd_handle() */ /*-------------------------------------------------------------------------- @@ -3776,21 +3778,23 @@ done: * *-------------------------------------------------------------------------- */ -herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) +herr_t +H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_get_vfd_handle, FAIL) - assert(file_handle); - if(NULL==file->cls->get_handle) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `get_vfd_handle' method"); - if((ret_value=file->cls->get_handle(file, fapl, file_handle)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); + HDassert(file_handle); + + if(NULL == file->cls->get_handle) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") + if((ret_value = file->cls->get_handle(file, fapl, file_handle)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_get_vfd_handle() */ /*------------------------------------------------------------------------- diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 807beb3..fc44c3c 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -1295,7 +1295,8 @@ HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_ HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); /* Retrieve direct block address from section */ - status = H5HF_sect_single_dblock_info(iblock->hdr, H5AC_dxpl_id, sect, &dblock_addr, &dblock_size); + /* (Casting away const OK - QAK) */ + status = H5HF_sect_single_dblock_info(iblock->hdr, H5AC_dxpl_id, (H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); HDassert(status >= 0); HDassert(H5F_addr_eq(iblock->ents[sect->u.single.par_entry].addr, dblock_addr)); HDassert(dblock_size > 0); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 0dd1d98..ff1e045 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3931,7 +3931,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, bitno = (ssize_t)(mrsh+msize - dst.u.f.msize); assert(bitno>=0 && (size_t)bitno<=msize); /*If the 1st bit being cut off is set and source isn't denormalized.*/ - if(H5T_bit_get_d(s, mpos+bitno-1, (size_t)1) && !denormalized) { + if(H5T_bit_get_d(s, (mpos + bitno) - 1, (size_t)1) && !denormalized) { /*Don't do rounding if exponent is 111...110 and mantissa is 111...11. *To do rounding and increment exponent in this case will create an infinity value.*/ if((H5T_bit_find(s, mpos+bitno, msize-bitno, H5T_BIT_LSB, FALSE)>=0 || exposhared->size) { assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad); - H5T_bit_set (d, dst.offset+dst.prec, + H5T_bit_set(d, dst.offset+dst.prec, 8*dst_p->shared->size - (dst.offset+ dst.prec), (hbool_t)(H5T_PAD_ONE==dst.msb_pad)); } @@ -10214,25 +10214,25 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_bit_set (d, dst.offset, dst.prec, FALSE); /* Copy source into a temporary buffer */ - H5T_bit_copy(int_buf, 0, s, src.offset, src.prec); + H5T_bit_copy(int_buf, (size_t)0, s, src.offset, src.prec); /* * Find the sign bit value of the source. */ - if (H5T_SGN_2 == src.u.i.sign) - sign = (size_t)H5T_bit_get_d(int_buf, src.prec-1, 1); + if(H5T_SGN_2 == src.u.i.sign) + sign = (size_t)H5T_bit_get_d(int_buf, src.prec - 1, (size_t)1); /* * What is the bit position(starting from 0 as first one) for the most significant * bit(MSB) of S which is set? */ if(H5T_SGN_2 == src.u.i.sign) { - sfirst = H5T_bit_find(int_buf, 0, src.prec-1, H5T_BIT_MSB, TRUE); + sfirst = H5T_bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); if(sign && sfirst < 0) /* The case 0x80...00, which is negative with maximal value */ is_max_neg = 1; } else if(H5T_SGN_NONE == src.u.i.sign) - sfirst = H5T_bit_find(int_buf, 0, src.prec, H5T_BIT_MSB, TRUE); + sfirst = H5T_bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, TRUE); /* Handle special cases here. Integer is zero */ if(!sign && sfirst < 0) @@ -10241,29 +10241,29 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Convert source integer if it's negative */ - if (H5T_SGN_2 == src.u.i.sign && sign) { + if(H5T_SGN_2 == src.u.i.sign && sign) { if(!is_max_neg) { /* Equivalent to ~(i - 1) */ - H5T_bit_dec(int_buf, 0, buf_size*8); - H5T_bit_neg(int_buf, 0, buf_size*8); - sfirst = H5T_bit_find(int_buf, 0, src.prec-1, H5T_BIT_MSB, TRUE); + H5T_bit_dec(int_buf, (size_t)0, buf_size * 8); + H5T_bit_neg(int_buf, (size_t)0, buf_size * 8); + sfirst = H5T_bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); } else { /* If it's maximal negative number 0x80...000, treat it as if it overflowed * (create a carry) to help conversion. i.e. a character type number 0x80 * is treated as 0x100. */ - sfirst = (ssize_t)(src.prec-1); + sfirst = (ssize_t)(src.prec - 1); is_max_neg = 0; } /* Sign bit has been negated if bit vector isn't 0x80...00. Set all bits in front of * sign bit to 0 in the temporary buffer because they're all negated from the previous * step. */ - H5T_bit_set(int_buf, src.prec, buf_size*8-src.prec, 0); + H5T_bit_set(int_buf, src.prec, (buf_size * 8) - src.prec, 0); /* Set sign bit in destination */ - H5T_bit_set_d(d, dst.u.f.sign, 1, (hsize_t)sign); - } + H5T_bit_set_d(d, dst.u.f.sign, (size_t)1, (hsize_t)sign); + } /* end if */ first = (size_t)sfirst; @@ -10282,7 +10282,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Handle mantissa part here */ if (H5T_NORM_IMPLIED==dst.u.f.norm) { /* Imply first bit */ - H5T_bit_set(int_buf, first, 1, 0); + H5T_bit_set(int_buf, first, (size_t)1, 0); } else if (H5T_NORM_NONE==dst.u.f.norm) { first++; } @@ -10311,28 +10311,28 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ /* Check 1st dropoff bit, see if it's set. */ - if(H5T_bit_get_d(int_buf, ((first-dst.u.f.msize)-1), 1)) { + if(H5T_bit_get_d(int_buf, ((first - dst.u.f.msize) - 1), (size_t)1)) { /* Check all bits after 1st dropoff bit, see if any of them is set. */ - if(((first-dst.u.f.msize)-1) > 0 && H5T_bit_get_d(int_buf, 0, ((first-dst.u.f.msize)-1))) + if(((first - dst.u.f.msize) - 1) > 0 && H5T_bit_get_d(int_buf, (size_t)0, ((first - dst.u.f.msize) - 1))) do_round = 1; else { /* The .50...0 case */ /* Check if the least significant bit is odd. */ - if(H5T_bit_get_d(int_buf, (first-dst.u.f.msize), 1)) + if(H5T_bit_get_d(int_buf, (first - dst.u.f.msize), (size_t)1)) do_round = 1; } } /* Right shift to drop off extra bits */ - H5T_bit_shift(int_buf, (ssize_t)(dst.u.f.msize-first), 0, buf_size*8); + H5T_bit_shift(int_buf, (ssize_t)(dst.u.f.msize - first), (size_t)0, buf_size * 8); if(do_round) { - H5T_bit_inc(int_buf, 0, buf_size*8); + H5T_bit_inc(int_buf, (size_t)0, buf_size * 8); do_round = 0; /* If integer is like 0x0ff...fff and we need to round up the * last f, we get 0x100...000. Treat this special case here. */ - if(H5T_bit_get_d(int_buf, dst.u.f.msize, 1)) { + if(H5T_bit_get_d(int_buf, dst.u.f.msize, (size_t)1)) { if (H5T_NORM_IMPLIED==dst.u.f.norm) { /* The bit at this 1's position was impled already, so this * number should be 0x200...000. We need to increment the @@ -10343,7 +10343,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Right shift 1 bit to let the carried 1 fit in the mantissa, * and increment exponent by 1. */ - H5T_bit_shift(int_buf, -1, 0, buf_size*8); + H5T_bit_shift(int_buf, (ssize_t)-1, (size_t)0, buf_size * 8); expo++; } } @@ -10351,7 +10351,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else { /* The bit sequence can fit mantissa part. Left shift to fit in from high-order of * bit position. */ - H5T_bit_shift(int_buf, (ssize_t)(dst.u.f.msize-first), 0, dst.u.f.msize); + H5T_bit_shift(int_buf, (ssize_t)(dst.u.f.msize - first), (size_t)0, dst.u.f.msize); } @@ -10383,22 +10383,22 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_bit_set_d(d, dst.u.f.epos, dst.u.f.esize, expo); /* Copy mantissa into destination */ - H5T_bit_copy(d, dst.u.f.mpos, int_buf, 0, buf_size*8 > dst.u.f.msize ? dst.u.f.msize : buf_size*8); + H5T_bit_copy(d, dst.u.f.mpos, int_buf, (size_t)0, (buf_size * 8) > dst.u.f.msize ? dst.u.f.msize : buf_size * 8); } padding: /* * Set padding areas in destination. */ - if (dst.offset>0) { - assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad); - H5T_bit_set (d, 0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad)); + if(dst.offset > 0) { + HDassert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); + H5T_bit_set(d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad)); } - if (dst.offset+dst.prec!=8*dst_p->shared->size) { - assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad); - H5T_bit_set (d, dst.offset+dst.prec, - 8*dst_p->shared->size - (dst.offset+ dst.prec), - (hbool_t)(H5T_PAD_ONE==dst.msb_pad)); + if(dst.offset + dst.prec != 8 * dst_p->shared->size) { + HDassert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); + H5T_bit_set(d, dst.offset + dst.prec, + 8 * dst_p->shared->size - (dst.offset + dst.prec), + (hbool_t)(H5T_PAD_ONE == dst.msb_pad)); } /* diff --git a/test/cache_common.c b/test/cache_common.c index dc19ac2..8cec96c 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -711,7 +711,11 @@ herr_t flush(H5F_t *f, hid_t UNUSED dxpl_id, hbool_t dest, - haddr_t addr, + haddr_t +#ifdef NDEBUG + UNUSED +#endif /* NDEBUG */ + addr, void *thing, unsigned * flags_ptr) { @@ -1336,7 +1340,7 @@ dirty_entry(H5C_t * cache_ptr, } else { - mark_pinned_entry_dirty(cache_ptr, type, idx, FALSE, 0); + mark_pinned_entry_dirty(cache_ptr, type, idx, FALSE, (size_t)0); } } @@ -1793,7 +1797,7 @@ verify_entry_status(H5C_t * cache_ptr, struct expected_entry_status expected[]) { static char msg[128]; - hbool_t in_cache; + hbool_t in_cache = FALSE; /* will set to TRUE if necessary */ int i; test_entry_t * entry_ptr; test_entry_t * base_addr; diff --git a/test/gen_filters.c b/test/gen_filters.c index b1e9e38..fa9cc58 100644 --- a/test/gen_filters.c +++ b/test/gen_filters.c @@ -29,48 +29,47 @@ 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 */ - hsize_t dims[1]={20}; /* dataspace dimensions */ - hsize_t chunk_dims[1]={10}; /* chunk dimensions */ +#if defined H5_HAVE_FILTER_FLETCHER32 + 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] = {20}; /* dataspace dimensions */ + hsize_t chunk_dims[1] = {10}; /* chunk dimensions */ int buf[20]; - int rank=1; + int rank = 1; int i; - for (i=0; i<20; i++){ - buf[i]=1; - } + for(i = 0; i < 20; i++) + buf[i] = 1; -#if defined H5_HAVE_FILTER_FLETCHER32 /* create a file using default properties */ - fid=H5Fcreate(TESTFILE,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); + if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* create a data space */ - if ((sid = H5Screate_simple(rank,dims,NULL))<0) goto error; + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto error; /* create dcpl */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if(H5Pset_chunk(dcpl,rank,chunk_dims)<0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5Pset_chunk(dcpl, rank, chunk_dims) < 0) goto error; - if (H5Pset_fletcher32 (dcpl)<0) goto error; + if(H5Pset_fletcher32(dcpl) < 0) goto error; /* create a dataset */ - if ((dsid = H5Dcreate(fid,"dset",H5T_NATIVE_INT,sid,dcpl)) <0) goto error; + if((dsid = H5Dcreate(fid, "dset", H5T_NATIVE_INT, sid, dcpl)) < 0) goto error; - if(H5Dwrite(dsid,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) - goto error; + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; /* close */ - if (H5Pclose (dcpl)<0) goto error; - if (H5Dclose (dsid)<0) goto error; - if (H5Sclose (sid)<0) goto error; - if (H5Fclose (fid)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Dclose(dsid) < 0) goto error; + if(H5Sclose(sid) < 0) goto error; + if(H5Fclose(fid) < 0) goto error; -#endif +#endif /* H5_HAVE_FILTER_FLETCHER32 */ return 0; +#if defined H5_HAVE_FILTER_FLETCHER32 error: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -79,6 +78,7 @@ error: H5Fclose(fid); } H5E_END_TRY; return -1; +#endif /* H5_HAVE_FILTER_FLETCHER32 */ } /* end test_filters_endianess() */ diff --git a/test/gen_new_fill.c b/test/gen_new_fill.c index fc7c246..b688d44 100644 --- a/test/gen_new_fill.c +++ b/test/gen_new_fill.c @@ -29,53 +29,53 @@ #define FILENAME "fill_new.h5" -int main() +int +main(void) { - hid_t file=-1, dcpl=-1, space=-1, dset1=-1, dset2=-1; - hsize_t cur_size[2]={8, 8}; - H5D_space_status_t allocation; - int fill_val1 = 4444, fill_val2=5555; + hid_t file=-1, dcpl=-1, space=-1, dset1=-1, dset2=-1; + hsize_t cur_size[2]={8, 8}; + H5D_space_status_t allocation; + int fill_val1 = 4444, fill_val2=5555; - if((file=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) - <0) goto error; - if((space=H5Screate_simple(2, cur_size, cur_size))<0) goto error; - if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; + if((file=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) <0) goto error; + if((space=H5Screate_simple(2, cur_size, cur_size))<0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - /* Create a dataset with space being allocated and fill value written */ - if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error; - if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val1)<0) goto error; - if((dset1 = H5Dcreate(file, "dset1", H5T_NATIVE_INT, space, dcpl))<0) - goto error; - if (H5Dget_space_status(dset1, &allocation)<0) goto error; - if (allocation == H5D_SPACE_STATUS_NOT_ALLOCATED) { - puts(" Got unallocated space instead of allocated."); - printf(" Got %d\n", allocation); - goto error; - } - if(H5Dclose(dset1)<0) goto error; + /* Create a dataset with space being allocated and fill value written */ + if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val1)<0) goto error; + if((dset1 = H5Dcreate(file, "dset1", H5T_NATIVE_INT, space, dcpl))<0) + goto error; + if (H5Dget_space_status(dset1, &allocation)<0) goto error; + if (allocation == H5D_SPACE_STATUS_NOT_ALLOCATED) { + puts(" Got unallocated space instead of allocated."); + printf(" Got %d\n", allocation); + goto error; + } + if(H5Dclose(dset1)<0) goto error; - /* Create a dataset with space allocation being delayed */ - if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error; - if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val2)<0) goto error; - if((dset2 = H5Dcreate(file, "dset2", H5T_NATIVE_INT, space, dcpl))<0) - goto error; - if (H5Dget_space_status(dset2, &allocation)<0) goto error; - if (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { - puts(" Got allocated space instead of unallocated."); - printf(" Got %d\n", allocation); - goto error; - } - if(H5Dclose(dset2)<0) goto error; + /* Create a dataset with space allocation being delayed */ + if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val2)<0) goto error; + if((dset2 = H5Dcreate(file, "dset2", H5T_NATIVE_INT, space, dcpl))<0) + goto error; + if (H5Dget_space_status(dset2, &allocation)<0) goto error; + if (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { + puts(" Got allocated space instead of unallocated."); + printf(" Got %d\n", allocation); + goto error; + } + if(H5Dclose(dset2)<0) goto error; - if(H5Sclose(space)<0) goto error; - if(H5Pclose(dcpl)<0) goto error; - if(H5Fclose(file)<0) goto error; + if(H5Sclose(space)<0) goto error; + if(H5Pclose(dcpl)<0) goto error; + if(H5Fclose(file)<0) goto error; - return 0; + return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(space); @@ -85,3 +85,4 @@ int main() } H5E_END_TRY; return 1; } + diff --git a/test/gen_noencoder.c b/test/gen_noencoder.c index 05a2ff1..8c85df3 100644 --- a/test/gen_noencoder.c +++ b/test/gen_noencoder.c @@ -30,51 +30,53 @@ * *------------------------------------------------------------------------- */ -main() +int +main(void) { - hid_t file_id; - hid_t dset_id; - hid_t dcpl_id; - hid_t space_id; - hsize_t dims, maxdims; - int fill = 0; - int write_buf[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + hid_t file_id; + hid_t dset_id; + hid_t dcpl_id; + hid_t space_id; + hsize_t dims, maxdims; + int fill = 0; + int write_buf[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - file_id = H5Fcreate("noencoder.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file_id = H5Fcreate("noencoder.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - dims = 10; - maxdims = H5S_UNLIMITED; - space_id = H5Screate_simple(1, &dims, &maxdims); + dims = 10; + maxdims = H5S_UNLIMITED; + space_id = H5Screate_simple(1, &dims, &maxdims); - dcpl_id = H5Pcreate(H5P_DATASET_CREATE); - H5Pset_chunk(dcpl_id, 1, &dims); - H5Pset_szip(dcpl_id, H5_SZIP_NN_OPTION_MASK, 4); - H5Pset_fill_value(dcpl_id, H5T_NATIVE_INT, &fill); - H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC); + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + H5Pset_chunk(dcpl_id, 1, &dims); + H5Pset_szip(dcpl_id, H5_SZIP_NN_OPTION_MASK, 4); + H5Pset_fill_value(dcpl_id, H5T_NATIVE_INT, &fill); + H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC); - /* Create dataset noencoder_szip_dset.h5 */ - dset_id = H5Dcreate(file_id, "noencoder_szip_dset.h5", H5T_NATIVE_INT, space_id, dcpl_id); +/* Create dataset noencoder_szip_dset.h5 */ + dset_id = H5Dcreate(file_id, "noencoder_szip_dset.h5", H5T_NATIVE_INT, space_id, dcpl_id); - H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf); + H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf); - H5Pclose(dcpl_id); - H5Dclose(dset_id); + H5Pclose(dcpl_id); + H5Dclose(dset_id); - dcpl_id = H5Pcreate(H5P_DATASET_CREATE); - H5Pset_chunk(dcpl_id, 1, &dims); - H5Pset_szip(dcpl_id, H5_SZIP_NN_OPTION_MASK, 4); - H5Pset_shuffle(dcpl_id); - H5Pset_fletcher32(dcpl_id); - H5Pset_fill_value(dcpl_id, H5T_NATIVE_INT, &fill); - H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC); + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + H5Pset_chunk(dcpl_id, 1, &dims); + H5Pset_szip(dcpl_id, H5_SZIP_NN_OPTION_MASK, 4); + H5Pset_shuffle(dcpl_id); + H5Pset_fletcher32(dcpl_id); + H5Pset_fill_value(dcpl_id, H5T_NATIVE_INT, &fill); + H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC); - /* Create dataset noencoder_szip_shuffle_fletcher_dset.h5 */ - dset_id = H5Dcreate(file_id, "noencoder_szip_shuffle_fletcher_dset.h5", H5T_NATIVE_INT, space_id, dcpl_id); +/* Create dataset noencoder_szip_shuffle_fletcher_dset.h5 */ + dset_id = H5Dcreate(file_id, "noencoder_szip_shuffle_fletcher_dset.h5", H5T_NATIVE_INT, space_id, dcpl_id); - H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf); + H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf); - H5Pclose(dcpl_id); - H5Dclose(dset_id); - H5Sclose(space_id); - H5Fclose(file_id); + H5Pclose(dcpl_id); + H5Dclose(dset_id); + H5Sclose(space_id); + H5Fclose(file_id); } + diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index d479797..dad7d27 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -61,9 +61,9 @@ main (void) if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* Create two groups in the second file */ - if((gid = H5Gcreate(fid2, "group", 0)) < 0) goto error; + if((gid = H5Gcreate(fid2, "group", (size_t)0)) < 0) goto error; if((H5Gclose(gid)) < 0) goto error; - if((gid = H5Gcreate(fid2, "group/subgroup", 0)) < 0) goto error; + if((gid = H5Gcreate(fid2, "group/subgroup", (size_t)0)) < 0) goto error; if((H5Gclose(gid)) < 0) goto error; /* Create an external link in the first file pointing to the group in the second file */ diff --git a/test/theap.c b/test/theap.c index 3ceb167..bfead3c 100644 --- a/test/theap.c +++ b/test/theap.c @@ -99,11 +99,11 @@ test_heap_init(void) /* Sort random numbers into increasing order */ HDmemcpy(inc_sort_num,rand_num,sizeof(test_obj)*NUM_ELEMS); - HDqsort(inc_sort_num,NUM_ELEMS,sizeof(test_obj),tst_inc_sort); + HDqsort(inc_sort_num, (size_t)NUM_ELEMS, sizeof(test_obj), tst_inc_sort); /* Sort random numbers into decreasing order */ HDmemcpy(dec_sort_num,rand_num,sizeof(test_obj)*NUM_ELEMS); - HDqsort(dec_sort_num,NUM_ELEMS,sizeof(test_obj),tst_dec_sort); + HDqsort(dec_sort_num, (size_t)NUM_ELEMS, sizeof(test_obj), tst_dec_sort); } /* end test_tst_init() */ /**************************************************************** @@ -310,7 +310,8 @@ test_heap_insert(void) ** "Core" routine called by test_heap_insert_many() routine. ** ****************************************************************/ -static void test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, int top_val) +static void +test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, int top_val) { H5HP_t *heap; /* Heap created */ ssize_t num; /* Number of elements in heap */ @@ -360,22 +361,22 @@ test_heap_insert_many(void) MESSAGE(6, ("Testing Inserting Many Objects Into Heaps\n")); /* Test creating a heap from random elements */ - test_heap_insert_many_core(H5HP_MAX_HEAP, rand_num,NUM_ELEMS,dec_sort_num[0].val); + test_heap_insert_many_core(H5HP_MAX_HEAP, rand_num, (size_t)NUM_ELEMS, dec_sort_num[0].val); /* Test creating a heap from elements in increasing order */ - test_heap_insert_many_core(H5HP_MAX_HEAP, inc_sort_num,NUM_ELEMS,dec_sort_num[0].val); + test_heap_insert_many_core(H5HP_MAX_HEAP, inc_sort_num, (size_t)NUM_ELEMS, dec_sort_num[0].val); /* Test creating a heap from elements in decreasing order */ - test_heap_insert_many_core(H5HP_MAX_HEAP, dec_sort_num,NUM_ELEMS,dec_sort_num[0].val); + test_heap_insert_many_core(H5HP_MAX_HEAP, dec_sort_num, (size_t)NUM_ELEMS, dec_sort_num[0].val); /* Test creating a heap from random elements */ - test_heap_insert_many_core(H5HP_MIN_HEAP, rand_num,NUM_ELEMS,inc_sort_num[0].val); + test_heap_insert_many_core(H5HP_MIN_HEAP, rand_num, (size_t)NUM_ELEMS, inc_sort_num[0].val); /* Test creating a heap from elements in increasing order */ - test_heap_insert_many_core(H5HP_MIN_HEAP, inc_sort_num,NUM_ELEMS,inc_sort_num[0].val); + test_heap_insert_many_core(H5HP_MIN_HEAP, inc_sort_num, (size_t)NUM_ELEMS, inc_sort_num[0].val); /* Test creating a heap from elements in decreasing order */ - test_heap_insert_many_core(H5HP_MIN_HEAP, dec_sort_num,NUM_ELEMS,inc_sort_num[0].val); + test_heap_insert_many_core(H5HP_MIN_HEAP, dec_sort_num, (size_t)NUM_ELEMS, inc_sort_num[0].val); } /* end test_heap_insert_many() */ @@ -670,22 +671,22 @@ test_heap_remove_many(void) MESSAGE(6, ("Testing Removing Many Objects From Heaps\n")); /* Test removing objects from maximum heap with random elements */ - test_heap_remove_many_core(H5HP_MAX_HEAP, rand_num,NUM_ELEMS); + test_heap_remove_many_core(H5HP_MAX_HEAP, rand_num, (size_t)NUM_ELEMS); /* Test removing objects from maximum heap with elements already sorted in increasing order */ - test_heap_remove_many_core(H5HP_MAX_HEAP, inc_sort_num,NUM_ELEMS); + test_heap_remove_many_core(H5HP_MAX_HEAP, inc_sort_num, (size_t)NUM_ELEMS); /* Test removing objects from maximum heap with elements already sorted in decreasing order */ - test_heap_remove_many_core(H5HP_MAX_HEAP, dec_sort_num,NUM_ELEMS); + test_heap_remove_many_core(H5HP_MAX_HEAP, dec_sort_num, (size_t)NUM_ELEMS); /* Test removing objects from minimum heap with random elements */ - test_heap_remove_many_core(H5HP_MIN_HEAP, rand_num,NUM_ELEMS); + test_heap_remove_many_core(H5HP_MIN_HEAP, rand_num, (size_t)NUM_ELEMS); /* Test removing objects from minimum heap with elements already sorted in increasing order */ - test_heap_remove_many_core(H5HP_MIN_HEAP, inc_sort_num,NUM_ELEMS); + test_heap_remove_many_core(H5HP_MIN_HEAP, inc_sort_num, (size_t)NUM_ELEMS); /* Test removing objects from minimum heap with elements already sorted in decreasing order */ - test_heap_remove_many_core(H5HP_MIN_HEAP, dec_sort_num,NUM_ELEMS); + test_heap_remove_many_core(H5HP_MIN_HEAP, dec_sort_num, (size_t)NUM_ELEMS); } /* end test_heap_remove_many() */ -- cgit v0.12