0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.2-168

This commit is contained in:
Bram Moolenaar 2009-05-13 10:51:08 +00:00
parent 3c65e314b4
commit 0ab2a8870c
18 changed files with 205 additions and 156 deletions

View File

@ -139,6 +139,7 @@ SRC_UNIX = \
src/INSTALL \
src/INSTALLx.txt \
src/Makefile \
src/cleanlint.vim \
src/auto/configure \
src/config.aap.in \
src/config.h.in \
@ -683,9 +684,7 @@ LANG_GEN = \
runtime/spell/??/main.aap \
runtime/spell/yi/README.txt \
runtime/spell/main.aap \
runtime/spell/cleanadd.vim \
runtime/spell/*.vim \
runtime/spell/fixdup \
# generic language files, binary
LANG_GEN_BIN = \

View File

@ -1,27 +0,0 @@
" Vim script to fix duplicate words in a .dic file vim: set ft=vim:
"
" Usage: Edit the .dic file and source this script.
let deleted = 0
" Start below the word count.
let lnum = 2
while lnum <= line('$')
let word = getline(lnum)
if word !~ '/'
if search('^' . word . '/', 'w') != 0
let deleted += 1
exe lnum . "d"
continue " don't increment lnum, it's already at the next word
endif
endif
let lnum += 1
endwhile
if deleted == 0
echomsg "No duplicate words found"
elseif deleted == 1
echomsg "Deleted 1 duplicate word"
else
echomsg printf("Deleted %d duplicate words", deleted)
endif

View File

@ -551,7 +551,12 @@ CClink = $(CC)
# }}}
# LINT - for running lint
LINT_OPTIONS = -beprxzF
# For standard lint
#LINT = lint
#LINT_OPTIONS = -beprxzF
# For splint (see cleanlint.vim for filtering the output)
LINT = splint
LINT_OPTIONS = +unixlib -weak -macrovarprefixexclude -showfunc -linelen 9999
# PROFILING - Uncomment the next two lines to do profiling with gcc and gprof.
# Might not work with GUI or Perl.
@ -1259,16 +1264,16 @@ CPP_DEPEND = $(CC) -I$(srcdir) -M$(CPP_MM) \
# This is for cproto 3 patchlevel 8 or below
# __inline, __attribute__ and __extension__ are not recognized by cproto
# G_IMPLEMENT_INLINES is to avoid functions defined in glib/gutils.h.
NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
-D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
-D__extension__= -D__restrict="" \
-D__gnuc_va_list=char -D__builtin_va_list=char
#NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
# -D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
# -D__extension__= -D__restrict="" \
# -D__gnuc_va_list=char -D__builtin_va_list=char
#
# This is for cproto 3 patchlevel 9 or above (currently 4.6)
# This is for cproto 3 patchlevel 9 or above (currently 4.6, 4.7g)
# __inline and __attribute__ are now recognized by cproto
# -D"foo()=" is not supported by all compilers so do not use it
# NO_ATTR=
NO_ATTR=
#
# maybe the "/usr/bin/cc -E" has to be adjusted for some systems
# This is for cproto 3.5 patchlevel 3:
@ -1432,6 +1437,7 @@ LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(PYTHON_SRC) $(TCL_SRC) \
$(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC) $(NETBEANS_SRC)
#LINT_SRC = $(SRC)
#LINT_SRC = $(ALL_SRC)
#LINT_SRC = $(BASIC_SRC)
OBJ = \
objects/buffer.o \
@ -2272,12 +2278,12 @@ depend:
# Run lint. Clean up the *.ln files that are sometimes left behind.
lint:
lint $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
$(LINT) $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
-rm -f *.ln
# Check dosinst.c with lint.
lintinstall:
lint $(LINT_OPTIONS) -DWIN32 -DUNIX_LINT dosinst.c
$(LINT) $(LINT_OPTIONS) -DWIN32 -DUNIX_LINT dosinst.c
-rm -f dosinst.ln
###########################################################################

View File

@ -44,6 +44,7 @@ static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname));
#ifdef FEAT_TITLE
static int ti_change __ARGS((char_u *str, char_u **last));
#endif
static int append_arg_number __ARGS((win_T *wp, char_u *buf, int buflen, int add_file));
static void free_buffer __ARGS((buf_T *));
static void free_buffer_stuff __ARGS((buf_T *buf, int free_options));
static void clear_wininfo __ARGS((buf_T *buf));
@ -1453,13 +1454,13 @@ enter_buffer(buf)
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
keymap_init();
(void)keymap_init();
#endif
#ifdef FEAT_SPELL
/* May need to set the spell language. Can only do this after the buffer
* has been properly setup. */
if (!curbuf->b_help && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
did_set_spelllang(curbuf);
(void)did_set_spelllang(curbuf);
#endif
redraw_later(NOT_VALID);
@ -2516,7 +2517,7 @@ buflist_findfpos(buf)
buf_T *buf;
{
wininfo_T *wip;
static pos_T no_position = {1, 0};
static pos_T no_position = INIT_POS_T(1, 0, 0);
wip = find_wininfo(buf, FALSE);
if (wip != NULL)
@ -2577,8 +2578,8 @@ buflist_list(eap)
{
IObuff[len++] = ' ';
} while (--i > 0 && len < IOSIZE - 18);
vim_snprintf((char *)IObuff + len, IOSIZE - len, _("line %ld"),
buf == curbuf ? curwin->w_cursor.lnum
vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len),
_("line %ld"), buf == curbuf ? curwin->w_cursor.lnum
: (long)buflist_findlnum(buf));
msg_outtrans(IObuff);
out_flush(); /* output one line at a time */
@ -2967,7 +2968,7 @@ fileinfo(fullname, shorthelp, dont_truncate)
if (fullname > 1) /* 2 CTRL-G: include buffer number */
{
sprintf((char *)buffer, "buf %d: ", curbuf->b_fnum);
vim_snprintf((char *)buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
p = buffer + STRLEN(buffer);
}
else
@ -3041,11 +3042,12 @@ fileinfo(fullname, shorthelp, dont_truncate)
(long)curbuf->b_ml.ml_line_count,
n);
validate_virtcol();
col_print(buffer + STRLEN(buffer),
len = STRLEN(buffer);
col_print(buffer + len, IOSIZE - len,
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
}
(void)append_arg_number(curwin, buffer, !shortmess(SHM_FILE), IOSIZE);
(void)append_arg_number(curwin, buffer, IOSIZE, !shortmess(SHM_FILE));
if (dont_truncate)
{
@ -3073,15 +3075,16 @@ fileinfo(fullname, shorthelp, dont_truncate)
}
void
col_print(buf, col, vcol)
col_print(buf, buflen, col, vcol)
char_u *buf;
size_t buflen;
int col;
int vcol;
{
if (col == vcol)
sprintf((char *)buf, "%d", col);
vim_snprintf((char *)buf, buflen, "%d", col);
else
sprintf((char *)buf, "%d-%d", col, vcol);
vim_snprintf((char *)buf, buflen, "%d-%d", col, vcol);
}
#if defined(FEAT_TITLE) || defined(PROTO)
@ -3194,18 +3197,18 @@ maketitle()
if (p == buf + off)
/* must be a help buffer */
vim_strncpy(buf + off, (char_u *)_("help"),
IOSIZE - off - 1);
(size_t)(IOSIZE - off - 1));
else
*p = NUL;
/* translate unprintable chars */
p = transstr(buf + off);
vim_strncpy(buf + off, p, IOSIZE - off - 1);
vim_strncpy(buf + off, p, (size_t)(IOSIZE - off - 1));
vim_free(p);
STRCAT(buf, ")");
}
append_arg_number(curwin, buf, FALSE, IOSIZE);
append_arg_number(curwin, buf, IOSIZE, FALSE);
#if defined(FEAT_CLIENTSERVER)
if (serverName != NULL)
@ -3520,7 +3523,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1;
*t = '<';
mch_memmove(t + 1, t + n, p - (t + n));
mch_memmove(t + 1, t + n, (size_t)(p - (t + n)));
p = p - n + 1;
#ifdef FEAT_MBYTE
/* Fill up space left over by half a double-wide char. */
@ -3550,7 +3553,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
else
{
/* fill by inserting characters */
mch_memmove(t + n - l, t, p - t);
mch_memmove(t + n - l, t, (size_t)(p - t));
l = n - l;
if (p + l >= out + outlen)
l = (long)((out + outlen) - p - 1);
@ -3686,7 +3689,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
p = t;
#ifdef FEAT_EVAL
sprintf((char *)tmp, "%d", curbuf->b_fnum);
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
set_internal_string_var((char_u *)"actual_curbuf", tmp);
o_curbuf = curbuf;
@ -3753,13 +3756,13 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
case STL_ALTPERCENT:
str = tmp;
get_rel_pos(wp, str);
get_rel_pos(wp, str, TMPLEN);
break;
case STL_ARGLISTSTAT:
fillable = FALSE;
tmp[0] = 0;
if (append_arg_number(wp, tmp, FALSE, (int)sizeof(tmp)))
if (append_arg_number(wp, tmp, (int)sizeof(tmp), FALSE))
str = tmp;
break;
@ -3794,7 +3797,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
case STL_BYTEVAL_X:
base = 'X';
case STL_BYTEVAL:
if (wp->w_cursor.col > STRLEN(linecont))
if (wp->w_cursor.col > (colnr_T)STRLEN(linecont))
num = 0;
else
{
@ -3967,7 +3970,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
if (zeropad)
*t++ = '0';
*t++ = '*';
*t++ = nbase == 16 ? base : (nbase == 8 ? 'o' : 'd');
*t++ = nbase == 16 ? base : (char_u)(nbase == 8 ? 'o' : 'd');
*t = 0;
for (n = num, l = 1; n >= nbase; n /= nbase)
@ -4160,13 +4163,14 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
#if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) \
|| defined(FEAT_GUI_TABLINE) || defined(PROTO)
/*
* Get relative cursor position in window into "str[]", in the form 99%, using
* "Top", "Bot" or "All" when appropriate.
* Get relative cursor position in window into "buf[buflen]", in the form 99%,
* using "Top", "Bot" or "All" when appropriate.
*/
void
get_rel_pos(wp, str)
get_rel_pos(wp, buf, buflen)
win_T *wp;
char_u *str;
char_u *buf;
int buflen;
{
long above; /* number of lines above window */
long below; /* number of lines below window */
@ -4177,34 +4181,35 @@ get_rel_pos(wp, str)
#endif
below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1;
if (below <= 0)
STRCPY(str, above == 0 ? _("All") : _("Bot"));
vim_strncpy(buf, (char_u *)(above == 0 ? _("All") : _("Bot")),
(size_t)(buflen - 1));
else if (above <= 0)
STRCPY(str, _("Top"));
vim_strncpy(buf, (char_u *)_("Top"), (size_t)(buflen - 1));
else
sprintf((char *)str, "%2d%%", above > 1000000L
vim_snprintf((char *)buf, (size_t)buflen, "%2d%%", above > 1000000L
? (int)(above / ((above + below) / 100L))
: (int)(above * 100L / (above + below)));
}
#endif
/*
* Append (file 2 of 8) to 'buf', if editing more than one file.
* Append (file 2 of 8) to "buf[buflen]", if editing more than one file.
* Return TRUE if it was appended.
*/
int
append_arg_number(wp, buf, add_file, maxlen)
static int
append_arg_number(wp, buf, buflen, add_file)
win_T *wp;
char_u *buf;
int buflen;
int add_file; /* Add "file" before the arg number */
int maxlen; /* maximum nr of chars in buf or zero*/
{
char_u *p;
if (ARGCOUNT <= 1) /* nothing to do */
return FALSE;
p = buf + STRLEN(buf); /* go to the end of the buffer */
if (maxlen && p - buf + 35 >= maxlen) /* getting too long */
p = buf + STRLEN(buf); /* go to the end of the buffer */
if (p - buf + 35 >= buflen) /* getting too long */
return FALSE;
*p++ = ' ';
*p++ = '(';
@ -4213,7 +4218,8 @@ append_arg_number(wp, buf, add_file, maxlen)
STRCPY(p, "file ");
p += 5;
}
sprintf((char *)p, wp->w_arg_idx_invalid ? "(%d) of %d)"
vim_snprintf((char *)p, (size_t)(buflen - (p - buf)),
wp->w_arg_idx_invalid ? "(%d) of %d)"
: "%d of %d)", wp->w_arg_idx + 1, ARGCOUNT);
return TRUE;
}
@ -4996,7 +5002,7 @@ read_viminfo_bufferlist(virp, writing)
if (tab != NULL)
{
*tab++ = '\0';
col = atoi((char *)tab);
col = (colnr_T)atoi((char *)tab);
tab = vim_strrchr(xline, '\t');
if (tab != NULL)
{
@ -5034,6 +5040,7 @@ write_viminfo_bufferlist(fp)
#endif
char_u *line;
int max_buffers;
size_t len;
if (find_viminfo_parameter('%') == NULL)
return;
@ -5042,7 +5049,8 @@ write_viminfo_bufferlist(fp)
max_buffers = get_viminfo_parameter('%');
/* Allocate room for the file name, lnum and col. */
line = alloc(MAXPATHL + 40);
#define LINE_BUF_LEN (MAXPATHL + 40)
line = alloc(LINE_BUF_LEN);
if (line == NULL)
return;
@ -5068,7 +5076,8 @@ write_viminfo_bufferlist(fp)
break;
putc('%', fp);
home_replace(NULL, buf->b_ffname, line, MAXPATHL, TRUE);
sprintf((char *)line + STRLEN(line), "\t%ld\t%d",
len = STRLEN(line);
vim_snprintf((char *)line + len, len - LINE_BUF_LEN, "\t%ld\t%d",
(long)buf->b_last_cursor.lnum,
buf->b_last_cursor.col);
viminfo_writestring(fp, line);
@ -5226,7 +5235,7 @@ buf_addsign(buf, id, lnum, typenr)
return;
}
int
linenr_T
buf_change_sign_type(buf, markId, typenr)
buf_T *buf; /* buffer to store sign in */
int markId; /* sign ID */
@ -5243,10 +5252,10 @@ buf_change_sign_type(buf, markId, typenr)
}
}
return 0;
return (linenr_T)0;
}
int_u
int
buf_getsigntype(buf, lnum, type)
buf_T *buf;
linenr_T lnum;

View File

@ -17,7 +17,7 @@ static int win_chartabsize __ARGS((win_T *wp, char_u *p, colnr_T col));
static int win_nolbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
#endif
static int nr2hex __ARGS((int c));
static unsigned nr2hex __ARGS((unsigned c));
static int chartab_initialized = FALSE;
@ -664,7 +664,7 @@ transchar_hex(buf, c)
}
#endif
buf[++i] = nr2hex((unsigned)c >> 4);
buf[++i] = nr2hex(c);
buf[++i] = nr2hex((unsigned)c);
buf[++i] = '>';
buf[++i] = NUL;
}
@ -674,9 +674,9 @@ transchar_hex(buf, c)
* Lower case letters are used to avoid the confusion of <F1> being 0xf1 or
* function key 1.
*/
static int
static unsigned
nr2hex(c)
int c;
unsigned c;
{
if ((c & 0xf) <= 9)
return (c & 0xf) + '0';
@ -884,7 +884,7 @@ vim_iswordc(c)
if (c >= 0x100)
{
if (enc_dbcs != 0)
return dbcs_class((unsigned)c >> 8, c & 0xff) >= 2;
return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2;
if (enc_utf8)
return utf_class(c) >= 2;
}
@ -1090,7 +1090,7 @@ win_lbr_chartabsize(wp, s, col, headp)
*/
numberextra = win_col_off(wp);
col2 = col;
colmax = W_WIDTH(wp) - numberextra;
colmax = (colnr_T)(W_WIDTH(wp) - numberextra);
if (col >= colmax)
{
n = colmax + win_col_off2(wp);
@ -1201,17 +1201,17 @@ in_win_border(wp, vcol)
win_T *wp;
colnr_T vcol;
{
colnr_T width1; /* width of first line (after line number) */
colnr_T width2; /* width of further lines */
int width1; /* width of first line (after line number) */
int width2; /* width of further lines */
#ifdef FEAT_VERTSPLIT
if (wp->w_width == 0) /* there is no border */
return FALSE;
#endif
width1 = W_WIDTH(wp) - win_col_off(wp);
if (vcol < width1 - 1)
if ((int)vcol < width1 - 1)
return FALSE;
if (vcol == width1 - 1)
if ((int)vcol == width1 - 1)
return TRUE;
width2 = width1 + win_col_off2(wp);
return ((vcol - width1) % width2 == width2 - 1);
@ -1396,13 +1396,13 @@ getvvcol(wp, pos, start, cursor, end)
# ifdef FEAT_MBYTE
/* Cannot put the cursor on part of a wide character. */
ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
if (pos->col < STRLEN(ptr))
if (pos->col < (colnr_T)STRLEN(ptr))
{
int c = (*mb_ptr2char)(ptr + pos->col);
if (c != TAB && vim_isprintc(c))
{
endadd = char2cells(c) - 1;
endadd = (colnr_T)(char2cells(c) - 1);
if (coladd > endadd) /* past end of line */
endadd = 0;
else
@ -1573,10 +1573,16 @@ vim_isxdigit(c)
#define LATIN1LOWER 'l'
#define LATIN1UPPER 'U'
#ifdef S_SPLINT_S /* splint can't handle some 8 bit chars */
static char_u latin1flags[] = (char_u *)" ";
static char_u latin1upper[] = (char_u *)" ";
static char_u latin1lower[] = (char_u *)" ";
#else
/* !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]%_'abcdefghijklmnopqrstuvwxyz{|}~ 、¥ウЖ┆<D096><E29486><EFBFBD>辈炒刀犯购患骄坷谅媚牌侨墒颂臀闲岩釉罩棕仝圮蒉哙徕沅彐玷殛腱眍镳耱篝貊鼬<E8B28A><E9BCAC><EFBFBD><EFBFBD> */
static char_u latin1flags[257] = " UUUUUUUUUUUUUUUUUUUUUUUUUU llllllllllllllllllllllllll UUUUUUUUUUUUUUUUUUUUUUU UUUUUUUllllllllllllllllllllllll llllllll";
static char_u latin1upper[257] = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<D096><E29486><EFBFBD>辈炒刀犯购患骄坷谅媚牌侨墒颂臀闲岩釉罩棕仝圮蒉呃谅媚牌侨墒颂臀闲岩釉罩髫仝圮蒉<E59CAE>";
static char_u latin1lower[257] = " !\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<D096><E29486><EFBFBD>辈炒刀犯购患骄苦徕沅彐玷殛腱眍镳耱篝貊坐<E8B28A><E59D90><EFBFBD>哙徕沅彐玷殛腱眍镳耱篝貊鼬<E8B28A><E9BCAC><EFBFBD><EFBFBD>";
#endif
int
vim_islower(c)

27
src/cleanlint.vim Normal file
View File

@ -0,0 +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

View File

@ -32,7 +32,7 @@ static int getexactdigraph __ARGS((int, int, int));
static void printdigraph __ARGS((digr_T *));
/* digraphs added by the user */
static garray_T user_digraphs = {0, 0, sizeof(digr_T), 10, NULL};
static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
/*
* Note: Characters marked with XX are not included literally, because some
@ -481,7 +481,7 @@ static digr_T digraphdefault[] =
{'\'', ' ', 213}, /* ' */
{'-', ':', 214}, /* ÷ */
{'D', 'I', 215}, /* × */
{'y', ':', 216}, /* ÿ */
{'y', ':', 216}, /* <8e> */
{'Y', ':', 217}, /* <20> */
{'/', '/', 218}, /* Ž */
{'E', '=', 219}, /* ¤ Euro System >=8.5 */
@ -2371,10 +2371,10 @@ printdigraph(dp)
}
else
#endif
*p++ = dp->result;
*p++ = (char_u)dp->result;
if (char2cells(dp->result) == 1)
*p++ = ' ';
sprintf((char *)p, " %3d", dp->result);
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
msg_outtrans(buf);
}
}
@ -2395,7 +2395,10 @@ typedef struct
static void keymap_unload __ARGS((void));
/*
* Set up key mapping tables for the 'keymap' option
* Set up key mapping tables for the 'keymap' option.
* Returns NULL if OK, an error message for failure. This only needs to be
* used when setting the option, not later when the value has already been
* checked.
*/
char_u *
keymap_init()
@ -2412,25 +2415,29 @@ keymap_init()
else
{
char_u *buf;
size_t buflen;
/* Source the keymap file. It will contain a ":loadkeymap" command
* which will call ex_loadkeymap() below. */
buf = alloc((unsigned)(STRLEN(curbuf->b_p_keymap)
buflen = STRLEN(curbuf->b_p_keymap)
# ifdef FEAT_MBYTE
+ STRLEN(p_enc)
+ STRLEN(p_enc)
# endif
+ 14));
+ 14;
buf = alloc((unsigned)buflen);
if (buf == NULL)
return e_outofmem;
# ifdef FEAT_MBYTE
/* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
sprintf((char *)buf, "keymap/%s_%s.vim", curbuf->b_p_keymap, p_enc);
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
curbuf->b_p_keymap, p_enc);
if (source_runtime(buf, FALSE) == FAIL)
# endif
{
/* try finding "keymap/'keymap'.vim" in 'runtimepath' */
sprintf((char *)buf, "keymap/%s.vim", curbuf->b_p_keymap);
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
curbuf->b_p_keymap);
if (source_runtime(buf, FALSE) == FAIL)
{
vim_free(buf);

View File

@ -57,7 +57,7 @@ static char *ctrl_x_msgs[] =
N_(" Keyword Local completion (^N^P)"),
};
static char_u e_hitend[] = N_("Hit end of paragraph");
static char e_hitend[] = N_("Hit end of paragraph");
/*
* Structure used to store one match for insert completion.
@ -69,7 +69,11 @@ struct compl_S
compl_T *cp_prev;
char_u *cp_str; /* matched text */
char cp_icase; /* TRUE or FALSE: ignore case */
#ifdef S_SPLINT_S /* splint can't handle array of pointers */
char_u **cp_text; /* text for the menu */
#else
char_u *(cp_text[CPT_COUNT]); /* text for the menu */
#endif
char_u *cp_fname; /* file containing the match, allocated when
* cp_flags has FREE_FNAME */
int cp_flags; /* ORIGINAL_TEXT, CONT_S_IPOS or FREE_FNAME */
@ -306,7 +310,7 @@ edit(cmdchar, startln, count)
int c = 0;
char_u *ptr;
int lastc;
colnr_T mincol;
int mincol;
static linenr_T o_lnum = 0;
int i;
int did_backspace = TRUE; /* previous char was backspace */
@ -387,7 +391,7 @@ edit(cmdchar, startln, count)
if (startln)
Insstart.col = 0;
}
Insstart_textlen = linetabsize(ml_get_curline());
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
Insstart_blank_vcol = MAXCOL;
if (!did_ai)
ai_col = 0;
@ -653,7 +657,7 @@ edit(cmdchar, startln, count)
mincol = curwin->w_wcol;
validate_cursor_col();
if ((int)curwin->w_wcol < (int)mincol - curbuf->b_p_ts
if ((int)curwin->w_wcol < mincol - curbuf->b_p_ts
&& curwin->w_wrow == W_WINROW(curwin)
+ curwin->w_height - 1 - p_so
&& (curwin->w_cursor.lnum != curwin->w_topline
@ -1773,7 +1777,7 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
* Compute the screen column where the cursor should be.
*/
vcol = get_indent() - vcol;
curwin->w_virtcol = (vcol < 0) ? 0 : vcol;
curwin->w_virtcol = (colnr_T)((vcol < 0) ? 0 : vcol);
/*
* Advance the cursor until we reach the right screen column.
@ -1800,9 +1804,9 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
*/
if (vcol != (int)curwin->w_virtcol)
{
curwin->w_cursor.col = new_cursor_col;
curwin->w_cursor.col = (colnr_T)new_cursor_col;
i = (int)curwin->w_virtcol - vcol;
ptr = alloc(i + 1);
ptr = alloc((unsigned)(i + 1));
if (ptr != NULL)
{
new_cursor_col += i;
@ -1826,7 +1830,7 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
if (new_cursor_col <= 0)
curwin->w_cursor.col = 0;
else
curwin->w_cursor.col = new_cursor_col;
curwin->w_cursor.col = (colnr_T)new_cursor_col;
curwin->w_set_curswant = TRUE;
changed_cline_bef_curs();
@ -1966,7 +1970,7 @@ del_char_after_col(limit_col)
#ifdef FEAT_MBYTE
if (enc_utf8 && limit_col >= 0)
{
int ecol = curwin->w_cursor.col + 1;
colnr_T ecol = curwin->w_cursor.col + 1;
/* Make sure the cursor is at the start of a character, but
* skip forward again when going too far back because of a
@ -1982,7 +1986,7 @@ del_char_after_col(limit_col)
}
if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
return FALSE;
del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
del_bytes((long)((int)ecol - curwin->w_cursor.col), FALSE, TRUE);
}
else
#endif
@ -2201,7 +2205,7 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags)
actual_compl_length = compl_length;
/* Allocate wide character array for the completion and fill it. */
wca = (int *)alloc(actual_len * sizeof(int));
wca = (int *)alloc((unsigned)(actual_len * sizeof(int)));
if (wca != NULL)
{
p = str;
@ -2580,7 +2584,7 @@ ins_compl_make_cyclic()
*/
void
set_completion(startcol, list)
int startcol;
colnr_T startcol;
list_T *list;
{
/* If already doing completions stop it. */
@ -2591,10 +2595,10 @@ set_completion(startcol, list)
if (stop_arrow() == FAIL)
return;
if (startcol > (int)curwin->w_cursor.col)
if (startcol > curwin->w_cursor.col)
startcol = curwin->w_cursor.col;
compl_col = startcol;
compl_length = curwin->w_cursor.col - startcol;
compl_length = (int)curwin->w_cursor.col - (int)startcol;
/* compl_pattern doesn't need to be set */
compl_orig_text = vim_strnsave(ml_get_curline() + compl_col, compl_length);
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
@ -2860,7 +2864,6 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
regmatch_T regmatch;
char_u **files;
int count;
int i;
int save_p_scs;
int dir = compl_direction;
@ -2892,17 +2895,18 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
if (ctrl_x_mode == CTRL_X_WHOLE_LINE)
{
char_u *pat_esc = vim_strsave_escaped(pat, (char_u *)"\\");
size_t len;
if (pat_esc == NULL)
goto theend;
i = (int)STRLEN(pat_esc) + 10;
ptr = alloc(i);
len = STRLEN(pat_esc) + 10;
ptr = alloc((unsigned)len);
if (ptr == NULL)
{
vim_free(pat_esc);
goto theend;
}
vim_snprintf((char *)ptr, i, "^\\s*\\zs\\V%s", pat_esc);
vim_snprintf((char *)ptr, len, "^\\s*\\zs\\V%s", pat_esc);
regmatch.regprog = vim_regcomp(ptr, RE_MAGIC);
vim_free(pat_esc);
vim_free(ptr);
@ -2993,7 +2997,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir)
{
vim_snprintf((char *)IObuff, IOSIZE,
_("Scanning dictionary: %s"), (char *)files[i]);
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
if (fp != NULL)
@ -3311,7 +3315,7 @@ ins_compl_new_leader()
static int
ins_compl_len()
{
int off = curwin->w_cursor.col - compl_col;
int off = (int)curwin->w_cursor.col - (int)compl_col;
if (off < 0)
return 0;
@ -3347,7 +3351,7 @@ ins_compl_addleader(c)
vim_free(compl_leader);
compl_leader = vim_strnsave(ml_get_curline() + compl_col,
curwin->w_cursor.col - compl_col);
(int)(curwin->w_cursor.col - compl_col));
if (compl_leader != NULL)
ins_compl_new_leader();
}
@ -3395,7 +3399,7 @@ ins_compl_set_original_text(str)
ins_compl_addfrommatch()
{
char_u *p;
int len = curwin->w_cursor.col - compl_col;
int len = (int)curwin->w_cursor.col - (int)compl_col;
int c;
compl_T *cp;
@ -3961,7 +3965,7 @@ ins_compl_get_exp(ini)
: ins_buf->b_sfname == NULL
? (char *)ins_buf->b_fname
: (char *)ins_buf->b_sfname);
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else if (*e_cpt == NUL)
break;
@ -3991,7 +3995,7 @@ ins_compl_get_exp(ini)
{
type = CTRL_X_TAGS;
sprintf((char*)IObuff, _("Scanning tags."));
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else
type = -1;
@ -6320,7 +6324,7 @@ stop_arrow()
ins_need_undo = FALSE;
}
Insstart = curwin->w_cursor; /* new insertion starts here */
Insstart_textlen = linetabsize(ml_get_curline());
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
ai_col = 0;
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)

View File

@ -1789,7 +1789,7 @@ write_viminfo(file, forceit)
* overwrite a user's viminfo file after a "su root", with a
* viminfo file that the user can't read.
*/
st_old.st_dev = 0;
st_old.st_dev = (dev_t)0;
st_old.st_ino = 0;
st_old.st_mode = 0600;
if (mch_stat((char *)fname, &st_old) == 0
@ -3715,7 +3715,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
/* If the window options were changed may need to set the spell language.
* Can only do this after the buffer has been properly setup. */
if (did_get_winopts && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
did_set_spelllang(curbuf);
(void)did_set_spelllang(curbuf);
#endif
if (command == NULL)
@ -3788,7 +3788,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
keymap_init();
(void)keymap_init();
#endif
--RedrawingDisabled;

View File

@ -524,7 +524,7 @@ EXTERN win_T *lastwin; /* last window */
EXTERN win_T *prevwin INIT(= NULL); /* previous window */
# define W_NEXT(wp) ((wp)->w_next)
# define FOR_ALL_WINDOWS(wp) for (wp = firstwin; wp != NULL; wp = wp->w_next)
#define FOR_ALL_TAB_WINDOWS(tp, wp) \
# define FOR_ALL_TAB_WINDOWS(tp, wp) \
for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
for ((wp) = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
@ -718,7 +718,7 @@ EXTERN int can_si_back INIT(= FALSE);
EXTERN pos_T saved_cursor /* w_cursor before formatting text. */
# ifdef DO_INIT
= INIT_POS_T
= INIT_POS_T(0, 0, 0)
# endif
;
@ -1039,7 +1039,7 @@ EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
EXTERN pos_T last_cursormoved /* for CursorMoved event */
# ifdef DO_INIT
= INIT_POS_T
= INIT_POS_T(0, 0, 0)
# endif
;
#endif

View File

@ -6400,7 +6400,7 @@ cursor_pos_info()
{
getvcols(curwin, &min_pos, &max_pos, &min_pos.col,
&max_pos.col);
sprintf((char *)buf1, _("%ld Cols; "),
vim_snprintf((char *)buf1, sizeof(buf1), _("%ld Cols; "),
(long)(oparg.end_vcol - oparg.start_vcol + 1));
}
else
@ -6408,13 +6408,15 @@ cursor_pos_info()
if (char_count_cursor == byte_count_cursor
&& char_count == byte_count)
sprintf((char *)IObuff, _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"),
vim_snprintf((char *)IObuff, IOSIZE,
_("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"),
buf1, line_count_selected,
(long)curbuf->b_ml.ml_line_count,
word_count_cursor, word_count,
byte_count_cursor, byte_count);
else
sprintf((char *)IObuff, _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes"),
vim_snprintf((char *)IObuff, IOSIZE,
_("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes"),
buf1, line_count_selected,
(long)curbuf->b_ml.ml_line_count,
word_count_cursor, word_count,
@ -6426,20 +6428,22 @@ cursor_pos_info()
{
p = ml_get_curline();
validate_virtcol();
col_print(buf1, (int)curwin->w_cursor.col + 1,
col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1,
(int)curwin->w_virtcol + 1);
col_print(buf2, (int)STRLEN(p), linetabsize(p));
col_print(buf2, sizeof(buf2), (int)STRLEN(p), linetabsize(p));
if (char_count_cursor == byte_count_cursor
&& char_count == byte_count)
sprintf((char *)IObuff, _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"),
vim_snprintf((char *)IObuff, IOSIZE,
_("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"),
(char *)buf1, (char *)buf2,
(long)curwin->w_cursor.lnum,
(long)curbuf->b_ml.ml_line_count,
word_count_cursor, word_count,
byte_count_cursor, byte_count);
else
sprintf((char *)IObuff, _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld"),
vim_snprintf((char *)IObuff, IOSIZE,
_("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld"),
(char *)buf1, (char *)buf2,
(long)curwin->w_cursor.lnum,
(long)curbuf->b_ml.ml_line_count,

View File

@ -199,7 +199,9 @@ static int save_patterns __ARGS((int num_pat, char_u **pat, int *num_file, char_
#endif
#ifndef SIG_ERR
# define SIG_ERR ((RETSIGTYPE (*)())-1)
# ifndef S_SPLINT_S
# define SIG_ERR ((RETSIGTYPE (*)())-1)
# endif
#endif
/* volatile because it is used in signal handler sig_winch(). */
@ -441,7 +443,9 @@ mch_char_avail()
#if defined(HAVE_TOTAL_MEM) || defined(PROTO)
# ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
# ifndef S_SPLINT_S /* splint crashes on bits/resource.h */
# include <sys/resource.h>
# endif
# endif
# if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTL)
# include <sys/sysctl.h>

View File

@ -53,7 +53,9 @@
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# ifndef S_SPLINT_S /* splint crashes on bits/confname.h */
# include <unistd.h>
# endif
#endif
#ifdef HAVE_LIBC_H

View File

@ -37,13 +37,12 @@ void buflist_altfpos __ARGS((win_T *win));
int otherfile __ARGS((char_u *ffname));
void buf_setino __ARGS((buf_T *buf));
void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
void col_print __ARGS((char_u *buf, int col, int vcol));
void col_print __ARGS((char_u *buf, size_t buflen, int col, int vcol));
void maketitle __ARGS((void));
void resettitle __ARGS((void));
void free_titles __ARGS((void));
int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox, int fillchar, int maxwidth, struct stl_hlrec *hltab, struct stl_hlrec *tabtab));
void get_rel_pos __ARGS((win_T *wp, char_u *str));
int append_arg_number __ARGS((win_T *wp, char_u *buf, int add_file, int maxlen));
void get_rel_pos __ARGS((win_T *wp, char_u *buf, int buflen));
char_u *fix_fname __ARGS((char_u *fname));
void fname_expand __ARGS((buf_T *buf, char_u **ffname, char_u **sfname));
char_u *alist_name __ARGS((aentry_T *aep));
@ -54,8 +53,8 @@ int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
void write_viminfo_bufferlist __ARGS((FILE *fp));
char *buf_spname __ARGS((buf_T *buf));
void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
int buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
int_u buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
linenr_T buf_delsign __ARGS((buf_T *buf, int id));
int buf_findsign __ARGS((buf_T *buf, int id));
int buf_findsign_id __ARGS((buf_T *buf, linenr_T lnum));

View File

@ -8,7 +8,7 @@ void truncate_spaces __ARGS((char_u *line));
void backspace_until_column __ARGS((int col));
int vim_is_ctrl_x_key __ARGS((int c));
int ins_compl_add_infercase __ARGS((char_u *str, int len, int icase, char_u *fname, int dir, int flags));
void set_completion __ARGS((int startcol, list_T *list));
void set_completion __ARGS((colnr_T startcol, list_T *list));
void ins_compl_show_pum __ARGS((void));
char_u *find_word_start __ARGS((char_u *ptr));
char_u *find_word_end __ARGS((char_u *ptr));

View File

@ -9481,13 +9481,15 @@ win_redr_ruler(wp, always)
win_T *wp;
int always;
{
char_u buffer[70];
#define RULER_BUF_LEN 70
char_u buffer[RULER_BUF_LEN];
int row;
int fillchar;
int attr;
int empty_line = FALSE;
colnr_T virtcol;
int i;
size_t len;
int o;
#ifdef FEAT_VERTSPLIT
int this_ru_col;
@ -9602,11 +9604,12 @@ win_redr_ruler(wp, always)
* Some sprintfs return the length, some return a pointer.
* To avoid portability problems we use strlen() here.
*/
sprintf((char *)buffer, "%ld,",
vim_snprintf((char *)buffer, RULER_BUF_LEN, "%ld,",
(wp->w_buffer->b_ml.ml_flags & ML_EMPTY)
? 0L
: (long)(wp->w_cursor.lnum));
col_print(buffer + STRLEN(buffer),
len = STRLEN(buffer);
col_print(buffer + len, RULER_BUF_LEN - len,
empty_line ? 0 : (int)wp->w_cursor.col + 1,
(int)virtcol + 1);
@ -9616,7 +9619,7 @@ win_redr_ruler(wp, always)
* screen up on some terminals).
*/
i = (int)STRLEN(buffer);
get_rel_pos(wp, buffer + i + 1);
get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
o = i + vim_strsize(buffer + i + 1);
#ifdef FEAT_WINDOWS
if (wp->w_status_height == 0) /* can't use last char of screen */
@ -9643,7 +9646,7 @@ win_redr_ruler(wp, always)
buffer[i++] = fillchar;
++o;
}
get_rel_pos(wp, buffer + i);
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
}
/* Truncate at window boundary. */
#ifdef FEAT_MBYTE

View File

@ -33,9 +33,9 @@ typedef struct
} pos_T;
#ifdef FEAT_VIRTUALEDIT
# define INIT_POS_T {0, 0, 0}
# define INIT_POS_T(l, c, ca) {l, c, ca}
#else
# define INIT_POS_T {0, 0}
# define INIT_POS_T(l, c, ca) {l, c}
#endif
/*
@ -1166,7 +1166,7 @@ struct file_buffer
char_u *b_fname; /* current file name */
#ifdef UNIX
int b_dev; /* device number (-1 if not set) */
dev_t b_dev; /* device number (-1 if not set) */
ino_t b_ino; /* inode number */
#endif
#ifdef FEAT_CW_EDITOR
@ -1645,7 +1645,11 @@ struct tabpage_S
#endif
#ifdef FEAT_DIFF
diff_T *tp_first_diff;
# ifdef S_SPLINT_S /* splint doesn't understand the array of pointers */
buf_T **tp_diffbuf;
# else
buf_T *(tp_diffbuf[DB_COUNT]);
# endif
int tp_diff_invalid; /* list of diffs is outdated */
#endif
frame_T *tp_snapshot; /* window layout snapshot */

View File

@ -676,6 +676,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
167,
/**/
166,
/**/