Skip to content

Commit

Permalink
updated for version 7.0073
Browse files Browse the repository at this point in the history
  • Loading branch information
vimboss committed May 19, 2005
1 parent 8ce9c3b commit 058c721
Show file tree
Hide file tree
Showing 10 changed files with 830 additions and 112 deletions.
52 changes: 26 additions & 26 deletions src/buffer.c
Expand Up @@ -2476,9 +2476,9 @@ buflist_list(eap)
{
IObuff[len++] = ' ';
} while (--i > 0 && len < IOSIZE - 18);
sprintf((char *)IObuff + len, _("line %ld"),
buf == curbuf ? curwin->w_cursor.lnum :
(long)buflist_findlnum(buf));
vim_snprintf((char *)IObuff + len, 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 */
ui_breakcheck();
Expand Down Expand Up @@ -2852,6 +2852,7 @@ fileinfo(fullname, shorthelp, dont_truncate)
int n;
char_u *p;
char_u *buffer;
size_t len;

buffer = alloc(IOSIZE);
if (buffer == NULL)
Expand All @@ -2878,7 +2879,8 @@ fileinfo(fullname, shorthelp, dont_truncate)
(int)(IOSIZE - (p - buffer)), TRUE);
}

sprintf((char *)buffer + STRLEN(buffer),
len = STRLEN(buffer);
vim_snprintf((char *)buffer + len, IOSIZE - len,
"\"%s%s%s%s%s%s",
curbufIsChanged() ? (shortmess(SHM_MOD)
? " [+]" : _(" [Modified]")) : " ",
Expand Down Expand Up @@ -2906,24 +2908,27 @@ fileinfo(fullname, shorthelp, dont_truncate)
else
n = (int)(((long)curwin->w_cursor.lnum * 100L) /
(long)curbuf->b_ml.ml_line_count);
len = STRLEN(buffer);
if (curbuf->b_ml.ml_flags & ML_EMPTY)
{
STRCPY(buffer + STRLEN(buffer), _(no_lines_msg));
vim_snprintf((char *)buffer + len, IOSIZE - len, "%s", _(no_lines_msg));
}
#ifdef FEAT_CMDL_INFO
else if (p_ru)
{
/* Current line and column are already on the screen -- webb */
if (curbuf->b_ml.ml_line_count == 1)
sprintf((char *)buffer + STRLEN(buffer), _("1 line --%d%%--"), n);
vim_snprintf((char *)buffer + len, IOSIZE - len,
_("1 line --%d%%--"), n);
else
sprintf((char *)buffer + STRLEN(buffer), _("%ld lines --%d%%--"),
vim_snprintf((char *)buffer + len, IOSIZE - len,
_("%ld lines --%d%%--"),
(long)curbuf->b_ml.ml_line_count, n);
}
#endif
else
{
sprintf((char *)buffer + STRLEN(buffer),
vim_snprintf((char *)buffer + len, IOSIZE - len,
_("line %ld of %ld --%d%%-- col "),
(long)curwin->w_cursor.lnum,
(long)curbuf->b_ml.ml_line_count,
Expand Down Expand Up @@ -3630,7 +3635,8 @@ build_stl_str_hl(wp, out, outlen, fmt, fillchar, maxwidth, hl)
if (*wp->w_buffer->b_p_ft != NUL
&& STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3)
{
sprintf((char *)tmp, "[%s]", wp->w_buffer->b_p_ft);
vim_snprintf((char *)tmp, sizeof(tmp), "[%s]",
wp->w_buffer->b_p_ft);
str = tmp;
}
break;
Expand All @@ -3640,7 +3646,8 @@ build_stl_str_hl(wp, out, outlen, fmt, fillchar, maxwidth, hl)
if (*wp->w_buffer->b_p_ft != NUL
&& STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 2)
{
sprintf((char *)tmp, ",%s", wp->w_buffer->b_p_ft);
vim_snprintf((char *)tmp, sizeof(tmp), ",%s",
wp->w_buffer->b_p_ft);
for (t = tmp; *t != 0; t++)
*t = TOUPPER_LOC(*t);
str = tmp;
Expand Down Expand Up @@ -3768,10 +3775,12 @@ build_stl_str_hl(wp, out, outlen, fmt, fillchar, maxwidth, hl)
*t++ = '%';
*t = t[-3];
*++t = 0;
sprintf((char *)p, (char *)nstr, 0, num, n);
vim_snprintf((char *)p, outlen - (p - out), (char *)nstr,
0, num, n);
}
else
sprintf((char *)p, (char *)nstr, minwid, num);
vim_snprintf((char *)p, outlen - (p - out), (char *)nstr,
minwid, num);
p += STRLEN(p);
}
else
Expand Down Expand Up @@ -3917,8 +3926,8 @@ build_stl_str_hl(wp, out, outlen, fmt, fillchar, maxwidth, hl)

#if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) || defined(PROTO)
/*
* Get relative cursor position in window, in the form 99%, using "Top", "Bot"
* or "All" when appropriate.
* Get relative cursor position in window into "str[]", in the form 99%, using
* "Top", "Bot" or "All" when appropriate.
*/
void
get_rel_pos(wp, str)
Expand Down Expand Up @@ -4694,7 +4703,7 @@ write_viminfo_bufferlist(fp)
max_buffers = get_viminfo_parameter('%');

/* Allocate room for the file name, lnum and col. */
line = alloc(MAXPATHL + 30);
line = alloc(MAXPATHL + 40);
if (line == NULL)
return;

Expand Down Expand Up @@ -5076,22 +5085,13 @@ sign_list_placed(rbuf)
{
if (buf->b_signlist != NULL)
{
#ifdef HAVE_SNPRINTF
snprintf
#else
sprintf
#endif
(lbuf,
#ifdef HAVE_SNPRINTF
BUFSIZ,
#endif
_("Signs for %s:"), buf->b_fname);
vim_snprintf(lbuf, BUFSIZ, _("Signs for %s:"), buf->b_fname);
MSG_PUTS_ATTR(lbuf, hl_attr(HLF_D));
msg_putchar('\n');
}
for (p = buf->b_signlist; p != NULL; p = p->next)
{
sprintf(lbuf, _(" line=%ld id=%d name=%s"),
vim_snprintf(lbuf, BUFSIZ, _(" line=%ld id=%d name=%s"),
(long)p->lnum, p->id, sign_typenr2name(p->typenr));
MSG_PUTS(lbuf);
msg_putchar('\n');
Expand Down
19 changes: 7 additions & 12 deletions src/ex_docmd.c
Expand Up @@ -1054,21 +1054,11 @@ do_cmdline(cmdline, getline, cookie, flags)

if (p_verbose >= 15 && sourcing_name != NULL)
{
int c = -1;

++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */
/* Truncate long lines, smsg() can't handle that. */
if (STRLEN(cmdline_copy) > 200)
{
c = cmdline_copy[200];
cmdline_copy[200] = NUL;
}
smsg((char_u *)_("line %ld: %s"),
(long)sourcing_lnum, cmdline_copy);
msg_puts((char_u *)"\n"); /* don't overwrite this either */
if (c >= 0)
cmdline_copy[200] = c;
cmdline_row = msg_row;
--no_wait_return;
}
Expand Down Expand Up @@ -1341,7 +1331,8 @@ do_cmdline(cmdline, getline, cookie, flags)
switch (current_exception->type)
{
case ET_USER:
sprintf((char *)IObuff, _("E605: Exception not caught: %s"),
vim_snprintf((char *)IObuff, IOSIZE,
_("E605: Exception not caught: %s"),
current_exception->value);
p = vim_strsave(IObuff);
break;
Expand Down Expand Up @@ -4802,7 +4793,7 @@ check_more(message, forceit)
if (n == 1)
STRCPY(buff, _("1 more file to edit. Quit anyway?"));
else
sprintf((char *)buff,
vim_snprintf((char *)buff, IOSIZE,
_("%d more files to edit. Quit anyway?"), n);
if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1) == VIM_YES)
return OK;
Expand Down Expand Up @@ -9902,6 +9893,10 @@ ex_viminfo(eap)
#endif

#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) || defined(PROTO)
/*
* Make a dialog message in "buff[IOSIZE]".
* "format" must contain "%.*s".
*/
void
dialog_msg(buff, format, fname)
char_u *buff;
Expand Down
4 changes: 2 additions & 2 deletions src/if_ruby.c
Expand Up @@ -474,15 +474,15 @@ static void error_print(int state)
char *p;

epath = rb_class_path(eclass);
snprintf(buff, BUFSIZ, "%s: %s",
vim_snprintf(buff, BUFSIZ, "%s: %s",
RSTRING(epath)->ptr, RSTRING(einfo)->ptr);
p = strchr(buff, '\n');
if (p) *p = '\0';
EMSG(buff);
}
break;
default:
snprintf(buff, BUFSIZ, _("E273: unknown longjmp status %d"), state);
vim_snprintf(buff, BUFSIZ, _("E273: unknown longjmp status %d"), state);
EMSG(buff);
break;
}
Expand Down
20 changes: 12 additions & 8 deletions src/if_sniff.c
Expand Up @@ -817,14 +817,15 @@ HandleSniffRequest(buffer)
vi_open_file(file);
else if (buf!=curbuf)
{
sprintf(VICommand, SelectBuf, file);
vim_snprintf(VICommand, sizeof(VICommand), SelectBuf, file);
vi_exec_cmd(VICommand);
}
if (command == 'o')
vi_set_cursor_pos((long)position);
else
{
sprintf(VICommand, GotoLine, (int)position);
vim_snprintf(VICommand, sizeof(VICommand), GotoLine,
(int)position);
vi_exec_cmd(VICommand);
}
checkpcmark(); /* [mark.c] */
Expand Down Expand Up @@ -853,7 +854,7 @@ HandleSniffRequest(buffer)
buf = vi_find_buffer(file);
if (buf && !buf->b_changed) /* delete buffer only if not modified */
{
sprintf(VICommand, DeleteBuf, file);
vim_snprintf(VICommand, sizeof(VICommand), DeleteBuf, file);
vi_exec_cmd(VICommand);
}
vi_open_file(new_path);
Expand All @@ -875,7 +876,8 @@ HandleSniffRequest(buffer)
buf->b_flags |= BF_CHECK_RO + BF_NEVERLOADED;
if (writable && !buf->b_changed)
{
sprintf(VICommand, UnloadBuf, file);
vim_snprintf(VICommand, sizeof(VICommand), UnloadBuf,
file);
vi_exec_cmd(VICommand);
}
}
Expand All @@ -895,7 +897,7 @@ HandleSniffRequest(buffer)

if (tab_width > 0 && tab_width <= 16)
{
sprintf(VICommand, SetTab, tab_width);
vim_snprintf(VICommand, sizeof(VICommand), SetTab, tab_width);
vi_exec_cmd(VICommand);
}
break;
Expand Down Expand Up @@ -1030,7 +1032,7 @@ SendRequest(command, symbol)
}

if (symbol)
sprintf(cmdstr, "%c%s%s%ld%s%s\n",
vim_snprintf(cmdstr, sizeof(cmdstr), "%c%s%s%ld%s%s\n",
command->cmd_code,
buffer_name,
sniff_rq_sep,
Expand All @@ -1039,7 +1041,8 @@ SendRequest(command, symbol)
symbol
);
else
sprintf(cmdstr, "%c%s\n", command->cmd_code, buffer_name);
vim_snprintf(cmdstr, sizeof(cmdstr), "%c%s\n",
command->cmd_code, buffer_name);
}
else /* simple request */
{
Expand All @@ -1051,7 +1054,8 @@ SendRequest(command, symbol)
{
if ((cmd_type & NEED_SYMBOL) && !(cmd_type & EMPTY_SYMBOL))
{
sprintf(msgtxt, "%s: %s", _(command->cmd_msg), symbol);
vim_snprintf(msgtxt, sizeof(msgtxt), "%s: %s",
_(command->cmd_msg), symbol);
vi_msg(msgtxt);
}
else
Expand Down

0 comments on commit 058c721

Please sign in to comment.