]> andersk Git - splint.git/blobdiff - src/cstringTable.c
Fixed problem with assertion checking for negative shifts in
[splint.git] / src / cstringTable.c
index 61be3f776642aaaf3f046a7b93dee6e2ecb021e2..d53ab14f80a9eb55bdc75eb28bab362040f83f53 100644 (file)
@@ -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;  
This page took 0.062771 seconds and 4 git commands to generate.