Fixing warning errors (9245)
authormcafee%netscape.com
Thu, 15 Jul 1999 00:17:20 +0000
changeset 146 06143e05f83bf7c76c4f1ed960e0afa52c621ff8
parent 144 a5cd7c8f874e1b9d960b884ca92e92f2fb928368
child 147 f1290a0dd6617035132d7870b81872a12de35b8f
push idunknown
push userunknown
push dateunknown
Fixing warning errors (9245)
dbm/include/extern.h
dbm/include/hash.h
dbm/src/h_bigkey.c
dbm/src/h_page.c
dbm/src/hash.c
dbm/src/hash_buf.c
dbm/src/nsres.c
dbm/tests/lots.c
--- a/dbm/include/extern.h
+++ b/dbm/include/extern.h
@@ -35,20 +35,20 @@
 
 BUFHEAD	*__add_ovflpage (HTAB *, BUFHEAD *);
 int	 __addel (HTAB *, BUFHEAD *, const DBT *, const DBT *);
 int	 __big_delete (HTAB *, BUFHEAD *);
 int	 __big_insert (HTAB *, BUFHEAD *, const DBT *, const DBT *);
 int	 __big_keydata (HTAB *, BUFHEAD *, DBT *, DBT *, int);
 int	 __big_return (HTAB *, BUFHEAD *, int, DBT *, int);
 int	 __big_split (HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
-		int, uint32, SPLIT_RETURN *);
+		uint32, uint32, SPLIT_RETURN *);
 int	 __buf_free (HTAB *, int, int);
 void	 __buf_init (HTAB *, int);
-uint32	 __call_hash (HTAB *, char *, int);
+uint32	 __call_hash (HTAB *, char *, size_t);
 int	 __delpair (HTAB *, BUFHEAD *, int);
 int	 __expand_table (HTAB *);
 int	 __find_bigpair (HTAB *, BUFHEAD *, int, char *, int);
 uint16	 __find_last_page (HTAB *, BUFHEAD **);
 void	 __free_ovflpage (HTAB *, BUFHEAD *);
 BUFHEAD	*__get_buf (HTAB *, uint32, BUFHEAD *, int);
 int	 __get_page (HTAB *, char *, uint32, int, int, int);
 int	 __ibitmap (HTAB *, int, int, int);
--- a/dbm/include/hash.h
+++ b/dbm/include/hash.h
@@ -178,17 +178,17 @@ typedef struct htab	 {		/* Memory reside
 
 #define SPLITSHIFT	11
 #define SPLITMASK	0x7FF
 #define SPLITNUM(N)	(((uint32)(N)) >> SPLITSHIFT)
 #define OPAGENUM(N)	((N) & SPLITMASK)
 #define	OADDR_OF(S,O)	((uint32)((uint32)(S) << SPLITSHIFT) + (O))
 
 #define BUCKET_TO_PAGE(B) \
-	(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((B)+1)-1] : 0)
+	(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((uint32)((B)+1))-1] : 0)
 #define OADDR_TO_PAGE(B) 	\
 	BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));
 
 /*
  * page.h contains a detailed description of the page format.
  *
  * Normally, keys and data are accessed from offset tables in the top of
  * each page which point to the beginning of the key and data.  There are
@@ -306,20 +306,20 @@ typedef struct htab	 {		/* Memory reside
 #define MAGIC		hdr.magic
 #define NEXT_FREE	hdr.next_free
 #define H_CHARKEY	hdr.h_charkey
 
 extern uint32 (*__default_hash) (const void *, size_t);
 void __buf_init(HTAB *hashp, int32 nbytes);
 int __big_delete(HTAB *hashp, BUFHEAD *bufp);
 BUFHEAD * __get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage);
-uint32 __call_hash(HTAB *hashp, char *k, int len);
+uint32 __call_hash(HTAB *hashp, char *k, size_t len);
 #include "page.h"
 extern int __big_split(HTAB *hashp, BUFHEAD *op,BUFHEAD *np,
-BUFHEAD *big_keyp,int addr,uint32   obucket, SPLIT_RETURN *ret);
+BUFHEAD *big_keyp,uint32 addr,uint32   obucket, SPLIT_RETURN *ret);
 void __free_ovflpage(HTAB *hashp, BUFHEAD *obufp);
 BUFHEAD * __add_ovflpage(HTAB *hashp, BUFHEAD *bufp);
 int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
 int __expand_table(HTAB *hashp);
 uint32 __log2(uint32 num);
 void __reclaim_buf(HTAB *hashp, BUFHEAD *bp);
 int __get_page(HTAB *hashp, char * p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap);
 int __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap);
--- a/dbm/src/h_bigkey.c
+++ b/dbm/src/h_bigkey.c
@@ -467,17 +467,17 @@ collect_data(
 		return (-1);
 
 	save_addr = bufp->addr;
 
 	if (bp[2] == FULL_KEY_DATA) {		/* End of Data */
 		totlen = len + mylen;
 		if (hashp->tmp_buf)
 			free(hashp->tmp_buf);
-		if ((hashp->tmp_buf = (char *)malloc(totlen)) == NULL)
+		if ((hashp->tmp_buf = (char *)malloc((size_t)totlen)) == NULL)
 			return (-1);
 		if (set) {
 			hashp->cndx = 1;
 			if (bp[0] == 2) {	/* No more buckets in chain */
 				hashp->cpage = NULL;
 				hashp->cbucket++;
 			} else {
 				hashp->cpage =
@@ -495,17 +495,17 @@ collect_data(
 		if (!xbp || ((totlen =
 		    collect_data(hashp, xbp, len + mylen, set)) < 1))
 			return (-1);
 	}
 	if (bufp->addr != save_addr) {
 		errno = EINVAL;			/* Out of buffers. */
 		return (-1);
 	}
-	memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], mylen);
+	memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], (size_t)mylen);
 	return (totlen);
 }
 
 /*
  * Fill in the key and data for this big pair.
  */
 extern int
 __big_keydata(
@@ -542,47 +542,47 @@ collect_key(
 	bp = (uint16 *)p;
 	mylen = hashp->BSIZE - bp[1];
 
 	save_addr = bufp->addr;
 	totlen = len + mylen;
 	if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) {    /* End of Key. */
 		if (hashp->tmp_key != NULL)
 			free(hashp->tmp_key);
-		if ((hashp->tmp_key = (char *)malloc(totlen)) == NULL)
+		if ((hashp->tmp_key = (char *)malloc((size_t)totlen)) == NULL)
 			return (-1);
 		if (__big_return(hashp, bufp, 1, val, set))
 			return (-1);
 	} else {
 		xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
 		if (!xbp || ((totlen =
 		    collect_key(hashp, xbp, totlen, val, set)) < 1))
 			return (-1);
 	}
 	if (bufp->addr != save_addr) {
 		errno = EINVAL;		/* MIS -- OUT OF BUFFERS */
 		return (-1);
 	}
-	memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], mylen);
+	memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], (size_t)mylen);
 	return (totlen);
 }
 
 /*
  * Returns:
  *  0 => OK
  * -1 => error
  */
 extern int
 __big_split(
 	HTAB *hashp,
 	BUFHEAD *op,	/* Pointer to where to put keys that go in old bucket */
 	BUFHEAD *np,	/* Pointer to new bucket page */
 			/* Pointer to first page containing the big key/data */
 	BUFHEAD *big_keyp,
-	int addr,	/* Address of big_keyp */
+	uint32 addr,	/* Address of big_keyp */
 	uint32   obucket,/* Old Bucket */
 	SPLIT_RETURN *ret)
 {
 	register BUFHEAD *tmpp;
 	register uint16 *tp;
 	BUFHEAD *bp;
 	DBT key, val;
 	uint32 change;
--- a/dbm/src/h_page.c
+++ b/dbm/src/h_page.c
@@ -154,17 +154,17 @@ long new_lseek(int fd, long offset, int 
 	   * the call
  	   */
  	  { 
  	 	char buffer[1024];
 	   	long len = seek_pos-end_pos;
 	   	memset(&buffer, 0, 1024);
 	   	while(len > 0)
 	      {
-	        write(fd, (char*)&buffer, (1024 > len ? len : 1024));
+	        write(fd, (char*)&buffer, (size_t)(1024 > len ? len : 1024));
 		    len -= 1024;
 		  }
 		return(lseek(fd, seek_pos, SEEK_SET));
 	  }		
 
 }
 
 /*
@@ -280,17 +280,18 @@ extern int
 {
 	register BUFHEAD *new_bufp, *old_bufp;
 	register uint16 *ino;
 	register uint16 *tmp_uint16_array;
 	register char *np;
 	DBT key, val;
     uint16 n, ndx;
 	int retval;
-	uint16 copyto, diff, off, moved;
+	uint16 copyto, diff, moved;
+	size_t off;
 	char *op;
 
 	copyto = (uint16)hashp->BSIZE;
 	off = (uint16)hashp->BSIZE;
 	old_bufp = __get_buf(hashp, obucket, NULL, 0);
 	if (old_bufp == NULL)
 		return (-1);
 	new_bufp = __get_buf(hashp, nbucket, NULL, 0);
@@ -679,18 +680,19 @@ extern BUFHEAD *
 extern int
 __get_page(HTAB *hashp,
 	char * p,
 	uint32 bucket, 
 	int is_bucket, 
 	int is_disk, 
 	int is_bitmap)
 {
-	register int fd, page, size;
-	int rsize;
+	register int fd, page;
+	size_t size;
+	ssize_t rsize;
 	uint16 *bp;
 
 	fd = hashp->fp;
 	size = hashp->BSIZE;
 
 	if ((fd == -1) || !is_disk) {
 		PAGE_INIT(p);
 		return (0);
@@ -814,18 +816,19 @@ extern int
  *
  * Returns:
  *	 0 ==> OK
  *	-1 ==>failure
  */
 extern int
 __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap)
 {
-	register int fd, page, size;
-	int wsize;
+	register int fd, page;
+	size_t size;
+	ssize_t wsize;
 
 	size = hashp->BSIZE;
 	if ((hashp->fp == -1) && open_temp(hashp))
 		return (-1);
 	fd = hashp->fp;
 
 	if (hashp->LORDER != BYTE_ORDER) {
 		register int i;
@@ -899,19 +902,19 @@ extern int
 /*
  * Initialize a new bitmap page.  Bitmap pages are left in memory
  * once they are read in.
  */
 extern int
 __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
 {
 	uint32 *ip;
-	int clearbytes, clearints;
+	size_t clearbytes, clearints;
 
-	if ((ip = (uint32 *)malloc(hashp->BSIZE)) == NULL)
+	if ((ip = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL)
 		return (1);
 	hashp->nmaps++;
 	clearints = ((nbits - 1) >> INT_BYTE_SHIFT) + 1;
 	clearbytes = clearints << INT_TO_BYTE;
 	(void)memset((char *)ip, 0, clearbytes);
 	(void)memset(((char *)ip) + clearbytes, 0xFF,
 	    hashp->BSIZE - clearbytes);
 	ip[clearints - 1] = ALL_SET << (nbits & BYTE_MASK);
@@ -1196,17 +1199,17 @@ squeeze_key(uint16 *sp, const DBT * key,
 	OFFSET(sp) = off;
 }
 
 static uint32 *
 fetch_bitmap(HTAB *hashp, uint32 ndx)
 {
 	if (ndx >= hashp->nmaps)
 		return (NULL);
-	if ((hashp->mapp[ndx] = (uint32 *)malloc(hashp->BSIZE)) == NULL)
+	if ((hashp->mapp[ndx] = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL)
 		return (NULL);
 	if (__get_page(hashp,
 	    (char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) {
 		free(hashp->mapp[ndx]);
 		hashp->mapp[ndx] = NULL; /* NEW: 9-11-95 */
 		return (NULL);
 	}                 
 	return (hashp->mapp[ndx]);
--- a/dbm/src/hash.c
+++ b/dbm/src/hash.c
@@ -76,17 +76,17 @@ static char sccsid[] = "@(#)hash.c	8.9 (
 static int   alloc_segs __P((HTAB *, int));
 static int   flush_meta __P((HTAB *));
 static int   hash_access __P((HTAB *, ACTION, DBT *, DBT *));
 static int   hash_close __P((DB *));
 static int   hash_delete __P((const DB *, const DBT *, uint));
 static int   hash_fd __P((const DB *));
 static int   hash_get __P((const DB *, const DBT *, DBT *, uint));
 static int   hash_put __P((const DB *, DBT *, const DBT *, uint));
-static void *hash_realloc __P((SEGMENT **, int, int));
+static void *hash_realloc __P((SEGMENT **, size_t, size_t));
 static int   hash_seq __P((const DB *, DBT *, DBT *, uint));
 static int   hash_sync __P((const DB *, uint));
 static int   hdestroy __P((HTAB *));
 static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *));
 static int   init_htab __P((HTAB *, int));
 #if BYTE_ORDER == LITTLE_ENDIAN
 static void  swap_header __P((HTAB *));
 static void  swap_header_copy __P((HASHHDR *, HASHHDR *));
@@ -419,17 +419,17 @@ init_hash(HTAB *hashp, const char *file,
 #endif
 
        	/* new code added by Lou to reduce block
        	 * size down below MAX_BSIZE
        	 */
        	if (hashp->BSIZE > MAX_BSIZE)
        		hashp->BSIZE = MAX_BSIZE;
 #endif
-		hashp->BSHIFT = __log2(hashp->BSIZE);
+		hashp->BSHIFT = __log2((uint32)hashp->BSIZE);
 	}
 
 	if (info) {
 		if (info->bsize) {
 			/* Round pagesize up to power of 2 */
 			hashp->BSHIFT = __log2(info->bsize);
 			hashp->BSIZE = 1 << hashp->BSHIFT;
 			if (hashp->BSIZE > MAX_BSIZE) {
@@ -472,35 +472,35 @@ init_htab(HTAB *hashp, int nelem)
 
 	/*
 	 * Divide number of elements by the fill factor and determine a
 	 * desired number of buckets.  Allocate space for the next greater
 	 * power of two number of buckets.
 	 */
 	nelem = (nelem - 1) / hashp->FFACTOR + 1;
 
-	l2 = __log2(MAX(nelem, 2));
+	l2 = __log2((uint32)MAX(nelem, 2));
 	nbuckets = 1 << l2;
 
 	hashp->SPARES[l2] = l2 + 1;
 	hashp->SPARES[l2 + 1] = l2 + 1;
 	hashp->OVFL_POINT = l2;
 	hashp->LAST_FREED = 2;
 
 	/* First bitmap page is at: splitpoint l2 page offset 1 */
-	if (__ibitmap(hashp, OADDR_OF(l2, 1), l2 + 1, 0))
+	if (__ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0))
 		return (-1);
 
 	hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1;
 	hashp->HIGH_MASK = (nbuckets << 1) - 1;
 	hashp->HDRPAGES = ((MAX(sizeof(HASHHDR), MINHDRSIZE) - 1) >>
 	    hashp->BSHIFT) + 1;
 
 	nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
-	nsegs = 1 << __log2(nsegs);
+	nsegs = 1 << __log2((uint32)nsegs);
 
 	if (nsegs > hashp->DSIZE)
 		hashp->DSIZE = nsegs;
 	return (alloc_segs(hashp, nsegs));
 }
 
 /********************** DESTROY/CLOSE ROUTINES ************************/
 
@@ -758,17 +758,18 @@ static int
 hash_access(
 	HTAB *hashp,
 	ACTION action,
 	DBT *key, DBT *val)
 {
 	register BUFHEAD *rbufp;
 	BUFHEAD *bufp, *save_bufp;
 	register uint16 *bp;
-	register long n, ndx, off, size;
+	register long n, ndx, off;
+	register size_t size;
 	register char *kp;
 	uint16 pageno;
 	uint32 ovfl_loop_count=0;
     int32 last_overflow_page_no = -1;
 
 #ifdef HASH_STATISTICS
 	hash_accesses++;
 #endif
@@ -817,17 +818,17 @@ hash_access(
 
 			/* FOR LOOP INIT */
 			bp = (uint16 *)rbufp->page;
 			n = *bp++;
 			ndx = 1;
 			off = hashp->BSIZE;
 		                } else if (bp[1] < REAL_KEY) {
 			if ((ndx =
-			    __find_bigpair(hashp, rbufp, ndx, kp, size)) > 0)
+			    __find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0)
 				goto found;
 			if (ndx == -2) {
 				bufp = rbufp;
 				if (!(pageno =
 				    __find_last_page(hashp, &bufp))) {
 					ndx = 0;
 					rbufp = bufp;
 					break;	/* FOR */
@@ -993,17 +994,18 @@ hash_seq(
  * Returns:
  *	 0 ==> OK
  *	-1 ==> Error
  */
 extern int
 __expand_table(HTAB *hashp)
 {
 	uint32 old_bucket, new_bucket;
-	int dirsize, new_segnum, spare_ndx;
+	int new_segnum, spare_ndx;
+	size_t dirsize;
 
 #ifdef HASH_STATISTICS
 	hash_expansions++;
 #endif
 	new_bucket = ++hashp->MAX_BUCKET;
 	old_bucket = (hashp->MAX_BUCKET & hashp->LOW_MASK);
 
 	new_segnum = new_bucket >> hashp->SSHIFT;
@@ -1014,27 +1016,27 @@ extern int
 		if (new_segnum >= hashp->DSIZE) {
 			/* Reallocate directory */
 			dirsize = hashp->DSIZE * sizeof(SEGMENT *);
 			if (!hash_realloc(&hashp->dir, dirsize, dirsize << 1))
 				return (-1);
 			hashp->DSIZE = dirsize << 1;
 		}
 		if ((hashp->dir[new_segnum] =
-		    (SEGMENT)calloc(hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
+		    (SEGMENT)calloc((size_t)hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
 			return (-1);
 		hashp->exsegs++;
 		hashp->nsegs++;
 	}
 	/*
 	 * If the split point is increasing (MAX_BUCKET's log base 2
 	 * * increases), we need to copy the current contents of the spare
 	 * split bucket to the next bucket.
 	 */
-	spare_ndx = __log2(hashp->MAX_BUCKET + 1);
+	spare_ndx = __log2((uint32)(hashp->MAX_BUCKET + 1));
 	if (spare_ndx > hashp->OVFL_POINT) {
 		hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
 		hashp->OVFL_POINT = spare_ndx;
 	}
 
 	if (new_bucket > hashp->HIGH_MASK) {
 		/* Starting a new doubling */
 		hashp->LOW_MASK = hashp->HIGH_MASK;
@@ -1046,31 +1048,31 @@ extern int
 
 /*
  * If realloc guarantees that the pointer is not destroyed if the realloc
  * fails, then this routine can go away.
  */
 static void *
 hash_realloc(
 	SEGMENT **p_ptr,
-	int oldsize, int newsize)
+	size_t oldsize, size_t newsize)
 {
 	register void *p;
 
 	if ((p = malloc(newsize))) {
 		memmove(p, *p_ptr, oldsize);
 		memset((char *)p + oldsize, 0, newsize - oldsize);
 		free(*p_ptr);
 		*p_ptr = (SEGMENT *)p;
 	}
 	return (p);
 }
 
 extern uint32
-__call_hash(HTAB *hashp, char *k, int len)
+__call_hash(HTAB *hashp, char *k, size_t len)
 {
 	uint32 n, bucket;
 
 	n = hashp->hash(k, len);
 	bucket = n & hashp->HIGH_MASK;
 	if (bucket > hashp->MAX_BUCKET)
 		bucket = bucket & hashp->LOW_MASK;
 	return (bucket);
@@ -1087,25 +1089,25 @@ alloc_segs(
 	int nsegs)
 {
 	register int i;
 	register SEGMENT store;
 
 	int save_errno;
 
 	if ((hashp->dir =
-	    (SEGMENT *)calloc(hashp->DSIZE, sizeof(SEGMENT *))) == NULL) {
+	    (SEGMENT *)calloc((size_t)hashp->DSIZE, sizeof(SEGMENT *))) == NULL) {
 		save_errno = errno;
 		(void)hdestroy(hashp);
 		errno = save_errno;
 		return (-1);
 	}
 	/* Allocate segments */
 	if ((store =
-	    (SEGMENT)calloc(nsegs << hashp->SSHIFT, sizeof(SEGMENT))) == NULL) {
+	    (SEGMENT)calloc((size_t)nsegs << hashp->SSHIFT, sizeof(SEGMENT))) == NULL) {
 		save_errno = errno;
 		(void)hdestroy(hashp);
 		errno = save_errno;
 		return (-1);
 	}
 	for (i = 0; i < nsegs; i++, hashp->nsegs++)
 		hashp->dir[i] = &store[i << hashp->SSHIFT];
 	return (0);
--- a/dbm/src/hash_buf.c
+++ b/dbm/src/hash_buf.c
@@ -211,25 +211,25 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD
 		if ((bp = (BUFHEAD *)malloc(sizeof(BUFHEAD))) == NULL)
 			return (NULL);
 
 		/* this memset is supposedly unnecessary but lets add
 		 * it anyways.
 		 */
 		memset(bp, 0xff, sizeof(BUFHEAD));
 
-		if ((bp->page = (char *)malloc(hashp->BSIZE)) == NULL) {
+		if ((bp->page = (char *)malloc((size_t)hashp->BSIZE)) == NULL) {
 			free(bp);
 			return (NULL);
 		}
 
 		/* this memset is supposedly unnecessary but lets add
 		 * it anyways.
 		 */
-		memset(bp->page, 0xff, hashp->BSIZE);
+		memset(bp->page, 0xff, (size_t)hashp->BSIZE);
 
 		if (hashp->nbufs)
 			hashp->nbufs--;
 	} else {
 		/* Kick someone out */
 		BUF_REMOVE(bp);
 		/*
 		 * If this is an overflow page with addr 0, it's already been
--- a/dbm/src/nsres.c
+++ b/dbm/src/nsres.c
@@ -44,17 +44,17 @@ HASHINFO res_hash_info = {
         0,
         0,   /* 64 * 1024U  */
         0};
 
 int GenKeyData(const char *library, int32 id, DBT *key)
 {
 	char idstr[10];
 	static char * strdata = NULL;
-	int len;
+	size_t len;
 
 	if (strdata)
 		free (strdata);
 
 	if (id == 0)
 		idstr[0] = '\0';
 	else
 	{
--- a/dbm/tests/lots.c
+++ b/dbm/tests/lots.c
@@ -129,34 +129,34 @@ DBT * MakeLargeKey(int32 num)
 	 */
 	low_bits = (num % 10000) + 1;
 
 	/* get the repeat char from the low 26 */
 	rep_char = (char) ((low_bits % 26) + 'a');
 
 	/* malloc a string low_bits wide */
 	size = low_bits*sizeof(char);
-	string_rv = (char *)malloc(size);
+	string_rv = (char *)malloc((size_t)size);
 
-	memset(string_rv, rep_char, size);
+	memset(string_rv, rep_char, (size_t)size);
 
 	rv.data = string_rv;
 	rv.size = size;
 
 	return(&rv);
 }
 
 DBT * MakeSmallKey(int32 num)
 {
 	static DBT rv;
 	static char data_string[64];
 
 	rv.data = data_string;
 
-	sprintf(data_string, "%ld", num);
+	sprintf(data_string, "%ld", (long)num);
 	rv.size = strlen(data_string);
 
 	return(&rv);
 
 }
 
 DBT * GenKey(int32 num, key_type_enum key_type)
 {
@@ -321,17 +321,17 @@ GenData(int32 num)
 	  }
 
 	n = rand();
 
 	n = n % 512;  /* bound to a 2K size */
 
 	
 	size = sizeof(int32)*(n+1);
-	int32_array = (int32 *) malloc(size);
+	int32_array = (int32 *) malloc((size_t)size);
 
 	memcpy(&int32_array[0], &n, sizeof(int32));
 
 	for(; n > 0; n--)
 	  {
 		memcpy(&int32_array[n], &num, sizeof(int32));
 	  }