summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-11-27 16:29:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-11-27 16:29:13 (GMT)
commitd456c2bb82be98bc2b7c1039927eb52258d1a0eb (patch)
treea7d8a65aef5d962c89b0965c86eb535917c023ad /tools/lib/h5tools.c
parent05264c88788f9bd9b04a58673ded246904210235 (diff)
downloadhdf5-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 'tools/lib/h5tools.c')
-rw-r--r--tools/lib/h5tools.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 569fe2f..c97914a 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -649,7 +649,8 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
ctx.p_min_idx[i] = 0;
H5Sget_simple_extent_dims(f_space, total_size, NULL);
- ctx.size_last_dim = total_size[ctx.ndims - 1];
+ assert(total_size[ctx.ndims - 1]==(hsize_t)((int)(total_size[ctx.ndims - 1])));
+ ctx.size_last_dim = (int)(total_size[ctx.ndims - 1]);
count = sset->count[ctx.ndims - 1];
sset->count[ctx.ndims - 1] = 1;
@@ -819,7 +820,10 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
ctx.p_min_idx[i] = 0;
H5Sget_simple_extent_dims(f_space, total_size, NULL);
- ctx.size_last_dim = total_size[ctx.ndims - 1];
+ /* printf("total_size[ctx.ndims-1]%d\n",total_size[ctx.ndims-1]);
+ printf("total_size cast %d\n",(int)(total_size[ctx.ndims-1])); */
+ /*assert(total_size[ctx.ndims - 1]==(hsize_t)((int)(total_size[ctx.ndims - 1])));*/
+ ctx.size_last_dim = (total_size[ctx.ndims - 1]);
/* calculate the number of elements we're going to print */
p_nelmts = 1;
@@ -975,8 +979,8 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
if (nelmts == 0)
return SUCCEED; /*nothing to print*/
-
- ctx.size_last_dim = ctx.p_max_idx[ctx.ndims - 1];
+ assert(ctx.p_max_idx[ctx.ndims - 1]==(hsize_t)((int)ctx.p_max_idx[ctx.ndims - 1]));
+ ctx.size_last_dim = (int)(ctx.p_max_idx[ctx.ndims - 1]);
/* Print it */
h5tools_dump_simple_data(stream, info, obj_id, &ctx,