summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.535
blob: e7f0f8a9cbd8d5361ca6489eed6a5f7e97b54ad4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
To: vim_dev@googlegroups.com
Subject: Patch 7.3.535
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.535
Problem:    Many #ifdefs for MB_MAXBYTES.
Solution:   Also define MB_MAXBYTES without the +multi_byte feature.  Fix
	    places where the buffer didn't include space for a NUL byte.
Files:	    src/arabic.c, src/edit.c, src/eval.c, src/getchar.c, src/mbyte.c,
	    src/misc1.c, src/screen.c, src/spell.c, src/vim.h


*** ../vim-7.3.534/src/arabic.c	2010-08-15 21:57:28.000000000 +0200
--- src/arabic.c	2012-06-01 14:59:37.000000000 +0200
***************
*** 1066,1072 ****
  
      if (curr_c != c && ccp != NULL)
      {
! 	char_u buf[MB_MAXBYTES];
  
  	/* Update the first byte of the character. */
  	(*mb_char2bytes)(curr_c, buf);
--- 1066,1072 ----
  
      if (curr_c != c && ccp != NULL)
      {
! 	char_u buf[MB_MAXBYTES + 1];
  
  	/* Update the first byte of the character. */
  	(*mb_char2bytes)(curr_c, buf);
*** ../vim-7.3.534/src/edit.c	2012-06-01 14:57:47.000000000 +0200
--- src/edit.c	2012-06-01 15:01:49.000000000 +0200
***************
*** 1648,1658 ****
  #define PC_STATUS_RIGHT	1	/* right halve of double-wide char */
  #define PC_STATUS_LEFT	2	/* left halve of double-wide char */
  #define PC_STATUS_SET	3	/* pc_bytes was filled */
- #ifdef FEAT_MBYTE
  static char_u pc_bytes[MB_MAXBYTES + 1]; /* saved bytes */
- #else
- static char_u pc_bytes[2];		/* saved bytes */
- #endif
  static int  pc_attr;
  static int  pc_row;
  static int  pc_col;
--- 1648,1654 ----
***************
*** 6819,6829 ****
      char_u	*s;
  
      vim_free(last_insert);
- #ifdef FEAT_MBYTE
      last_insert = alloc(MB_MAXBYTES * 3 + 5);
- #else
-     last_insert = alloc(6);
- #endif
      if (last_insert != NULL)
      {
  	s = last_insert;
--- 6815,6821 ----
***************
*** 6861,6867 ****
      char_u	*s;
  {
  #ifdef FEAT_MBYTE
!     char_u	temp[MB_MAXBYTES];
      int		i;
      int		len;
  
--- 6853,6859 ----
      char_u	*s;
  {
  #ifdef FEAT_MBYTE
!     char_u	temp[MB_MAXBYTES + 1];
      int		i;
      int		len;
  
***************
*** 7423,7429 ****
      int		cc;
  {
      int		n;
!     char_u	buf[MB_MAXBYTES];
      int		i;
      int		c;
  
--- 7415,7421 ----
      int		cc;
  {
      int		n;
!     char_u	buf[MB_MAXBYTES + 1];
      int		i;
      int		c;
  
***************
*** 10109,10119 ****
      int c;
  {
      char_u	*res;
- #ifdef FEAT_MBYTE
      char_u	buf[MB_MAXBYTES + 1];
- #else
-     char_u	buf[2];
- #endif
  
      /* Return quickly when there is nothing to do. */
      if (!has_insertcharpre())
--- 10101,10107 ----
*** ../vim-7.3.534/src/eval.c	2012-05-18 18:34:15.000000000 +0200
--- src/eval.c	2012-06-01 15:02:08.000000000 +0200
***************
*** 19170,19180 ****
  set_vim_var_char(c)
      int c;
  {
! #ifdef FEAT_MBYTE
!     char_u	buf[MB_MAXBYTES];
! #else
!     char_u	buf[2];
! #endif
  
  #ifdef FEAT_MBYTE
      if (has_mbyte)
--- 19170,19176 ----
  set_vim_var_char(c)
      int c;
  {
!     char_u	buf[MB_MAXBYTES + 1];
  
  #ifdef FEAT_MBYTE
      if (has_mbyte)
*** ../vim-7.3.534/src/getchar.c	2012-04-05 16:07:01.000000000 +0200
--- src/getchar.c	2012-06-01 15:03:51.000000000 +0200
***************
*** 723,729 ****
      int				c;
  #ifdef FEAT_MBYTE
      int				n;
!     char_u			buf[MB_MAXBYTES];
      int				i;
  #endif
  
--- 723,729 ----
      int				c;
  #ifdef FEAT_MBYTE
      int				n;
!     char_u			buf[MB_MAXBYTES + 1];
      int				i;
  #endif
  
***************
*** 1072,1078 ****
      int	    c;
  {
  #ifdef FEAT_MBYTE
!     char_u	buf[MB_MAXBYTES];
  #else
      char_u	buf[4];
  #endif
--- 1072,1078 ----
      int	    c;
  {
  #ifdef FEAT_MBYTE
!     char_u	buf[MB_MAXBYTES + 1];
  #else
      char_u	buf[4];
  #endif
***************
*** 1547,1553 ****
      int		c, c2;
  #ifdef FEAT_MBYTE
      int		n;
!     char_u	buf[MB_MAXBYTES];
      int		i;
  #endif
  
--- 1547,1553 ----
      int		c, c2;
  #ifdef FEAT_MBYTE
      int		n;
!     char_u	buf[MB_MAXBYTES + 1];
      int		i;
  #endif
  
***************
*** 4335,4345 ****
      int		scol;		/* starting column of the abbr. */
      int		j;
      char_u	*s;
- #ifdef FEAT_MBYTE
      char_u	tb[MB_MAXBYTES + 4];
- #else
-     char_u	tb[4];
- #endif
      mapblock_T	*mp;
  #ifdef FEAT_LOCALMAP
      mapblock_T	*mp2;
--- 4335,4341 ----
*** ../vim-7.3.534/src/mbyte.c	2012-03-07 19:38:52.000000000 +0100
--- src/mbyte.c	2012-06-01 15:04:27.000000000 +0200
***************
*** 708,714 ****
  	     */
  	    n = (i & 0x80) ? 2 : 1;
  # else
! 	    char buf[MB_MAXBYTES];
  # ifdef X_LOCALE
  #  ifndef mblen
  #   define mblen _Xmblen
--- 708,714 ----
  	     */
  	    n = (i & 0x80) ? 2 : 1;
  # else
! 	    char buf[MB_MAXBYTES + 1];
  # ifdef X_LOCALE
  #  ifndef mblen
  #   define mblen _Xmblen
***************
*** 1953,1959 ****
  /*
   * Convert the character at screen position "off" to a sequence of bytes.
   * Includes the composing characters.
!  * "buf" must at least have the length MB_MAXBYTES.
   * Only to be used when ScreenLinesUC[off] != 0.
   * Returns the produced number of bytes.
   */
--- 1953,1959 ----
  /*
   * Convert the character at screen position "off" to a sequence of bytes.
   * Includes the composing characters.
!  * "buf" must at least have the length MB_MAXBYTES + 1.
   * Only to be used when ScreenLinesUC[off] != 0.
   * Returns the produced number of bytes.
   */
*** ../vim-7.3.534/src/misc1.c	2012-04-30 21:09:38.000000000 +0200
--- src/misc1.c	2012-06-01 15:04:56.000000000 +0200
***************
*** 1932,1938 ****
      int		c;
  {
  #if defined(FEAT_MBYTE) || defined(PROTO)
!     char_u	buf[MB_MAXBYTES];
      int		n;
  
      n = (*mb_char2bytes)(c, buf);
--- 1932,1938 ----
      int		c;
  {
  #if defined(FEAT_MBYTE) || defined(PROTO)
!     char_u	buf[MB_MAXBYTES + 1];
      int		n;
  
      n = (*mb_char2bytes)(c, buf);
*** ../vim-7.3.534/src/screen.c	2012-03-23 16:25:13.000000000 +0100
--- src/screen.c	2012-06-01 15:06:03.000000000 +0200
***************
*** 6621,6636 ****
      int	    row, col;
      int	    attr;
  {
- #ifdef FEAT_MBYTE
      char_u	buf[MB_MAXBYTES + 1];
  
!     buf[(*mb_char2bytes)(c, buf)] = NUL;
! #else
!     char_u	buf[2];
! 
!     buf[0] = c;
!     buf[1] = NUL;
  #endif
      screen_puts(buf, row, col, attr);
  }
  
--- 6621,6637 ----
      int	    row, col;
      int	    attr;
  {
      char_u	buf[MB_MAXBYTES + 1];
  
! #ifdef FEAT_MBYTE
!     if (has_mbyte)
! 	buf[(*mb_char2bytes)(c, buf)] = NUL;
!     else
  #endif
+     {
+ 	buf[0] = c;
+ 	buf[1] = NUL;
+     }
      screen_puts(buf, row, col, attr);
  }
  
*** ../vim-7.3.534/src/spell.c	2012-05-18 18:07:57.000000000 +0200
--- src/spell.c	2012-06-01 15:06:30.000000000 +0200
***************
*** 13694,13700 ****
  {
      int		m1, m2;
  #ifdef FEAT_MBYTE
!     char_u	buf[MB_MAXBYTES];
      hashitem_T  *hi;
  
      if (c1 >= 256)
--- 13694,13700 ----
  {
      int		m1, m2;
  #ifdef FEAT_MBYTE
!     char_u	buf[MB_MAXBYTES + 1];
      hashitem_T  *hi;
  
      if (c1 >= 256)
*** ../vim-7.3.534/src/vim.h	2012-04-30 18:48:38.000000000 +0200
--- src/vim.h	2012-06-01 14:59:28.000000000 +0200
***************
*** 1703,1708 ****
--- 1703,1710 ----
   * character of up to 6 bytes, or one 16-bit character of up to three bytes
   * plus six following composing characters of three bytes each. */
  # define MB_MAXBYTES	21
+ #else
+ # define MB_MAXBYTES	1
  #endif
  
  #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
***************
*** 2017,2022 ****
--- 2019,2025 ----
   #pragma warning(disable : 4312)
  #endif
  
+ /* Note: a NULL argument for vim_realloc() is not portable, don't use it. */
  #if defined(MEM_PROFILE)
  # define vim_realloc(ptr, size)  mem_realloc((ptr), (size))
  #else
*** ../vim-7.3.534/src/version.c	2012-06-01 14:57:47.000000000 +0200
--- src/version.c	2012-06-01 15:08:20.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     535,
  /**/

-- 
Me?  A skeptic?  I trust you have proof.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///