mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
Use portable format specifiers: Case %ld - localized - vim_snprintf.
Fix uses of localized "%ld" within vim_snprintf(): - Replace "%ld" with "%" PRId64. - Cast corresponding argument to (int64_t).
This commit is contained in:

committed by
Thiago de Arruda

parent
3f8061f16c
commit
22dd4f62d3
12
src/buffer.c
12
src/buffer.c
@@ -2184,8 +2184,8 @@ void buflist_list(exarg_T *eap)
|
|||||||
IObuff[len++] = ' ';
|
IObuff[len++] = ' ';
|
||||||
} while (--i > 0 && len < IOSIZE - 18);
|
} while (--i > 0 && len < IOSIZE - 18);
|
||||||
vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len),
|
vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len),
|
||||||
_("line %ld"), buf == curbuf ? curwin->w_cursor.lnum
|
_("line %" PRId64), buf == curbuf ? (int64_t)curwin->w_cursor.lnum
|
||||||
: (long)buflist_findlnum(buf));
|
: (int64_t)buflist_findlnum(buf));
|
||||||
msg_outtrans(IObuff);
|
msg_outtrans(IObuff);
|
||||||
out_flush(); /* output one line at a time */
|
out_flush(); /* output one line at a time */
|
||||||
ui_breakcheck();
|
ui_breakcheck();
|
||||||
@@ -2574,8 +2574,8 @@ fileinfo (
|
|||||||
if (curbuf->b_ml.ml_line_count == 1)
|
if (curbuf->b_ml.ml_line_count == 1)
|
||||||
vim_snprintf_add((char *)buffer, IOSIZE, _("1 line --%d%%--"), n);
|
vim_snprintf_add((char *)buffer, IOSIZE, _("1 line --%d%%--"), n);
|
||||||
else
|
else
|
||||||
vim_snprintf_add((char *)buffer, IOSIZE, _("%ld lines --%d%%--"),
|
vim_snprintf_add((char *)buffer, IOSIZE, _("%" PRId64 " lines --%d%%--"),
|
||||||
(long)curbuf->b_ml.ml_line_count, n);
|
(int64_t)curbuf->b_ml.ml_line_count, n);
|
||||||
} else {
|
} else {
|
||||||
vim_snprintf_add((char *)buffer, IOSIZE,
|
vim_snprintf_add((char *)buffer, IOSIZE,
|
||||||
_("line %ld of %ld --%d%%-- col "),
|
_("line %ld of %ld --%d%%-- col "),
|
||||||
@@ -4595,8 +4595,8 @@ void sign_list_placed(buf_T *rbuf)
|
|||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
}
|
}
|
||||||
for (p = buf->b_signlist; p != NULL && !got_int; p = p->next) {
|
for (p = buf->b_signlist; p != NULL && !got_int; p = p->next) {
|
||||||
vim_snprintf(lbuf, BUFSIZ, _(" line=%ld id=%d name=%s"),
|
vim_snprintf(lbuf, BUFSIZ, _(" line=%" PRId64 " id=%d name=%s"),
|
||||||
(long)p->lnum, p->id, sign_typenr2name(p->typenr));
|
(int64_t)p->lnum, p->id, sign_typenr2name(p->typenr));
|
||||||
MSG_PUTS(lbuf);
|
MSG_PUTS(lbuf);
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
}
|
}
|
||||||
|
@@ -1190,7 +1190,7 @@ do_filter (
|
|||||||
if (linecount > p_report) {
|
if (linecount > p_report) {
|
||||||
if (do_in) {
|
if (do_in) {
|
||||||
vim_snprintf((char *)msg_buf, sizeof(msg_buf),
|
vim_snprintf((char *)msg_buf, sizeof(msg_buf),
|
||||||
_("%ld lines filtered"), (long)linecount);
|
_("%" PRId64 " lines filtered"), (int64_t)linecount);
|
||||||
if (msg(msg_buf) && !msg_scroll)
|
if (msg(msg_buf) && !msg_scroll)
|
||||||
/* save message to display it after redraw */
|
/* save message to display it after redraw */
|
||||||
set_keep_msg(msg_buf, 0);
|
set_keep_msg(msg_buf, 0);
|
||||||
|
@@ -602,8 +602,8 @@ static void catch_exception(except_T *excp)
|
|||||||
set_vim_var_string(VV_EXCEPTION, excp->value, -1);
|
set_vim_var_string(VV_EXCEPTION, excp->value, -1);
|
||||||
if (*excp->throw_name != NUL) {
|
if (*excp->throw_name != NUL) {
|
||||||
if (excp->throw_lnum != 0)
|
if (excp->throw_lnum != 0)
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, _("%s, line %ld"),
|
vim_snprintf((char *)IObuff, IOSIZE, _("%s, line %" PRId64),
|
||||||
excp->throw_name, (long)excp->throw_lnum);
|
excp->throw_name, (int64_t)excp->throw_lnum);
|
||||||
else
|
else
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, "%s", excp->throw_name);
|
vim_snprintf((char *)IObuff, IOSIZE, "%s", excp->throw_name);
|
||||||
set_vim_var_string(VV_THROWPOINT, IObuff, -1);
|
set_vim_var_string(VV_THROWPOINT, IObuff, -1);
|
||||||
@@ -648,8 +648,8 @@ static void finish_exception(except_T *excp)
|
|||||||
if (*caught_stack->throw_name != NUL) {
|
if (*caught_stack->throw_name != NUL) {
|
||||||
if (caught_stack->throw_lnum != 0)
|
if (caught_stack->throw_lnum != 0)
|
||||||
vim_snprintf((char *)IObuff, IOSIZE,
|
vim_snprintf((char *)IObuff, IOSIZE,
|
||||||
_("%s, line %ld"), caught_stack->throw_name,
|
_("%s, line %" PRId64), caught_stack->throw_name,
|
||||||
(long)caught_stack->throw_lnum);
|
(int64_t)caught_stack->throw_lnum);
|
||||||
else
|
else
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, "%s",
|
vim_snprintf((char *)IObuff, IOSIZE, "%s",
|
||||||
caught_stack->throw_name);
|
caught_stack->throw_name);
|
||||||
|
10
src/fileio.c
10
src/fileio.c
@@ -3749,9 +3749,9 @@ restore_backup:
|
|||||||
errmsg_allocated = TRUE;
|
errmsg_allocated = TRUE;
|
||||||
errmsg = alloc(300);
|
errmsg = alloc(300);
|
||||||
vim_snprintf((char *)errmsg, 300,
|
vim_snprintf((char *)errmsg, 300,
|
||||||
_(
|
_("E513: write error, conversion failed in line %" PRId64
|
||||||
"E513: write error, conversion failed in line %ld (make 'fenc' empty to override)"),
|
" (make 'fenc' empty to override)"),
|
||||||
(long)write_info.bw_conv_error_lnum);
|
(int64_t)write_info.bw_conv_error_lnum);
|
||||||
}
|
}
|
||||||
} else if (got_int)
|
} else if (got_int)
|
||||||
errmsg = (char_u *)_(e_interr);
|
errmsg = (char_u *)_(e_interr);
|
||||||
@@ -3817,8 +3817,8 @@ restore_backup:
|
|||||||
STRCAT(IObuff, _(" CONVERSION ERROR"));
|
STRCAT(IObuff, _(" CONVERSION ERROR"));
|
||||||
c = TRUE;
|
c = TRUE;
|
||||||
if (write_info.bw_conv_error_lnum != 0)
|
if (write_info.bw_conv_error_lnum != 0)
|
||||||
vim_snprintf_add((char *)IObuff, IOSIZE, _(" in line %ld;"),
|
vim_snprintf_add((char *)IObuff, IOSIZE, _(" in line %" PRId64 ";"),
|
||||||
(long)write_info.bw_conv_error_lnum);
|
(int64_t)write_info.bw_conv_error_lnum);
|
||||||
} else if (notconverted) {
|
} else if (notconverted) {
|
||||||
STRCAT(IObuff, _("[NOT converted]"));
|
STRCAT(IObuff, _("[NOT converted]"));
|
||||||
c = TRUE;
|
c = TRUE;
|
||||||
|
@@ -1813,8 +1813,8 @@ static void inc_msg_scrolled(void)
|
|||||||
else {
|
else {
|
||||||
len = (int)STRLEN(p) + 40;
|
len = (int)STRLEN(p) + 40;
|
||||||
tofree = alloc(len);
|
tofree = alloc(len);
|
||||||
vim_snprintf((char *)tofree, len, _("%s line %ld"),
|
vim_snprintf((char *)tofree, len, _("%s line %" PRId64),
|
||||||
p, (long)sourcing_lnum);
|
p, (int64_t)sourcing_lnum);
|
||||||
p = tofree;
|
p = tofree;
|
||||||
}
|
}
|
||||||
set_vim_var_string(VV_SCROLLSTART, p, -1);
|
set_vim_var_string(VV_SCROLLSTART, p, -1);
|
||||||
|
@@ -2604,10 +2604,10 @@ void msgmore(long n)
|
|||||||
} else {
|
} else {
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
vim_snprintf((char *)msg_buf, MSG_BUF_LEN,
|
vim_snprintf((char *)msg_buf, MSG_BUF_LEN,
|
||||||
_("%ld more lines"), pn);
|
_("%" PRId64 " more lines"), (int64_t)pn);
|
||||||
else
|
else
|
||||||
vim_snprintf((char *)msg_buf, MSG_BUF_LEN,
|
vim_snprintf((char *)msg_buf, MSG_BUF_LEN,
|
||||||
_("%ld fewer lines"), pn);
|
_("%" PRId64 " fewer lines"), (int64_t)pn);
|
||||||
}
|
}
|
||||||
if (got_int)
|
if (got_int)
|
||||||
vim_strcat(msg_buf, (char_u *)_(" (Interrupted)"), MSG_BUF_LEN);
|
vim_strcat(msg_buf, (char_u *)_(" (Interrupted)"), MSG_BUF_LEN);
|
||||||
|
55
src/ops.c
55
src/ops.c
@@ -5141,28 +5141,30 @@ void cursor_pos_info(void)
|
|||||||
if (VIsual_mode == Ctrl_V && curwin->w_curswant < MAXCOL) {
|
if (VIsual_mode == Ctrl_V && curwin->w_curswant < MAXCOL) {
|
||||||
getvcols(curwin, &min_pos, &max_pos, &min_pos.col,
|
getvcols(curwin, &min_pos, &max_pos, &min_pos.col,
|
||||||
&max_pos.col);
|
&max_pos.col);
|
||||||
vim_snprintf((char *)buf1, sizeof(buf1), _("%ld Cols; "),
|
vim_snprintf((char *)buf1, sizeof(buf1), _("%" PRId64 " Cols; "),
|
||||||
(long)(oparg.end_vcol - oparg.start_vcol + 1));
|
(int64_t)(oparg.end_vcol - oparg.start_vcol + 1));
|
||||||
} else
|
} else
|
||||||
buf1[0] = NUL;
|
buf1[0] = NUL;
|
||||||
|
|
||||||
if (char_count_cursor == byte_count_cursor
|
if (char_count_cursor == byte_count_cursor
|
||||||
&& char_count == byte_count)
|
&& char_count == byte_count)
|
||||||
vim_snprintf((char *)IObuff, IOSIZE,
|
vim_snprintf((char *)IObuff, IOSIZE,
|
||||||
_("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"),
|
_("Selected %s%" PRId64 " of %" PRId64 " Lines; %" PRId64
|
||||||
buf1, line_count_selected,
|
" of %" PRId64 " Words; %" PRId64 " of %" PRId64 " Bytes"),
|
||||||
(long)curbuf->b_ml.ml_line_count,
|
buf1, (int64_t)line_count_selected,
|
||||||
word_count_cursor, word_count,
|
(int64_t)curbuf->b_ml.ml_line_count,
|
||||||
byte_count_cursor, byte_count);
|
(int64_t)word_count_cursor, (int64_t)word_count,
|
||||||
|
(int64_t)byte_count_cursor, (int64_t)byte_count);
|
||||||
else
|
else
|
||||||
vim_snprintf((char *)IObuff, IOSIZE,
|
vim_snprintf((char *)IObuff, IOSIZE,
|
||||||
_(
|
_("Selected %s%" PRId64 " of %" PRId64 " Lines; %" PRId64
|
||||||
"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes"),
|
" of %" PRId64 " Words; %" PRId64 " of %" PRId64
|
||||||
buf1, line_count_selected,
|
" Chars; %" PRId64 " of %" PRId64 " Bytes"),
|
||||||
(long)curbuf->b_ml.ml_line_count,
|
buf1, (int64_t)line_count_selected,
|
||||||
word_count_cursor, word_count,
|
(int64_t)curbuf->b_ml.ml_line_count,
|
||||||
char_count_cursor, char_count,
|
(int64_t)word_count_cursor, (int64_t)word_count,
|
||||||
byte_count_cursor, byte_count);
|
(int64_t)char_count_cursor, (int64_t)char_count,
|
||||||
|
(int64_t)byte_count_cursor, (int64_t)byte_count);
|
||||||
} else {
|
} else {
|
||||||
p = ml_get_curline();
|
p = ml_get_curline();
|
||||||
validate_virtcol();
|
validate_virtcol();
|
||||||
@@ -5173,22 +5175,25 @@ void cursor_pos_info(void)
|
|||||||
if (char_count_cursor == byte_count_cursor
|
if (char_count_cursor == byte_count_cursor
|
||||||
&& char_count == byte_count)
|
&& char_count == byte_count)
|
||||||
vim_snprintf((char *)IObuff, IOSIZE,
|
vim_snprintf((char *)IObuff, IOSIZE,
|
||||||
_("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"),
|
_("Col %s of %s; Line %" PRId64 " of %" PRId64 "; Word %" PRId64
|
||||||
|
" of %" PRId64 "; Byte %" PRId64 " of %" PRId64 ""),
|
||||||
(char *)buf1, (char *)buf2,
|
(char *)buf1, (char *)buf2,
|
||||||
(long)curwin->w_cursor.lnum,
|
(int64_t)curwin->w_cursor.lnum,
|
||||||
(long)curbuf->b_ml.ml_line_count,
|
(int64_t)curbuf->b_ml.ml_line_count,
|
||||||
word_count_cursor, word_count,
|
(int64_t)word_count_cursor, (int64_t)word_count,
|
||||||
byte_count_cursor, byte_count);
|
(int64_t)byte_count_cursor, (int64_t)byte_count);
|
||||||
else
|
else
|
||||||
vim_snprintf((char *)IObuff, IOSIZE,
|
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"),
|
"Col %s of %s; Line %" PRId64 " of %" PRId64 "; Word %" PRId64
|
||||||
|
" of %" PRId64 "; Char %" PRId64 " of %" PRId64
|
||||||
|
"; Byte %" PRId64 " of %" PRId64 ""),
|
||||||
(char *)buf1, (char *)buf2,
|
(char *)buf1, (char *)buf2,
|
||||||
(long)curwin->w_cursor.lnum,
|
(int64_t)curwin->w_cursor.lnum,
|
||||||
(long)curbuf->b_ml.ml_line_count,
|
(int64_t)curbuf->b_ml.ml_line_count,
|
||||||
word_count_cursor, word_count,
|
(int64_t)word_count_cursor, (int64_t)word_count,
|
||||||
char_count_cursor, char_count,
|
(int64_t)char_count_cursor, (int64_t)char_count,
|
||||||
byte_count_cursor, byte_count);
|
(int64_t)byte_count_cursor, (int64_t)byte_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_count = bomb_size();
|
byte_count = bomb_size();
|
||||||
|
@@ -2465,8 +2465,8 @@ static void u_add_time(char_u *buf, size_t buflen, time_t tt)
|
|||||||
/* longer ago */
|
/* longer ago */
|
||||||
(void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime);
|
(void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime);
|
||||||
} else
|
} else
|
||||||
vim_snprintf((char *)buf, buflen, _("%ld seconds ago"),
|
vim_snprintf((char *)buf, buflen, _("%" PRId64 " seconds ago"),
|
||||||
(long)(time(NULL) - tt));
|
(int64_t)(time(NULL) - tt));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user