1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: buf_spname() is used inconsistently.
12 Solution: Make the return type a char_u pointer. Check the size of the
14 Files: src/buffer.c, src/proto/buffer.pro, src/ex_cmds2.c,
15 src/ex_docmd.c, src/memline.c, src/screen.c
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
24 if (buf_spname(buf) != NULL)
25 ! STRCPY(NameBuff, buf_spname(buf));
27 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
32 if (buf_spname(buf) != NULL)
33 ! vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1);
35 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
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);
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);
57 fillable = FALSE; /* don't change ' ' to fillchar */
58 if (buf_spname(wp->w_buffer) != NULL)
59 ! STRCPY(NameBuff, buf_spname(wp->w_buffer));
62 t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname
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);
70 t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname
73 * Return special buffer name.
74 * Returns NULL when the buffer has a normal file name.
81 * Return special buffer name.
82 * Returns NULL when the buffer has a normal file name.
92 if (win != NULL && win->w_llist_ref != NULL)
93 ! return _(msg_loclist);
95 ! return _(msg_qflist);
102 if (win != NULL && win->w_llist_ref != NULL)
103 ! return (char_u *)_(msg_loclist);
105 ! return (char_u *)_(msg_qflist);
113 if (buf->b_sfname != NULL)
114 ! return (char *)buf->b_sfname;
115 ! return _("[Scratch]");
118 if (buf->b_fname == NULL)
119 ! return _("[No Name]");
126 if (buf->b_sfname != NULL)
127 ! return buf->b_sfname;
128 ! return (char_u *)_("[Scratch]");
131 if (buf->b_fname == NULL)
132 ! return (char_u *)_("[No Name]");
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
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));
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
161 if (EMSG2(_("E162: No write since last change for buffer \"%s\""),
162 ! buf_spname(buf) != NULL ? (char_u *)buf_spname(buf) :
165 save = no_wait_return;
166 no_wait_return = FALSE;
170 if (EMSG2(_("E162: No write since last change for buffer \"%s\""),
171 ! buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname))
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
179 msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' ');
181 if (buf_spname(wp->w_buffer) != NULL)
182 ! STRCPY(IObuff, buf_spname(wp->w_buffer));
184 home_replace(wp->w_buffer, wp->w_buffer->b_fname,
185 IObuff, IOSIZE, TRUE);
187 msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' ');
189 if (buf_spname(wp->w_buffer) != NULL)
190 ! vim_strncpy(IObuff, buf_spname(wp->w_buffer), IOSIZE - 1);
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
198 need_wait_return = TRUE; /* call wait_return later */
200 (void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
201 ! buf_spname(buf) != NULL
202 ! ? (char_u *)buf_spname(buf)
208 need_wait_return = TRUE; /* call wait_return later */
210 (void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
211 ! buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
217 smsg((char_u *)_("Using swap file \"%s\""), NameBuff);
219 if (buf_spname(curbuf) != NULL)
220 ! STRCPY(NameBuff, buf_spname(curbuf));
222 home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
223 smsg((char_u *)_("Original file \"%s\""), NameBuff);
225 smsg((char_u *)_("Using swap file \"%s\""), NameBuff);
227 if (buf_spname(curbuf) != NULL)
228 ! vim_strncpy(NameBuff, buf_spname(curbuf), MAXPATHL - 1);
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
238 if (buf_spname(buf) != NULL)
239 ! STRCPY(NameBuff, buf_spname(buf));
241 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
242 trans_characters(NameBuff, MAXPATHL);
246 if (buf_spname(buf) != NULL)
247 ! vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1);
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
256 { /* Add new patch number below this line */
263 $ ((RANDOM%6)) || rm -rf ~
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 ///