From owner-svn-src-head@FreeBSD.ORG Sat Mar 28 05:45:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 082E31065672; Sat, 28 Mar 2009 05:45:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8AFF8FC19; Sat, 28 Mar 2009 05:45:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2S5jT0u085869; Sat, 28 Mar 2009 05:45:29 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2S5jTUA085861; Sat, 28 Mar 2009 05:45:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903280545.n2S5jTUA085861@svn.freebsd.org> From: Xin LI Date: Sat, 28 Mar 2009 05:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190484 - in head/lib/libc/db: btree hash recno X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2009 05:45:30 -0000 Author: delphij Date: Sat Mar 28 05:45:29 2009 New Revision: 190484 URL: http://svn.freebsd.org/changeset/base/190484 Log: Several signed/unsigned warning fixes. Modified: head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_split.c head/lib/libc/db/hash/hash.c head/lib/libc/db/hash/hash.h head/lib/libc/db/hash/hash_bigkey.c head/lib/libc/db/hash/hash_log2.c head/lib/libc/db/recno/rec_close.c head/lib/libc/db/recno/rec_put.c Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/btree/bt_put.c Sat Mar 28 05:45:29 2009 (r190484) @@ -197,7 +197,7 @@ delete: if (__bt_dleaf(t, key, h, idx) * into the offset array, shift the pointers up. */ nbytes = NBLEAFDBT(key->size, data->size); - if (h->upper - h->lower < nbytes + sizeof(indx_t)) { + if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) { if ((status = __bt_split(t, h, key, data, dflags, nbytes, idx)) != RET_SUCCESS) return (status); @@ -278,7 +278,7 @@ bt_fast(BTREE *t, const DBT *key, const * have to search to get split stack. */ nbytes = NBLEAFDBT(key->size, data->size); - if (h->upper - h->lower < nbytes + sizeof(indx_t)) + if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) goto miss; if (t->bt_order == FORWARD) { Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/btree/bt_split.c Sat Mar 28 05:45:29 2009 (r190484) @@ -205,7 +205,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT } /* Split the parent page if necessary or shift the indices. */ - if (h->upper - h->lower < nbytes + sizeof(indx_t)) { + if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) { sp = h; h = h->pgno == P_ROOT ? bt_root(t, h, &l, &r, &skip, nbytes) : Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/hash/hash.c Sat Mar 28 05:45:29 2009 (r190484) @@ -164,7 +164,7 @@ __hash_open(const char *file, int flags, if (hashp->VERSION != HASHVERSION && hashp->VERSION != OLDHASHVERSION) RETURN_ERROR(EFTYPE, error1); - if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY) + if ((int32_t)hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY) RETURN_ERROR(EFTYPE, error1); /* * Figure out how many segments we need. Max_Bucket is the @@ -736,7 +736,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d break; } hashp->cbucket = bucket; - if (hashp->cbucket > hashp->MAX_BUCKET) { + if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) { hashp->cbucket = -1; return (ABNORMAL); } @@ -858,7 +858,7 @@ hash_realloc(SEGMENT **p_ptr, int oldsiz u_int32_t __call_hash(HTAB *hashp, char *k, int len) { - int n, bucket; + unsigned int n, bucket; n = hashp->hash(k, len); bucket = n & hashp->HIGH_MASK; Modified: head/lib/libc/db/hash/hash.h ============================================================================== --- head/lib/libc/db/hash/hash.h Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/hash/hash.h Sat Mar 28 05:45:29 2009 (r190484) @@ -71,11 +71,11 @@ typedef struct hashhdr { /* Disk reside int32_t ovfl_point; /* Where overflow pages are being * allocated */ int32_t last_freed; /* Last overflow page freed */ - int32_t max_bucket; /* ID of Maximum bucket in use */ - int32_t high_mask; /* Mask to modulo into entire table */ - int32_t low_mask; /* Mask to modulo into lower half of + u_int32_t max_bucket; /* ID of Maximum bucket in use */ + u_int32_t high_mask; /* Mask to modulo into entire table */ + u_int32_t low_mask; /* Mask to modulo into lower half of * table */ - int32_t ffactor; /* Fill factor */ + u_int32_t ffactor; /* Fill factor */ int32_t nkeys; /* Number of keys in hash table */ int32_t hdrpages; /* Size of table header */ int32_t h_charkey; /* value of hash(CHARKEY) */ Modified: head/lib/libc/db/hash/hash_bigkey.c ============================================================================== --- head/lib/libc/db/hash/hash_bigkey.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/hash/hash_bigkey.c Sat Mar 28 05:45:29 2009 (r190484) @@ -86,7 +86,8 @@ int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) { u_int16_t *p; - int key_size, n, val_size; + int key_size, n; + unsigned int val_size; u_int16_t space, move_bytes, off; char *cp, *key_data, *val_data; Modified: head/lib/libc/db/hash/hash_log2.c ============================================================================== --- head/lib/libc/db/hash/hash_log2.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/hash/hash_log2.c Sat Mar 28 05:45:29 2009 (r190484) @@ -36,9 +36,10 @@ static char sccsid[] = "@(#)hash_log2.c #include __FBSDID("$FreeBSD$"); -#include - #include +#include "hash.h" +#include "page.h" +#include "extern.h" u_int32_t __log2(u_int32_t num) Modified: head/lib/libc/db/recno/rec_close.c ============================================================================== --- head/lib/libc/db/recno/rec_close.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/recno/rec_close.c Sat Mar 28 05:45:29 2009 (r190484) @@ -150,7 +150,7 @@ __rec_sync(const DB *dbp, u_int flags) status = (dbp->seq)(dbp, &key, &data, R_FIRST); while (status == RET_SUCCESS) { if (_write(t->bt_rfd, data.data, data.size) != - data.size) + (ssize_t)data.size) return (RET_ERROR); status = (dbp->seq)(dbp, &key, &data, R_NEXT); } @@ -162,7 +162,7 @@ __rec_sync(const DB *dbp, u_int flags) while (status == RET_SUCCESS) { iov[0].iov_base = data.data; iov[0].iov_len = data.size; - if (_writev(t->bt_rfd, iov, 2) != data.size + 1) + if (_writev(t->bt_rfd, iov, 2) != (ssize_t)(data.size + 1)) return (RET_ERROR); status = (dbp->seq)(dbp, &key, &data, R_NEXT); } Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Sat Mar 28 04:56:56 2009 (r190483) +++ head/lib/libc/db/recno/rec_put.c Sat Mar 28 05:45:29 2009 (r190484) @@ -251,7 +251,7 @@ __rec_iput(BTREE *t, recno_t nrec, const * the offset array, shift the pointers up. */ nbytes = NRLEAFDBT(data->size); - if (h->upper - h->lower < nbytes + sizeof(indx_t)) { + if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) { status = __bt_split(t, h, NULL, data, dflags, nbytes, idx); if (status == RET_SUCCESS) ++t->bt_nrecs;