Fixing compile warnings on Unix, patch from kiel@pobox.com (21494). r=cls@seawood.org,mcafee@netscape.com

This commit is contained in:
mcafee%netscape.com 1999-12-28 08:02:07 +00:00
Родитель caf725ed86
Коммит 9f3d5d8eb0
3 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -429,7 +429,7 @@ __big_return(
}
val->size = collect_data(hashp, bufp, (int)len, set_current);
if (val->size == -1)
if ((val->size + 1) == 0) // unsigned ints are not really negative
return (-1);
if (save_p->addr != save_addr) {
/* We are pretty short on buffers. */
@ -515,7 +515,7 @@ __big_keydata(
int set)
{
key->size = collect_key(hashp, bufp, 0, val, set);
if (key->size == -1)
if ((key->size + 1) == 0) // same compile warning about comparing signed and unsigned
return (-1);
key->data = (uint8 *)hashp->tmp_key;
return (0);

Просмотреть файл

@ -709,7 +709,7 @@ __get_page(HTAB *hashp,
if (!rsize)
bp[0] = 0; /* We hit the EOF, so initialize a new page */
else
if (rsize != size) {
if ((unsigned)rsize != size) {
errno = EFTYPE;
return (-1);
}
@ -750,7 +750,7 @@ __get_page(HTAB *hashp,
* the maximum number of entries
* in the array
*/
if(max > (size / sizeof(uint16)))
if((unsigned)max > (size / sizeof(uint16)))
return(DATABASE_CORRUPTED_ERROR);
/* do the byte order swap
@ -845,7 +845,7 @@ __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap)
* the maximum number of entries
* in the array
*/
if(max > (size / sizeof(uint16)))
if((unsigned)max > (size / sizeof(uint16)))
return(DATABASE_CORRUPTED_ERROR);
for (i = 0; i <= max; i++)
@ -862,7 +862,7 @@ __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap)
((wsize = write(fd, p, size)) == -1))
/* Errno is set */
return (-1);
if (wsize != size) {
if ((unsigned)wsize != size) {
errno = EFTYPE;
return (-1);
}
@ -957,16 +957,16 @@ overflow_page(HTAB *hashp)
/* Look through all the free maps to find the first free block */
first_page = hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT);
for ( i = first_page; i <= free_page; i++ ) {
for ( i = first_page; i <= (unsigned)free_page; i++ ) {
if (!(freep = (uint32 *)hashp->mapp[i]) &&
!(freep = fetch_bitmap(hashp, i)))
return (0);
if (i == free_page)
if (i == (unsigned)free_page)
in_use_bits = free_bit;
else
in_use_bits = (hashp->BSIZE << BYTE_SHIFT) - 1;
if (i == first_page) {
if (i == (unsigned)first_page) {
bit = hashp->LAST_FREED &
((hashp->BSIZE << BYTE_SHIFT) - 1);
j = bit / BITS_PER_MAP;
@ -1075,7 +1075,7 @@ found:
hashp->LAST_FREED = bit - 1;
/* Calculate the split number for this page */
for (i = 0; (i < splitnum) && (bit > hashp->SPARES[i]); i++) {}
for (i = 0; (i < (unsigned)splitnum) && (bit > hashp->SPARES[i]); i++) {}
offset = (i ? bit - hashp->SPARES[i - 1] : bit);
if (offset >= SPLITMASK)
return (0); /* Out of overflow pages */
@ -1110,7 +1110,7 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
ndx = (((uint16)addr) >> SPLITSHIFT);
bit_address =
(ndx ? hashp->SPARES[ndx - 1] : 0) + (addr & SPLITMASK) - 1;
if (bit_address < hashp->LAST_FREED)
if (bit_address < (unsigned)hashp->LAST_FREED)
hashp->LAST_FREED = bit_address;
free_page = (bit_address >> (hashp->BSHIFT + BYTE_SHIFT));
free_bit = bit_address & ((hashp->BSIZE << BYTE_SHIFT) - 1);
@ -1202,7 +1202,7 @@ squeeze_key(uint16 *sp, const DBT * key, const DBT * val)
static uint32 *
fetch_bitmap(HTAB *hashp, uint32 ndx)
{
if (ndx >= hashp->nmaps)
if (ndx >= (unsigned)hashp->nmaps)
return (NULL);
if ((hashp->mapp[ndx] = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL)
return (NULL);

Просмотреть файл

@ -232,7 +232,7 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl
if (hashp->VERSION != HASHVERSION &&
hashp->VERSION != OLDHASHVERSION)
RETURN_ERROR(EFTYPE, error1);
if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != (unsigned)hashp->H_CHARKEY)
RETURN_ERROR(EFTYPE, error1);
if (hashp->NKEYS < 0) {
/*
@ -789,7 +789,7 @@ hash_access(
if (bp[1] >= REAL_KEY) {
/* Real key/data pair */
if (size == off - *bp &&
if (size == (unsigned)(off - *bp) &&
memcmp(kp, rbufp->page + *bp, size) == 0)
goto found;
off = bp[1];
@ -933,7 +933,7 @@ hash_seq(
for (bp = NULL; !bp || !bp[0]; ) {
if (!(bufp = hashp->cpage)) {
for (bucket = hashp->cbucket;
bucket <= hashp->MAX_BUCKET;
bucket <= (unsigned)hashp->MAX_BUCKET;
bucket++, hashp->cndx = 1) {
bufp = __get_buf(hashp, bucket, NULL, 0);
if (!bufp)
@ -1037,7 +1037,7 @@ __expand_table(HTAB *hashp)
hashp->OVFL_POINT = spare_ndx;
}
if (new_bucket > hashp->HIGH_MASK) {
if (new_bucket > (unsigned)hashp->HIGH_MASK) {
/* Starting a new doubling */
hashp->LOW_MASK = hashp->HIGH_MASK;
hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
@ -1073,7 +1073,7 @@ __call_hash(HTAB *hashp, char *k, size_t len)
n = hashp->hash(k, len);
bucket = n & hashp->HIGH_MASK;
if (bucket > hashp->MAX_BUCKET)
if (bucket > (unsigned)hashp->MAX_BUCKET)
bucket = bucket & hashp->LOW_MASK;
return (bucket);
}