X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/368f75ae50489f85a5f83f997f050653f48e5d18..b8dce3c7c286678208d27713c5380cfe35867101:/src/cstringTable.c diff --git a/src/cstringTable.c b/src/cstringTable.c index 61be3f7..d53ab14 100644 --- a/src/cstringTable.c +++ b/src/cstringTable.c @@ -200,7 +200,7 @@ void hbucket_free (/*@only@*/ hbucket h) void cstringTable_free (/*@only@*/ cstringTable h) { - int i; + unsigned int i; llassert (cstringTable_isDefined (h)); @@ -217,7 +217,7 @@ static int cstringTable_countCollisions (cstringTable h) { int nc = 0; - int i; + unsigned int i; llassert (cstringTable_isDefined (h)); @@ -234,7 +234,7 @@ static int cstringTable_countEmpty (cstringTable h) { int nc = 0; - int i; + unsigned int i; llassert (cstringTable_isDefined (h)); @@ -276,7 +276,7 @@ cstringTable_hash (/*@notnull@*/ cstringTable h, cstring key) /*@only@*/ cstringTable -cstringTable_create (int size) +cstringTable_create (unsigned int size) { int i; cstringTable h = (cstringTable) dmalloc (sizeof (*h)); @@ -297,7 +297,7 @@ cstringTable_create (int size) cstring cstringTable_unparse (cstringTable h) { cstring res = cstring_newEmpty (); - int i; + unsigned int i; if (cstringTable_isDefined (h)) { @@ -311,7 +311,7 @@ cstring cstringTable_unparse (cstringTable h) } } - res = message ("%qsize: %d, collisions: %d, empty: %d", + res = message ("%qsize: %u, collisions: %d, empty: %d", res, h->size, cstringTable_countCollisions (h), @@ -331,7 +331,7 @@ cstring cstringTable_unparse (cstringTable h) cstringTable_stats (cstringTable h) { llassert (cstringTable_isDefined (h)); - return (message ("size: %d, collisions: %d, empty: %d\n", + return (message ("size: %u, collisions: %d, empty: %d\n", h->size, cstringTable_countCollisions (h), cstringTable_countEmpty (h))); } @@ -343,9 +343,10 @@ cstringTable_rehash (/*@notnull@*/ cstringTable h) ** rehashing based (loosely) on code by Steve Harrison */ - int i; - int oldsize = h->size; - int newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */ + unsigned int i; + /* Fix provided by Thomas Mertz (int -> unsigned long), 21 Apr 2004 */ + unsigned long oldsize = h->size; + unsigned long newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */ hbucket *oldbuckets = h->buckets; h->size = newsize;