Commits

Anonymous committed 2c12cd5

updated for version 7.3.740
Problem: IOC tool complains about undefined behavior for int.
Solution: Change to unsigned int. (Dominique Pelle)

  • Participants
  • Parent commits aca1563
  • Tags v7-3-740

Comments (0)

Files changed (3)

File src/hashtab.c

     hash_T	perturb;
     hashitem_T	*freeitem;
     hashitem_T	*hi;
-    int		idx;
+    unsigned	idx;
 
 #ifdef HT_DEBUG
     ++hash_count_lookup;
      * - skip over a removed item
      * - return if the item matches
      */
-    idx = (int)(hash & ht->ht_mask);
+    idx = (unsigned)(hash & ht->ht_mask);
     hi = &ht->ht_array[idx];
 
     if (hi->hi_key == NULL)
 #ifdef HT_DEBUG
 	++hash_count_perturb;	    /* count a "miss" for hashtab lookup */
 #endif
-	idx = (int)((idx << 2) + idx + perturb + 1);
+	idx = (unsigned)((idx << 2U) + idx + perturb + 1U);
 	hi = &ht->ht_array[idx & ht->ht_mask];
 	if (hi->hi_key == NULL)
 	    return freeitem == NULL ? hi : freeitem;
     hashitem_T	temparray[HT_INIT_SIZE];
     hashitem_T	*oldarray, *newarray;
     hashitem_T	*olditem, *newitem;
-    int		newi;
+    unsigned	newi;
     int		todo;
     long_u	oldsize, newsize;
     long_u	minsize;
 	     * the algorithm to find an item in hash_lookup().  But we only
 	     * need to search for a NULL key, thus it's simpler.
 	     */
-	    newi = (int)(olditem->hi_hash & newmask);
+	    newi = (unsigned)(olditem->hi_hash & newmask);
 	    newitem = &newarray[newi];
 
 	    if (newitem->hi_key != NULL)
 		for (perturb = olditem->hi_hash; ; perturb >>= PERTURB_SHIFT)
 		{
-		    newi = (int)((newi << 2) + newi + perturb + 1);
+		    newi = (unsigned)((newi << 2U) + newi + perturb + 1U);
 		    newitem = &newarray[newi & newmask];
 		    if (newitem->hi_key == NULL)
 			break;
     ush temp; \
  \
     temp = (ush)keys[2] | 2; \
-    t = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff); \
+    t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \
 }
 
 /*
 	    ush temp;
 
 	    temp = (ush)keys[2] | 2;
-	    temp = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff);
+	    temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff);
 	    UPDATE_KEYS_ZIP(*p ^= temp);
 	}
     else

File src/version.c

 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    740,
+/**/
     739,
 /**/
     738,