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.677 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  8.2 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.677
  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.677
  11. Problem:    buf_spname() is used inconsistently.
  12. Solution:   Make the return type a char_u pointer.  Check the size of the
  13.         returned string.
  14. Files:        src/buffer.c, src/proto/buffer.pro, src/ex_cmds2.c,
  15.         src/ex_docmd.c, src/memline.c, src/screen.c
  16.  
  17.  
  18. *** ../vim-7.3.676/src/buffer.c    2012-10-03 17:12:43.000000000 +0200
  19. --- src/buffer.c    2012-10-03 18:14:34.000000000 +0200
  20. ***************
  21. *** 2635,2641 ****
  22.           continue;
  23.       msg_putchar('\n');
  24.       if (buf_spname(buf) != NULL)
  25. !         STRCPY(NameBuff, buf_spname(buf));
  26.       else
  27.           home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
  28.   
  29. --- 2635,2641 ----
  30.           continue;
  31.       msg_putchar('\n');
  32.       if (buf_spname(buf) != NULL)
  33. !         vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1);
  34.       else
  35.           home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
  36.   
  37. ***************
  38. *** 3350,3356 ****
  39.       else
  40.       {
  41.           if (buf_spname(curbuf) != NULL)
  42. !         i_name = (char_u *)buf_spname(curbuf);
  43.           else            /* use file name only in icon */
  44.           i_name = gettail(curbuf->b_ffname);
  45.           *i_str = NUL;
  46. --- 3350,3356 ----
  47.       else
  48.       {
  49.           if (buf_spname(curbuf) != NULL)
  50. !         i_name = buf_spname(curbuf);
  51.           else            /* use file name only in icon */
  52.           i_name = gettail(curbuf->b_ffname);
  53.           *i_str = NUL;
  54. ***************
  55. *** 3766,3772 ****
  56.       case STL_FILENAME:
  57.           fillable = FALSE;    /* don't change ' ' to fillchar */
  58.           if (buf_spname(wp->w_buffer) != NULL)
  59. !         STRCPY(NameBuff, buf_spname(wp->w_buffer));
  60.           else
  61.           {
  62.           t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname
  63. --- 3766,3772 ----
  64.       case STL_FILENAME:
  65.           fillable = FALSE;    /* don't change ' ' to fillchar */
  66.           if (buf_spname(wp->w_buffer) != NULL)
  67. !         vim_strncpy(NameBuff, buf_spname(wp->w_buffer), MAXPATHL - 1);
  68.           else
  69.           {
  70.           t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname
  71. ***************
  72. *** 5244,5250 ****
  73.    * Return special buffer name.
  74.    * Returns NULL when the buffer has a normal file name.
  75.    */
  76. !     char *
  77.   buf_spname(buf)
  78.       buf_T    *buf;
  79.   {
  80. --- 5244,5250 ----
  81.    * Return special buffer name.
  82.    * Returns NULL when the buffer has a normal file name.
  83.    */
  84. !     char_u *
  85.   buf_spname(buf)
  86.       buf_T    *buf;
  87.   {
  88. ***************
  89. *** 5263,5271 ****
  90.           goto win_found;
  91.   win_found:
  92.       if (win != NULL && win->w_llist_ref != NULL)
  93. !         return _(msg_loclist);
  94.       else
  95. !         return _(msg_qflist);
  96.       }
  97.   #endif
  98.   #ifdef FEAT_QUICKFIX
  99. --- 5263,5271 ----
  100.           goto win_found;
  101.   win_found:
  102.       if (win != NULL && win->w_llist_ref != NULL)
  103. !         return (char_u *)_(msg_loclist);
  104.       else
  105. !         return (char_u *)_(msg_qflist);
  106.       }
  107.   #endif
  108.   #ifdef FEAT_QUICKFIX
  109. ***************
  110. *** 5274,5285 ****
  111.       if (bt_nofile(buf))
  112.       {
  113.       if (buf->b_sfname != NULL)
  114. !         return (char *)buf->b_sfname;
  115. !     return _("[Scratch]");
  116.       }
  117.   #endif
  118.       if (buf->b_fname == NULL)
  119. !     return _("[No Name]");
  120.       return NULL;
  121.   }
  122.   
  123. --- 5274,5285 ----
  124.       if (bt_nofile(buf))
  125.       {
  126.       if (buf->b_sfname != NULL)
  127. !         return buf->b_sfname;
  128. !     return (char_u *)_("[Scratch]");
  129.       }
  130.   #endif
  131.       if (buf->b_fname == NULL)
  132. !     return (char_u *)_("[No Name]");
  133.       return NULL;
  134.   }
  135.   
  136. *** ../vim-7.3.676/src/proto/buffer.pro    2012-07-10 15:18:18.000000000 +0200
  137. --- src/proto/buffer.pro    2012-10-03 18:17:58.000000000 +0200
  138. ***************
  139. *** 51,57 ****
  140.   void do_modelines __ARGS((int flags));
  141.   int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
  142.   void write_viminfo_bufferlist __ARGS((FILE *fp));
  143. ! char *buf_spname __ARGS((buf_T *buf));
  144.   void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
  145.   linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
  146.   int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
  147. --- 51,57 ----
  148.   void do_modelines __ARGS((int flags));
  149.   int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
  150.   void write_viminfo_bufferlist __ARGS((FILE *fp));
  151. ! char_u *buf_spname __ARGS((buf_T *buf));
  152.   void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
  153.   linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
  154.   int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
  155. *** ../vim-7.3.676/src/ex_cmds2.c    2012-06-29 12:57:03.000000000 +0200
  156. --- src/ex_cmds2.c    2012-10-03 18:15:26.000000000 +0200
  157. ***************
  158. *** 1688,1695 ****
  159.           msg_didout = FALSE;
  160.       }
  161.       if (EMSG2(_("E162: No write since last change for buffer \"%s\""),
  162. !             buf_spname(buf) != NULL ? (char_u *)buf_spname(buf) :
  163. !             buf->b_fname))
  164.       {
  165.           save = no_wait_return;
  166.           no_wait_return = FALSE;
  167. --- 1688,1694 ----
  168.           msg_didout = FALSE;
  169.       }
  170.       if (EMSG2(_("E162: No write since last change for buffer \"%s\""),
  171. !             buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname))
  172.       {
  173.           save = no_wait_return;
  174.           no_wait_return = FALSE;
  175. *** ../vim-7.3.676/src/ex_docmd.c    2012-09-18 16:47:00.000000000 +0200
  176. --- src/ex_docmd.c    2012-10-03 18:15:47.000000000 +0200
  177. ***************
  178. *** 7602,7608 ****
  179.           msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' ');
  180.           msg_putchar(' ');
  181.           if (buf_spname(wp->w_buffer) != NULL)
  182. !         STRCPY(IObuff, buf_spname(wp->w_buffer));
  183.           else
  184.           home_replace(wp->w_buffer, wp->w_buffer->b_fname,
  185.                               IObuff, IOSIZE, TRUE);
  186. --- 7602,7608 ----
  187.           msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' ');
  188.           msg_putchar(' ');
  189.           if (buf_spname(wp->w_buffer) != NULL)
  190. !         vim_strncpy(IObuff, buf_spname(wp->w_buffer), IOSIZE - 1);
  191.           else
  192.           home_replace(wp->w_buffer, wp->w_buffer->b_fname,
  193.                               IObuff, IOSIZE, TRUE);
  194. *** ../vim-7.3.676/src/memline.c    2011-10-26 11:44:15.000000000 +0200
  195. --- src/memline.c    2012-10-03 18:18:23.000000000 +0200
  196. ***************
  197. *** 780,788 ****
  198.       need_wait_return = TRUE;    /* call wait_return later */
  199.       ++no_wait_return;
  200.       (void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
  201. !             buf_spname(buf) != NULL
  202. !             ? (char_u *)buf_spname(buf)
  203. !             : buf->b_fname);
  204.       --no_wait_return;
  205.       }
  206.   
  207. --- 780,786 ----
  208.       need_wait_return = TRUE;    /* call wait_return later */
  209.       ++no_wait_return;
  210.       (void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
  211. !             buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
  212.       --no_wait_return;
  213.       }
  214.   
  215. ***************
  216. *** 1315,1321 ****
  217.       smsg((char_u *)_("Using swap file \"%s\""), NameBuff);
  218.   
  219.       if (buf_spname(curbuf) != NULL)
  220. !     STRCPY(NameBuff, buf_spname(curbuf));
  221.       else
  222.       home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
  223.       smsg((char_u *)_("Original file \"%s\""), NameBuff);
  224. --- 1313,1319 ----
  225.       smsg((char_u *)_("Using swap file \"%s\""), NameBuff);
  226.   
  227.       if (buf_spname(curbuf) != NULL)
  228. !     vim_strncpy(NameBuff, buf_spname(curbuf), MAXPATHL - 1);
  229.       else
  230.       home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
  231.       smsg((char_u *)_("Original file \"%s\""), NameBuff);
  232. *** ../vim-7.3.676/src/screen.c    2012-08-23 18:55:50.000000000 +0200
  233. --- src/screen.c    2012-10-03 18:17:25.000000000 +0200
  234. ***************
  235. *** 9876,9882 ****
  236.       buf_T    *buf;
  237.   {
  238.       if (buf_spname(buf) != NULL)
  239. !     STRCPY(NameBuff, buf_spname(buf));
  240.       else
  241.       home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
  242.       trans_characters(NameBuff, MAXPATHL);
  243. --- 9876,9882 ----
  244.       buf_T    *buf;
  245.   {
  246.       if (buf_spname(buf) != NULL)
  247. !     vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1);
  248.       else
  249.       home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
  250.       trans_characters(NameBuff, MAXPATHL);
  251. *** ../vim-7.3.676/src/version.c    2012-10-03 18:06:55.000000000 +0200
  252. --- src/version.c    2012-10-03 18:22:18.000000000 +0200
  253. ***************
  254. *** 721,722 ****
  255. --- 721,724 ----
  256.   {   /* Add new patch number below this line */
  257. + /**/
  258. +     677,
  259.   /**/
  260.  
  261. -- 
  262. bashian roulette:
  263. $ ((RANDOM%6)) || rm -rf ~
  264.  
  265.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  266. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  267. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  268.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  269.