diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-01-09 21:22:30 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-01-09 21:22:30 (GMT) |
commit | 35bc545296209684a5c46db0cde11beb9403a4dc (patch) | |
tree | 98b5a037ed928085b98abc1fee71fc62f81073c1 /test/fillval.c | |
parent | 1290c4808d3e9890c765b1445f66b823c9026734 (diff) | |
download | hdf5-35bc545296209684a5c46db0cde11beb9403a4dc.zip hdf5-35bc545296209684a5c46db0cde11beb9403a4dc.tar.gz hdf5-35bc545296209684a5c46db0cde11beb9403a4dc.tar.bz2 |
[svn-r3252] Purpose:
Code cleanup.
Description:
Fixed _lots_ (I mean _tons_) of warnings spit out by the gcc with the
extra warnings. Including a few show-stoppers for compression on IRIX
machines.
Solution:
Changed lots of variables' types to more sensible and consistent types,
more range-checking, more variable typecasts, etc.
Platforms tested:
FreeBSD 4.2 (hawkwind), IRIX64-64 (modi4)
Diffstat (limited to 'test/fillval.c')
-rw-r--r-- | test/fillval.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/fillval.c b/test/fillval.c index f5f9700..86fa6a7 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -380,7 +380,8 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) nelmts *= hs_size[i]; } if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error; - buf = malloc(nelmts*sizeof(int)); + assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/ + buf = malloc((size_t)(nelmts*sizeof(int))); for (i=0; i<nelmts; i++) buf[i] = 9999; if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL)<0) goto error; @@ -519,7 +520,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4]; if ((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666))<0 || close(fd)<0) goto error; - if (H5Pset_external(dcpl, FILE_NAME_RAW, 0, nelmts*sizeof(int))<0) + if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int))<0) goto error; } #endif @@ -577,7 +578,8 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) nelmts *= hs_size[i]; } if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error; - buf = malloc(nelmts*sizeof(int)); + assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/ + buf = malloc((size_t)(nelmts*sizeof(int))); for (i=0; i<nelmts; i++) buf[i] = 9999; if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL)<0) goto error; |