add func_attr_printf in :

log.c
message.c
strings.c

fixed some printf warnings in:

src/nvim/undo.c
src/nvim/eval.c
src/nvim/eval/encode.c
src/nvim/eval/typval.c
src/nvim/ex_getln.c
src/nvim/fileio.c
src/nvim/lua/executor.c
src/nvim/main.c
src/nvim/regexp_nfa.c
src/nvim/shada.c
src/nvim/spellfile.c
src/nvim/tui/terminfo.c
src/nvim/garray.h
This commit is contained in:
MichaHoffmann 2018-09-23 15:44:13 +02:00
parent 9183e2c67e
commit affef0aab8
17 changed files with 114 additions and 107 deletions

View File

@ -180,7 +180,7 @@ void buf_updates_send_changes(buf_T *buf,
// change notifications are so frequent that many dead channels will be // change notifications are so frequent that many dead channels will be
// cleared up quickly. // cleared up quickly.
if (badchannelid != 0) { if (badchannelid != 0) {
ELOG("Disabling buffer updates for dead channel %llu", badchannelid); ELOG("Disabling buffer updates for dead channel %"PRIu64, badchannelid);
buf_updates_unregister(buf, badchannelid); buf_updates_unregister(buf, badchannelid);
} }
} }

View File

@ -1940,10 +1940,10 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv,
} else if (*arg == '@') { } else if (*arg == '@') {
arg++; arg++;
if (op != NULL && (*op == '+' || *op == '-')) { if (op != NULL && (*op == '+' || *op == '-')) {
emsgf(_(e_letwrong), op); EMSG2(_(e_letwrong), op);
} else if (endchars != NULL } else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) { && vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) {
emsgf(_(e_letunexp)); EMSG(_(e_letunexp));
} else { } else {
char_u *s; char_u *s;
@ -2083,7 +2083,7 @@ static char_u *get_lval(char_u *const name, typval_T *const rettv,
(flags & GLV_READ_ONLY) ? NULL : &ht, (flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD); flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet) { if (v == NULL && !quiet) {
emsgf(_("E121: Undefined variable: %.*s"), EMSG3(_("E121: Undefined variable: %.*s"),
(int)lp->ll_name_len, lp->ll_name); (int)lp->ll_name_len, lp->ll_name);
} }
if (v == NULL) { if (v == NULL) {
@ -2152,7 +2152,7 @@ static char_u *get_lval(char_u *const name, typval_T *const rettv,
if (rettv != NULL && (rettv->v_type != VAR_LIST if (rettv != NULL && (rettv->v_type != VAR_LIST
|| rettv->vval.v_list == NULL)) { || rettv->vval.v_list == NULL)) {
if (!quiet) { if (!quiet) {
emsgf(_("E709: [:] requires a List value")); EMSG(_("E709: [:] requires a List value"));
} }
tv_clear(&var1); tv_clear(&var1);
return NULL; return NULL;
@ -2179,7 +2179,7 @@ static char_u *get_lval(char_u *const name, typval_T *const rettv,
if (*p != ']') { if (*p != ']') {
if (!quiet) { if (!quiet) {
emsgf(_(e_missbrac)); EMSG(_(e_missbrac));
} }
tv_clear(&var1); tv_clear(&var1);
tv_clear(&var2); tv_clear(&var2);
@ -2234,7 +2234,7 @@ static char_u *get_lval(char_u *const name, typval_T *const rettv,
/* Key does not exist in dict: may need to add it. */ /* Key does not exist in dict: may need to add it. */
if (*p == '[' || *p == '.' || unlet) { if (*p == '[' || *p == '.' || unlet) {
if (!quiet) { if (!quiet) {
emsgf(_(e_dictkey), key); EMSG2(_(e_dictkey), key);
} }
tv_clear(&var1); tv_clear(&var1);
return NULL; return NULL;
@ -3036,7 +3036,7 @@ static int do_lock_var(lval_T *lp, char_u *const name_end, const int deep,
&& di->di_tv.v_type != VAR_LIST) { && di->di_tv.v_type != VAR_LIST) {
// For historical reasons this error is not given for Lists and // For historical reasons this error is not given for Lists and
// Dictionaries. E.g. b: dictionary may be locked/unlocked. // Dictionaries. E.g. b: dictionary may be locked/unlocked.
emsgf(_("E940: Cannot lock or unlock variable %s"), lp->ll_name); EMSG2(_("E940: Cannot lock or unlock variable %s"), lp->ll_name);
} else { } else {
if (lock) { if (lock) {
di->di_flags |= DI_FLAGS_LOCK; di->di_flags |= DI_FLAGS_LOCK;
@ -3254,7 +3254,7 @@ int eval0(char_u *arg, typval_T *rettv, char_u **nextcmd, int evaluate)
// been cancelled due to an aborting error, an interrupt, or an // been cancelled due to an aborting error, an interrupt, or an
// exception. // exception.
if (!aborting()) { if (!aborting()) {
emsgf(_(e_invexpr2), arg); EMSG2(_(e_invexpr2), arg);
} }
ret = FAIL; ret = FAIL;
} }
@ -3313,7 +3313,7 @@ static int eval1(char_u **arg, typval_T *rettv, int evaluate)
* Check for the ":". * Check for the ":".
*/ */
if ((*arg)[0] != ':') { if ((*arg)[0] != ':') {
emsgf(_("E109: Missing ':' after '?'")); EMSG(_("E109: Missing ':' after '?'"));
if (evaluate && result) { if (evaluate && result) {
tv_clear(rettv); tv_clear(rettv);
} }
@ -4421,7 +4421,7 @@ eval_index(
/* Check for the ']'. */ /* Check for the ']'. */
if (**arg != ']') { if (**arg != ']') {
if (verbose) { if (verbose) {
emsgf(_(e_missbrac)); EMSG(_(e_missbrac));
} }
tv_clear(&var1); tv_clear(&var1);
if (range) { if (range) {
@ -4533,7 +4533,7 @@ eval_index(
case VAR_DICT: { case VAR_DICT: {
if (range) { if (range) {
if (verbose) { if (verbose) {
emsgf(_(e_dictrange)); EMSG(_(e_dictrange));
} }
if (len == -1) { if (len == -1) {
tv_clear(&var1); tv_clear(&var1);
@ -4553,7 +4553,7 @@ eval_index(
(const char *)key, len); (const char *)key, len);
if (item == NULL && verbose) { if (item == NULL && verbose) {
emsgf(_(e_dictkey), key); EMSG2(_(e_dictkey), key);
} }
if (len == -1) { if (len == -1) {
tv_clear(&var1); tv_clear(&var1);
@ -4890,14 +4890,14 @@ static int get_list_tv(char_u **arg, typval_T *rettv, int evaluate)
break; break;
} }
if (**arg != ',') { if (**arg != ',') {
emsgf(_("E696: Missing comma in List: %s"), *arg); EMSG2(_("E696: Missing comma in List: %s"), *arg);
goto failret; goto failret;
} }
*arg = skipwhite(*arg + 1); *arg = skipwhite(*arg + 1);
} }
if (**arg != ']') { if (**arg != ']') {
emsgf(_("E697: Missing end of List ']': %s"), *arg); EMSG2(_("E697: Missing end of List ']': %s"), *arg);
failret: failret:
if (evaluate) { if (evaluate) {
tv_list_free(l); tv_list_free(l);
@ -7783,7 +7783,7 @@ static void f_deepcopy(typval_T *argvars, typval_T *rettv, FunPtr fptr)
noref = tv_get_number_chk(&argvars[1], NULL); noref = tv_get_number_chk(&argvars[1], NULL);
} }
if (noref < 0 || noref > 1) { if (noref < 0 || noref > 1) {
emsgf(_(e_invarg)); EMSG(_(e_invarg));
} else { } else {
var_item_copy(NULL, &argvars[0], rettv, true, (noref == 0 var_item_copy(NULL, &argvars[0], rettv, true, (noref == 0
? get_copyID() ? get_copyID()
@ -7835,17 +7835,17 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
if (argvars[0].v_type != VAR_DICT) { if (argvars[0].v_type != VAR_DICT) {
emsgf(_(e_invarg2), "dict"); EMSG2(_(e_invarg2), "dict");
return; return;
} else if (argvars[0].vval.v_dict == NULL) { } else if (argvars[0].vval.v_dict == NULL) {
const char *const arg_errmsg = _("dictwatcheradd() argument"); const char *const arg_errmsg = _("dictwatcheradd() argument");
const size_t arg_errmsg_len = strlen(arg_errmsg); const size_t arg_errmsg_len = strlen(arg_errmsg);
emsgf(_(e_readonlyvar), (int)arg_errmsg_len, arg_errmsg); EMSG3(_(e_readonlyvar), (int)arg_errmsg_len, arg_errmsg);
return; return;
} }
if (argvars[1].v_type != VAR_STRING && argvars[1].v_type != VAR_NUMBER) { if (argvars[1].v_type != VAR_STRING && argvars[1].v_type != VAR_NUMBER) {
emsgf(_(e_invarg2), "key"); EMSG2(_(e_invarg2), "key");
return; return;
} }
@ -7857,7 +7857,7 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
Callback callback; Callback callback;
if (!callback_from_typval(&callback, &argvars[2])) { if (!callback_from_typval(&callback, &argvars[2])) {
emsgf(_(e_invarg2), "funcref"); EMSG2(_(e_invarg2), "funcref");
return; return;
} }
@ -7873,12 +7873,12 @@ static void f_dictwatcherdel(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
if (argvars[0].v_type != VAR_DICT) { if (argvars[0].v_type != VAR_DICT) {
emsgf(_(e_invarg2), "dict"); EMSG2(_(e_invarg2), "dict");
return; return;
} }
if (argvars[2].v_type != VAR_FUNC && argvars[2].v_type != VAR_STRING) { if (argvars[2].v_type != VAR_FUNC && argvars[2].v_type != VAR_STRING) {
emsgf(_(e_invarg2), "funcref"); EMSG2(_(e_invarg2), "funcref");
return; return;
} }
@ -8643,7 +8643,7 @@ static int filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
} }
if (*s != NUL) { // check for trailing chars after expr if (*s != NUL) { // check for trailing chars after expr
emsgf(_(e_invexpr2), s); EMSG2(_(e_invexpr2), s);
goto theend; goto theend;
} }
} }
@ -8944,7 +8944,7 @@ static void common_function(typval_T *argvars, typval_T *rettv,
} }
if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s)) if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s))
|| (is_funcref && trans_name == NULL)) { || (is_funcref && trans_name == NULL)) {
emsgf(_(e_invarg2), (use_string EMSG2(_(e_invarg2), (use_string
? tv_get_string(&argvars[0]) ? tv_get_string(&argvars[0])
: (const char *)s)); : (const char *)s));
// Don't check an autoload name for existence here. // Don't check an autoload name for existence here.
@ -11178,7 +11178,7 @@ void get_user_input(const typval_T *const argvars,
char def[1] = { 0 }; char def[1] = { 0 };
if (argvars[0].v_type == VAR_DICT) { if (argvars[0].v_type == VAR_DICT) {
if (argvars[1].v_type != VAR_UNKNOWN) { if (argvars[1].v_type != VAR_UNKNOWN) {
emsgf(_("E5050: {opts} must be the only argument")); EMSG(_("E5050: {opts} must be the only argument"));
return; return;
} }
dict_T *const dict = argvars[0].vval.v_dict; dict_T *const dict = argvars[0].vval.v_dict;
@ -11487,7 +11487,7 @@ static void dict_list(typval_T *const tv, typval_T *const rettv,
const DictListType what) const DictListType what)
{ {
if (tv->v_type != VAR_DICT) { if (tv->v_type != VAR_DICT) {
emsgf(_(e_dictreq)); EMSG(_(e_dictreq));
return; return;
} }
if (tv->vval.v_dict == NULL) { if (tv->vval.v_dict == NULL) {
@ -11917,7 +11917,7 @@ static void f_json_decode(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
} }
if (json_decode_string(s, len, rettv) == FAIL) { if (json_decode_string(s, len, rettv) == FAIL) {
emsgf(_("E474: Failed to parse %.*s"), (int) len, s); EMSG3(_("E474: Failed to parse %.*s"), (int) len, s);
rettv->v_type = VAR_NUMBER; rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
} }
@ -12907,11 +12907,11 @@ static void f_nr2char(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return; return;
} }
if (num < 0) { if (num < 0) {
emsgf(_("E5070: Character number must not be less than zero")); EMSG(_("E5070: Character number must not be less than zero"));
return; return;
} }
if (num > INT_MAX) { if (num > INT_MAX) {
emsgf(_("E5071: Character number must not be greater than INT_MAX (%i)"), EMSG2(_("E5071: Character number must not be greater than INT_MAX (%i)"),
INT_MAX); INT_MAX);
return; return;
} }
@ -13053,9 +13053,9 @@ static void f_range(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return; // Type error; errmsg already given. return; // Type error; errmsg already given.
} }
if (stride == 0) { if (stride == 0) {
emsgf(_("E726: Stride is zero")); EMSG(_("E726: Stride is zero"));
} else if (stride > 0 ? end + 1 < start : end - 1 > start) { } else if (stride > 0 ? end + 1 < start : end - 1 > start) {
emsgf(_("E727: Start past end")); EMSG(_("E727: Start past end"));
} else { } else {
tv_list_alloc_ret(rettv, (end - start) / stride); tv_list_alloc_ret(rettv, (end - start) / stride);
for (i = start; stride > 0 ? i <= end : i >= end; i += stride) { for (i = start; stride > 0 ? i <= end : i >= end; i += stride) {
@ -13392,7 +13392,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
} }
if (li == NULL) { // Didn't find "item2" after "item". if (li == NULL) { // Didn't find "item2" after "item".
emsgf(_(e_invrange)); EMSG(_(e_invrange));
} else { } else {
tv_list_move_items(l, item, item2, tv_list_alloc_ret(rettv, cnt), tv_list_move_items(l, item, item2, tv_list_alloc_ret(rettv, cnt),
cnt); cnt);
@ -13683,7 +13683,7 @@ static int get_search_arg(typval_T *varp, int *flagsp)
} }
} }
if (mask == 0) { if (mask == 0) {
emsgf(_(e_invarg2), flags); EMSG2(_(e_invarg2), flags);
dir = 0; dir = 0;
} else { } else {
*flagsp |= mask; *flagsp |= mask;
@ -13934,7 +13934,7 @@ static void f_rpcstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
int i = 0; int i = 0;
TV_LIST_ITER_CONST(args, arg, { TV_LIST_ITER_CONST(args, arg, {
if (TV_LIST_ITEM_TV(arg)->v_type != VAR_STRING) { if (TV_LIST_ITEM_TV(arg)->v_type != VAR_STRING) {
emsgf(_("E5010: List item %d of the second argument is not a string"), EMSG2(_("E5010: List item %d of the second argument is not a string"),
i); i);
return; return;
} }
@ -14703,7 +14703,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
} else if (title_arg->v_type == VAR_DICT) { } else if (title_arg->v_type == VAR_DICT) {
d = title_arg->vval.v_dict; d = title_arg->vval.v_dict;
} else { } else {
emsgf(_(e_dictreq)); EMSG(_(e_dictreq));
return; return;
} }
@ -14753,7 +14753,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
TV_LIST_ITER_CONST(l, li, { TV_LIST_ITER_CONST(l, li, {
if (TV_LIST_ITEM_TV(li)->v_type != VAR_DICT if (TV_LIST_ITEM_TV(li)->v_type != VAR_DICT
|| (d = TV_LIST_ITEM_TV(li)->vval.v_dict) == NULL) { || (d = TV_LIST_ITEM_TV(li)->vval.v_dict) == NULL) {
emsgf(_("E474: List item %d is either not a dictionary " EMSG2(_("E474: List item %d is either not a dictionary "
"or an empty one"), i); "or an empty one"), i);
return; return;
} }
@ -14762,7 +14762,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|| tv_dict_find(d, S_LEN("pos1")) != NULL) || tv_dict_find(d, S_LEN("pos1")) != NULL)
&& tv_dict_find(d, S_LEN("priority")) != NULL && tv_dict_find(d, S_LEN("priority")) != NULL
&& tv_dict_find(d, S_LEN("id")) != NULL)) { && tv_dict_find(d, S_LEN("id")) != NULL)) {
emsgf(_("E474: List item %d is missing one of the required keys"), i); EMSG2(_("E474: List item %d is missing one of the required keys"), i);
return; return;
} }
i++; i++;
@ -16199,7 +16199,7 @@ static void f_submatch(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
if (no < 0 || no >= NSUBEXP) { if (no < 0 || no >= NSUBEXP) {
EMSGN(_("E935: invalid submatch number: %d"), no); EMSG2(_("E935: invalid submatch number: %ld"), no);
return; return;
} }
int retList = 0; int retList = 0;
@ -17563,7 +17563,7 @@ static void f_winrestview(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_DICT if (argvars[0].v_type != VAR_DICT
|| (dict = argvars[0].vval.v_dict) == NULL) { || (dict = argvars[0].vval.v_dict) == NULL) {
emsgf(_(e_invarg)); EMSG(_(e_invarg));
} else { } else {
dictitem_T *di; dictitem_T *di;
if ((di = tv_dict_find(dict, S_LEN("lnum"))) != NULL) { if ((di = tv_dict_find(dict, S_LEN("lnum"))) != NULL) {
@ -17680,7 +17680,7 @@ static bool write_list(FileDescriptor *const fp, const list_T *const list,
} }
return true; return true;
write_list_error: write_list_error:
emsgf(_("E80: Error while writing: %s"), os_strerror(error)); EMSG2(_("E80: Error while writing: %s"), os_strerror(error));
return false; return false;
} }
@ -17829,7 +17829,7 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
case 'S': { do_fsync = false; break; } case 'S': { do_fsync = false; break; }
default: { default: {
// Using %s, p and not %c, *p to preserve multibyte characters // Using %s, p and not %c, *p to preserve multibyte characters
emsgf(_("E5060: Unknown flag: %s"), p); EMSG2(_("E5060: Unknown flag: %s"), p);
return; return;
} }
} }
@ -17848,14 +17848,14 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if ((error = file_open(&fp, fname, } else if ((error = file_open(&fp, fname,
((append ? kFileAppend : kFileTruncate) ((append ? kFileAppend : kFileTruncate)
| kFileCreate), 0666)) != 0) { | kFileCreate), 0666)) != 0) {
emsgf(_("E482: Can't open file %s for writing: %s"), EMSG3(_("E482: Can't open file %s for writing: %s"),
fname, os_strerror(error)); fname, os_strerror(error));
} else { } else {
if (write_list(&fp, list, binary)) { if (write_list(&fp, list, binary)) {
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
} }
if ((error = file_close(&fp, do_fsync)) != 0) { if ((error = file_close(&fp, do_fsync)) != 0) {
emsgf(_("E80: Error when closing file %s: %s"), EMSG3(_("E80: Error when closing file %s: %s"),
fname, os_strerror(error)); fname, os_strerror(error));
} }
} }
@ -18588,7 +18588,7 @@ static int get_var_tv(
if (tv == NULL) { if (tv == NULL) {
if (rettv != NULL && verbose) { if (rettv != NULL && verbose) {
emsgf(_("E121: Undefined variable: %.*s"), len, name); EMSG3(_("E121: Undefined variable: %.*s"), len, name);
} }
ret = FAIL; ret = FAIL;
} else if (rettv != NULL) { } else if (rettv != NULL) {
@ -19236,7 +19236,7 @@ static void set_var(const char *name, const size_t name_len, typval_T *const tv,
} else { // Add a new variable. } else { // Add a new variable.
// Can't add "v:" variable. // Can't add "v:" variable.
if (ht == &vimvarht) { if (ht == &vimvarht) {
emsgf(_(e_illvar), name); EMSG2(_(e_illvar), name);
return; return;
} }
@ -19315,7 +19315,7 @@ bool var_check_ro(const int flags, const char *name,
name_len = strlen(name); name_len = strlen(name);
} }
emsgf(_(error_message), (int)name_len, name); EMSG3(_(error_message), (int)name_len, name);
return true; return true;
} }
@ -19349,7 +19349,7 @@ static bool var_check_fixed(const int flags, const char *name,
} else if (name_len == TV_CSTRING) { } else if (name_len == TV_CSTRING) {
name_len = strlen(name); name_len = strlen(name);
} }
emsgf(_("E795: Cannot delete variable %.*s"), (int)name_len, name); EMSG3(_("E795: Cannot delete variable %.*s"), (int)name_len, name);
return true; return true;
} }
return false; return false;
@ -19400,7 +19400,7 @@ bool valid_varname(const char *varname)
if (!eval_isnamec1((int)(uint8_t)(*p)) if (!eval_isnamec1((int)(uint8_t)(*p))
&& (p == varname || !ascii_isdigit(*p)) && (p == varname || !ascii_isdigit(*p))
&& *p != AUTOLOAD_CHAR) { && *p != AUTOLOAD_CHAR) {
emsgf(_(e_illvar), varname); EMSG2(_(e_illvar), varname);
return false; return false;
} }
} }
@ -19958,7 +19958,7 @@ void ex_function(exarg_T *eap)
if (*p == '\n') { if (*p == '\n') {
line_arg = p + 1; line_arg = p + 1;
} else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) { } else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) {
emsgf(_(e_trailing)); EMSG(_(e_trailing));
} }
/* /*
@ -20378,7 +20378,7 @@ trans_function_name(
*/ */
if (!aborting()) { if (!aborting()) {
if (end != NULL) { if (end != NULL) {
emsgf(_(e_invarg2), start); EMSG2(_(e_invarg2), start);
} }
} else { } else {
*pp = (char_u *)find_name_end(start, NULL, NULL, FNE_INCL_BR); *pp = (char_u *)find_name_end(start, NULL, NULL, FNE_INCL_BR);

View File

@ -609,14 +609,14 @@ static inline int convert_to_json_string(garray_T *const gap,
if (ch > 0x7F && shift == 1) { if (ch > 0x7F && shift == 1) {
emsgf(_("E474: String \"%.*s\" contains byte that does not start " emsgf(_("E474: String \"%.*s\" contains byte that does not start "
"any UTF-8 character"), "any UTF-8 character"),
utf_len - (i - shift), utf_buf + i - shift); (int)(utf_len - (i - shift)), utf_buf + i - shift);
xfree(tofree); xfree(tofree);
return FAIL; return FAIL;
} else if ((SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END) } else if ((SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END)
|| (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END)) { || (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END)) {
emsgf(_("E474: UTF-8 string contains code point which belongs " emsgf(_("E474: UTF-8 string contains code point which belongs "
"to a surrogate pair: %.*s"), "to a surrogate pair: %.*s"),
utf_len - (i - shift), utf_buf + i - shift); (int)(utf_len - (i - shift)), utf_buf + i - shift);
xfree(tofree); xfree(tofree);
return FAIL; return FAIL;
} else if (ENCODE_RAW(ch)) { } else if (ENCODE_RAW(ch)) {

View File

@ -61,7 +61,7 @@ void list_write_log(const char *const fname)
FileDescriptor fp; FileDescriptor fp;
const int fo_ret = file_open(&fp, fname, kFileCreate|kFileAppend, 0600); const int fo_ret = file_open(&fp, fname, kFileCreate|kFileAppend, 0600);
if (fo_ret != 0) { if (fo_ret != 0) {
emsgf(_("E5142: Failed to open file %s: %s"), fname, os_strerror(fo_ret)); EMSG3(_("E5142: Failed to open file %s: %s"), fname, os_strerror(fo_ret));
return; return;
} }
for (ListLog *chunk = list_log_first; chunk != NULL;) { for (ListLog *chunk = list_log_first; chunk != NULL;) {
@ -83,7 +83,7 @@ void list_write_log(const char *const fname)
sizeof(chunk->entries[0]) * (chunk->size - i)); sizeof(chunk->entries[0]) * (chunk->size - i));
chunk->size -= i; chunk->size -= i;
} }
emsgf(_("E5143: Failed to write to file %s: %s"), EMSG3(_("E5143: Failed to write to file %s: %s"),
fname, os_strerror((int)fw_ret)); fname, os_strerror((int)fw_ret));
return; return;
} }
@ -94,7 +94,7 @@ void list_write_log(const char *const fname)
} }
const int fc_ret = file_close(&fp, true); const int fc_ret = file_close(&fp, true);
if (fc_ret != 0) { if (fc_ret != 0) {
emsgf(_("E5144: Failed to close file %s: %s"), fname, os_strerror(fc_ret)); EMSG3(_("E5144: Failed to close file %s: %s"), fname, os_strerror(fc_ret));
} }
} }
@ -991,7 +991,7 @@ const char *tv_list_find_str(list_T *const l, const int n)
{ {
const listitem_T *const li = tv_list_find(l, n); const listitem_T *const li = tv_list_find(l, n);
if (li == NULL) { if (li == NULL) {
emsgf(_(e_listidx), (int64_t)n); EMSG2(_(e_listidx), (int64_t)n);
return NULL; return NULL;
} }
return tv_get_string(TV_LIST_ITEM_TV(li)); return tv_get_string(TV_LIST_ITEM_TV(li));
@ -1286,7 +1286,7 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
{ {
hashitem_T *const hi = hash_find(&dict->dv_hashtab, item->di_key); hashitem_T *const hi = hash_find(&dict->dv_hashtab, item->di_key);
if (HASHITEM_EMPTY(hi)) { if (HASHITEM_EMPTY(hi)) {
emsgf(_(e_intern2), "tv_dict_item_remove()"); EMSG2(_(e_intern2), "tv_dict_item_remove()");
} else { } else {
hash_remove(&dict->dv_hashtab, hi); hash_remove(&dict->dv_hashtab, hi);
} }
@ -1532,7 +1532,7 @@ bool tv_dict_get_callback(dict_T *const d,
} }
if (!tv_is_func(di->di_tv) && di->di_tv.v_type != VAR_STRING) { if (!tv_is_func(di->di_tv) && di->di_tv.v_type != VAR_STRING) {
emsgf(_("E6000: Argument is not a function or function name")); EMSG(_("E6000: Argument is not a function or function name"));
return false; return false;
} }
@ -1759,7 +1759,7 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2,
NULL); NULL);
} }
} else if (*action == 'e') { } else if (*action == 'e') {
emsgf(_("E737: Key already exists: %s"), di2->di_key); EMSG2(_("E737: Key already exists: %s"), di2->di_key);
break; break;
} else if (*action == 'f' && di2 != di1) { } else if (*action == 'f' && di2 != di1) {
typval_T oldtv; typval_T oldtv;
@ -2278,7 +2278,7 @@ void tv_copy(const typval_T *const from, typval_T *const to)
break; break;
} }
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(e_intern2), "tv_copy(UNKNOWN)"); EMSG2(_(e_intern2), "tv_copy(UNKNOWN)");
break; break;
} }
} }
@ -2298,7 +2298,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock)
static int recurse = 0; static int recurse = 0;
if (recurse >= DICT_MAXNEST) { if (recurse >= DICT_MAXNEST) {
emsgf(_("E743: variable nested too deep for (un)lock")); EMSG(_("E743: variable nested too deep for (un)lock"));
return; return;
} }
if (deep == 0) { if (deep == 0) {
@ -2426,7 +2426,7 @@ bool tv_check_lock(const VarLockStatus lock, const char *name,
name_len = strlen(name); name_len = strlen(name);
} }
emsgf(_(error_message), (int)name_len, name); EMSG3(_(error_message), (int)name_len, name);
return true; return true;
} }
@ -2546,28 +2546,28 @@ bool tv_check_str_or_nr(const typval_T *const tv)
return true; return true;
} }
case VAR_FLOAT: { case VAR_FLOAT: {
emsgf(_("E805: Expected a Number or a String, Float found")); EMSG(_("E805: Expected a Number or a String, Float found"));
return false; return false;
} }
case VAR_PARTIAL: case VAR_PARTIAL:
case VAR_FUNC: { case VAR_FUNC: {
emsgf(_("E703: Expected a Number or a String, Funcref found")); EMSG(_("E703: Expected a Number or a String, Funcref found"));
return false; return false;
} }
case VAR_LIST: { case VAR_LIST: {
emsgf(_("E745: Expected a Number or a String, List found")); EMSG(_("E745: Expected a Number or a String, List found"));
return false; return false;
} }
case VAR_DICT: { case VAR_DICT: {
emsgf(_("E728: Expected a Number or a String, Dictionary found")); EMSG(_("E728: Expected a Number or a String, Dictionary found"));
return false; return false;
} }
case VAR_SPECIAL: { case VAR_SPECIAL: {
emsgf(_("E5300: Expected a Number or a String")); EMSG(_("E5300: Expected a Number or a String"));
return false; return false;
} }
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(e_intern2), "tv_check_str_or_nr(UNKNOWN)"); EMSG2(_(e_intern2), "tv_check_str_or_nr(UNKNOWN)");
return false; return false;
} }
} }
@ -2611,7 +2611,7 @@ bool tv_check_num(const typval_T *const tv)
case VAR_DICT: case VAR_DICT:
case VAR_FLOAT: case VAR_FLOAT:
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(num_errors[tv->v_type])); EMSG(_(num_errors[tv->v_type]));
return false; return false;
} }
} }
@ -2655,7 +2655,7 @@ bool tv_check_str(const typval_T *const tv)
case VAR_DICT: case VAR_DICT:
case VAR_FLOAT: case VAR_FLOAT:
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(str_errors[tv->v_type])); EMSG(_(str_errors[tv->v_type]));
return false; return false;
} }
} }
@ -2702,7 +2702,7 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
case VAR_LIST: case VAR_LIST:
case VAR_DICT: case VAR_DICT:
case VAR_FLOAT: { case VAR_FLOAT: {
emsgf(_(num_errors[tv->v_type])); EMSG(_(num_errors[tv->v_type]));
break; break;
} }
case VAR_NUMBER: { case VAR_NUMBER: {
@ -2728,7 +2728,7 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
break; break;
} }
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(e_intern2), "tv_get_number(UNKNOWN)"); EMSG2(_(e_intern2), "tv_get_number(UNKNOWN)");
break; break;
} }
} }
@ -2778,27 +2778,27 @@ float_T tv_get_float(const typval_T *const tv)
} }
case VAR_PARTIAL: case VAR_PARTIAL:
case VAR_FUNC: { case VAR_FUNC: {
emsgf(_("E891: Using a Funcref as a Float")); EMSG(_("E891: Using a Funcref as a Float"));
break; break;
} }
case VAR_STRING: { case VAR_STRING: {
emsgf(_("E892: Using a String as a Float")); EMSG(_("E892: Using a String as a Float"));
break; break;
} }
case VAR_LIST: { case VAR_LIST: {
emsgf(_("E893: Using a List as a Float")); EMSG(_("E893: Using a List as a Float"));
break; break;
} }
case VAR_DICT: { case VAR_DICT: {
emsgf(_("E894: Using a Dictionary as a Float")); EMSG(_("E894: Using a Dictionary as a Float"));
break; break;
} }
case VAR_SPECIAL: { case VAR_SPECIAL: {
emsgf(_("E907: Using a special value as a Float")); EMSG(_("E907: Using a special value as a Float"));
break; break;
} }
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(e_intern2), "tv_get_float(UNKNOWN)"); EMSG2(_(e_intern2), "tv_get_float(UNKNOWN)");
break; break;
} }
} }
@ -2840,7 +2840,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf)
case VAR_DICT: case VAR_DICT:
case VAR_FLOAT: case VAR_FLOAT:
case VAR_UNKNOWN: { case VAR_UNKNOWN: {
emsgf(_(str_errors[tv->v_type])); EMSG(_(str_errors[tv->v_type]));
return false; return false;
} }
} }

View File

@ -2693,7 +2693,7 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
} }
const list_T *const l = TV_LIST_ITEM_TV(li)->vval.v_list; const list_T *const l = TV_LIST_ITEM_TV(li)->vval.v_list;
if (tv_list_len(l) != 3) { if (tv_list_len(l) != 3) {
PRINT_ERRMSG(_("E5402: List item %i has incorrect length: %li /= 3"), PRINT_ERRMSG(_("E5402: List item %i has incorrect length: %d /= 3"),
i, tv_list_len(l)); i, tv_list_len(l));
goto color_cmdline_error; goto color_cmdline_error;
} }

View File

@ -3686,7 +3686,7 @@ nofail:
} else if (errmsgarg != 0) { } else if (errmsgarg != 0) {
emsgf(errmsg, os_strerror(errmsgarg)); emsgf(errmsg, os_strerror(errmsgarg));
} else { } else {
emsgf(errmsg); EMSG(errmsg);
} }
if (errmsg_allocated) { if (errmsg_allocated) {
xfree(errmsg); xfree(errmsg);
@ -6216,7 +6216,7 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd,
/* refuse to add buffer-local ap if buffer number is invalid */ /* refuse to add buffer-local ap if buffer number is invalid */
if (is_buflocal && (buflocal_nr == 0 if (is_buflocal && (buflocal_nr == 0
|| buflist_findnr(buflocal_nr) == NULL)) { || buflist_findnr(buflocal_nr) == NULL)) {
EMSGN(_("E680: <buffer=%d>: invalid buffer number "), EMSG2(_("E680: <buffer=%d>: invalid buffer number "),
buflocal_nr); buflocal_nr);
return FAIL; return FAIL;
} }

View File

@ -37,7 +37,7 @@ typedef struct growarray {
static inline void *ga_append_via_ptr(garray_T *gap, size_t item_size) static inline void *ga_append_via_ptr(garray_T *gap, size_t item_size)
{ {
if ((int)item_size != gap->ga_itemsize) { if ((int)item_size != gap->ga_itemsize) {
WLOG("wrong item size (%d), should be %d", item_size, gap->ga_itemsize); WLOG("wrong item size (%zu), should be %d", item_size, gap->ga_itemsize);
} }
ga_grow(gap, 1); ga_grow(gap, 1);
return ((char *)gap->ga_data) + (item_size * (size_t)gap->ga_len++); return ((char *)gap->ga_data) + (item_size * (size_t)gap->ga_len++);

View File

@ -103,7 +103,7 @@ void log_unlock(void)
/// @param line_num source line number, or -1 /// @param line_num source line number, or -1
bool logmsg(int log_level, const char *context, const char *func_name, bool logmsg(int log_level, const char *context, const char *func_name,
int line_num, bool eol, const char *fmt, ...) int line_num, bool eol, const char *fmt, ...)
FUNC_ATTR_UNUSED FUNC_ATTR_UNUSED FUNC_ATTR_PRINTF(6, 7)
{ {
if (log_level < MIN_LOG_LEVEL) { if (log_level < MIN_LOG_LEVEL) {
return false; return false;
@ -240,6 +240,7 @@ end:
static bool do_log_to_file(FILE *log_file, int log_level, const char *context, static bool do_log_to_file(FILE *log_file, int log_level, const char *context,
const char *func_name, int line_num, bool eol, const char *func_name, int line_num, bool eol,
const char* fmt, ...) const char* fmt, ...)
FUNC_ATTR_PRINTF(7, 8)
{ {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);

View File

@ -291,7 +291,7 @@ static int nlua_print(lua_State *const lstate)
return 0; return 0;
nlua_print_error: nlua_print_error:
emsgf(_("E5114: Error while converting print argument #%i: %.*s"), emsgf(_("E5114: Error while converting print argument #%i: %.*s"),
curargidx, errmsg_len, errmsg); curargidx, (int)errmsg_len, errmsg);
ga_clear(&msg_ga); ga_clear(&msg_ga);
lua_pop(lstate, lua_gettop(lstate)); lua_pop(lstate, lua_gettop(lstate));
return 0; return 0;

View File

@ -828,11 +828,11 @@ static void command_line_scan(mparm_T *parmp)
msgpack_packer *p = msgpack_packer_new(&fp, msgpack_file_write); msgpack_packer *p = msgpack_packer_new(&fp, msgpack_file_write);
if (fof_ret != 0) { if (fof_ret != 0) {
emsgf(_("E5421: Failed to open stdin: %s"), os_strerror(fof_ret)); EMSG2(_("E5421: Failed to open stdin: %s"), os_strerror(fof_ret));
} }
if (p == NULL) { if (p == NULL) {
emsgf(_(e_outofmem)); EMSG(_(e_outofmem));
} }
Object md = DICTIONARY_OBJ(api_metadata()); Object md = DICTIONARY_OBJ(api_metadata());

View File

@ -331,6 +331,7 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen)
*/ */
int smsg(char *s, ...) int smsg(char *s, ...)
FUNC_ATTR_PRINTF(1, 2)
{ {
va_list arglist; va_list arglist;
@ -341,6 +342,7 @@ int smsg(char *s, ...)
} }
int smsg_attr(int attr, char *s, ...) int smsg_attr(int attr, char *s, ...)
FUNC_ATTR_PRINTF(2, 3)
{ {
va_list arglist; va_list arglist;
@ -581,6 +583,7 @@ void emsg_invreg(int name)
/// Print an error message with unknown number of arguments /// Print an error message with unknown number of arguments
bool emsgf(const char *const fmt, ...) bool emsgf(const char *const fmt, ...)
FUNC_ATTR_PRINTF(1, 2)
{ {
bool ret; bool ret;
@ -644,6 +647,7 @@ static void msg_emsgf_event(void **argv)
} }
void msg_schedule_emsgf(const char *const fmt, ...) void msg_schedule_emsgf(const char *const fmt, ...)
FUNC_ATTR_PRINTF(1, 2)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -1672,7 +1676,7 @@ void msg_puts_attr_len(const char *const str, const ptrdiff_t len, int attr)
/// @param[in] attr Highlight attributes. /// @param[in] attr Highlight attributes.
/// @param[in] fmt Format string. /// @param[in] fmt Format string.
void msg_printf_attr(const int attr, const char *const fmt, ...) void msg_printf_attr(const int attr, const char *const fmt, ...)
FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_PRINTF(2, 3)
{ {
static char msgbuf[IOSIZE]; static char msgbuf[IOSIZE];

View File

@ -1384,7 +1384,7 @@ static int nfa_regatom(void)
re_has_z = REX_SET; re_has_z = REX_SET;
break; break;
default: default:
EMSGN(_("E867: (NFA) Unknown operator '\\z%c'"), EMSG2(_("E867: (NFA) Unknown operator '\\z%c'"),
no_Magic(c)); no_Magic(c));
return FAIL; return FAIL;
} }
@ -1524,7 +1524,7 @@ static int nfa_regatom(void)
break; break;
} }
} }
EMSGN(_("E867: (NFA) Unknown operator '\\%%%c'"), EMSG2(_("E867: (NFA) Unknown operator '\\%%%c'"),
no_Magic(c)); no_Magic(c));
return FAIL; return FAIL;
} }
@ -1937,7 +1937,7 @@ static int nfa_regpiece(void)
break; break;
} }
if (i == 0) { if (i == 0) {
EMSGN(_("E869: (NFA) Unknown operator '\\@%c'"), op); EMSG2(_("E869: (NFA) Unknown operator '\\@%c'"), op);
return FAIL; return FAIL;
} }
EMIT(i); EMIT(i);

View File

@ -884,7 +884,7 @@ static int shada_read_file(const char *const file, const int flags)
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg(_("Reading ShaDa file \"%s\"%s%s%s"), smsg(_("Reading ShaDa file \"%s\"%s%s%s%s"),
fname, fname,
(flags & kShaDaWantInfo) ? _(" info") : "", (flags & kShaDaWantInfo) ? _(" info") : "",
(flags & kShaDaWantMarks) ? _(" marks") : "", (flags & kShaDaWantMarks) ? _(" marks") : "",
@ -2033,7 +2033,7 @@ static const char *shada_format_entry(const ShadaEntry entry)
{ {
static char ret[1024]; static char ret[1024];
ret[0] = 0; ret[0] = 0;
vim_snprintf(S_LEN(ret), "[ ] ts=%" PRIu64 " "); vim_snprintf(S_LEN(ret), "%s", "[ ] ts=%" PRIu64 " ");
// ^ Space for `can_free_entry` // ^ Space for `can_free_entry`
switch (entry.type) { switch (entry.type) {
case kSDItemMissing: { case kSDItemMissing: {
@ -2091,7 +2091,7 @@ static const char *shada_format_entry(const ShadaEntry entry)
entry.data.filemark.mark.lnum, \ entry.data.filemark.mark.lnum, \
entry.data.filemark.mark.col, \ entry.data.filemark.mark.col, \
entry.data.filemark.mark.coladd, \ entry.data.filemark.mark.coladd, \
entry.data.filemark.additional_data, \ (void*)entry.data.filemark.additional_data, \
ad_len, \ ad_len, \
ad); \ ad); \
} while (0) } while (0)

View File

@ -3096,7 +3096,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
if (spin->si_verbose && spin->si_msg_count > 10000) { if (spin->si_verbose && spin->si_msg_count > 10000) {
spin->si_msg_count = 0; spin->si_msg_count = 0;
vim_snprintf((char *)message, sizeof(message), vim_snprintf((char *)message, sizeof(message),
_("line %6d, word %6d - %s"), _("line %6d, word %6ld - %s"),
lnum, spin->si_foldwcount + spin->si_keepwcount, w); lnum, spin->si_foldwcount + spin->si_keepwcount, w);
msg_start(); msg_start();
msg_puts_long_attr(message, 0); msg_puts_long_attr(message, 0);
@ -3570,7 +3570,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
if (spin->si_conv.vc_type != CONV_NONE) { if (spin->si_conv.vc_type != CONV_NONE) {
pc = string_convert(&spin->si_conv, rline, NULL); pc = string_convert(&spin->si_conv, rline, NULL);
if (pc == NULL) { if (pc == NULL) {
smsg(_("Conversion failure for word in %s line %d: %s"), smsg(_("Conversion failure for word in %s line %ld: %s"),
fname, lnum, rline); fname, lnum, rline);
continue; continue;
} }
@ -3584,10 +3584,10 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
++line; ++line;
if (STRNCMP(line, "encoding=", 9) == 0) { if (STRNCMP(line, "encoding=", 9) == 0) {
if (spin->si_conv.vc_type != CONV_NONE) if (spin->si_conv.vc_type != CONV_NONE)
smsg(_("Duplicate /encoding= line ignored in %s line %d: %s"), smsg(_("Duplicate /encoding= line ignored in %s line %ld: %s"),
fname, lnum, line - 1); fname, lnum, line - 1);
else if (did_word) else if (did_word)
smsg(_("/encoding= line after word ignored in %s line %d: %s"), smsg(_("/encoding= line after word ignored in %s line %ld: %s"),
fname, lnum, line - 1); fname, lnum, line - 1);
else { else {
char_u *enc; char_u *enc;
@ -3608,12 +3608,12 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
if (STRNCMP(line, "regions=", 8) == 0) { if (STRNCMP(line, "regions=", 8) == 0) {
if (spin->si_region_count > 1) if (spin->si_region_count > 1)
smsg(_("Duplicate /regions= line ignored in %s line %d: %s"), smsg(_("Duplicate /regions= line ignored in %s line %ld: %s"),
fname, lnum, line); fname, lnum, line);
else { else {
line += 8; line += 8;
if (STRLEN(line) > MAXREGIONS * 2) { if (STRLEN(line) > MAXREGIONS * 2) {
smsg(_("Too many regions in %s line %d: %s"), smsg(_("Too many regions in %s line %ld: %s"),
fname, lnum, line); fname, lnum, line);
} else { } else {
spin->si_region_count = (int)STRLEN(line) / 2; spin->si_region_count = (int)STRLEN(line) / 2;
@ -3626,7 +3626,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
continue; continue;
} }
smsg(_("/ line ignored in %s line %d: %s"), smsg(_("/ line ignored in %s line %ld: %s"),
fname, lnum, line - 1); fname, lnum, line - 1);
continue; continue;
} }
@ -3652,13 +3652,13 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
l = *p - '0'; l = *p - '0';
if (l == 0 || l > spin->si_region_count) { if (l == 0 || l > spin->si_region_count) {
smsg(_("Invalid region nr in %s line %d: %s"), smsg(_("Invalid region nr in %s line %ld: %s"),
fname, lnum, p); fname, lnum, p);
break; break;
} }
regionmask |= 1 << (l - 1); regionmask |= 1 << (l - 1);
} else { } else {
smsg(_("Unrecognized flags in %s line %d: %s"), smsg(_("Unrecognized flags in %s line %ld: %s"),
fname, lnum, p); fname, lnum, p);
break; break;
} }
@ -5136,7 +5136,7 @@ mkspell (
} else if (vim_strchr(path_tail(wfname), '_') != NULL) { } else if (vim_strchr(path_tail(wfname), '_') != NULL) {
EMSG(_("E751: Output file name must not have region name")); EMSG(_("E751: Output file name must not have region name"));
} else if (incount > MAXREGIONS) { } else if (incount > MAXREGIONS) {
EMSGN(_("E754: Only up to %ld regions supported"), MAXREGIONS); EMSG2(_("E754: Only up to %d regions supported"), MAXREGIONS);
} else { } else {
// Check for overwriting before doing things that may take a lot of // Check for overwriting before doing things that may take a lot of
// time. // time.

View File

@ -693,6 +693,7 @@ static float_T tv_float(typval_T *const tvs, int *const idxp)
/// ///
/// @see vim_vsnprintf(). /// @see vim_vsnprintf().
int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...) int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
FUNC_ATTR_PRINTF(3, 4)
{ {
const size_t len = strlen(str); const size_t len = strlen(str);
size_t space; size_t space;
@ -718,6 +719,7 @@ int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
/// @return Number of bytes excluding NUL byte that would be written to the /// @return Number of bytes excluding NUL byte that would be written to the
/// string if str_m was greater or equal to the return value. /// string if str_m was greater or equal to the return value.
int vim_snprintf(char *str, size_t str_m, const char *fmt, ...) int vim_snprintf(char *str, size_t str_m, const char *fmt, ...)
FUNC_ATTR_PRINTF(3, 4)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

View File

@ -144,7 +144,7 @@ void terminfo_info_msg(const unibi_term *const ut)
for (enum unibi_numeric i = unibi_numeric_begin_ + 1; for (enum unibi_numeric i = unibi_numeric_begin_ + 1;
i < unibi_numeric_end_; i++) { i < unibi_numeric_end_; i++) {
int n = unibi_get_num(ut, i); // -1 means "empty" int n = unibi_get_num(ut, i); // -1 means "empty"
msg_printf_attr(0, " %-25s %-10s = %hd\n", unibi_name_num(i), msg_printf_attr(0, " %-25s %-10s = %d\n", unibi_name_num(i),
unibi_short_name_num(i), n); unibi_short_name_num(i), n);
} }
@ -173,7 +173,7 @@ void terminfo_info_msg(const unibi_term *const ut)
if (unibi_count_ext_num(ut)) { if (unibi_count_ext_num(ut)) {
msg_puts("Extended numeric capabilities:\n"); msg_puts("Extended numeric capabilities:\n");
for (size_t i = 0; i < unibi_count_ext_num(ut); i++) { for (size_t i = 0; i < unibi_count_ext_num(ut); i++) {
msg_printf_attr(0, " %-25s = %hd\n", msg_printf_attr(0, " %-25s = %d\n",
unibi_get_ext_num_name(ut, i), unibi_get_ext_num_name(ut, i),
unibi_get_ext_num(ut, i)); unibi_get_ext_num(ut, i));
} }

View File

@ -2503,7 +2503,7 @@ void ex_undolist(exarg_T *eap)
while (uhp != NULL) { while (uhp != NULL) {
if (uhp->uh_prev.ptr == NULL && uhp->uh_walk != nomark if (uhp->uh_prev.ptr == NULL && uhp->uh_walk != nomark
&& uhp->uh_walk != mark) { && uhp->uh_walk != mark) {
vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7ld ", vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d ",
uhp->uh_seq, changes); uhp->uh_seq, changes);
u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff),
uhp->uh_time); uhp->uh_time);