To: vim_dev@googlegroups.com Subject: Patch 7.4.1780 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1780 Problem: Warnings reported by cppcheck. Solution: Fix the warnings. (Dominique Pelle) Files: src/ex_cmds2.c, src/json.c, src/misc1.c, src/ops.c, src/regexp_nfa.c *** ../vim-7.4.1779/src/ex_cmds2.c 2016-04-05 21:12:55.975983365 +0200 --- src/ex_cmds2.c 2016-04-23 14:27:12.696815390 +0200 *************** *** 335,343 **** get_maxbacktrace_level(void) { char *p, *q; ! int maxbacktrace = 1; - maxbacktrace = 0; if (sourcing_name != NULL) { p = (char *)sourcing_name; --- 335,342 ---- get_maxbacktrace_level(void) { char *p, *q; ! int maxbacktrace = 0; if (sourcing_name != NULL) { p = (char *)sourcing_name; *** ../vim-7.4.1779/src/json.c 2016-03-28 14:11:36.854303544 +0200 --- src/json.c 2016-04-23 14:27:12.696815390 +0200 *************** *** 539,545 **** char_u *p; int c; long nr; - char_u buf[NUMBUFLEN]; if (res != NULL) ga_init2(&ga, 1, 200); --- 539,544 ---- *************** *** 617,622 **** --- 616,622 ---- if (res != NULL) { #ifdef FEAT_MBYTE + char_u buf[NUMBUFLEN]; buf[utf_char2bytes((int)nr, buf)] = NUL; ga_concat(&ga, buf); #else *** ../vim-7.4.1779/src/misc1.c 2016-03-25 17:21:15.870934592 +0100 --- src/misc1.c 2016-04-23 14:27:12.700815349 +0200 *************** *** 1197,1203 **** int i; int l; ! for (i = 0; p[i] != NUL && i < lead_len; i += l) { l = (*mb_ptr2len)(p + i); if (vim_strnsize(p, i + l) > repl_size) --- 1197,1203 ---- int i; int l; ! for (i = 0; i < lead_len && p[i] != NUL; i += l) { l = (*mb_ptr2len)(p + i); if (vim_strnsize(p, i + l) > repl_size) *** ../vim-7.4.1779/src/ops.c 2016-04-08 17:07:09.542160709 +0200 --- src/ops.c 2016-04-23 14:27:12.700815349 +0200 *************** *** 5709,5715 **** if (buf1 == NULL) goto theend; ptr = buf1; ! if (negative && (!visual || (visual && was_positive))) { *ptr++ = '-'; } --- 5709,5715 ---- if (buf1 == NULL) goto theend; ptr = buf1; ! if (negative && (!visual || was_positive)) { *ptr++ = '-'; } *** ../vim-7.4.1779/src/regexp_nfa.c 2016-04-04 20:55:51.432055834 +0200 --- src/regexp_nfa.c 2016-04-23 14:27:12.700815349 +0200 *************** *** 5515,5528 **** int add_off = 0; int toplevel = start->c == NFA_MOPEN; #ifdef NFA_REGEXP_DEBUG_LOG ! FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a"); ! ! if (debug == NULL) ! { ! EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG); ! return FALSE; ! } #endif /* Some patterns may take a long time to match, especially when using * recursive_regmatch(). Allow interrupting them with CTRL-C. */ fast_breakcheck(); --- 5515,5523 ---- int add_off = 0; int toplevel = start->c == NFA_MOPEN; #ifdef NFA_REGEXP_DEBUG_LOG ! FILE *debug; #endif + /* Some patterns may take a long time to match, especially when using * recursive_regmatch(). Allow interrupting them with CTRL-C. */ fast_breakcheck(); *************** *** 5533,5538 **** --- 5528,5541 ---- return FALSE; #endif + #ifdef NFA_REGEXP_DEBUG_LOG + debug = fopen(NFA_REGEXP_DEBUG_LOG, "a"); + if (debug == NULL) + { + EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG); + return FALSE; + } + #endif nfa_match = FALSE; /* Allocate memory for the lists of nodes. */ *** ../vim-7.4.1779/src/version.c 2016-04-23 13:54:36.688653059 +0200 --- src/version.c 2016-04-23 14:28:38.303946507 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1780, /**/ -- BLACK KNIGHT: Come on you pansy! [hah] [parry thrust] [ARTHUR chops the BLACK KNIGHT's right arm off] ARTHUR: Victory is mine! [kneeling] We thank thee Lord, that in thy merc- [Black Knight kicks Arthur in the head while he is praying] The Quest for the Holy Grail (Monty Python) /// 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 ///