summaryrefslogtreecommitdiffstats
path: root/hl
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 /hl
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 'hl')
-rw-r--r--hl/tools/gif2h5/hdf2gif.c8
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index c2ddb10..cc7bab4 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -16,7 +16,7 @@
*/
#include <stdio.h>
-
+#include <assert.h>
#include "gif.h"
#define MAX_FILE_LEN 256
@@ -208,8 +208,10 @@ int main(int argc , char **argv)
return -1;
}
- RWidth = dim_sizes[1];
- RHeight = dim_sizes[0];
+ assert(dim_sizes[0]==(hsize_t)((int)dim_sizes[0]));
+ assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1]));
+ RWidth = (int)dim_sizes[1];
+ RHeight = (int)dim_sizes[0];
#ifdef UNUSED
w = dim_sizes[1];
h = dim_sizes[0];
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index b13b79a..9804098 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -152,7 +152,9 @@ static unsigned long cur_accum = 0;
static int cur_bits = 0;
#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1)
+#ifndef WIN32
#define min(a,b) ((a>b) ? b : a)
+#endif
#define XV_BITS 12 /* BITS was already defined on some systems */
#define MSDOS 1
#define HSIZE 5003 /* 80% occupancy */