diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-11-27 16:29:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-11-27 16:29:13 (GMT) |
commit | d456c2bb82be98bc2b7c1039927eb52258d1a0eb (patch) | |
tree | a7d8a65aef5d962c89b0965c86eb535917c023ad /src/H5Farray.c | |
parent | 05264c88788f9bd9b04a58673ded246904210235 (diff) | |
download | hdf5-d456c2bb82be98bc2b7c1039927eb52258d1a0eb.zip hdf5-d456c2bb82be98bc2b7c1039927eb52258d1a0eb.tar.gz hdf5-d456c2bb82be98bc2b7c1039927eb52258d1a0eb.tar.bz2 |
[svn-r4643] Purpose:
Code cleanup
Description:
Windows is generating hundreds of warnings from some of the practices in
the library. Mostly, they are because size_t is 32-bit and hsize_t is
64-bit on Windows and we were carelessly casting the larger values down to
the smaller ones without checking for overflow.
Also, some other small code cleanups,etc.
Solution:
Re-worked some algorithms to eliminate the casts and also added more
overflow checking for assignments and function parameters which needed
casts.
Kent did most of the work, I just went over his changes and fit them into
the the library code a bit better.
Platforms tested:
FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'src/H5Farray.c')
-rw-r--r-- | src/H5Farray.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/H5Farray.c b/src/H5Farray.c index 5874b67..6b4155c 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -142,7 +142,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, hsize_t file_start; /*byte offset to start */ hsize_t max_data = 0; /*bytes in dataset */ hsize_t elmt_size = 1; /*bytes per element */ - size_t nelmts, z; /*number of elements */ + hsize_t nelmts, z; /*number of elements */ unsigned ndims; /*stride dimensionality */ haddr_t addr; /*address in file */ int j; /*counters */ @@ -153,7 +153,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, H5P_genplist_t *plist=NULL; /* Property list */ #endif #ifdef COALESCE_READS - unsigned gather_reads; /* # of MPIO reads to gather */ + hsize_t gather_reads; /* # of MPIO reads to gather */ #endif FUNC_ENTER(H5F_arr_read, FAIL); @@ -242,8 +242,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, * and memory. Optimize the strides to result in the fewest number of * I/O requests. */ - mem_start = H5V_hyper_stride(ndims, hslab_size, mem_size, - mem_offset, mem_stride/*out*/); + H5_ASSIGN_OVERFLOW(mem_start,H5V_hyper_stride(ndims, hslab_size, mem_size, mem_offset, mem_stride/*out*/),hsize_t,size_t); file_start = H5V_hyper_stride(ndims, hslab_size, layout->dim, file_offset, file_stride/*out*/); H5V_stride_optimize2(&ndims, &elmt_size, hslab_size, @@ -311,7 +310,6 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, /* Track the number of reads to gather */ if(H5P_set(plist, H5D_XFER_GATHER_READS_NAME, &gather_reads)<0) HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve gather reads"); - #else for (z=0; z<nelmts; z++) { #endif @@ -433,7 +431,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, hsize_t file_start; /*byte offset to start */ hsize_t max_data = 0; /*bytes in dataset */ hsize_t elmt_size = 1; /*bytes per element */ - size_t nelmts, z; /*number of elements */ + hsize_t nelmts, z; /*number of elements */ unsigned ndims; /*dimensionality */ haddr_t addr; /*address in file */ int j; /*counters */ @@ -548,6 +546,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ H5V_vector_cpy(ndims, idx, hslab_size); nelmts = H5V_vector_reduce_product(ndims, hslab_size); + if (efl && efl->nused>0) { addr = 0; } else { |