From 3424f9f5d1c45e739480e16ab3faa272ca1569f8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 22 Mar 2006 13:11:24 -0500 Subject: [svn-r12128] Purpose: Code cleanup Description: Clean up some compiler warnings (esp. those flagged on Windows builds) Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest --- src/H5Dio.c | 4 ++-- src/H5Distore.c | 34 +++++++++------------------------- src/H5Dpkg.h | 6 ++---- src/H5Dselect.c | 4 ++-- src/H5HLdbg.c | 3 +-- src/H5Vprivate.h | 14 +++++++------- src/H5Zscaleoffset.c | 4 ++-- src/H5Zszip.c | 2 +- test/tmisc.c | 6 +++--- tools/h5repack/h5repack_main.c | 1 + tools/h5repack/h5repack_opttable.c | 1 + 11 files changed, 31 insertions(+), 48 deletions(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index f5513f0..dec068e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -2191,8 +2191,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f for(u=0; uf_ndims; u++) fm->total_chunks= fm->total_chunks*fm->chunks[u]; if(IS_H5FD_MPI(dataset->oloc.file)) { - - if(NULL == (fm->select_chunk = (hbool_t *) H5MM_calloc(fm->total_chunks*sizeof(hbool_t)))) + H5_CHECK_OVERFLOW(fm->total_chunks, hsize_t, size_t); + if(NULL == (fm->select_chunk = (hbool_t *) H5MM_calloc((size_t)fm->total_chunks * sizeof(hbool_t)))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") } diff --git a/src/H5Distore.c b/src/H5Distore.c index 570cf81..8ab2527 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -904,9 +904,8 @@ H5D_istore_iter_chunkmap (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt H5D_istore_it_ud5_t *udata = (H5D_istore_it_ud5_t *)_udata; const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; unsigned rank; - hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */ hsize_t chunk_index; - int ret_value = H5B_ITER_CONT; /* Return value */ + int ret_value = H5B_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_iter_chunkmap); @@ -915,20 +914,12 @@ H5D_istore_iter_chunkmap (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt if(H5V_chunk_index(rank,lt_key->offset,udata->common.mesg->u.chunk.dim,udata->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") -#if 0 - HDfprintf(stdout,"chunk index is %Hu\n",chunk_index); -#endif udata->chunk_addr[chunk_index] = addr; -#if 0 - HDfprintf(stdout,"chunk address is %Hu\n",addr); -#endif - done: +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D_istore_iter_allocated() */ - - /*------------------------------------------------------------------------- * Function: H5D_istore_iter_dump @@ -2463,30 +2454,24 @@ herr_t H5D_istore_chunkmap(const H5D_io_info_t *io_info, hsize_t total_chunks,haddr_t chunk_addr[],hsize_t down_chunks[]) { H5D_t *dset=io_info->dset; /* Local pointer to dataset info */ +#if 0 const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ H5D_rdcc_ent_t *ent; /*cache entry */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */ +#endif H5D_istore_it_ud5_t udata; - - hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /*current dataspace dimensions */ - hsize_t chunks[H5O_LAYOUT_NDIMS]; /*current number of chunks in each dimension */ - - int srank; /*current # of dimensions (signed) */ - unsigned rank; /*current # of dimensions */ - unsigned u; - hid_t dxpl_id = io_info->dxpl_id; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_chunkmap, 0) + FUNC_ENTER_NOAPI(H5D_istore_chunkmap, FAIL) HDassert(dset); #if 0 /* Fill the DXPL cache values for later use */ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't fill dxpl cache") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Construct dataset I/O info */ H5D_BUILD_IO_INFO(&io_info,dset,dxpl_cache,dxpl_id,NULL); @@ -2495,7 +2480,7 @@ H5D_istore_chunkmap(const H5D_io_info_t *io_info, hsize_t total_chunks,haddr_t c for(ent = rdcc->head; ent; ent = ent->next) { /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D_istore_flush_entry(&io_info, ent, FALSE)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, 0, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") } /* end for */ #endif @@ -2503,11 +2488,10 @@ H5D_istore_chunkmap(const H5D_io_info_t *io_info, hsize_t total_chunks,haddr_t c udata.common.mesg = &dset->shared->layout; udata.down_chunks = down_chunks; udata.chunk_addr = chunk_addr; - + if (H5B_iterate(dset->oloc.file, dxpl_id, H5B_ISTORE, H5D_istore_iter_chunkmap, dset->shared->layout.u.chunk.addr, &udata)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_chunkmap() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 615f728..4c1c663 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -249,13 +249,11 @@ H5_DLL size_t H5D_select_mgath (const void *_buf, H5_DLL herr_t H5D_select_read(H5D_io_info_t *io_info, size_t nelmts, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - haddr_t addr, - void *buf/*out*/); + haddr_t addr, void *buf/*out*/); H5_DLL herr_t H5D_select_write(H5D_io_info_t *io_info, size_t nelmts, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - haddr_t addr, - const void *buf/*out*/); + haddr_t addr, const void *buf/*out*/); /* Functions that operate on contiguous storage */ H5_DLL herr_t H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout); diff --git a/src/H5Dselect.c b/src/H5Dselect.c index df9d32f..928f90d 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -432,7 +432,7 @@ herr_t H5D_select_read(H5D_io_info_t *io_info, size_t nelmts, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - const haddr_t UNUSED addr, + haddr_t UNUSED addr, void *buf/*out*/) { H5S_sel_iter_t mem_iter; /* Memory selection iteration info */ @@ -576,7 +576,7 @@ herr_t H5D_select_write(H5D_io_info_t *io_info, size_t nelmts, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - const haddr_t UNUSED addr, + haddr_t UNUSED addr, const void *buf/*out*/) { H5S_sel_iter_t mem_iter; /* Memory selection iteration info */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 1dedaa5..bee7182 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -54,8 +54,7 @@ herr_t H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth) { H5HL_t *h = NULL; - int i, j, overlap, free_block; - uint8_t c; + int i, overlap, free_block; H5HL_free_t *freelist = NULL; uint8_t *marker = NULL; size_t amount_free = 0; diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 71f62b0..942381d 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -347,16 +347,16 @@ H5V_log2_gen(hsize_t n) unsigned r = 0; /* r will be log2(n) */ register unsigned int t, tt, ttt; /* temporaries */ - if((ttt = n >> 32)) - if((tt = n >> 48)) - r = (t = n >> 56) ? 56 + LogTable256[t] : 48 + LogTable256[tt & 0xFF]; + if((ttt = (unsigned)(n >> 32))) + if((tt = (unsigned)(n >> 48))) + r = (t = (unsigned)(n >> 56)) ? 56 + LogTable256[t] : 48 + LogTable256[tt & 0xFF]; else - r = (t = n >> 40) ? 40 + LogTable256[t] : 32 + LogTable256[ttt & 0xFF]; + r = (t = (unsigned)(n >> 40)) ? 40 + LogTable256[t] : 32 + LogTable256[ttt & 0xFF]; else - if((tt = n >> 16)) - r = (t = n >> 24) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; + if((tt = (unsigned)(n >> 16))) + r = (t = (unsigned)(n >> 24)) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; else - r = (t = n >> 8) ? 8 + LogTable256[t] : LogTable256[n]; + r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[n]; return(r); } /* H5V_log2_gen() */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 8326516..20f0c6e 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -991,11 +991,11 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu if(scale_type==H5Z_SO_FLOAT_DSCALE) { /* floating-point type, variable-minimum-bits */ D_val = (double)scale_factor; } else { /* integer type, or floating-point type with fixed-minimum-bits method */ - if(scale_factor>cd_values[H5Z_SCALEOFFSET_PARM_SIZE]*8) + if(scale_factor > (int)(cd_values[H5Z_SCALEOFFSET_PARM_SIZE] * 8)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "minimum number of bits exceeds maximum") /* no need to process data */ - if(scale_factor==cd_values[H5Z_SCALEOFFSET_PARM_SIZE]*8) { + if(scale_factor == (int)(cd_values[H5Z_SCALEOFFSET_PARM_SIZE] * 8)) { ret_value = *buf_size; goto done; } diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 1da1b39..e393ebd 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -141,7 +141,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dataspace (i.e. chunk) dimensions */ int ndims; /* Number of (chunk) dimensions */ H5T_order_t dtype_order; /* Datatype's endianness order */ - int dtype_size; /* Datatype's size (in bits) */ + size_t dtype_size; /* Datatype's size (in bits) */ size_t dtype_precision; /* Datatype's precision (in bits) */ size_t dtype_offset; /* Datatype's offset (in bits) */ hsize_t scanline; /* Size of dataspace's fastest changing dimension */ diff --git a/test/tmisc.c b/test/tmisc.c index 357291b..024e762 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -3625,13 +3625,13 @@ test_misc22(void) hid_t fdts[2]={H5T_NATIVE_FLOAT32, H5T_NATIVE_FLOAT64} */ - int prec[4] = {3,11,19,27}; + size_t prec[4] = {3,11,19,27}; int offsets[5] = {0,3,11,19,27}; int i,j,k; unsigned int flags; size_t cd_nelmts=32; unsigned int cd_values[32]; - int correct; + unsigned correct; if (h5_szip_can_encode() != 1) return; idts[0]=H5Tcopy(H5T_NATIVE_UINT8); @@ -3661,7 +3661,7 @@ test_misc22(void) if (offsets[k] > (H5Tget_size(idts[i])*8)) continue; /* skip irrelevant combinations */ if ((prec[j]+offsets[k]) > (H5Tget_size(idts[i])*8)) continue; - MESSAGE(5, (" Testing datatypes size=%d precision=%d offset=%d\n",H5Tget_size(idts[i]),prec[j],offsets[k])); + MESSAGE(5, (" Testing datatypes size=%d precision=%u offset=%d\n",H5Tget_size(idts[i]),(unsigned)prec[j],offsets[k])); /* Create the DCPL */ dcpl = H5Pcreate (H5P_DATASET_CREATE); diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index efedd95..127dc01 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -13,6 +13,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include #include "h5repack.h" static void usage(void); diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index d4c2532..17e8f2c 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -14,6 +14,7 @@ #include +#include #include "h5repack.h" -- cgit v0.12