home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.740 < prev    next >
Encoding:
Internet Message Format  |  2012-11-27  |  4.7 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.740
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.740
  11. Problem:    IOC tool complains about undefined behavior for int.
  12. Solution:   Change to unsigned int. (Dominique Pelle)
  13. Files:        src/hashtab.c, src/misc2.c
  14.  
  15.  
  16. *** ../vim-7.3.739/src/hashtab.c    2010-08-15 21:57:25.000000000 +0200
  17. --- src/hashtab.c    2012-11-28 18:27:46.000000000 +0100
  18. ***************
  19. *** 138,144 ****
  20.       hash_T    perturb;
  21.       hashitem_T    *freeitem;
  22.       hashitem_T    *hi;
  23. !     int        idx;
  24.   
  25.   #ifdef HT_DEBUG
  26.       ++hash_count_lookup;
  27. --- 138,144 ----
  28.       hash_T    perturb;
  29.       hashitem_T    *freeitem;
  30.       hashitem_T    *hi;
  31. !     unsigned    idx;
  32.   
  33.   #ifdef HT_DEBUG
  34.       ++hash_count_lookup;
  35. ***************
  36. *** 150,156 ****
  37.        * - skip over a removed item
  38.        * - return if the item matches
  39.        */
  40. !     idx = (int)(hash & ht->ht_mask);
  41.       hi = &ht->ht_array[idx];
  42.   
  43.       if (hi->hi_key == NULL)
  44. --- 150,156 ----
  45.        * - skip over a removed item
  46.        * - return if the item matches
  47.        */
  48. !     idx = (unsigned)(hash & ht->ht_mask);
  49.       hi = &ht->ht_array[idx];
  50.   
  51.       if (hi->hi_key == NULL)
  52. ***************
  53. *** 176,182 ****
  54.   #ifdef HT_DEBUG
  55.       ++hash_count_perturb;        /* count a "miss" for hashtab lookup */
  56.   #endif
  57. !     idx = (int)((idx << 2) + idx + perturb + 1);
  58.       hi = &ht->ht_array[idx & ht->ht_mask];
  59.       if (hi->hi_key == NULL)
  60.           return freeitem == NULL ? hi : freeitem;
  61. --- 176,182 ----
  62.   #ifdef HT_DEBUG
  63.       ++hash_count_perturb;        /* count a "miss" for hashtab lookup */
  64.   #endif
  65. !     idx = (unsigned)((idx << 2U) + idx + perturb + 1U);
  66.       hi = &ht->ht_array[idx & ht->ht_mask];
  67.       if (hi->hi_key == NULL)
  68.           return freeitem == NULL ? hi : freeitem;
  69. ***************
  70. *** 342,348 ****
  71.       hashitem_T    temparray[HT_INIT_SIZE];
  72.       hashitem_T    *oldarray, *newarray;
  73.       hashitem_T    *olditem, *newitem;
  74. !     int        newi;
  75.       int        todo;
  76.       long_u    oldsize, newsize;
  77.       long_u    minsize;
  78. --- 342,348 ----
  79.       hashitem_T    temparray[HT_INIT_SIZE];
  80.       hashitem_T    *oldarray, *newarray;
  81.       hashitem_T    *olditem, *newitem;
  82. !     unsigned    newi;
  83.       int        todo;
  84.       long_u    oldsize, newsize;
  85.       long_u    minsize;
  86. ***************
  87. *** 448,460 ****
  88.            * the algorithm to find an item in hash_lookup().  But we only
  89.            * need to search for a NULL key, thus it's simpler.
  90.            */
  91. !         newi = (int)(olditem->hi_hash & newmask);
  92.           newitem = &newarray[newi];
  93.   
  94.           if (newitem->hi_key != NULL)
  95.           for (perturb = olditem->hi_hash; ; perturb >>= PERTURB_SHIFT)
  96.           {
  97. !             newi = (int)((newi << 2) + newi + perturb + 1);
  98.               newitem = &newarray[newi & newmask];
  99.               if (newitem->hi_key == NULL)
  100.               break;
  101. --- 448,460 ----
  102.            * the algorithm to find an item in hash_lookup().  But we only
  103.            * need to search for a NULL key, thus it's simpler.
  104.            */
  105. !         newi = (unsigned)(olditem->hi_hash & newmask);
  106.           newitem = &newarray[newi];
  107.   
  108.           if (newitem->hi_key != NULL)
  109.           for (perturb = olditem->hi_hash; ; perturb >>= PERTURB_SHIFT)
  110.           {
  111. !             newi = (unsigned)((newi << 2U) + newi + perturb + 1U);
  112.               newitem = &newarray[newi & newmask];
  113.               if (newitem->hi_key == NULL)
  114.               break;
  115. *** ../vim-7.3.739/src/misc2.c    2012-08-15 16:20:59.000000000 +0200
  116. --- src/misc2.c    2012-11-28 18:27:46.000000000 +0100
  117. ***************
  118. *** 3860,3866 ****
  119.       ush temp; \
  120.    \
  121.       temp = (ush)keys[2] | 2; \
  122. !     t = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff); \
  123.   }
  124.   
  125.   /*
  126. --- 3860,3866 ----
  127.       ush temp; \
  128.    \
  129.       temp = (ush)keys[2] | 2; \
  130. !     t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \
  131.   }
  132.   
  133.   /*
  134. ***************
  135. *** 4002,4008 ****
  136.           ush temp;
  137.   
  138.           temp = (ush)keys[2] | 2;
  139. !         temp = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff);
  140.           UPDATE_KEYS_ZIP(*p ^= temp);
  141.       }
  142.       else
  143. --- 4002,4008 ----
  144.           ush temp;
  145.   
  146.           temp = (ush)keys[2] | 2;
  147. !         temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff);
  148.           UPDATE_KEYS_ZIP(*p ^= temp);
  149.       }
  150.       else
  151. *** ../vim-7.3.739/src/version.c    2012-11-28 18:22:04.000000000 +0100
  152. --- src/version.c    2012-11-28 18:28:00.000000000 +0100
  153. ***************
  154. *** 727,728 ****
  155. --- 727,730 ----
  156.   {   /* Add new patch number below this line */
  157. + /**/
  158. +     740,
  159.   /**/
  160.  
  161. -- 
  162. From "know your smileys":
  163.  ~#:-(    I just washed my hair, and I can't do nuthin' with it.
  164.  
  165.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  166. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  167. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  168.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  169.