Patch 7.3.740
Problem:    IOC tool complains about undefined behavior for int.
Solution:   Change to unsigned int. (Dominique Pelle)
Files:      src/hashtab.c, src/misc2.c


*** ../vim-7.3.739/src/hashtab.c        2010-08-15 21:57:25.000000000 +0200
--- src/hashtab.c       2012-11-28 18:27:46.000000000 +0100
***************
*** 138,144 ****
      hash_T    perturb;
      hashitem_T        *freeitem;
      hashitem_T        *hi;
!     int               idx;
  
  #ifdef HT_DEBUG
      ++hash_count_lookup;
--- 138,144 ----
      hash_T    perturb;
      hashitem_T        *freeitem;
      hashitem_T        *hi;
!     unsigned  idx;
  
  #ifdef HT_DEBUG
      ++hash_count_lookup;
***************
*** 150,156 ****
       * - skip over a removed item
       * - return if the item matches
       */
!     idx = (int)(hash & ht->ht_mask);
      hi = &ht->ht_array[idx];
  
      if (hi->hi_key == NULL)
--- 150,156 ----
       * - skip over a removed item
       * - return if the item matches
       */
!     idx = (unsigned)(hash & ht->ht_mask);
      hi = &ht->ht_array[idx];
  
      if (hi->hi_key == NULL)
***************
*** 176,182 ****
  #ifdef HT_DEBUG
        ++hash_count_perturb;       /* count a "miss" for hashtab lookup */
  #endif
!       idx = (int)((idx << 2) + idx + perturb + 1);
        hi = &ht->ht_array[idx & ht->ht_mask];
        if (hi->hi_key == NULL)
            return freeitem == NULL ? hi : freeitem;
--- 176,182 ----
  #ifdef HT_DEBUG
        ++hash_count_perturb;       /* count a "miss" for hashtab lookup */
  #endif
!       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;
***************
*** 342,348 ****
      hashitem_T        temparray[HT_INIT_SIZE];
      hashitem_T        *oldarray, *newarray;
      hashitem_T        *olditem, *newitem;
!     int               newi;
      int               todo;
      long_u    oldsize, newsize;
      long_u    minsize;
--- 342,348 ----
      hashitem_T        temparray[HT_INIT_SIZE];
      hashitem_T        *oldarray, *newarray;
      hashitem_T        *olditem, *newitem;
!     unsigned  newi;
      int               todo;
      long_u    oldsize, newsize;
      long_u    minsize;
***************
*** 448,460 ****
             * 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);
            newitem = &newarray[newi];
  
            if (newitem->hi_key != NULL)
                for (perturb = olditem->hi_hash; ; perturb >>= PERTURB_SHIFT)
                {
!                   newi = (int)((newi << 2) + newi + perturb + 1);
                    newitem = &newarray[newi & newmask];
                    if (newitem->hi_key == NULL)
                        break;
--- 448,460 ----
             * the algorithm to find an item in hash_lookup().  But we only
             * need to search for a NULL key, thus it's simpler.
             */
!           newi = (unsigned)(olditem->hi_hash & newmask);
            newitem = &newarray[newi];
  
            if (newitem->hi_key != NULL)
                for (perturb = olditem->hi_hash; ; perturb >>= PERTURB_SHIFT)
                {
!                   newi = (unsigned)((newi << 2U) + newi + perturb + 1U);
                    newitem = &newarray[newi & newmask];
                    if (newitem->hi_key == NULL)
                        break;
*** ../vim-7.3.739/src/misc2.c  2012-08-15 16:20:59.000000000 +0200
--- src/misc2.c 2012-11-28 18:27:46.000000000 +0100
***************
*** 3860,3866 ****
      ush temp; \
   \
      temp = (ush)keys[2] | 2; \
!     t = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff); \
  }
  
  /*
--- 3860,3866 ----
      ush temp; \
   \
      temp = (ush)keys[2] | 2; \
!     t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \
  }
  
  /*
***************
*** 4002,4008 ****
            ush temp;
  
            temp = (ush)keys[2] | 2;
!           temp = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff);
            UPDATE_KEYS_ZIP(*p ^= temp);
        }
      else
--- 4002,4008 ----
            ush temp;
  
            temp = (ush)keys[2] | 2;
!           temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff);
            UPDATE_KEYS_ZIP(*p ^= temp);
        }
      else
*** ../vim-7.3.739/src/version.c        2012-11-28 18:22:04.000000000 +0100
--- src/version.c       2012-11-28 18:28:00.000000000 +0100
***************
*** 727,728 ****
--- 727,730 ----
  {   /* Add new patch number below this line */
+ /**/
+     740,
  /**/

-- 
>From "know your smileys":
 ~#:-(  I just washed my hair, and I can't do nuthin' with it.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui