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: Many #ifdefs for MB_MAXBYTES.
12 Solution: Also define MB_MAXBYTES without the +multi_byte feature. Fix
13 places where the buffer didn't include space for a NUL byte.
14 Files: src/arabic.c, src/edit.c, src/eval.c, src/getchar.c, src/mbyte.c,
15 src/misc1.c, src/screen.c, src/spell.c, src/vim.h
18 *** ../vim-7.3.534/src/arabic.c 2010-08-15 21:57:28.000000000 +0200
19 --- src/arabic.c 2012-06-01 14:59:37.000000000 +0200
23 if (curr_c != c && ccp != NULL)
25 ! char_u buf[MB_MAXBYTES];
27 /* Update the first byte of the character. */
28 (*mb_char2bytes)(curr_c, buf);
31 if (curr_c != c && ccp != NULL)
33 ! char_u buf[MB_MAXBYTES + 1];
35 /* Update the first byte of the character. */
36 (*mb_char2bytes)(curr_c, buf);
37 *** ../vim-7.3.534/src/edit.c 2012-06-01 14:57:47.000000000 +0200
38 --- src/edit.c 2012-06-01 15:01:49.000000000 +0200
41 #define PC_STATUS_RIGHT 1 /* right halve of double-wide char */
42 #define PC_STATUS_LEFT 2 /* left halve of double-wide char */
43 #define PC_STATUS_SET 3 /* pc_bytes was filled */
45 static char_u pc_bytes[MB_MAXBYTES + 1]; /* saved bytes */
47 - static char_u pc_bytes[2]; /* saved bytes */
57 vim_free(last_insert);
59 last_insert = alloc(MB_MAXBYTES * 3 + 5);
61 - last_insert = alloc(6);
63 if (last_insert != NULL)
72 ! char_u temp[MB_MAXBYTES];
80 ! char_u temp[MB_MAXBYTES + 1];
89 ! char_u buf[MB_MAXBYTES];
97 ! char_u buf[MB_MAXBYTES + 1];
107 char_u buf[MB_MAXBYTES + 1];
112 /* Return quickly when there is nothing to do. */
113 if (!has_insertcharpre())
115 *** ../vim-7.3.534/src/eval.c 2012-05-18 18:34:15.000000000 +0200
116 --- src/eval.c 2012-06-01 15:02:08.000000000 +0200
123 ! char_u buf[MB_MAXBYTES];
134 ! char_u buf[MB_MAXBYTES + 1];
138 *** ../vim-7.3.534/src/getchar.c 2012-04-05 16:07:01.000000000 +0200
139 --- src/getchar.c 2012-06-01 15:03:51.000000000 +0200
145 ! char_u buf[MB_MAXBYTES];
153 ! char_u buf[MB_MAXBYTES + 1];
162 ! char_u buf[MB_MAXBYTES];
170 ! char_u buf[MB_MAXBYTES + 1];
179 ! char_u buf[MB_MAXBYTES];
187 ! char_u buf[MB_MAXBYTES + 1];
193 int scol; /* starting column of the abbr. */
197 char_u tb[MB_MAXBYTES + 4];
205 *** ../vim-7.3.534/src/mbyte.c 2012-03-07 19:38:52.000000000 +0100
206 --- src/mbyte.c 2012-06-01 15:04:27.000000000 +0200
210 n = (i & 0x80) ? 2 : 1;
212 ! char buf[MB_MAXBYTES];
215 # define mblen _Xmblen
218 n = (i & 0x80) ? 2 : 1;
220 ! char buf[MB_MAXBYTES + 1];
223 # define mblen _Xmblen
227 * Convert the character at screen position "off" to a sequence of bytes.
228 * Includes the composing characters.
229 ! * "buf" must at least have the length MB_MAXBYTES.
230 * Only to be used when ScreenLinesUC[off] != 0.
231 * Returns the produced number of bytes.
235 * Convert the character at screen position "off" to a sequence of bytes.
236 * Includes the composing characters.
237 ! * "buf" must at least have the length MB_MAXBYTES + 1.
238 * Only to be used when ScreenLinesUC[off] != 0.
239 * Returns the produced number of bytes.
241 *** ../vim-7.3.534/src/misc1.c 2012-04-30 21:09:38.000000000 +0200
242 --- src/misc1.c 2012-06-01 15:04:56.000000000 +0200
247 #if defined(FEAT_MBYTE) || defined(PROTO)
248 ! char_u buf[MB_MAXBYTES];
251 n = (*mb_char2bytes)(c, buf);
255 #if defined(FEAT_MBYTE) || defined(PROTO)
256 ! char_u buf[MB_MAXBYTES + 1];
259 n = (*mb_char2bytes)(c, buf);
260 *** ../vim-7.3.534/src/screen.c 2012-03-23 16:25:13.000000000 +0100
261 --- src/screen.c 2012-06-01 15:06:03.000000000 +0200
268 char_u buf[MB_MAXBYTES + 1];
270 ! buf[(*mb_char2bytes)(c, buf)] = NUL;
277 screen_puts(buf, row, col, attr);
284 char_u buf[MB_MAXBYTES + 1];
288 ! buf[(*mb_char2bytes)(c, buf)] = NUL;
295 screen_puts(buf, row, col, attr);
298 *** ../vim-7.3.534/src/spell.c 2012-05-18 18:07:57.000000000 +0200
299 --- src/spell.c 2012-06-01 15:06:30.000000000 +0200
305 ! char_u buf[MB_MAXBYTES];
313 ! char_u buf[MB_MAXBYTES + 1];
317 *** ../vim-7.3.534/src/vim.h 2012-04-30 18:48:38.000000000 +0200
318 --- src/vim.h 2012-06-01 14:59:28.000000000 +0200
322 * character of up to 6 bytes, or one 16-bit character of up to three bytes
323 * plus six following composing characters of three bytes each. */
324 # define MB_MAXBYTES 21
326 + # define MB_MAXBYTES 1
329 #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
333 #pragma warning(disable : 4312)
336 + /* Note: a NULL argument for vim_realloc() is not portable, don't use it. */
337 #if defined(MEM_PROFILE)
338 # define vim_realloc(ptr, size) mem_realloc((ptr), (size))
340 *** ../vim-7.3.534/src/version.c 2012-06-01 14:57:47.000000000 +0200
341 --- src/version.c 2012-06-01 15:08:20.000000000 +0200
345 { /* Add new patch number below this line */
351 Me? A skeptic? I trust you have proof.
353 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
354 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
355 \\\ an exciting new programming language -- http://www.Zimbu.org ///
356 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///