]>
Commit | Line | Data |
---|---|---|
9a1bc5e5 ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.161 | |
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.161 | |
11 | Problem: Items on the stack may be too big. | |
12 | Solution: Make items static or allocate them. | |
13 | Files: src/eval.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, | |
14 | src/fileio.c, src/hardcopy.c, src/quickfix.c, src/main.c, | |
15 | src/netbeans.c, src/spell.c, src/tag.c, src/vim.h, src/xxd/xxd.c | |
16 | ||
17 | ||
18 | *** ../vim-7.3.160/src/eval.c 2011-04-11 13:46:07.000000000 +0200 | |
19 | --- src/eval.c 2011-04-11 21:05:50.000000000 +0200 | |
20 | *************** | |
21 | *** 11100,11117 **** | |
22 | typval_T *argvars UNUSED; | |
23 | typval_T *rettv; | |
24 | { | |
25 | ! char_u cwd[MAXPATHL]; | |
26 | ||
27 | rettv->v_type = VAR_STRING; | |
28 | ! if (mch_dirname(cwd, MAXPATHL) == FAIL) | |
29 | ! rettv->vval.v_string = NULL; | |
30 | ! else | |
31 | { | |
32 | ! rettv->vval.v_string = vim_strsave(cwd); | |
33 | #ifdef BACKSLASH_IN_FILENAME | |
34 | ! if (rettv->vval.v_string != NULL) | |
35 | ! slash_adjust(rettv->vval.v_string); | |
36 | #endif | |
37 | } | |
38 | } | |
39 | ||
40 | --- 11100,11121 ---- | |
41 | typval_T *argvars UNUSED; | |
42 | typval_T *rettv; | |
43 | { | |
44 | ! char_u *cwd; | |
45 | ||
46 | rettv->v_type = VAR_STRING; | |
47 | ! rettv->vval.v_string = NULL; | |
48 | ! cwd = alloc(MAXPATHL); | |
49 | ! if (cwd != NULL) | |
50 | { | |
51 | ! if (mch_dirname(cwd, MAXPATHL) != FAIL) | |
52 | ! { | |
53 | ! rettv->vval.v_string = vim_strsave(cwd); | |
54 | #ifdef BACKSLASH_IN_FILENAME | |
55 | ! if (rettv->vval.v_string != NULL) | |
56 | ! slash_adjust(rettv->vval.v_string); | |
57 | #endif | |
58 | + } | |
59 | + vim_free(cwd); | |
60 | } | |
61 | } | |
62 | ||
63 | *************** | |
64 | *** 14938,14943 **** | |
65 | --- 14942,14950 ---- | |
66 | typval_T *rettv; | |
67 | { | |
68 | char_u *p; | |
69 | + #ifdef HAVE_READLINK | |
70 | + char_u *buf = NULL; | |
71 | + #endif | |
72 | ||
73 | p = get_tv_string(&argvars[0]); | |
74 | #ifdef FEAT_SHORTCUT | |
75 | *************** | |
76 | *** 14953,14959 **** | |
77 | #else | |
78 | # ifdef HAVE_READLINK | |
79 | { | |
80 | - char_u buf[MAXPATHL + 1]; | |
81 | char_u *cpy; | |
82 | int len; | |
83 | char_u *remain = NULL; | |
84 | --- 14960,14965 ---- | |
85 | *************** | |
86 | *** 14981,14986 **** | |
87 | --- 14987,14996 ---- | |
88 | q[-1] = NUL; | |
89 | } | |
90 | ||
91 | + buf = alloc(MAXPATHL + 1); | |
92 | + if (buf == NULL) | |
93 | + goto fail; | |
94 | + | |
95 | for (;;) | |
96 | { | |
97 | for (;;) | |
98 | *************** | |
99 | *** 15124,15129 **** | |
100 | --- 15134,15140 ---- | |
101 | ||
102 | #ifdef HAVE_READLINK | |
103 | fail: | |
104 | + vim_free(buf); | |
105 | #endif | |
106 | rettv->v_type = VAR_STRING; | |
107 | } | |
108 | *************** | |
109 | *** 17604,17621 **** | |
110 | typval_T *argvars UNUSED; | |
111 | typval_T *rettv; | |
112 | { | |
113 | ! char_u fname[MAXPATHL + 1]; | |
114 | tagname_T tn; | |
115 | int first; | |
116 | ||
117 | if (rettv_list_alloc(rettv) == FAIL) | |
118 | return; | |
119 | ||
120 | for (first = TRUE; ; first = FALSE) | |
121 | if (get_tagfname(&tn, first, fname) == FAIL | |
122 | || list_append_string(rettv->vval.v_list, fname, -1) == FAIL) | |
123 | break; | |
124 | tagname_free(&tn); | |
125 | } | |
126 | ||
127 | /* | |
128 | --- 17615,17636 ---- | |
129 | typval_T *argvars UNUSED; | |
130 | typval_T *rettv; | |
131 | { | |
132 | ! char_u *fname; | |
133 | tagname_T tn; | |
134 | int first; | |
135 | ||
136 | if (rettv_list_alloc(rettv) == FAIL) | |
137 | return; | |
138 | + fname = alloc(MAXPATHL); | |
139 | + if (fname == NULL) | |
140 | + return; | |
141 | ||
142 | for (first = TRUE; ; first = FALSE) | |
143 | if (get_tagfname(&tn, first, fname) == FAIL | |
144 | || list_append_string(rettv->vval.v_list, fname, -1) == FAIL) | |
145 | break; | |
146 | tagname_free(&tn); | |
147 | + vim_free(fname); | |
148 | } | |
149 | ||
150 | /* | |
151 | *** ../vim-7.3.160/src/ex_cmds.c 2011-02-01 13:48:47.000000000 +0100 | |
152 | --- src/ex_cmds.c 2011-04-11 20:51:34.000000000 +0200 | |
153 | *************** | |
154 | *** 2777,2783 **** | |
155 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
156 | if (p_confirm || cmdmod.confirm) | |
157 | { | |
158 | ! char_u buff[IOSIZE]; | |
159 | ||
160 | dialog_msg(buff, _("Overwrite existing file \"%s\"?"), fname); | |
161 | if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) != VIM_YES) | |
162 | --- 2777,2783 ---- | |
163 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
164 | if (p_confirm || cmdmod.confirm) | |
165 | { | |
166 | ! char_u buff[DIALOG_MSG_SIZE]; | |
167 | ||
168 | dialog_msg(buff, _("Overwrite existing file \"%s\"?"), fname); | |
169 | if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) != VIM_YES) | |
170 | *************** | |
171 | *** 2795,2801 **** | |
172 | /* For ":w! filename" check that no swap file exists for "filename". */ | |
173 | if (other && !emsg_silent) | |
174 | { | |
175 | ! char_u dir[MAXPATHL]; | |
176 | char_u *p; | |
177 | int r; | |
178 | char_u *swapname; | |
179 | --- 2795,2801 ---- | |
180 | /* For ":w! filename" check that no swap file exists for "filename". */ | |
181 | if (other && !emsg_silent) | |
182 | { | |
183 | ! char_u *dir; | |
184 | char_u *p; | |
185 | int r; | |
186 | char_u *swapname; | |
187 | *************** | |
188 | *** 2806,2825 **** | |
189 | * Use 'shortname' of the current buffer, since there is no buffer | |
190 | * for the written file. */ | |
191 | if (*p_dir == NUL) | |
192 | STRCPY(dir, "."); | |
193 | else | |
194 | { | |
195 | p = p_dir; | |
196 | copy_option_part(&p, dir, MAXPATHL, ","); | |
197 | } | |
198 | swapname = makeswapname(fname, ffname, curbuf, dir); | |
199 | r = vim_fexists(swapname); | |
200 | if (r) | |
201 | { | |
202 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
203 | if (p_confirm || cmdmod.confirm) | |
204 | { | |
205 | ! char_u buff[IOSIZE]; | |
206 | ||
207 | dialog_msg(buff, | |
208 | _("Swap file \"%s\" exists, overwrite anyway?"), | |
209 | --- 2806,2834 ---- | |
210 | * Use 'shortname' of the current buffer, since there is no buffer | |
211 | * for the written file. */ | |
212 | if (*p_dir == NUL) | |
213 | + { | |
214 | + dir = alloc(5); | |
215 | + if (dir == NULL) | |
216 | + return FAIL; | |
217 | STRCPY(dir, "."); | |
218 | + } | |
219 | else | |
220 | { | |
221 | + dir = alloc(MAXPATHL); | |
222 | + if (dir == NULL) | |
223 | + return FAIL; | |
224 | p = p_dir; | |
225 | copy_option_part(&p, dir, MAXPATHL, ","); | |
226 | } | |
227 | swapname = makeswapname(fname, ffname, curbuf, dir); | |
228 | + vim_free(dir); | |
229 | r = vim_fexists(swapname); | |
230 | if (r) | |
231 | { | |
232 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
233 | if (p_confirm || cmdmod.confirm) | |
234 | { | |
235 | ! char_u buff[DIALOG_MSG_SIZE]; | |
236 | ||
237 | dialog_msg(buff, | |
238 | _("Swap file \"%s\" exists, overwrite anyway?"), | |
239 | *************** | |
240 | *** 2969,2975 **** | |
241 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
242 | if ((p_confirm || cmdmod.confirm) && buf->b_fname != NULL) | |
243 | { | |
244 | ! char_u buff[IOSIZE]; | |
245 | ||
246 | if (buf->b_p_ro) | |
247 | dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"), | |
248 | --- 2978,2984 ---- | |
249 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
250 | if ((p_confirm || cmdmod.confirm) && buf->b_fname != NULL) | |
251 | { | |
252 | ! char_u buff[DIALOG_MSG_SIZE]; | |
253 | ||
254 | if (buf->b_p_ro) | |
255 | dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"), | |
256 | *** ../vim-7.3.160/src/ex_cmds2.c 2011-02-25 14:46:06.000000000 +0100 | |
257 | --- src/ex_cmds2.c 2011-04-11 20:51:40.000000000 +0200 | |
258 | *************** | |
259 | *** 1492,1498 **** | |
260 | buf_T *buf; | |
261 | int checkall; /* may abandon all changed buffers */ | |
262 | { | |
263 | ! char_u buff[IOSIZE]; | |
264 | int ret; | |
265 | buf_T *buf2; | |
266 | ||
267 | --- 1492,1498 ---- | |
268 | buf_T *buf; | |
269 | int checkall; /* may abandon all changed buffers */ | |
270 | { | |
271 | ! char_u buff[DIALOG_MSG_SIZE]; | |
272 | int ret; | |
273 | buf_T *buf2; | |
274 | ||
275 | *** ../vim-7.3.160/src/ex_docmd.c 2011-04-11 16:56:29.000000000 +0200 | |
276 | --- src/ex_docmd.c 2011-04-11 21:20:35.000000000 +0200 | |
277 | *************** | |
278 | *** 5093,5106 **** | |
279 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
280 | if ((p_confirm || cmdmod.confirm) && curbuf->b_fname != NULL) | |
281 | { | |
282 | ! char_u buff[IOSIZE]; | |
283 | ||
284 | if (n == 1) | |
285 | vim_strncpy(buff, | |
286 | (char_u *)_("1 more file to edit. Quit anyway?"), | |
287 | ! IOSIZE - 1); | |
288 | else | |
289 | ! vim_snprintf((char *)buff, IOSIZE, | |
290 | _("%d more files to edit. Quit anyway?"), n); | |
291 | if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1) == VIM_YES) | |
292 | return OK; | |
293 | --- 5093,5106 ---- | |
294 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | |
295 | if ((p_confirm || cmdmod.confirm) && curbuf->b_fname != NULL) | |
296 | { | |
297 | ! char_u buff[DIALOG_MSG_SIZE]; | |
298 | ||
299 | if (n == 1) | |
300 | vim_strncpy(buff, | |
301 | (char_u *)_("1 more file to edit. Quit anyway?"), | |
302 | ! DIALOG_MSG_SIZE - 1); | |
303 | else | |
304 | ! vim_snprintf((char *)buff, DIALOG_MSG_SIZE, | |
305 | _("%d more files to edit. Quit anyway?"), n); | |
306 | if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1) == VIM_YES) | |
307 | return OK; | |
308 | *************** | |
309 | *** 8926,8960 **** | |
310 | failed = TRUE; | |
311 | if (eap->cmdidx == CMD_mksession) | |
312 | { | |
313 | ! char_u dirnow[MAXPATHL]; /* current directory */ | |
314 | ||
315 | ! /* | |
316 | ! * Change to session file's dir. | |
317 | ! */ | |
318 | ! if (mch_dirname(dirnow, MAXPATHL) == FAIL | |
319 | ! || mch_chdir((char *)dirnow) != 0) | |
320 | ! *dirnow = NUL; | |
321 | ! if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR)) | |
322 | ! { | |
323 | ! if (vim_chdirfile(fname) == OK) | |
324 | ! shorten_fnames(TRUE); | |
325 | ! } | |
326 | ! else if (*dirnow != NUL | |
327 | ! && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) | |
328 | { | |
329 | ! if (mch_chdir((char *)globaldir) == 0) | |
330 | ! shorten_fnames(TRUE); | |
331 | ! } | |
332 | ||
333 | ! failed |= (makeopens(fd, dirnow) == FAIL); | |
334 | ||
335 | ! /* restore original dir */ | |
336 | ! if (*dirnow != NUL && ((ssop_flags & SSOP_SESDIR) | |
337 | || ((ssop_flags & SSOP_CURDIR) && globaldir != NULL))) | |
338 | ! { | |
339 | ! if (mch_chdir((char *)dirnow) != 0) | |
340 | ! EMSG(_(e_prev_dir)); | |
341 | ! shorten_fnames(TRUE); | |
342 | } | |
343 | } | |
344 | else | |
345 | --- 8926,8967 ---- | |
346 | failed = TRUE; | |
347 | if (eap->cmdidx == CMD_mksession) | |
348 | { | |
349 | ! char_u *dirnow; /* current directory */ | |
350 | ||
351 | ! dirnow = alloc(MAXPATHL); | |
352 | ! if (dirnow == NULL) | |
353 | ! failed = TRUE; | |
354 | ! else | |
355 | { | |
356 | ! /* | |
357 | ! * Change to session file's dir. | |
358 | ! */ | |
359 | ! if (mch_dirname(dirnow, MAXPATHL) == FAIL | |
360 | ! || mch_chdir((char *)dirnow) != 0) | |
361 | ! *dirnow = NUL; | |
362 | ! if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR)) | |
363 | ! { | |
364 | ! if (vim_chdirfile(fname) == OK) | |
365 | ! shorten_fnames(TRUE); | |
366 | ! } | |
367 | ! else if (*dirnow != NUL | |
368 | ! && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) | |
369 | ! { | |
370 | ! if (mch_chdir((char *)globaldir) == 0) | |
371 | ! shorten_fnames(TRUE); | |
372 | ! } | |
373 | ||
374 | ! failed |= (makeopens(fd, dirnow) == FAIL); | |
375 | ||
376 | ! /* restore original dir */ | |
377 | ! if (*dirnow != NUL && ((ssop_flags & SSOP_SESDIR) | |
378 | || ((ssop_flags & SSOP_CURDIR) && globaldir != NULL))) | |
379 | ! { | |
380 | ! if (mch_chdir((char *)dirnow) != 0) | |
381 | ! EMSG(_(e_prev_dir)); | |
382 | ! shorten_fnames(TRUE); | |
383 | ! } | |
384 | ! vim_free(dirnow); | |
385 | } | |
386 | } | |
387 | else | |
388 | *************** | |
389 | *** 8985,8994 **** | |
390 | else if (eap->cmdidx == CMD_mksession) | |
391 | { | |
392 | /* successful session write - set this_session var */ | |
393 | ! char_u tbuf[MAXPATHL]; | |
394 | ||
395 | ! if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK) | |
396 | ! set_vim_var_string(VV_THIS_SESSION, tbuf, -1); | |
397 | } | |
398 | #endif | |
399 | #ifdef MKSESSION_NL | |
400 | --- 8992,9006 ---- | |
401 | else if (eap->cmdidx == CMD_mksession) | |
402 | { | |
403 | /* successful session write - set this_session var */ | |
404 | ! char_u *tbuf; | |
405 | ||
406 | ! tbuf = alloc(MAXPATHL); | |
407 | ! if (tbuf != NULL) | |
408 | ! { | |
409 | ! if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK) | |
410 | ! set_vim_var_string(VV_THIS_SESSION, tbuf, -1); | |
411 | ! vim_free(tbuf); | |
412 | ! } | |
413 | } | |
414 | #endif | |
415 | #ifdef MKSESSION_NL | |
416 | *************** | |
417 | *** 10677,10683 **** | |
418 | unsigned *flagp; | |
419 | { | |
420 | int i; | |
421 | ! char_u buf[MAXPATHL]; | |
422 | char_u *s; | |
423 | ||
424 | if (gap->ga_len == 0) | |
425 | --- 10689,10695 ---- | |
426 | unsigned *flagp; | |
427 | { | |
428 | int i; | |
429 | ! char_u *buf = NULL; | |
430 | char_u *s; | |
431 | ||
432 | if (gap->ga_len == 0) | |
433 | *************** | |
434 | *** 10692,10702 **** | |
435 | { | |
436 | if (fullname) | |
437 | { | |
438 | ! (void)vim_FullName(s, buf, MAXPATHL, FALSE); | |
439 | ! s = buf; | |
440 | } | |
441 | if (fputs(" ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL) | |
442 | return FAIL; | |
443 | } | |
444 | } | |
445 | return put_eol(fd); | |
446 | --- 10704,10722 ---- | |
447 | { | |
448 | if (fullname) | |
449 | { | |
450 | ! buf = alloc(MAXPATHL); | |
451 | ! if (buf != NULL) | |
452 | ! { | |
453 | ! (void)vim_FullName(s, buf, MAXPATHL, FALSE); | |
454 | ! s = buf; | |
455 | ! } | |
456 | } | |
457 | if (fputs(" ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL) | |
458 | + { | |
459 | + vim_free(buf); | |
460 | return FAIL; | |
461 | + } | |
462 | + vim_free(buf); | |
463 | } | |
464 | } | |
465 | return put_eol(fd); | |
466 | *************** | |
467 | *** 10925,10931 **** | |
468 | ||
469 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) || defined(PROTO) | |
470 | /* | |
471 | ! * Make a dialog message in "buff[IOSIZE]". | |
472 | * "format" must contain "%s". | |
473 | */ | |
474 | void | |
475 | --- 10945,10951 ---- | |
476 | ||
477 | #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) || defined(PROTO) | |
478 | /* | |
479 | ! * Make a dialog message in "buff[DIALOG_MSG_SIZE]". | |
480 | * "format" must contain "%s". | |
481 | */ | |
482 | void | |
483 | *************** | |
484 | *** 10936,10942 **** | |
485 | { | |
486 | if (fname == NULL) | |
487 | fname = (char_u *)_("Untitled"); | |
488 | ! vim_snprintf((char *)buff, IOSIZE, format, fname); | |
489 | } | |
490 | #endif | |
491 | ||
492 | --- 10956,10962 ---- | |
493 | { | |
494 | if (fname == NULL) | |
495 | fname = (char_u *)_("Untitled"); | |
496 | ! vim_snprintf((char *)buff, DIALOG_MSG_SIZE, format, fname); | |
497 | } | |
498 | #endif | |
499 | ||
500 | *** ../vim-7.3.160/src/fileio.c 2011-02-25 16:52:13.000000000 +0100 | |
501 | --- src/fileio.c 2011-04-11 18:35:10.000000000 +0200 | |
502 | *************** | |
503 | *** 6023,6037 **** | |
504 | shorten_fname1(full_path) | |
505 | char_u *full_path; | |
506 | { | |
507 | ! char_u dirname[MAXPATHL]; | |
508 | char_u *p = full_path; | |
509 | ||
510 | if (mch_dirname(dirname, MAXPATHL) == OK) | |
511 | { | |
512 | p = shorten_fname(full_path, dirname); | |
513 | if (p == NULL || *p == NUL) | |
514 | p = full_path; | |
515 | } | |
516 | return p; | |
517 | } | |
518 | #endif | |
519 | --- 6023,6041 ---- | |
520 | shorten_fname1(full_path) | |
521 | char_u *full_path; | |
522 | { | |
523 | ! char_u *dirname; | |
524 | char_u *p = full_path; | |
525 | ||
526 | + dirname = alloc(MAXPATHL); | |
527 | + if (dirname == NULL) | |
528 | + return full_path; | |
529 | if (mch_dirname(dirname, MAXPATHL) == OK) | |
530 | { | |
531 | p = shorten_fname(full_path, dirname); | |
532 | if (p == NULL || *p == NUL) | |
533 | p = full_path; | |
534 | } | |
535 | + vim_free(dirname); | |
536 | return p; | |
537 | } | |
538 | #endif | |
539 | *** ../vim-7.3.160/src/hardcopy.c 2011-04-11 16:56:29.000000000 +0200 | |
540 | --- src/hardcopy.c 2011-04-11 18:23:38.000000000 +0200 | |
541 | *************** | |
542 | *** 1759,1765 **** | |
543 | char *name; | |
544 | struct prt_ps_resource_S *resource; | |
545 | { | |
546 | ! char_u buffer[MAXPATHL + 1]; | |
547 | ||
548 | vim_strncpy(resource->name, (char_u *)name, 63); | |
549 | /* Look for named resource file in runtimepath */ | |
550 | --- 1759,1770 ---- | |
551 | char *name; | |
552 | struct prt_ps_resource_S *resource; | |
553 | { | |
554 | ! char_u *buffer; | |
555 | ! int retval; | |
556 | ! | |
557 | ! buffer = alloc(MAXPATHL + 1); | |
558 | ! if (buffer == NULL) | |
559 | ! return FALSE; | |
560 | ||
561 | vim_strncpy(resource->name, (char_u *)name, 63); | |
562 | /* Look for named resource file in runtimepath */ | |
563 | *************** | |
564 | *** 1768,1776 **** | |
565 | vim_strcat(buffer, (char_u *)name, MAXPATHL); | |
566 | vim_strcat(buffer, (char_u *)".ps", MAXPATHL); | |
567 | resource->filename[0] = NUL; | |
568 | ! return (do_in_runtimepath(buffer, FALSE, prt_resource_name, | |
569 | resource->filename) | |
570 | && resource->filename[0] != NUL); | |
571 | } | |
572 | ||
573 | /* PS CR and LF characters have platform independent values */ | |
574 | --- 1773,1783 ---- | |
575 | vim_strcat(buffer, (char_u *)name, MAXPATHL); | |
576 | vim_strcat(buffer, (char_u *)".ps", MAXPATHL); | |
577 | resource->filename[0] = NUL; | |
578 | ! retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name, | |
579 | resource->filename) | |
580 | && resource->filename[0] != NUL); | |
581 | + vim_free(buffer); | |
582 | + return retval; | |
583 | } | |
584 | ||
585 | /* PS CR and LF characters have platform independent values */ | |
586 | *************** | |
587 | *** 2848,2862 **** | |
588 | double right; | |
589 | double top; | |
590 | double bottom; | |
591 | ! struct prt_ps_resource_S res_prolog; | |
592 | ! struct prt_ps_resource_S res_encoding; | |
593 | char buffer[256]; | |
594 | char_u *p_encoding; | |
595 | char_u *p; | |
596 | #ifdef FEAT_MBYTE | |
597 | ! struct prt_ps_resource_S res_cidfont; | |
598 | ! struct prt_ps_resource_S res_cmap; | |
599 | #endif | |
600 | ||
601 | /* | |
602 | * PS DSC Header comments - no PS code! | |
603 | --- 2855,2887 ---- | |
604 | double right; | |
605 | double top; | |
606 | double bottom; | |
607 | ! struct prt_ps_resource_S *res_prolog; | |
608 | ! struct prt_ps_resource_S *res_encoding; | |
609 | char buffer[256]; | |
610 | char_u *p_encoding; | |
611 | char_u *p; | |
612 | #ifdef FEAT_MBYTE | |
613 | ! struct prt_ps_resource_S *res_cidfont; | |
614 | ! struct prt_ps_resource_S *res_cmap; | |
615 | #endif | |
616 | + int retval = FALSE; | |
617 | + | |
618 | + res_prolog = (struct prt_ps_resource_S *) | |
619 | + alloc(sizeof(struct prt_ps_resource_S)); | |
620 | + res_encoding = (struct prt_ps_resource_S *) | |
621 | + alloc(sizeof(struct prt_ps_resource_S)); | |
622 | + #ifdef FEAT_MBYTE | |
623 | + res_cidfont = (struct prt_ps_resource_S *) | |
624 | + alloc(sizeof(struct prt_ps_resource_S)); | |
625 | + res_cmap = (struct prt_ps_resource_S *) | |
626 | + alloc(sizeof(struct prt_ps_resource_S)); | |
627 | + #endif | |
628 | + if (res_prolog == NULL || res_encoding == NULL | |
629 | + #ifdef FEAT_MBYTE | |
630 | + || res_cidfont == NULL || res_cmap == NULL | |
631 | + #endif | |
632 | + ) | |
633 | + goto theend; | |
634 | ||
635 | /* | |
636 | * PS DSC Header comments - no PS code! | |
637 | *************** | |
638 | *** 2932,2958 **** | |
639 | #endif | |
640 | ||
641 | /* Search for external resources VIM supplies */ | |
642 | ! if (!prt_find_resource("prolog", &res_prolog)) | |
643 | { | |
644 | EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\"")); | |
645 | return FALSE; | |
646 | } | |
647 | ! if (!prt_open_resource(&res_prolog)) | |
648 | return FALSE; | |
649 | ! if (!prt_check_resource(&res_prolog, PRT_PROLOG_VERSION)) | |
650 | return FALSE; | |
651 | #ifdef FEAT_MBYTE | |
652 | if (prt_out_mbyte) | |
653 | { | |
654 | /* Look for required version of multi-byte printing procset */ | |
655 | ! if (!prt_find_resource("cidfont", &res_cidfont)) | |
656 | { | |
657 | EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\"")); | |
658 | return FALSE; | |
659 | } | |
660 | ! if (!prt_open_resource(&res_cidfont)) | |
661 | return FALSE; | |
662 | ! if (!prt_check_resource(&res_cidfont, PRT_CID_PROLOG_VERSION)) | |
663 | return FALSE; | |
664 | } | |
665 | #endif | |
666 | --- 2957,2983 ---- | |
667 | #endif | |
668 | ||
669 | /* Search for external resources VIM supplies */ | |
670 | ! if (!prt_find_resource("prolog", res_prolog)) | |
671 | { | |
672 | EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\"")); | |
673 | return FALSE; | |
674 | } | |
675 | ! if (!prt_open_resource(res_prolog)) | |
676 | return FALSE; | |
677 | ! if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION)) | |
678 | return FALSE; | |
679 | #ifdef FEAT_MBYTE | |
680 | if (prt_out_mbyte) | |
681 | { | |
682 | /* Look for required version of multi-byte printing procset */ | |
683 | ! if (!prt_find_resource("cidfont", res_cidfont)) | |
684 | { | |
685 | EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\"")); | |
686 | return FALSE; | |
687 | } | |
688 | ! if (!prt_open_resource(res_cidfont)) | |
689 | return FALSE; | |
690 | ! if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION)) | |
691 | return FALSE; | |
692 | } | |
693 | #endif | |
694 | *************** | |
695 | *** 2968,2974 **** | |
696 | #endif | |
697 | p_encoding = enc_skip(p_penc); | |
698 | if (*p_encoding == NUL | |
699 | ! || !prt_find_resource((char *)p_encoding, &res_encoding)) | |
700 | { | |
701 | /* 'printencoding' not set or not supported - find alternate */ | |
702 | #ifdef FEAT_MBYTE | |
703 | --- 2993,2999 ---- | |
704 | #endif | |
705 | p_encoding = enc_skip(p_penc); | |
706 | if (*p_encoding == NUL | |
707 | ! || !prt_find_resource((char *)p_encoding, res_encoding)) | |
708 | { | |
709 | /* 'printencoding' not set or not supported - find alternate */ | |
710 | #ifdef FEAT_MBYTE | |
711 | *************** | |
712 | *** 2977,2989 **** | |
713 | p_encoding = enc_skip(p_enc); | |
714 | props = enc_canon_props(p_encoding); | |
715 | if (!(props & ENC_8BIT) | |
716 | ! || !prt_find_resource((char *)p_encoding, &res_encoding)) | |
717 | /* 8-bit 'encoding' is not supported */ | |
718 | #endif | |
719 | { | |
720 | /* Use latin1 as default printing encoding */ | |
721 | p_encoding = (char_u *)"latin1"; | |
722 | ! if (!prt_find_resource((char *)p_encoding, &res_encoding)) | |
723 | { | |
724 | EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), | |
725 | p_encoding); | |
726 | --- 3002,3014 ---- | |
727 | p_encoding = enc_skip(p_enc); | |
728 | props = enc_canon_props(p_encoding); | |
729 | if (!(props & ENC_8BIT) | |
730 | ! || !prt_find_resource((char *)p_encoding, res_encoding)) | |
731 | /* 8-bit 'encoding' is not supported */ | |
732 | #endif | |
733 | { | |
734 | /* Use latin1 as default printing encoding */ | |
735 | p_encoding = (char_u *)"latin1"; | |
736 | ! if (!prt_find_resource((char *)p_encoding, res_encoding)) | |
737 | { | |
738 | EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), | |
739 | p_encoding); | |
740 | *************** | |
741 | *** 2991,2997 **** | |
742 | } | |
743 | } | |
744 | } | |
745 | ! if (!prt_open_resource(&res_encoding)) | |
746 | return FALSE; | |
747 | /* For the moment there are no checks on encoding resource files to | |
748 | * perform */ | |
749 | --- 3016,3022 ---- | |
750 | } | |
751 | } | |
752 | } | |
753 | ! if (!prt_open_resource(res_encoding)) | |
754 | return FALSE; | |
755 | /* For the moment there are no checks on encoding resource files to | |
756 | * perform */ | |
757 | *************** | |
758 | *** 3005,3017 **** | |
759 | if (prt_use_courier) | |
760 | { | |
761 | /* Include ASCII range encoding vector */ | |
762 | ! if (!prt_find_resource(prt_ascii_encoding, &res_encoding)) | |
763 | { | |
764 | EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), | |
765 | prt_ascii_encoding); | |
766 | return FALSE; | |
767 | } | |
768 | ! if (!prt_open_resource(&res_encoding)) | |
769 | return FALSE; | |
770 | /* For the moment there are no checks on encoding resource files to | |
771 | * perform */ | |
772 | --- 3030,3042 ---- | |
773 | if (prt_use_courier) | |
774 | { | |
775 | /* Include ASCII range encoding vector */ | |
776 | ! if (!prt_find_resource(prt_ascii_encoding, res_encoding)) | |
777 | { | |
778 | EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), | |
779 | prt_ascii_encoding); | |
780 | return FALSE; | |
781 | } | |
782 | ! if (!prt_open_resource(res_encoding)) | |
783 | return FALSE; | |
784 | /* For the moment there are no checks on encoding resource files to | |
785 | * perform */ | |
786 | *************** | |
787 | *** 3034,3077 **** | |
788 | if (prt_out_mbyte && prt_custom_cmap) | |
789 | { | |
790 | /* Find user supplied CMap */ | |
791 | ! if (!prt_find_resource(prt_cmap, &res_cmap)) | |
792 | { | |
793 | EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), | |
794 | prt_cmap); | |
795 | return FALSE; | |
796 | } | |
797 | ! if (!prt_open_resource(&res_cmap)) | |
798 | return FALSE; | |
799 | } | |
800 | #endif | |
801 | ||
802 | /* List resources supplied */ | |
803 | ! STRCPY(buffer, res_prolog.title); | |
804 | STRCAT(buffer, " "); | |
805 | ! STRCAT(buffer, res_prolog.version); | |
806 | prt_dsc_resources("DocumentSuppliedResources", "procset", buffer); | |
807 | #ifdef FEAT_MBYTE | |
808 | if (prt_out_mbyte) | |
809 | { | |
810 | ! STRCPY(buffer, res_cidfont.title); | |
811 | STRCAT(buffer, " "); | |
812 | ! STRCAT(buffer, res_cidfont.version); | |
813 | prt_dsc_resources(NULL, "procset", buffer); | |
814 | ||
815 | if (prt_custom_cmap) | |
816 | { | |
817 | ! STRCPY(buffer, res_cmap.title); | |
818 | STRCAT(buffer, " "); | |
819 | ! STRCAT(buffer, res_cmap.version); | |
820 | prt_dsc_resources(NULL, "cmap", buffer); | |
821 | } | |
822 | } | |
823 | if (!prt_out_mbyte || prt_use_courier) | |
824 | #endif | |
825 | { | |
826 | ! STRCPY(buffer, res_encoding.title); | |
827 | STRCAT(buffer, " "); | |
828 | ! STRCAT(buffer, res_encoding.version); | |
829 | prt_dsc_resources(NULL, "encoding", buffer); | |
830 | } | |
831 | prt_dsc_requirements(prt_duplex, prt_tumble, prt_collate, | |
832 | --- 3059,3102 ---- | |
833 | if (prt_out_mbyte && prt_custom_cmap) | |
834 | { | |
835 | /* Find user supplied CMap */ | |
836 | ! if (!prt_find_resource(prt_cmap, res_cmap)) | |
837 | { | |
838 | EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), | |
839 | prt_cmap); | |
840 | return FALSE; | |
841 | } | |
842 | ! if (!prt_open_resource(res_cmap)) | |
843 | return FALSE; | |
844 | } | |
845 | #endif | |
846 | ||
847 | /* List resources supplied */ | |
848 | ! STRCPY(buffer, res_prolog->title); | |
849 | STRCAT(buffer, " "); | |
850 | ! STRCAT(buffer, res_prolog->version); | |
851 | prt_dsc_resources("DocumentSuppliedResources", "procset", buffer); | |
852 | #ifdef FEAT_MBYTE | |
853 | if (prt_out_mbyte) | |
854 | { | |
855 | ! STRCPY(buffer, res_cidfont->title); | |
856 | STRCAT(buffer, " "); | |
857 | ! STRCAT(buffer, res_cidfont->version); | |
858 | prt_dsc_resources(NULL, "procset", buffer); | |
859 | ||
860 | if (prt_custom_cmap) | |
861 | { | |
862 | ! STRCPY(buffer, res_cmap->title); | |
863 | STRCAT(buffer, " "); | |
864 | ! STRCAT(buffer, res_cmap->version); | |
865 | prt_dsc_resources(NULL, "cmap", buffer); | |
866 | } | |
867 | } | |
868 | if (!prt_out_mbyte || prt_use_courier) | |
869 | #endif | |
870 | { | |
871 | ! STRCPY(buffer, res_encoding->title); | |
872 | STRCAT(buffer, " "); | |
873 | ! STRCAT(buffer, res_encoding->version); | |
874 | prt_dsc_resources(NULL, "encoding", buffer); | |
875 | } | |
876 | prt_dsc_requirements(prt_duplex, prt_tumble, prt_collate, | |
877 | *************** | |
878 | *** 3114,3128 **** | |
879 | prt_dsc_noarg("BeginProlog"); | |
880 | ||
881 | /* Add required procsets - NOTE: order is important! */ | |
882 | ! if (!prt_add_resource(&res_prolog)) | |
883 | return FALSE; | |
884 | #ifdef FEAT_MBYTE | |
885 | if (prt_out_mbyte) | |
886 | { | |
887 | /* Add CID font procset, and any user supplied CMap */ | |
888 | ! if (!prt_add_resource(&res_cidfont)) | |
889 | return FALSE; | |
890 | ! if (prt_custom_cmap && !prt_add_resource(&res_cmap)) | |
891 | return FALSE; | |
892 | } | |
893 | #endif | |
894 | --- 3139,3153 ---- | |
895 | prt_dsc_noarg("BeginProlog"); | |
896 | ||
897 | /* Add required procsets - NOTE: order is important! */ | |
898 | ! if (!prt_add_resource(res_prolog)) | |
899 | return FALSE; | |
900 | #ifdef FEAT_MBYTE | |
901 | if (prt_out_mbyte) | |
902 | { | |
903 | /* Add CID font procset, and any user supplied CMap */ | |
904 | ! if (!prt_add_resource(res_cidfont)) | |
905 | return FALSE; | |
906 | ! if (prt_custom_cmap && !prt_add_resource(res_cmap)) | |
907 | return FALSE; | |
908 | } | |
909 | #endif | |
910 | *************** | |
911 | *** 3132,3138 **** | |
912 | #endif | |
913 | /* There will be only one Roman font encoding to be included in the PS | |
914 | * file. */ | |
915 | ! if (!prt_add_resource(&res_encoding)) | |
916 | return FALSE; | |
917 | ||
918 | prt_dsc_noarg("EndProlog"); | |
919 | --- 3157,3163 ---- | |
920 | #endif | |
921 | /* There will be only one Roman font encoding to be included in the PS | |
922 | * file. */ | |
923 | ! if (!prt_add_resource(res_encoding)) | |
924 | return FALSE; | |
925 | ||
926 | prt_dsc_noarg("EndProlog"); | |
927 | *************** | |
928 | *** 3248,3254 **** | |
929 | prt_dsc_noarg("EndSetup"); | |
930 | ||
931 | /* Fail if any problems writing out to the PS file */ | |
932 | ! return !prt_file_error; | |
933 | } | |
934 | ||
935 | void | |
936 | --- 3273,3289 ---- | |
937 | prt_dsc_noarg("EndSetup"); | |
938 | ||
939 | /* Fail if any problems writing out to the PS file */ | |
940 | ! retval = !prt_file_error; | |
941 | ! | |
942 | ! theend: | |
943 | ! vim_free(res_prolog); | |
944 | ! vim_free(res_encoding); | |
945 | ! #ifdef FEAT_MBYTE | |
946 | ! vim_free(res_cidfont); | |
947 | ! vim_free(res_cmap); | |
948 | ! #endif | |
949 | ! | |
950 | ! return retval; | |
951 | } | |
952 | ||
953 | void | |
954 | *** ../vim-7.3.160/src/quickfix.c 2010-12-02 15:33:10.000000000 +0100 | |
955 | --- src/quickfix.c 2011-04-11 17:54:07.000000000 +0200 | |
956 | *************** | |
957 | *** 3049,3056 **** | |
958 | int flags = 0; | |
959 | colnr_T col; | |
960 | long tomatch; | |
961 | ! char_u dirname_start[MAXPATHL]; | |
962 | ! char_u dirname_now[MAXPATHL]; | |
963 | char_u *target_dir = NULL; | |
964 | #ifdef FEAT_AUTOCMD | |
965 | char_u *au_name = NULL; | |
966 | --- 3049,3056 ---- | |
967 | int flags = 0; | |
968 | colnr_T col; | |
969 | long tomatch; | |
970 | ! char_u *dirname_start = NULL; | |
971 | ! char_u *dirname_now = NULL; | |
972 | char_u *target_dir = NULL; | |
973 | #ifdef FEAT_AUTOCMD | |
974 | char_u *au_name = NULL; | |
975 | *************** | |
976 | *** 3128,3133 **** | |
977 | --- 3128,3138 ---- | |
978 | goto theend; | |
979 | } | |
980 | ||
981 | + dirname_start = alloc(MAXPATHL); | |
982 | + dirname_now = alloc(MAXPATHL); | |
983 | + if (dirname_start == NULL || dirname_now == NULL) | |
984 | + goto theend; | |
985 | + | |
986 | /* Remember the current directory, because a BufRead autocommand that does | |
987 | * ":lcd %:p:h" changes the meaning of short path names. */ | |
988 | mch_dirname(dirname_start, MAXPATHL); | |
989 | *************** | |
990 | *** 3364,3369 **** | |
991 | --- 3369,3376 ---- | |
992 | } | |
993 | ||
994 | theend: | |
995 | + vim_free(dirname_now); | |
996 | + vim_free(dirname_start); | |
997 | vim_free(target_dir); | |
998 | vim_free(regmatch.regprog); | |
999 | } | |
1000 | *** ../vim-7.3.160/src/main.c 2011-03-22 18:10:34.000000000 +0100 | |
1001 | --- src/main.c 2011-04-11 18:06:06.000000000 +0200 | |
1002 | *************** | |
1003 | *** 3814,3820 **** | |
1004 | int i; | |
1005 | char_u *inicmd = NULL; | |
1006 | char_u *p; | |
1007 | ! char_u cwd[MAXPATHL]; | |
1008 | ||
1009 | if (filec > 0 && filev[0][0] == '+') | |
1010 | { | |
1011 | --- 3814,3820 ---- | |
1012 | int i; | |
1013 | char_u *inicmd = NULL; | |
1014 | char_u *p; | |
1015 | ! char_u *cwd; | |
1016 | ||
1017 | if (filec > 0 && filev[0][0] == '+') | |
1018 | { | |
1019 | *************** | |
1020 | *** 3827,3841 **** | |
1021 | mainerr_arg_missing((char_u *)filev[-1]); | |
1022 | ||
1023 | /* Temporarily cd to the current directory to handle relative file names. */ | |
1024 | if (mch_dirname(cwd, MAXPATHL) != OK) | |
1025 | return NULL; | |
1026 | ! if ((p = vim_strsave_escaped_ext(cwd, | |
1027 | #ifdef BACKSLASH_IN_FILENAME | |
1028 | "", /* rem_backslash() will tell what chars to escape */ | |
1029 | #else | |
1030 | PATH_ESC_CHARS, | |
1031 | #endif | |
1032 | ! '\\', TRUE)) == NULL) | |
1033 | return NULL; | |
1034 | ga_init2(&ga, 1, 100); | |
1035 | ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd "); | |
1036 | --- 3827,3849 ---- | |
1037 | mainerr_arg_missing((char_u *)filev[-1]); | |
1038 | ||
1039 | /* Temporarily cd to the current directory to handle relative file names. */ | |
1040 | + cwd = alloc(MAXPATHL); | |
1041 | + if (cwd == NULL) | |
1042 | + return NULL; | |
1043 | if (mch_dirname(cwd, MAXPATHL) != OK) | |
1044 | + { | |
1045 | + vim_free(cwd); | |
1046 | return NULL; | |
1047 | ! } | |
1048 | ! p = vim_strsave_escaped_ext(cwd, | |
1049 | #ifdef BACKSLASH_IN_FILENAME | |
1050 | "", /* rem_backslash() will tell what chars to escape */ | |
1051 | #else | |
1052 | PATH_ESC_CHARS, | |
1053 | #endif | |
1054 | ! '\\', TRUE); | |
1055 | ! vim_free(cwd); | |
1056 | ! if (p == NULL) | |
1057 | return NULL; | |
1058 | ga_init2(&ga, 1, 100); | |
1059 | ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd "); | |
1060 | *** ../vim-7.3.160/src/netbeans.c 2011-04-11 16:56:29.000000000 +0200 | |
1061 | --- src/netbeans.c 2011-04-11 18:27:08.000000000 +0200 | |
1062 | *************** | |
1063 | *** 2891,2897 **** | |
1064 | char_u *text; | |
1065 | linenr_T lnum; | |
1066 | int col; | |
1067 | ! char buf[MAXPATHL * 2 + 25]; | |
1068 | char_u *p; | |
1069 | ||
1070 | /* Don't do anything when 'ballooneval' is off, messages scrolled the | |
1071 | --- 2891,2897 ---- | |
1072 | char_u *text; | |
1073 | linenr_T lnum; | |
1074 | int col; | |
1075 | ! char *buf; | |
1076 | char_u *p; | |
1077 | ||
1078 | /* Don't do anything when 'ballooneval' is off, messages scrolled the | |
1079 | *************** | |
1080 | *** 2905,2919 **** | |
1081 | * length. */ | |
1082 | if (text != NULL && text[0] != NUL && STRLEN(text) < MAXPATHL) | |
1083 | { | |
1084 | ! p = nb_quote(text); | |
1085 | ! if (p != NULL) | |
1086 | { | |
1087 | ! vim_snprintf(buf, sizeof(buf), | |
1088 | ! "0:balloonText=%d \"%s\"\n", r_cmdno, p); | |
1089 | ! vim_free(p); | |
1090 | } | |
1091 | - nbdebug(("EVT: %s", buf)); | |
1092 | - nb_send(buf, "netbeans_beval_cb"); | |
1093 | } | |
1094 | vim_free(text); | |
1095 | } | |
1096 | --- 2905,2924 ---- | |
1097 | * length. */ | |
1098 | if (text != NULL && text[0] != NUL && STRLEN(text) < MAXPATHL) | |
1099 | { | |
1100 | ! buf = (char *)alloc(MAXPATHL * 2 + 25); | |
1101 | ! if (buf != NULL) | |
1102 | { | |
1103 | ! p = nb_quote(text); | |
1104 | ! if (p != NULL) | |
1105 | ! { | |
1106 | ! vim_snprintf(buf, MAXPATHL * 2 + 25, | |
1107 | ! "0:balloonText=%d \"%s\"\n", r_cmdno, p); | |
1108 | ! vim_free(p); | |
1109 | ! } | |
1110 | ! nbdebug(("EVT: %s", buf)); | |
1111 | ! nb_send(buf, "netbeans_beval_cb"); | |
1112 | ! vim_free(buf); | |
1113 | } | |
1114 | } | |
1115 | vim_free(text); | |
1116 | } | |
1117 | *** ../vim-7.3.160/src/spell.c 2011-04-11 16:56:29.000000000 +0200 | |
1118 | --- src/spell.c 2011-04-11 18:00:49.000000000 +0200 | |
1119 | *************** | |
1120 | *** 8590,8596 **** | |
1121 | spellinfo_T *spin; | |
1122 | char_u *wfname; | |
1123 | { | |
1124 | ! char_u fname[MAXPATHL]; | |
1125 | int len; | |
1126 | slang_T *slang; | |
1127 | int free_slang = FALSE; | |
1128 | --- 8590,8596 ---- | |
1129 | spellinfo_T *spin; | |
1130 | char_u *wfname; | |
1131 | { | |
1132 | ! char_u *fname = NULL; | |
1133 | int len; | |
1134 | slang_T *slang; | |
1135 | int free_slang = FALSE; | |
1136 | *************** | |
1137 | *** 8654,8659 **** | |
1138 | --- 8654,8662 ---- | |
1139 | * Write the .sug file. | |
1140 | * Make the file name by changing ".spl" to ".sug". | |
1141 | */ | |
1142 | + fname = alloc(MAXPATHL); | |
1143 | + if (fname == NULL) | |
1144 | + goto theend; | |
1145 | vim_strncpy(fname, wfname, MAXPATHL - 1); | |
1146 | len = (int)STRLEN(fname); | |
1147 | fname[len - 2] = 'u'; | |
1148 | *************** | |
1149 | *** 8661,8666 **** | |
1150 | --- 8664,8670 ---- | |
1151 | sug_write(spin, fname); | |
1152 | ||
1153 | theend: | |
1154 | + vim_free(fname); | |
1155 | if (free_slang) | |
1156 | slang_free(slang); | |
1157 | free_blocks(spin->si_blocks); | |
1158 | *************** | |
1159 | *** 9106,9113 **** | |
1160 | int overwrite; /* overwrite existing output file */ | |
1161 | int added_word; /* invoked through "zg" */ | |
1162 | { | |
1163 | ! char_u fname[MAXPATHL]; | |
1164 | ! char_u wfname[MAXPATHL]; | |
1165 | char_u **innames; | |
1166 | int incount; | |
1167 | afffile_T *(afile[8]); | |
1168 | --- 9110,9117 ---- | |
1169 | int overwrite; /* overwrite existing output file */ | |
1170 | int added_word; /* invoked through "zg" */ | |
1171 | { | |
1172 | ! char_u *fname = NULL; | |
1173 | ! char_u *wfname; | |
1174 | char_u **innames; | |
1175 | int incount; | |
1176 | afffile_T *(afile[8]); | |
1177 | *************** | |
1178 | *** 9135,9140 **** | |
1179 | --- 9139,9148 ---- | |
1180 | innames = &fnames[1]; | |
1181 | incount = fcount - 1; | |
1182 | ||
1183 | + wfname = alloc(MAXPATHL); | |
1184 | + if (wfname == NULL) | |
1185 | + return; | |
1186 | + | |
1187 | if (fcount >= 1) | |
1188 | { | |
1189 | len = (int)STRLEN(fnames[0]); | |
1190 | *************** | |
1191 | *** 9144,9167 **** | |
1192 | * "path/en.latin1.add.spl". */ | |
1193 | innames = &fnames[0]; | |
1194 | incount = 1; | |
1195 | ! vim_snprintf((char *)wfname, sizeof(wfname), "%s.spl", fnames[0]); | |
1196 | } | |
1197 | else if (fcount == 1) | |
1198 | { | |
1199 | /* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */ | |
1200 | innames = &fnames[0]; | |
1201 | incount = 1; | |
1202 | ! vim_snprintf((char *)wfname, sizeof(wfname), SPL_FNAME_TMPL, | |
1203 | fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); | |
1204 | } | |
1205 | else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0) | |
1206 | { | |
1207 | /* Name ends in ".spl", use as the file name. */ | |
1208 | ! vim_strncpy(wfname, fnames[0], sizeof(wfname) - 1); | |
1209 | } | |
1210 | else | |
1211 | /* Name should be language, make the file name from it. */ | |
1212 | ! vim_snprintf((char *)wfname, sizeof(wfname), SPL_FNAME_TMPL, | |
1213 | fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); | |
1214 | ||
1215 | /* Check for .ascii.spl. */ | |
1216 | --- 9152,9175 ---- | |
1217 | * "path/en.latin1.add.spl". */ | |
1218 | innames = &fnames[0]; | |
1219 | incount = 1; | |
1220 | ! vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]); | |
1221 | } | |
1222 | else if (fcount == 1) | |
1223 | { | |
1224 | /* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */ | |
1225 | innames = &fnames[0]; | |
1226 | incount = 1; | |
1227 | ! vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, | |
1228 | fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); | |
1229 | } | |
1230 | else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0) | |
1231 | { | |
1232 | /* Name ends in ".spl", use as the file name. */ | |
1233 | ! vim_strncpy(wfname, fnames[0], MAXPATHL - 1); | |
1234 | } | |
1235 | else | |
1236 | /* Name should be language, make the file name from it. */ | |
1237 | ! vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, | |
1238 | fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); | |
1239 | ||
1240 | /* Check for .ascii.spl. */ | |
1241 | *************** | |
1242 | *** 9186,9199 **** | |
1243 | if (!overwrite && mch_stat((char *)wfname, &st) >= 0) | |
1244 | { | |
1245 | EMSG(_(e_exists)); | |
1246 | ! return; | |
1247 | } | |
1248 | if (mch_isdir(wfname)) | |
1249 | { | |
1250 | EMSG2(_(e_isadir2), wfname); | |
1251 | ! return; | |
1252 | } | |
1253 | ||
1254 | /* | |
1255 | * Init the aff and dic pointers. | |
1256 | * Get the region names if there are more than 2 arguments. | |
1257 | --- 9194,9211 ---- | |
1258 | if (!overwrite && mch_stat((char *)wfname, &st) >= 0) | |
1259 | { | |
1260 | EMSG(_(e_exists)); | |
1261 | ! goto theend; | |
1262 | } | |
1263 | if (mch_isdir(wfname)) | |
1264 | { | |
1265 | EMSG2(_(e_isadir2), wfname); | |
1266 | ! goto theend; | |
1267 | } | |
1268 | ||
1269 | + fname = alloc(MAXPATHL); | |
1270 | + if (fname == NULL) | |
1271 | + goto theend; | |
1272 | + | |
1273 | /* | |
1274 | * Init the aff and dic pointers. | |
1275 | * Get the region names if there are more than 2 arguments. | |
1276 | *************** | |
1277 | *** 9209,9215 **** | |
1278 | || innames[i][len - 3] != '_') | |
1279 | { | |
1280 | EMSG2(_("E755: Invalid region in %s"), innames[i]); | |
1281 | ! return; | |
1282 | } | |
1283 | spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]); | |
1284 | spin.si_region_name[i * 2 + 1] = | |
1285 | --- 9221,9227 ---- | |
1286 | || innames[i][len - 3] != '_') | |
1287 | { | |
1288 | EMSG2(_("E755: Invalid region in %s"), innames[i]); | |
1289 | ! goto theend; | |
1290 | } | |
1291 | spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]); | |
1292 | spin.si_region_name[i * 2 + 1] = | |
1293 | *************** | |
1294 | *** 9226,9232 **** | |
1295 | || spin.si_prefroot == NULL) | |
1296 | { | |
1297 | free_blocks(spin.si_blocks); | |
1298 | ! return; | |
1299 | } | |
1300 | ||
1301 | /* When not producing a .add.spl file clear the character table when | |
1302 | --- 9238,9244 ---- | |
1303 | || spin.si_prefroot == NULL) | |
1304 | { | |
1305 | free_blocks(spin.si_blocks); | |
1306 | ! goto theend; | |
1307 | } | |
1308 | ||
1309 | /* When not producing a .add.spl file clear the character table when | |
1310 | *************** | |
1311 | *** 9247,9253 **** | |
1312 | spin.si_conv.vc_type = CONV_NONE; | |
1313 | spin.si_region = 1 << i; | |
1314 | ||
1315 | ! vim_snprintf((char *)fname, sizeof(fname), "%s.aff", innames[i]); | |
1316 | if (mch_stat((char *)fname, &st) >= 0) | |
1317 | { | |
1318 | /* Read the .aff file. Will init "spin->si_conv" based on the | |
1319 | --- 9259,9265 ---- | |
1320 | spin.si_conv.vc_type = CONV_NONE; | |
1321 | spin.si_region = 1 << i; | |
1322 | ||
1323 | ! vim_snprintf((char *)fname, MAXPATHL, "%s.aff", innames[i]); | |
1324 | if (mch_stat((char *)fname, &st) >= 0) | |
1325 | { | |
1326 | /* Read the .aff file. Will init "spin->si_conv" based on the | |
1327 | *************** | |
1328 | *** 9258,9264 **** | |
1329 | else | |
1330 | { | |
1331 | /* Read the .dic file and store the words in the trees. */ | |
1332 | ! vim_snprintf((char *)fname, sizeof(fname), "%s.dic", | |
1333 | innames[i]); | |
1334 | if (spell_read_dic(&spin, fname, afile[i]) == FAIL) | |
1335 | error = TRUE; | |
1336 | --- 9270,9276 ---- | |
1337 | else | |
1338 | { | |
1339 | /* Read the .dic file and store the words in the trees. */ | |
1340 | ! vim_snprintf((char *)fname, MAXPATHL, "%s.dic", | |
1341 | innames[i]); | |
1342 | if (spell_read_dic(&spin, fname, afile[i]) == FAIL) | |
1343 | error = TRUE; | |
1344 | *************** | |
1345 | *** 9340,9345 **** | |
1346 | --- 9352,9361 ---- | |
1347 | spell_make_sugfile(&spin, wfname); | |
1348 | ||
1349 | } | |
1350 | + | |
1351 | + theend: | |
1352 | + vim_free(fname); | |
1353 | + vim_free(wfname); | |
1354 | } | |
1355 | ||
1356 | /* | |
1357 | *************** | |
1358 | *** 9392,9398 **** | |
1359 | buf_T *buf = NULL; | |
1360 | int new_spf = FALSE; | |
1361 | char_u *fname; | |
1362 | ! char_u fnamebuf[MAXPATHL]; | |
1363 | char_u line[MAXWLEN * 2]; | |
1364 | long fpos, fpos_next = 0; | |
1365 | int i; | |
1366 | --- 9408,9414 ---- | |
1367 | buf_T *buf = NULL; | |
1368 | int new_spf = FALSE; | |
1369 | char_u *fname; | |
1370 | ! char_u *fnamebuf = NULL; | |
1371 | char_u line[MAXWLEN * 2]; | |
1372 | long fpos, fpos_next = 0; | |
1373 | int i; | |
1374 | *************** | |
1375 | *** 9422,9427 **** | |
1376 | --- 9438,9446 ---- | |
1377 | EMSG2(_(e_notset), "spellfile"); | |
1378 | return; | |
1379 | } | |
1380 | + fnamebuf = alloc(MAXPATHL); | |
1381 | + if (fnamebuf == NULL) | |
1382 | + return; | |
1383 | ||
1384 | for (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; ++i) | |
1385 | { | |
1386 | *************** | |
1387 | *** 9431,9436 **** | |
1388 | --- 9450,9456 ---- | |
1389 | if (*spf == NUL) | |
1390 | { | |
1391 | EMSGN(_("E765: 'spellfile' does not have %ld entries"), idx); | |
1392 | + vim_free(fnamebuf); | |
1393 | return; | |
1394 | } | |
1395 | } | |
1396 | *************** | |
1397 | *** 9442,9447 **** | |
1398 | --- 9462,9468 ---- | |
1399 | if (buf != NULL && bufIsChanged(buf)) | |
1400 | { | |
1401 | EMSG(_(e_bufloaded)); | |
1402 | + vim_free(fnamebuf); | |
1403 | return; | |
1404 | } | |
1405 | ||
1406 | *************** | |
1407 | *** 9536,9541 **** | |
1408 | --- 9557,9563 ---- | |
1409 | ||
1410 | redraw_all_later(SOME_VALID); | |
1411 | } | |
1412 | + vim_free(fnamebuf); | |
1413 | } | |
1414 | ||
1415 | /* | |
1416 | *************** | |
1417 | *** 9544,9550 **** | |
1418 | static void | |
1419 | init_spellfile() | |
1420 | { | |
1421 | ! char_u buf[MAXPATHL]; | |
1422 | int l; | |
1423 | char_u *fname; | |
1424 | char_u *rtp; | |
1425 | --- 9566,9572 ---- | |
1426 | static void | |
1427 | init_spellfile() | |
1428 | { | |
1429 | ! char_u *buf; | |
1430 | int l; | |
1431 | char_u *fname; | |
1432 | char_u *rtp; | |
1433 | *************** | |
1434 | *** 9554,9559 **** | |
1435 | --- 9576,9585 ---- | |
1436 | ||
1437 | if (*curwin->w_s->b_p_spl != NUL && curwin->w_s->b_langp.ga_len > 0) | |
1438 | { | |
1439 | + buf = alloc(MAXPATHL); | |
1440 | + if (buf == NULL) | |
1441 | + return; | |
1442 | + | |
1443 | /* Find the end of the language name. Exclude the region. If there | |
1444 | * is a path separator remember the start of the tail. */ | |
1445 | for (lend = curwin->w_s->b_p_spl; *lend != NUL | |
1446 | *************** | |
1447 | *** 9597,9603 **** | |
1448 | "/%.*s", (int)(lend - lstart), lstart); | |
1449 | } | |
1450 | l = (int)STRLEN(buf); | |
1451 | ! fname = LANGP_ENTRY(curwin->w_s->b_langp, 0)->lp_slang->sl_fname; | |
1452 | vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add", | |
1453 | fname != NULL | |
1454 | && strstr((char *)gettail(fname), ".ascii.") != NULL | |
1455 | --- 9623,9630 ---- | |
1456 | "/%.*s", (int)(lend - lstart), lstart); | |
1457 | } | |
1458 | l = (int)STRLEN(buf); | |
1459 | ! fname = LANGP_ENTRY(curwin->w_s->b_langp, 0) | |
1460 | ! ->lp_slang->sl_fname; | |
1461 | vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add", | |
1462 | fname != NULL | |
1463 | && strstr((char *)gettail(fname), ".ascii.") != NULL | |
1464 | *************** | |
1465 | *** 9607,9612 **** | |
1466 | --- 9634,9641 ---- | |
1467 | } | |
1468 | aspath = FALSE; | |
1469 | } | |
1470 | + | |
1471 | + vim_free(buf); | |
1472 | } | |
1473 | } | |
1474 | ||
1475 | *** ../vim-7.3.160/src/tag.c 2011-04-11 16:56:29.000000000 +0200 | |
1476 | --- src/tag.c 2011-04-11 20:54:36.000000000 +0200 | |
1477 | *************** | |
1478 | *** 775,791 **** | |
1479 | { | |
1480 | list_T *list; | |
1481 | char_u tag_name[128 + 1]; | |
1482 | ! char_u fname[MAXPATHL + 1]; | |
1483 | ! char_u cmd[CMDBUFFSIZE + 1]; | |
1484 | ||
1485 | /* | |
1486 | * Add the matching tags to the location list for the current | |
1487 | * window. | |
1488 | */ | |
1489 | ||
1490 | list = list_alloc(); | |
1491 | ! if (list == NULL) | |
1492 | goto end_do_tag; | |
1493 | ||
1494 | for (i = 0; i < num_matches; ++i) | |
1495 | { | |
1496 | --- 775,799 ---- | |
1497 | { | |
1498 | list_T *list; | |
1499 | char_u tag_name[128 + 1]; | |
1500 | ! char_u *fname; | |
1501 | ! char_u *cmd; | |
1502 | ||
1503 | /* | |
1504 | * Add the matching tags to the location list for the current | |
1505 | * window. | |
1506 | */ | |
1507 | ||
1508 | + fname = alloc(MAXPATHL + 1); | |
1509 | + cmd = alloc(CMDBUFFSIZE + 1); | |
1510 | list = list_alloc(); | |
1511 | ! if (list == NULL || fname == NULL || cmd == NULL) | |
1512 | ! { | |
1513 | ! vim_free(cmd); | |
1514 | ! vim_free(fname); | |
1515 | ! if (list != NULL) | |
1516 | ! list_free(list, TRUE); | |
1517 | goto end_do_tag; | |
1518 | + } | |
1519 | ||
1520 | for (i = 0; i < num_matches; ++i) | |
1521 | { | |
1522 | *************** | |
1523 | *** 911,916 **** | |
1524 | --- 919,926 ---- | |
1525 | set_errorlist(curwin, list, ' ', IObuff); | |
1526 | ||
1527 | list_free(list, TRUE); | |
1528 | + vim_free(fname); | |
1529 | + vim_free(cmd); | |
1530 | ||
1531 | cur_match = 0; /* Jump to the first tag */ | |
1532 | } | |
1533 | *************** | |
1534 | *** 3777,3784 **** | |
1535 | char_u *start; /* start of the value */ | |
1536 | char_u *end; /* after the value; can be NULL */ | |
1537 | { | |
1538 | ! char_u buf[MAXPATHL]; | |
1539 | int len = 0; | |
1540 | ||
1541 | /* check that the field name doesn't exist yet */ | |
1542 | if (dict_find(dict, (char_u *)field_name, -1) != NULL) | |
1543 | --- 3787,3795 ---- | |
1544 | char_u *start; /* start of the value */ | |
1545 | char_u *end; /* after the value; can be NULL */ | |
1546 | { | |
1547 | ! char_u *buf; | |
1548 | int len = 0; | |
1549 | + int retval; | |
1550 | ||
1551 | /* check that the field name doesn't exist yet */ | |
1552 | if (dict_find(dict, (char_u *)field_name, -1) != NULL) | |
1553 | *************** | |
1554 | *** 3791,3796 **** | |
1555 | --- 3802,3810 ---- | |
1556 | } | |
1557 | return FAIL; | |
1558 | } | |
1559 | + buf = alloc(MAXPATHL); | |
1560 | + if (buf == NULL) | |
1561 | + return FAIL; | |
1562 | if (start != NULL) | |
1563 | { | |
1564 | if (end == NULL) | |
1565 | *************** | |
1566 | *** 3800,3811 **** | |
1567 | --end; | |
1568 | } | |
1569 | len = (int)(end - start); | |
1570 | ! if (len > (int)sizeof(buf) - 1) | |
1571 | ! len = sizeof(buf) - 1; | |
1572 | vim_strncpy(buf, start, len); | |
1573 | } | |
1574 | buf[len] = NUL; | |
1575 | ! return dict_add_nr_str(dict, field_name, 0L, buf); | |
1576 | } | |
1577 | ||
1578 | /* | |
1579 | --- 3814,3827 ---- | |
1580 | --end; | |
1581 | } | |
1582 | len = (int)(end - start); | |
1583 | ! if (len > MAXPATHL - 1) | |
1584 | ! len = MAXPATHL - 1; | |
1585 | vim_strncpy(buf, start, len); | |
1586 | } | |
1587 | buf[len] = NUL; | |
1588 | ! retval = dict_add_nr_str(dict, field_name, 0L, buf); | |
1589 | ! vim_free(buf); | |
1590 | ! return retval; | |
1591 | } | |
1592 | ||
1593 | /* | |
1594 | *** ../vim-7.3.160/src/vim.h 2010-12-30 12:30:26.000000000 +0100 | |
1595 | --- src/vim.h 2011-04-11 20:50:54.000000000 +0200 | |
1596 | *************** | |
1597 | *** 1435,1440 **** | |
1598 | --- 1435,1442 ---- | |
1599 | ||
1600 | #define IOSIZE (1024+1) /* file i/o and sprintf buffer size */ | |
1601 | ||
1602 | + #define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */ | |
1603 | + | |
1604 | #ifdef FEAT_MBYTE | |
1605 | # define MSG_BUF_LEN 480 /* length of buffer for small messages */ | |
1606 | # define MSG_BUF_CLEN (MSG_BUF_LEN / 6) /* cell length (worst case: utf-8 | |
1607 | *** ../vim-7.3.160/src/xxd/xxd.c 2011-04-02 14:44:50.000000000 +0200 | |
1608 | --- src/xxd/xxd.c 2011-04-11 16:40:48.000000000 +0200 | |
1609 | *************** | |
1610 | *** 476,482 **** | |
1611 | int octspergrp = -1; /* number of octets grouped in output */ | |
1612 | int grplen; /* total chars per octet group */ | |
1613 | long length = -1, n = 0, seekoff = 0; | |
1614 | ! char l[LLEN+1]; | |
1615 | char *pp; | |
1616 | ||
1617 | #ifdef AMIGA | |
1618 | --- 476,482 ---- | |
1619 | int octspergrp = -1; /* number of octets grouped in output */ | |
1620 | int grplen; /* total chars per octet group */ | |
1621 | long length = -1, n = 0, seekoff = 0; | |
1622 | ! static char l[LLEN+1]; /* static because it may be too big for stack */ | |
1623 | char *pp; | |
1624 | ||
1625 | #ifdef AMIGA | |
1626 | *** ../vim-7.3.160/src/version.c 2011-04-11 16:56:29.000000000 +0200 | |
1627 | --- src/version.c 2011-04-11 21:15:33.000000000 +0200 | |
1628 | *************** | |
1629 | *** 716,717 **** | |
1630 | --- 716,719 ---- | |
1631 | { /* Add new patch number below this line */ | |
1632 | + /**/ | |
1633 | + 161, | |
1634 | /**/ | |
1635 | ||
1636 | -- | |
1637 | The process for understanding customers primarily involves sitting around with | |
1638 | other marketing people and talking about what you would to if you were dumb | |
1639 | enough to be a customer. | |
1640 | (Scott Adams - The Dilbert principle) | |
1641 | ||
1642 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
1643 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
1644 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
1645 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |