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 /tools/h5ls/h5ls.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 'tools/h5ls/h5ls.c')
-rw-r--r-- | tools/h5ls/h5ls.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 8aa69f9..bfbe251 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1252,6 +1252,7 @@ list_attr (hid_t obj, const char *attr_name, void * UNUSED op_data) hsize_t size[64], nelmts=1; int ndims, i, n; size_t need; + hsize_t temp_need; void *buf; h5dump_t info; @@ -1314,7 +1315,10 @@ list_attr (hid_t obj, const char *attr_name, void * UNUSED op_data) p_type = h5tools_fixtype(type); } if (p_type>=0) { - need = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); + temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); + assert(temp_need==(hsize_t)((size_t)temp_need)); + need = (size_t)temp_need; + /*need = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));*/ buf = malloc(need); assert(buf); if (H5Aread(attr, p_type, buf)>=0) { |