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.1 / 7.1.050 < prev    next >
Encoding:
Internet Message Format  |  2007-11-19  |  4.7 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 7.1.050
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.1.050
  11. Problem:    Possible crash when using C++ indenting. (Chris Monson)
  12. Solution:   Keep the line pointer to the line to compare with.  Avoid going
  13.         past the end of line.
  14. Files:        src/misc1.c
  15.  
  16.  
  17. *** ../vim-7.1.049/src/misc1.c    Tue Jul 24 15:25:27 2007
  18. --- src/misc1.c    Fri Aug  3 21:07:17 2007
  19. ***************
  20. *** 4820,4826 ****
  21.   static int    cin_iswhileofdo __ARGS((char_u *, linenr_T, int));
  22.   static int    cin_iswhileofdo_end __ARGS((int terminated, int    ind_maxparen, int ind_maxcomment));
  23.   static int    cin_isbreak __ARGS((char_u *));
  24. ! static int    cin_is_cpp_baseclass __ARGS((char_u *line, colnr_T *col));
  25.   static int    get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass));
  26.   static int    cin_ends_in __ARGS((char_u *, char_u *, char_u *));
  27.   static int    cin_skip2pos __ARGS((pos_T *trypos));
  28. --- 4820,4826 ----
  29.   static int    cin_iswhileofdo __ARGS((char_u *, linenr_T, int));
  30.   static int    cin_iswhileofdo_end __ARGS((int terminated, int    ind_maxparen, int ind_maxcomment));
  31.   static int    cin_isbreak __ARGS((char_u *));
  32. ! static int    cin_is_cpp_baseclass __ARGS((colnr_T *col));
  33.   static int    get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass));
  34.   static int    cin_ends_in __ARGS((char_u *, char_u *, char_u *));
  35.   static int    cin_skip2pos __ARGS((pos_T *trypos));
  36. ***************
  37. *** 5585,5597 ****
  38.    * This is a lot of guessing.  Watch out for "cond ? func() : foo".
  39.    */
  40.       static int
  41. ! cin_is_cpp_baseclass(line, col)
  42. !     char_u    *line;
  43.       colnr_T    *col;        /* return: column to align with */
  44.   {
  45.       char_u    *s;
  46.       int        class_or_struct, lookfor_ctor_init, cpp_base_class;
  47.       linenr_T    lnum = curwin->w_cursor.lnum;
  48.   
  49.       *col = 0;
  50.   
  51. --- 5585,5597 ----
  52.    * This is a lot of guessing.  Watch out for "cond ? func() : foo".
  53.    */
  54.       static int
  55. ! cin_is_cpp_baseclass(col)
  56.       colnr_T    *col;        /* return: column to align with */
  57.   {
  58.       char_u    *s;
  59.       int        class_or_struct, lookfor_ctor_init, cpp_base_class;
  60.       linenr_T    lnum = curwin->w_cursor.lnum;
  61. +     char_u    *line = ml_get_curline();
  62.   
  63.       *col = 0;
  64.   
  65. ***************
  66. *** 5619,5625 ****
  67.        */
  68.       while (lnum > 1)
  69.       {
  70. !     s = skipwhite(ml_get(lnum - 1));
  71.       if (*s == '#' || *s == NUL)
  72.           break;
  73.       while (*s != NUL)
  74. --- 5619,5626 ----
  75.        */
  76.       while (lnum > 1)
  77.       {
  78. !     line = ml_get(lnum - 1);
  79. !     s = skipwhite(line);
  80.       if (*s == '#' || *s == NUL)
  81.           break;
  82.       while (*s != NUL)
  83. ***************
  84. *** 5636,5642 ****
  85.       --lnum;
  86.       }
  87.   
  88. !     s = cin_skipcomment(ml_get(lnum));
  89.       for (;;)
  90.       {
  91.       if (*s == NUL)
  92. --- 5637,5644 ----
  93.       --lnum;
  94.       }
  95.   
  96. !     line = ml_get(lnum);
  97. !     s = cin_skipcomment(line);
  98.       for (;;)
  99.       {
  100.       if (*s == NUL)
  101. ***************
  102. *** 5644,5650 ****
  103.           if (lnum == curwin->w_cursor.lnum)
  104.           break;
  105.           /* Continue in the cursor line. */
  106. !         s = cin_skipcomment(ml_get(++lnum));
  107.       }
  108.   
  109.       if (s[0] == ':')
  110. --- 5646,5655 ----
  111.           if (lnum == curwin->w_cursor.lnum)
  112.           break;
  113.           /* Continue in the cursor line. */
  114. !         line = ml_get(++lnum);
  115. !         s = cin_skipcomment(line);
  116. !         if (*s == NUL)
  117. !         continue;
  118.       }
  119.   
  120.       if (s[0] == ':')
  121. ***************
  122. *** 7113,7119 ****
  123.           n = FALSE;
  124.           if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0)
  125.           {
  126. !             n = cin_is_cpp_baseclass(l, &col);
  127.               l = ml_get_curline();
  128.           }
  129.           if (n)
  130. --- 7118,7124 ----
  131.           n = FALSE;
  132.           if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0)
  133.           {
  134. !             n = cin_is_cpp_baseclass(&col);
  135.               l = ml_get_curline();
  136.           }
  137.           if (n)
  138. ***************
  139. *** 7704,7710 ****
  140.           n = FALSE;
  141.           if (ind_cpp_baseclass != 0 && theline[0] != '{')
  142.           {
  143. !             n = cin_is_cpp_baseclass(l, &col);
  144.               l = ml_get_curline();
  145.           }
  146.           if (n)
  147. --- 7709,7715 ----
  148.           n = FALSE;
  149.           if (ind_cpp_baseclass != 0 && theline[0] != '{')
  150.           {
  151. !             n = cin_is_cpp_baseclass(&col);
  152.               l = ml_get_curline();
  153.           }
  154.           if (n)
  155. *** ../vim-7.1.049/src/version.c    Fri Aug  3 22:01:35 2007
  156. --- src/version.c    Sat Aug  4 12:11:51 2007
  157. ***************
  158. *** 668,669 ****
  159. --- 668,671 ----
  160.   {   /* Add new patch number below this line */
  161. + /**/
  162. +     50,
  163.   /**/
  164.  
  165. -- 
  166. From "know your smileys":
  167.  |-P    Reaction to unusually ugly C code
  168.  
  169.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  170. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  171. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  172.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  173.