]> git.ipfire.org Git - ipfire-3.x.git/blob - vim/patches/vim-7.3.535.patch0
Merge remote-tracking branch 'stevee/dracut'
[ipfire-3.x.git] / vim / patches / vim-7.3.535.patch0
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.535
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.535
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
16
17
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
20 ***************
21 *** 1066,1072 ****
22
23 if (curr_c != c && ccp != NULL)
24 {
25 ! char_u buf[MB_MAXBYTES];
26
27 /* Update the first byte of the character. */
28 (*mb_char2bytes)(curr_c, buf);
29 --- 1066,1072 ----
30
31 if (curr_c != c && ccp != NULL)
32 {
33 ! char_u buf[MB_MAXBYTES + 1];
34
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
39 ***************
40 *** 1648,1658 ****
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 */
44 - #ifdef FEAT_MBYTE
45 static char_u pc_bytes[MB_MAXBYTES + 1]; /* saved bytes */
46 - #else
47 - static char_u pc_bytes[2]; /* saved bytes */
48 - #endif
49 static int pc_attr;
50 static int pc_row;
51 static int pc_col;
52 --- 1648,1654 ----
53 ***************
54 *** 6819,6829 ****
55 char_u *s;
56
57 vim_free(last_insert);
58 - #ifdef FEAT_MBYTE
59 last_insert = alloc(MB_MAXBYTES * 3 + 5);
60 - #else
61 - last_insert = alloc(6);
62 - #endif
63 if (last_insert != NULL)
64 {
65 s = last_insert;
66 --- 6815,6821 ----
67 ***************
68 *** 6861,6867 ****
69 char_u *s;
70 {
71 #ifdef FEAT_MBYTE
72 ! char_u temp[MB_MAXBYTES];
73 int i;
74 int len;
75
76 --- 6853,6859 ----
77 char_u *s;
78 {
79 #ifdef FEAT_MBYTE
80 ! char_u temp[MB_MAXBYTES + 1];
81 int i;
82 int len;
83
84 ***************
85 *** 7423,7429 ****
86 int cc;
87 {
88 int n;
89 ! char_u buf[MB_MAXBYTES];
90 int i;
91 int c;
92
93 --- 7415,7421 ----
94 int cc;
95 {
96 int n;
97 ! char_u buf[MB_MAXBYTES + 1];
98 int i;
99 int c;
100
101 ***************
102 *** 10109,10119 ****
103 int c;
104 {
105 char_u *res;
106 - #ifdef FEAT_MBYTE
107 char_u buf[MB_MAXBYTES + 1];
108 - #else
109 - char_u buf[2];
110 - #endif
111
112 /* Return quickly when there is nothing to do. */
113 if (!has_insertcharpre())
114 --- 10101,10107 ----
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
117 ***************
118 *** 19170,19180 ****
119 set_vim_var_char(c)
120 int c;
121 {
122 ! #ifdef FEAT_MBYTE
123 ! char_u buf[MB_MAXBYTES];
124 ! #else
125 ! char_u buf[2];
126 ! #endif
127
128 #ifdef FEAT_MBYTE
129 if (has_mbyte)
130 --- 19170,19176 ----
131 set_vim_var_char(c)
132 int c;
133 {
134 ! char_u buf[MB_MAXBYTES + 1];
135
136 #ifdef FEAT_MBYTE
137 if (has_mbyte)
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
140 ***************
141 *** 723,729 ****
142 int c;
143 #ifdef FEAT_MBYTE
144 int n;
145 ! char_u buf[MB_MAXBYTES];
146 int i;
147 #endif
148
149 --- 723,729 ----
150 int c;
151 #ifdef FEAT_MBYTE
152 int n;
153 ! char_u buf[MB_MAXBYTES + 1];
154 int i;
155 #endif
156
157 ***************
158 *** 1072,1078 ****
159 int c;
160 {
161 #ifdef FEAT_MBYTE
162 ! char_u buf[MB_MAXBYTES];
163 #else
164 char_u buf[4];
165 #endif
166 --- 1072,1078 ----
167 int c;
168 {
169 #ifdef FEAT_MBYTE
170 ! char_u buf[MB_MAXBYTES + 1];
171 #else
172 char_u buf[4];
173 #endif
174 ***************
175 *** 1547,1553 ****
176 int c, c2;
177 #ifdef FEAT_MBYTE
178 int n;
179 ! char_u buf[MB_MAXBYTES];
180 int i;
181 #endif
182
183 --- 1547,1553 ----
184 int c, c2;
185 #ifdef FEAT_MBYTE
186 int n;
187 ! char_u buf[MB_MAXBYTES + 1];
188 int i;
189 #endif
190
191 ***************
192 *** 4335,4345 ****
193 int scol; /* starting column of the abbr. */
194 int j;
195 char_u *s;
196 - #ifdef FEAT_MBYTE
197 char_u tb[MB_MAXBYTES + 4];
198 - #else
199 - char_u tb[4];
200 - #endif
201 mapblock_T *mp;
202 #ifdef FEAT_LOCALMAP
203 mapblock_T *mp2;
204 --- 4335,4341 ----
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
207 ***************
208 *** 708,714 ****
209 */
210 n = (i & 0x80) ? 2 : 1;
211 # else
212 ! char buf[MB_MAXBYTES];
213 # ifdef X_LOCALE
214 # ifndef mblen
215 # define mblen _Xmblen
216 --- 708,714 ----
217 */
218 n = (i & 0x80) ? 2 : 1;
219 # else
220 ! char buf[MB_MAXBYTES + 1];
221 # ifdef X_LOCALE
222 # ifndef mblen
223 # define mblen _Xmblen
224 ***************
225 *** 1953,1959 ****
226 /*
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.
232 */
233 --- 1953,1959 ----
234 /*
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.
240 */
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
243 ***************
244 *** 1932,1938 ****
245 int c;
246 {
247 #if defined(FEAT_MBYTE) || defined(PROTO)
248 ! char_u buf[MB_MAXBYTES];
249 int n;
250
251 n = (*mb_char2bytes)(c, buf);
252 --- 1932,1938 ----
253 int c;
254 {
255 #if defined(FEAT_MBYTE) || defined(PROTO)
256 ! char_u buf[MB_MAXBYTES + 1];
257 int n;
258
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
262 ***************
263 *** 6621,6636 ****
264 int row, col;
265 int attr;
266 {
267 - #ifdef FEAT_MBYTE
268 char_u buf[MB_MAXBYTES + 1];
269
270 ! buf[(*mb_char2bytes)(c, buf)] = NUL;
271 ! #else
272 ! char_u buf[2];
273 !
274 ! buf[0] = c;
275 ! buf[1] = NUL;
276 #endif
277 screen_puts(buf, row, col, attr);
278 }
279
280 --- 6621,6637 ----
281 int row, col;
282 int attr;
283 {
284 char_u buf[MB_MAXBYTES + 1];
285
286 ! #ifdef FEAT_MBYTE
287 ! if (has_mbyte)
288 ! buf[(*mb_char2bytes)(c, buf)] = NUL;
289 ! else
290 #endif
291 + {
292 + buf[0] = c;
293 + buf[1] = NUL;
294 + }
295 screen_puts(buf, row, col, attr);
296 }
297
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
300 ***************
301 *** 13694,13700 ****
302 {
303 int m1, m2;
304 #ifdef FEAT_MBYTE
305 ! char_u buf[MB_MAXBYTES];
306 hashitem_T *hi;
307
308 if (c1 >= 256)
309 --- 13694,13700 ----
310 {
311 int m1, m2;
312 #ifdef FEAT_MBYTE
313 ! char_u buf[MB_MAXBYTES + 1];
314 hashitem_T *hi;
315
316 if (c1 >= 256)
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
319 ***************
320 *** 1703,1708 ****
321 --- 1703,1710 ----
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
325 + #else
326 + # define MB_MAXBYTES 1
327 #endif
328
329 #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
330 ***************
331 *** 2017,2022 ****
332 --- 2019,2025 ----
333 #pragma warning(disable : 4312)
334 #endif
335
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))
339 #else
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
342 ***************
343 *** 716,717 ****
344 --- 716,719 ----
345 { /* Add new patch number below this line */
346 + /**/
347 + 535,
348 /**/
349
350 --
351 Me? A skeptic? I trust you have proof.
352
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 ///