| To: vim-dev@vim.org |
| Subject: Patch 7.2.169 |
| 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.2.169 |
| Problem: Splint complains about a lot of things. |
| Solution: Add type casts, #ifdefs and other changes to avoid warnings. |
| Change colnr_T from unsigned to int. Avoids mistakes with |
| subtracting columns. |
| Files: src/cleanlint.vim, src/diff.c, src/edit.c, src/ex_cmds.c, |
| src/ex_cmds2.c, src/ex_docmd.c, src/proto/ex_cmds.pro, |
| src/proto/spell.pro, src/quickfix.c, src/spell.c, src/structs.h, |
| src/term.h, src/vim.h |
| |
| |
| |
| |
| |
| *** 1,27 **** |
| " Vim tool: Filter output of splint |
| " |
| " Maintainer: Bram Moolenaar <Bram@vim.org> |
| ! " Last Change: 2009 May 05 |
| |
| " Usage: redirect output of "make lint" to a file, edit that file with Vim and |
| " :call CleanLint() |
| " This deletes irrelevant messages. What remains might be valid warnings. |
| |
| fun! CleanLint() |
| - g/^ Types are incompatible/lockmarks d |
| g/Assignment of dev_t to __dev_t:/lockmarks d |
| g/Assignment of __dev_t to dev_t:/lockmarks d |
| g/Operands of == have incompatible types (__dev_t, dev_t): /lockmarks d |
| ! g/Operands of == have incompatible types (unsigned int, int): /lockmarks d |
| g/Assignment of char to char_u: /lockmarks d |
| g/Assignment of unsigned int to int: /lockmarks d |
| ! g/Assignment of colnr_T to int: /lockmarks d |
| g/Assignment of int to char_u: /lockmarks d |
| g/Function .* expects arg . to be wint_t gets int: /lockmarks d |
| ! g/^digraph.c.*digraphdefault.*is type char, expects char_u:/lockmarks d |
| g/^digraph.c.*Additional initialization errors for digraphdefault not reported/lockmarks d |
| g/Function strncasecmp expects arg 3 to be int gets size_t: /lockmarks d |
| g/ To ignore signs in type comparisons use +ignoresigns/lockmarks d |
| g/ To allow arbitrary integral types to match any integral type, use +matchanyintegral./lockmarks d |
| g/ To allow arbitrary integral types to match long unsigned, use +longintegral./lockmarks d |
| endfun |
| --- 1,32 ---- |
| " Vim tool: Filter output of splint |
| " |
| " Maintainer: Bram Moolenaar <Bram@vim.org> |
| ! " Last Change: 2009 May 13 |
| |
| " Usage: redirect output of "make lint" to a file, edit that file with Vim and |
| " :call CleanLint() |
| " This deletes irrelevant messages. What remains might be valid warnings. |
| |
| fun! CleanLint() |
| g/Assignment of dev_t to __dev_t:/lockmarks d |
| g/Assignment of __dev_t to dev_t:/lockmarks d |
| g/Operands of == have incompatible types (__dev_t, dev_t): /lockmarks d |
| ! g/Operands of == have incompatible types (char_u, int): /lockmarks d |
| g/Assignment of char to char_u: /lockmarks d |
| g/Assignment of unsigned int to int: /lockmarks d |
| ! g/Assignment of int to unsigned int: /lockmarks d |
| ! g/Assignment of unsigned int to long int: /lockmarks d |
| g/Assignment of int to char_u: /lockmarks d |
| g/Function .* expects arg . to be wint_t gets int: /lockmarks d |
| ! g/Function .* expects arg . to be size_t gets int: /lockmarks d |
| ! g/Initial value of .* is type char, expects char_u: /lockmarks d |
| ! g/^ex_cmds.h:.* Function types are inconsistent. Parameter 1 is implicitly temp, but unqualified in assigned function:/lockmarks d |
| ! g/^ex_docmd.c:.* nospec_str/lockmarks d |
| g/^digraph.c.*Additional initialization errors for digraphdefault not reported/lockmarks d |
| g/Function strncasecmp expects arg 3 to be int gets size_t: /lockmarks d |
| + g/^ Types are incompatible/lockmarks d |
| g/ To ignore signs in type comparisons use +ignoresigns/lockmarks d |
| g/ To allow arbitrary integral types to match any integral type, use +matchanyintegral./lockmarks d |
| g/ To allow arbitrary integral types to match long unsigned, use +longintegral./lockmarks d |
| + g+ A variable is declared but never used. Use /.@unused@./ in front of declaration to suppress message.+lockmarks d |
| endfun |
| |
| |
| |
| *** 827,832 **** |
| --- 827,833 ---- |
| char_u *tmp_diff; |
| { |
| char_u *cmd; |
| + size_t len; |
| |
| #ifdef FEAT_EVAL |
| if (*p_dex != NUL) |
| |
| *** 835,842 **** |
| else |
| #endif |
| { |
| ! cmd = alloc((unsigned)(STRLEN(tmp_orig) + STRLEN(tmp_new) |
| ! + STRLEN(tmp_diff) + STRLEN(p_srr) + 27)); |
| if (cmd != NULL) |
| { |
| /* We don't want $DIFF_OPTIONS to get in the way. */ |
| --- 836,844 ---- |
| else |
| #endif |
| { |
| ! len = STRLEN(tmp_orig) + STRLEN(tmp_new) |
| ! + STRLEN(tmp_diff) + STRLEN(p_srr) + 27; |
| ! cmd = alloc((unsigned)len); |
| if (cmd != NULL) |
| { |
| /* We don't want $DIFF_OPTIONS to get in the way. */ |
| |
| *** 846,852 **** |
| /* Build the diff command and execute it. Always use -a, binary |
| * differences are of no use. Ignore errors, diff returns |
| * non-zero when differences have been found. */ |
| ! sprintf((char *)cmd, "diff %s%s%s%s%s %s", |
| diff_a_works == FALSE ? "" : "-a ", |
| #if defined(MSWIN) || defined(MSDOS) |
| diff_bin_works == TRUE ? "--binary " : "", |
| --- 848,854 ---- |
| /* Build the diff command and execute it. Always use -a, binary |
| * differences are of no use. Ignore errors, diff returns |
| * non-zero when differences have been found. */ |
| ! vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s %s", |
| diff_a_works == FALSE ? "" : "-a ", |
| #if defined(MSWIN) || defined(MSDOS) |
| diff_bin_works == TRUE ? "--binary " : "", |
| |
| *** 856,862 **** |
| (diff_flags & DIFF_IWHITE) ? "-b " : "", |
| (diff_flags & DIFF_ICASE) ? "-i " : "", |
| tmp_orig, tmp_new); |
| ! append_redir(cmd, p_srr, tmp_diff); |
| #ifdef FEAT_AUTOCMD |
| block_autocmds(); /* Avoid ShellCmdPost stuff */ |
| #endif |
| --- 858,864 ---- |
| (diff_flags & DIFF_IWHITE) ? "-b " : "", |
| (diff_flags & DIFF_ICASE) ? "-i " : "", |
| tmp_orig, tmp_new); |
| ! append_redir(cmd, (int)len, p_srr, tmp_diff); |
| #ifdef FEAT_AUTOCMD |
| block_autocmds(); /* Avoid ShellCmdPost stuff */ |
| #endif |
| |
| *** 881,886 **** |
| --- 883,889 ---- |
| char_u *tmp_orig; /* name of original temp file */ |
| char_u *tmp_new; /* name of patched temp file */ |
| char_u *buf = NULL; |
| + size_t buflen; |
| win_T *old_curwin = curwin; |
| char_u *newname = NULL; /* name of patched file buffer */ |
| #ifdef UNIX |
| |
| *** 920,930 **** |
| /* Get the absolute path of the patchfile, changing directory below. */ |
| fullname = FullName_save(eap->arg, FALSE); |
| #endif |
| ! buf = alloc((unsigned)(STRLEN(tmp_orig) + ( |
| # ifdef UNIX |
| fullname != NULL ? STRLEN(fullname) : |
| # endif |
| ! STRLEN(eap->arg)) + STRLEN(tmp_new) + 16)); |
| if (buf == NULL) |
| goto theend; |
| |
| --- 923,934 ---- |
| /* Get the absolute path of the patchfile, changing directory below. */ |
| fullname = FullName_save(eap->arg, FALSE); |
| #endif |
| ! buflen = STRLEN(tmp_orig) + ( |
| # ifdef UNIX |
| fullname != NULL ? STRLEN(fullname) : |
| # endif |
| ! STRLEN(eap->arg)) + STRLEN(tmp_new) + 16; |
| ! buf = alloc((unsigned)buflen); |
| if (buf == NULL) |
| goto theend; |
| |
| |
| *** 961,967 **** |
| { |
| /* Build the patch command and execute it. Ignore errors. Switch to |
| * cooked mode to allow the user to respond to prompts. */ |
| ! sprintf((char *)buf, "patch -o %s %s < \"%s\"", tmp_new, tmp_orig, |
| # ifdef UNIX |
| fullname != NULL ? fullname : |
| # endif |
| --- 965,972 ---- |
| { |
| /* Build the patch command and execute it. Ignore errors. Switch to |
| * cooked mode to allow the user to respond to prompts. */ |
| ! vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"", |
| ! tmp_new, tmp_orig, |
| # ifdef UNIX |
| fullname != NULL ? fullname : |
| # endif |
| |
| |
| |
| *** 169,175 **** |
| static int ins_compl_key2count __ARGS((int c)); |
| static int ins_compl_use_match __ARGS((int c)); |
| static int ins_complete __ARGS((int c)); |
| ! static int quote_meta __ARGS((char_u *dest, char_u *str, int len)); |
| #endif /* FEAT_INS_EXPAND */ |
| |
| #define BACKSPACE_CHAR 1 |
| --- 169,175 ---- |
| static int ins_compl_key2count __ARGS((int c)); |
| static int ins_compl_use_match __ARGS((int c)); |
| static int ins_complete __ARGS((int c)); |
| ! static unsigned quote_meta __ARGS((char_u *dest, char_u *str, int len)); |
| #endif /* FEAT_INS_EXPAND */ |
| |
| #define BACKSPACE_CHAR 1 |
| |
| *** 757,763 **** |
| * there is nothing to add, CTRL-L works like CTRL-P then. */ |
| if (c == Ctrl_L |
| && (ctrl_x_mode != CTRL_X_WHOLE_LINE |
| ! || STRLEN(compl_shown_match->cp_str) |
| > curwin->w_cursor.col - compl_col)) |
| { |
| ins_compl_addfrommatch(); |
| --- 757,763 ---- |
| * there is nothing to add, CTRL-L works like CTRL-P then. */ |
| if (c == Ctrl_L |
| && (ctrl_x_mode != CTRL_X_WHOLE_LINE |
| ! || (int)STRLEN(compl_shown_match->cp_str) |
| > curwin->w_cursor.col - compl_col)) |
| { |
| ins_compl_addfrommatch(); |
| |
| *** 3837,3843 **** |
| --- 3837,3847 ---- |
| char_u *word; |
| int icase = FALSE; |
| int adup = FALSE; |
| + #ifdef S_SPLINT_S /* splint doesn't parse array of pointers correctly */ |
| + char_u **cptext; |
| + #else |
| char_u *(cptext[CPT_COUNT]); |
| + #endif |
| |
| if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL) |
| { |
| |
| *** 3994,4000 **** |
| else if (*e_cpt == ']' || *e_cpt == 't') |
| { |
| type = CTRL_X_TAGS; |
| ! sprintf((char*)IObuff, _("Scanning tags.")); |
| (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); |
| } |
| else |
| --- 3998,4004 ---- |
| else if (*e_cpt == ']' || *e_cpt == 't') |
| { |
| type = CTRL_X_TAGS; |
| ! vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags.")); |
| (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); |
| } |
| else |
| |
| *** 4093,4099 **** |
| case CTRL_X_SPELL: |
| #ifdef FEAT_SPELL |
| num_matches = expand_spelling(first_match_pos.lnum, |
| ! first_match_pos.col, compl_pattern, &matches); |
| if (num_matches > 0) |
| ins_compl_add_matches(num_matches, matches, p_ic); |
| #endif |
| --- 4097,4103 ---- |
| case CTRL_X_SPELL: |
| #ifdef FEAT_SPELL |
| num_matches = expand_spelling(first_match_pos.lnum, |
| ! compl_pattern, &matches); |
| if (num_matches > 0) |
| ins_compl_add_matches(num_matches, matches, p_ic); |
| #endif |
| |
| *** 4803,4812 **** |
| { |
| char_u *prefix = (char_u *)"\\<"; |
| |
| ! /* we need 3 extra chars, 1 for the NUL and |
| ! * 2 >= strlen(prefix) -- Acevedo */ |
| compl_pattern = alloc(quote_meta(NULL, line + compl_col, |
| ! compl_length) + 3); |
| if (compl_pattern == NULL) |
| return FAIL; |
| if (!vim_iswordp(line + compl_col) |
| --- 4807,4815 ---- |
| { |
| char_u *prefix = (char_u *)"\\<"; |
| |
| ! /* we need up to 2 extra chars for the prefix */ |
| compl_pattern = alloc(quote_meta(NULL, line + compl_col, |
| ! compl_length) + 2); |
| if (compl_pattern == NULL) |
| return FAIL; |
| if (!vim_iswordp(line + compl_col) |
| |
| *** 4881,4887 **** |
| else |
| { |
| compl_pattern = alloc(quote_meta(NULL, line + compl_col, |
| ! compl_length) + 3); |
| if (compl_pattern == NULL) |
| return FAIL; |
| STRCPY((char *)compl_pattern, "\\<"); |
| --- 4884,4890 ---- |
| else |
| { |
| compl_pattern = alloc(quote_meta(NULL, line + compl_col, |
| ! compl_length) + 2); |
| if (compl_pattern == NULL) |
| return FAIL; |
| STRCPY((char *)compl_pattern, "\\<"); |
| |
| *** 4963,4969 **** |
| if (col < 0) |
| col = curs_col; |
| compl_col = col; |
| ! if ((colnr_T)compl_col > curs_col) |
| compl_col = curs_col; |
| |
| /* Setup variables for completion. Need to obtain "line" again, |
| --- 4966,4972 ---- |
| if (col < 0) |
| col = curs_col; |
| compl_col = col; |
| ! if (compl_col > curs_col) |
| compl_col = curs_col; |
| |
| /* Setup variables for completion. Need to obtain "line" again, |
| |
| *** 5236,5250 **** |
| * a backslash) the metachars, and dest would be NUL terminated. |
| * Returns the length (needed) of dest |
| */ |
| ! static int |
| quote_meta(dest, src, len) |
| char_u *dest; |
| char_u *src; |
| int len; |
| { |
| ! int m; |
| |
| ! for (m = len; --len >= 0; src++) |
| { |
| switch (*src) |
| { |
| --- 5239,5253 ---- |
| * a backslash) the metachars, and dest would be NUL terminated. |
| * Returns the length (needed) of dest |
| */ |
| ! static unsigned |
| quote_meta(dest, src, len) |
| char_u *dest; |
| char_u *src; |
| int len; |
| { |
| ! unsigned m = (unsigned)len + 1; /* one extra for the NUL */ |
| |
| ! for ( ; --len >= 0; src++) |
| { |
| switch (*src) |
| { |
| |
| *** 6073,6079 **** |
| * in 'formatoptions' and there is a single character before the cursor. |
| * Otherwise the line would be broken and when typing another non-white |
| * next they are not joined back together. */ |
| ! wasatend = (pos.col == STRLEN(old)); |
| if (*old != NUL && !trailblank && wasatend) |
| { |
| dec_cursor(); |
| --- 6076,6082 ---- |
| * in 'formatoptions' and there is a single character before the cursor. |
| * Otherwise the line would be broken and when typing another non-white |
| * next they are not joined back together. */ |
| ! wasatend = (pos.col == (colnr_T)STRLEN(old)); |
| if (*old != NUL && !trailblank && wasatend) |
| { |
| dec_cursor(); |
| |
| *** 6250,6256 **** |
| * three digits. */ |
| if (VIM_ISDIGIT(c)) |
| { |
| ! sprintf((char *)buf, "%03d", c); |
| AppendToRedobuff(buf); |
| } |
| else |
| --- 6253,6259 ---- |
| * three digits. */ |
| if (VIM_ISDIGIT(c)) |
| { |
| ! vim_snprintf((char *)buf, sizeof(buf), "%03d", c); |
| AppendToRedobuff(buf); |
| } |
| else |
| |
| *** 6453,6462 **** |
| * deleted characters. */ |
| if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum) |
| { |
| ! cc = (int)STRLEN(ml_get_curline()); |
| ! if (VIsual.col > (colnr_T)cc) |
| { |
| ! VIsual.col = cc; |
| # ifdef FEAT_VIRTUALEDIT |
| VIsual.coladd = 0; |
| # endif |
| --- 6457,6467 ---- |
| * deleted characters. */ |
| if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum) |
| { |
| ! int len = (int)STRLEN(ml_get_curline()); |
| ! |
| ! if (VIsual.col > len) |
| { |
| ! VIsual.col = len; |
| # ifdef FEAT_VIRTUALEDIT |
| VIsual.coladd = 0; |
| # endif |
| |
| *** 8315,8320 **** |
| --- 8320,8326 ---- |
| linenr_T lnum; |
| int cc; |
| int temp = 0; /* init for GCC */ |
| + colnr_T save_col; |
| colnr_T mincol; |
| int did_backspace = FALSE; |
| int in_indent; |
| |
| *** 8472,8484 **** |
| */ |
| while (cc > 0) |
| { |
| ! temp = curwin->w_cursor.col; |
| #ifdef FEAT_MBYTE |
| mb_replace_pop_ins(cc); |
| #else |
| ins_char(cc); |
| #endif |
| ! curwin->w_cursor.col = temp; |
| cc = replace_pop(); |
| } |
| /* restore the characters that NL replaced */ |
| --- 8478,8490 ---- |
| */ |
| while (cc > 0) |
| { |
| ! save_col = curwin->w_cursor.col; |
| #ifdef FEAT_MBYTE |
| mb_replace_pop_ins(cc); |
| #else |
| ins_char(cc); |
| #endif |
| ! curwin->w_cursor.col = save_col; |
| cc = replace_pop(); |
| } |
| /* restore the characters that NL replaced */ |
| |
| *** 8510,8520 **** |
| #endif |
| ) |
| { |
| ! temp = curwin->w_cursor.col; |
| beginline(BL_WHITE); |
| if (curwin->w_cursor.col < (colnr_T)temp) |
| mincol = curwin->w_cursor.col; |
| ! curwin->w_cursor.col = temp; |
| } |
| |
| /* |
| --- 8516,8526 ---- |
| #endif |
| ) |
| { |
| ! save_col = curwin->w_cursor.col; |
| beginline(BL_WHITE); |
| if (curwin->w_cursor.col < (colnr_T)temp) |
| mincol = curwin->w_cursor.col; |
| ! curwin->w_cursor.col = save_col; |
| } |
| |
| /* |
| |
| |
| |
| *** 87,99 **** |
| )) |
| { |
| transchar_nonprint(buf3, c); |
| ! sprintf(buf1, " <%s>", (char *)buf3); |
| } |
| else |
| buf1[0] = NUL; |
| #ifndef EBCDIC |
| if (c >= 0x80) |
| ! sprintf(buf2, " <M-%s>", transchar(c & 0x7f)); |
| else |
| #endif |
| buf2[0] = NUL; |
| --- 87,100 ---- |
| )) |
| { |
| transchar_nonprint(buf3, c); |
| ! vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3); |
| } |
| else |
| buf1[0] = NUL; |
| #ifndef EBCDIC |
| if (c >= 0x80) |
| ! vim_snprintf(buf2, sizeof(buf2), " <M-%s>", |
| ! (char *)transchar(c & 0x7f)); |
| else |
| #endif |
| buf2[0] = NUL; |
| |
| *** 358,364 **** |
| linenr_T lnum; |
| long maxlen = 0; |
| sorti_T *nrs; |
| ! size_t count = eap->line2 - eap->line1 + 1; |
| size_t i; |
| char_u *p; |
| char_u *s; |
| --- 359,365 ---- |
| linenr_T lnum; |
| long maxlen = 0; |
| sorti_T *nrs; |
| ! size_t count = (size_t)(eap->line2 - eap->line1 + 1); |
| size_t i; |
| char_u *p; |
| char_u *s; |
| |
| *** 957,963 **** |
| } |
| len += (int)STRLEN(prevcmd); |
| } |
| ! if ((t = alloc(len)) == NULL) |
| { |
| vim_free(newcmd); |
| return; |
| --- 958,964 ---- |
| } |
| len += (int)STRLEN(prevcmd); |
| } |
| ! if ((t = alloc((unsigned)len)) == NULL) |
| { |
| vim_free(newcmd); |
| return; |
| |
| *** 1548,1554 **** |
| * redirecting input and/or output. |
| */ |
| if (itmp != NULL || otmp != NULL) |
| ! sprintf((char *)buf, "(%s)", (char *)cmd); |
| else |
| STRCPY(buf, cmd); |
| if (itmp != NULL) |
| --- 1549,1555 ---- |
| * redirecting input and/or output. |
| */ |
| if (itmp != NULL || otmp != NULL) |
| ! vim_snprintf((char *)buf, len, "(%s)", (char *)cmd); |
| else |
| STRCPY(buf, cmd); |
| if (itmp != NULL) |
| |
| *** 1597,1633 **** |
| } |
| #endif |
| if (otmp != NULL) |
| ! append_redir(buf, p_srr, otmp); |
| |
| return buf; |
| } |
| |
| /* |
| ! * Append output redirection for file "fname" to the end of string buffer "buf" |
| * Works with the 'shellredir' and 'shellpipe' options. |
| * The caller should make sure that there is enough room: |
| * STRLEN(opt) + STRLEN(fname) + 3 |
| */ |
| void |
| ! append_redir(buf, opt, fname) |
| char_u *buf; |
| char_u *opt; |
| char_u *fname; |
| { |
| char_u *p; |
| |
| ! buf += STRLEN(buf); |
| /* find "%s", skipping "%%" */ |
| for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p) |
| if (p[1] == 's') |
| break; |
| if (p != NULL) |
| { |
| ! *buf = ' '; /* not really needed? Not with sh, ksh or bash */ |
| ! sprintf((char *)buf + 1, (char *)opt, (char *)fname); |
| } |
| else |
| ! sprintf((char *)buf, |
| #ifdef FEAT_QUICKFIX |
| # ifndef RISCOS |
| opt != p_sp ? " %s%s" : |
| --- 1598,1638 ---- |
| } |
| #endif |
| if (otmp != NULL) |
| ! append_redir(buf, (int)len, p_srr, otmp); |
| |
| return buf; |
| } |
| |
| /* |
| ! * Append output redirection for file "fname" to the end of string buffer |
| ! * "buf[buflen]" |
| * Works with the 'shellredir' and 'shellpipe' options. |
| * The caller should make sure that there is enough room: |
| * STRLEN(opt) + STRLEN(fname) + 3 |
| */ |
| void |
| ! append_redir(buf, buflen, opt, fname) |
| char_u *buf; |
| + int buflen; |
| char_u *opt; |
| char_u *fname; |
| { |
| char_u *p; |
| + char_u *end; |
| |
| ! end = buf + STRLEN(buf); |
| /* find "%s", skipping "%%" */ |
| for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p) |
| if (p[1] == 's') |
| break; |
| if (p != NULL) |
| { |
| ! *end = ' '; /* not really needed? Not with sh, ksh or bash */ |
| ! vim_snprintf((char *)end + 1, (size_t)(buflen - (end + 1 - buf)), |
| ! (char *)opt, (char *)fname); |
| } |
| else |
| ! vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), |
| #ifdef FEAT_QUICKFIX |
| # ifndef RISCOS |
| opt != p_sp ? " %s%s" : |
| |
| *** 2390,2396 **** |
| |
| if (curwin->w_p_nu || use_number) |
| { |
| ! sprintf((char *)numbuf, "%*ld ", number_width(curwin), (long)lnum); |
| msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */ |
| } |
| msg_prt_line(ml_get(lnum), list); |
| --- 2395,2402 ---- |
| |
| if (curwin->w_p_nu || use_number) |
| { |
| ! vim_snprintf((char *)numbuf, sizeof(numbuf), |
| ! "%*ld ", number_width(curwin), (long)lnum); |
| msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */ |
| } |
| msg_prt_line(ml_get(lnum), list); |
| |
| *** 4486,4492 **** |
| char_u *p1; |
| int did_sub = FALSE; |
| int lastone; |
| ! unsigned len, needed_len; |
| long nmatch_tl = 0; /* nr of lines matched below lnum */ |
| int do_again; /* do it again after joining lines */ |
| int skip_match = FALSE; |
| --- 4492,4498 ---- |
| char_u *p1; |
| int did_sub = FALSE; |
| int lastone; |
| ! int len, copy_len, needed_len; |
| long nmatch_tl = 0; /* nr of lines matched below lnum */ |
| int do_again; /* do it again after joining lines */ |
| int skip_match = FALSE; |
| |
| *** 4631,4636 **** |
| --- 4637,4644 ---- |
| |
| if (do_ask) |
| { |
| + int typed; |
| + |
| /* change State to CONFIRM, so that the mouse works |
| * properly */ |
| save_State = State; |
| |
| *** 4669,4675 **** |
| resp = getexmodeline('?', NULL, 0); |
| if (resp != NULL) |
| { |
| ! i = *resp; |
| vim_free(resp); |
| } |
| } |
| --- 4677,4683 ---- |
| resp = getexmodeline('?', NULL, 0); |
| if (resp != NULL) |
| { |
| ! typed = *resp; |
| vim_free(resp); |
| } |
| } |
| |
| *** 4721,4727 **** |
| #endif |
| ++no_mapping; /* don't map this key */ |
| ++allow_keys; /* allow special keys */ |
| ! i = plain_vgetc(); |
| --allow_keys; |
| --no_mapping; |
| |
| --- 4729,4735 ---- |
| #endif |
| ++no_mapping; /* don't map this key */ |
| ++allow_keys; /* allow special keys */ |
| ! typed = plain_vgetc(); |
| --allow_keys; |
| --no_mapping; |
| |
| |
| *** 4732,4766 **** |
| } |
| |
| need_wait_return = FALSE; /* no hit-return prompt */ |
| ! if (i == 'q' || i == ESC || i == Ctrl_C |
| #ifdef UNIX |
| ! || i == intr_char |
| #endif |
| ) |
| { |
| got_quit = TRUE; |
| break; |
| } |
| ! if (i == 'n') |
| break; |
| ! if (i == 'y') |
| break; |
| ! if (i == 'l') |
| { |
| /* last: replace and then stop */ |
| do_all = FALSE; |
| line2 = lnum; |
| break; |
| } |
| ! if (i == 'a') |
| { |
| do_ask = FALSE; |
| break; |
| } |
| #ifdef FEAT_INS_EXPAND |
| ! if (i == Ctrl_E) |
| scrollup_clamp(); |
| ! else if (i == Ctrl_Y) |
| scrolldown_clamp(); |
| #endif |
| } |
| --- 4740,4774 ---- |
| } |
| |
| need_wait_return = FALSE; /* no hit-return prompt */ |
| ! if (typed == 'q' || typed == ESC || typed == Ctrl_C |
| #ifdef UNIX |
| ! || typed == intr_char |
| #endif |
| ) |
| { |
| got_quit = TRUE; |
| break; |
| } |
| ! if (typed == 'n') |
| break; |
| ! if (typed == 'y') |
| break; |
| ! if (typed == 'l') |
| { |
| /* last: replace and then stop */ |
| do_all = FALSE; |
| line2 = lnum; |
| break; |
| } |
| ! if (typed == 'a') |
| { |
| do_ask = FALSE; |
| break; |
| } |
| #ifdef FEAT_INS_EXPAND |
| ! if (typed == Ctrl_E) |
| scrollup_clamp(); |
| ! else if (typed == Ctrl_Y) |
| scrolldown_clamp(); |
| #endif |
| } |
| |
| *** 4771,4777 **** |
| if (vim_strchr(p_cpo, CPO_UNDO) != NULL) |
| --no_u_sync; |
| |
| ! if (i == 'n') |
| { |
| /* For a multi-line match, put matchcol at the NUL at |
| * the end of the line and set nmatch to one, so that |
| --- 4779,4785 ---- |
| if (vim_strchr(p_cpo, CPO_UNDO) != NULL) |
| --no_u_sync; |
| |
| ! if (typed == 'n') |
| { |
| /* For a multi-line match, put matchcol at the NUL at |
| * the end of the line and set nmatch to one, so that |
| |
| *** 4822,4830 **** |
| p1 = ml_get(sub_firstlnum + nmatch - 1); |
| nmatch_tl += nmatch - 1; |
| } |
| ! i = regmatch.startpos[0].col - copycol; |
| ! needed_len = i + ((unsigned)STRLEN(p1) - regmatch.endpos[0].col) |
| ! + sublen + 1; |
| if (new_start == NULL) |
| { |
| /* |
| --- 4830,4838 ---- |
| p1 = ml_get(sub_firstlnum + nmatch - 1); |
| nmatch_tl += nmatch - 1; |
| } |
| ! copy_len = regmatch.startpos[0].col - copycol; |
| ! needed_len = copy_len + ((unsigned)STRLEN(p1) |
| ! - regmatch.endpos[0].col) + sublen + 1; |
| if (new_start == NULL) |
| { |
| /* |
| |
| *** 4847,4853 **** |
| */ |
| len = (unsigned)STRLEN(new_start); |
| needed_len += len; |
| ! if (needed_len > new_start_len) |
| { |
| new_start_len = needed_len + 50; |
| if ((p1 = alloc_check(new_start_len)) == NULL) |
| --- 4855,4861 ---- |
| */ |
| len = (unsigned)STRLEN(new_start); |
| needed_len += len; |
| ! if (needed_len > (int)new_start_len) |
| { |
| new_start_len = needed_len + 50; |
| if ((p1 = alloc_check(new_start_len)) == NULL) |
| |
| *** 4865,4872 **** |
| /* |
| * copy the text up to the part that matched |
| */ |
| ! mch_memmove(new_end, sub_firstline + copycol, (size_t)i); |
| ! new_end += i; |
| |
| (void)vim_regsub_multi(®match, |
| sub_firstlnum - regmatch.startpos[0].lnum, |
| --- 4873,4880 ---- |
| /* |
| * copy the text up to the part that matched |
| */ |
| ! mch_memmove(new_end, sub_firstline + copycol, (size_t)copy_len); |
| ! new_end += copy_len; |
| |
| (void)vim_regsub_multi(®match, |
| sub_firstlnum - regmatch.startpos[0].lnum, |
| |
| *** 5768,5773 **** |
| --- 5776,5785 ---- |
| { |
| char_u *s, *d; |
| int i; |
| + #ifdef S_SPLINT_S /* splint doesn't understand array of pointers */ |
| + static char **mtable; |
| + static char **rtable; |
| + #else |
| static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*", |
| "/*", "/\\*", "\"*", "**", |
| "/\\(\\)", |
| |
| *** 5782,5787 **** |
| --- 5794,5800 ---- |
| "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=", |
| "\\[count]", "\\[quotex]", "\\[range]", |
| "\\[pattern]", "\\\\bar", "/\\\\%\\$"}; |
| + #endif |
| int flags; |
| |
| d = IObuff; /* assume IObuff is long enough! */ |
| |
| *** 5790,5796 **** |
| * Recognize a few exceptions to the rule. Some strings that contain '*' |
| * with "star". Otherwise '*' is recognized as a wildcard. |
| */ |
| ! for (i = sizeof(mtable) / sizeof(char *); --i >= 0; ) |
| if (STRCMP(arg, mtable[i]) == 0) |
| { |
| STRCPY(d, rtable[i]); |
| --- 5803,5809 ---- |
| * Recognize a few exceptions to the rule. Some strings that contain '*' |
| * with "star". Otherwise '*' is recognized as a wildcard. |
| */ |
| ! for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; ) |
| if (STRCMP(arg, mtable[i]) == 0) |
| { |
| STRCPY(d, rtable[i]); |
| |
| |
| |
| *** 3373,3379 **** |
| p = skipwhite(sp->nextline); |
| if (*p != '\\') |
| break; |
| ! s = alloc((int)(STRLEN(line) + STRLEN(p))); |
| if (s == NULL) /* out of memory */ |
| break; |
| STRCPY(s, line); |
| --- 3373,3379 ---- |
| p = skipwhite(sp->nextline); |
| if (*p != '\\') |
| break; |
| ! s = alloc((unsigned)(STRLEN(line) + STRLEN(p))); |
| if (s == NULL) /* out of memory */ |
| break; |
| STRCPY(s, line); |
| |
| |
| |
| *** 2737,2743 **** |
| int i; |
| |
| for (i = 0; cmd[i] != NUL; ++i) |
| ! if (cmd[i] != (*pp)[i]) |
| break; |
| if (i >= len && !isalpha((*pp)[i])) |
| { |
| --- 2737,2743 ---- |
| int i; |
| |
| for (i = 0; cmd[i] != NUL; ++i) |
| ! if (((char_u *)cmd)[i] != (*pp)[i]) |
| break; |
| if (i >= len && !isalpha((*pp)[i])) |
| { |
| |
| *** 2803,2809 **** |
| /* Check for ":dl", ":dell", etc. to ":deletel": that's |
| * :delete with the 'l' flag. Same for 'p'. */ |
| for (i = 0; i < len; ++i) |
| ! if (eap->cmd[i] != "delete"[i]) |
| break; |
| if (i == len - 1) |
| { |
| --- 2803,2809 ---- |
| /* Check for ":dl", ":dell", etc. to ":deletel": that's |
| * :delete with the 'l' flag. Same for 'p'. */ |
| for (i = 0; i < len; ++i) |
| ! if (eap->cmd[i] != ((char_u *)"delete")[i]) |
| break; |
| if (i == len - 1) |
| { |
| |
| *** 3823,3829 **** |
| char_u *cmd; |
| int *ctx; /* pointer to xp_context or NULL */ |
| { |
| ! int delim; |
| |
| while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL) |
| { |
| --- 3823,3829 ---- |
| char_u *cmd; |
| int *ctx; /* pointer to xp_context or NULL */ |
| { |
| ! unsigned delim; |
| |
| while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL) |
| { |
| |
| *** 9417,9423 **** |
| { |
| int len; |
| int i; |
| ! static char *(spec_str[]) = { |
| "%", |
| #define SPEC_PERC 0 |
| "#", |
| --- 9417,9429 ---- |
| { |
| int len; |
| int i; |
| ! #ifdef S_SPLINT_S /* splint can't handle array of pointers */ |
| ! static char **spec_str; |
| ! static char *(nospec_str[]) |
| ! #else |
| ! static char *(spec_str[]) |
| ! #endif |
| ! = { |
| "%", |
| #define SPEC_PERC 0 |
| "#", |
| |
| *** 9443,9451 **** |
| # define SPEC_CLIENT 9 |
| #endif |
| }; |
| - #define SPEC_COUNT (sizeof(spec_str) / sizeof(char *)) |
| |
| ! for (i = 0; i < SPEC_COUNT; ++i) |
| { |
| len = (int)STRLEN(spec_str[i]); |
| if (STRNCMP(src, spec_str[i], len) == 0) |
| --- 9449,9456 ---- |
| # define SPEC_CLIENT 9 |
| #endif |
| }; |
| |
| ! for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i) |
| { |
| len = (int)STRLEN(spec_str[i]); |
| if (STRNCMP(src, spec_str[i], len) == 0) |
| |
| *** 9796,9802 **** |
| } |
| |
| /* allocate memory */ |
| ! retval = alloc(len + 1); |
| if (retval == NULL) |
| break; |
| } |
| --- 9801,9807 ---- |
| } |
| |
| /* allocate memory */ |
| ! retval = alloc((unsigned)len + 1); |
| if (retval == NULL) |
| break; |
| } |
| |
| |
| |
| *** 9,15 **** |
| void do_bang __ARGS((int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)); |
| void do_shell __ARGS((char_u *cmd, int flags)); |
| char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp)); |
| ! void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname)); |
| int viminfo_error __ARGS((char *errnum, char *message, char_u *line)); |
| int read_viminfo __ARGS((char_u *file, int flags)); |
| void write_viminfo __ARGS((char_u *file, int forceit)); |
| --- 9,15 ---- |
| void do_bang __ARGS((int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)); |
| void do_shell __ARGS((char_u *cmd, int flags)); |
| char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp)); |
| ! void append_redir __ARGS((char_u *buf, int buflen, char_u *opt, char_u *fname)); |
| int viminfo_error __ARGS((char *errnum, char *message, char_u *line)); |
| int read_viminfo __ARGS((char_u *file, int flags)); |
| void write_viminfo __ARGS((char_u *file, int forceit)); |
| |
| |
| |
| *** 22,26 **** |
| char_u *spell_to_word_end __ARGS((char_u *start, buf_T *buf)); |
| int spell_word_start __ARGS((int startcol)); |
| void spell_expand_check_cap __ARGS((colnr_T col)); |
| ! int expand_spelling __ARGS((linenr_T lnum, int col, char_u *pat, char_u ***matchp)); |
| /* vim: set ft=c : */ |
| --- 22,26 ---- |
| char_u *spell_to_word_end __ARGS((char_u *start, buf_T *buf)); |
| int spell_word_start __ARGS((int startcol)); |
| void spell_expand_check_cap __ARGS((colnr_T col)); |
| ! int expand_spelling __ARGS((linenr_T lnum, char_u *pat, char_u ***matchp)); |
| /* vim: set ft=c : */ |
| |
| |
| |
| *** 2774,2780 **** |
| sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg, |
| (char *)p_shq); |
| if (*p_sp != NUL) |
| ! append_redir(cmd, p_sp, fname); |
| /* |
| * Output a newline if there's something else than the :make command that |
| * was typed (in which case the cursor is in column 0). |
| --- 2774,2780 ---- |
| sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg, |
| (char *)p_shq); |
| if (*p_sp != NUL) |
| ! append_redir(cmd, len, p_sp, fname); |
| /* |
| * Output a newline if there's something else than the :make command that |
| * was typed (in which case the cursor is in column 0). |
| |
| |
| |
| *** 16151,16161 **** |
| * Returns the number of matches. The matches are in "matchp[]", array of |
| * allocated strings. |
| */ |
| - /*ARGSUSED*/ |
| int |
| ! expand_spelling(lnum, col, pat, matchp) |
| linenr_T lnum; |
| - int col; |
| char_u *pat; |
| char_u ***matchp; |
| { |
| --- 16151,16159 ---- |
| * Returns the number of matches. The matches are in "matchp[]", array of |
| * allocated strings. |
| */ |
| int |
| ! expand_spelling(lnum, pat, matchp) |
| linenr_T lnum; |
| char_u *pat; |
| char_u ***matchp; |
| { |
| |
| |
| |
| *** 16,22 **** |
| */ |
| #if defined(SASC) && SASC < 658 |
| typedef long linenr_T; |
| ! typedef unsigned colnr_T; |
| typedef unsigned short short_u; |
| #endif |
| |
| --- 16,22 ---- |
| */ |
| #if defined(SASC) && SASC < 658 |
| typedef long linenr_T; |
| ! typedef int colnr_T; |
| typedef unsigned short short_u; |
| #endif |
| |
| |
| |
| |
| *** 96,102 **** |
| --- 96,106 ---- |
| * - there should be code in term.c to obtain the value from the termcap |
| */ |
| |
| + #ifdef S_SPLINT_S /* splint doesn't understand array of pointers */ |
| + extern char_u **term_strings; /* current terminal strings */ |
| + #else |
| extern char_u *(term_strings[]); /* current terminal strings */ |
| + #endif |
| |
| /* |
| * strings used for terminal |
| |
| |
| |
| *** 1460,1467 **** |
| # define PERROR(msg) perror(msg) |
| #endif |
| |
| ! typedef long linenr_T; /* line number type */ |
| ! typedef unsigned colnr_T; /* column number type */ |
| typedef unsigned short disptick_T; /* display tick type */ |
| |
| #define MAXLNUM (0x7fffffffL) /* maximum (invalid) line number */ |
| --- 1460,1467 ---- |
| # define PERROR(msg) perror(msg) |
| #endif |
| |
| ! typedef long linenr_T; /* line number type */ |
| ! typedef int colnr_T; /* column number type */ |
| typedef unsigned short disptick_T; /* display tick type */ |
| |
| #define MAXLNUM (0x7fffffffL) /* maximum (invalid) line number */ |
| |
| |
| |
| *** 678,679 **** |
| --- 678,681 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 169, |
| /**/ |
| |
| -- |
| Females are strictly forbidden to appear unshaven in public. |
| [real standing law in New Mexico, United States of America] |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ download, build and distribute -- http://www.A-A-P.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |