vim-patch:8.1.1271: compiler warnings for use of STRNCPY()

Problem:    Compiler warnings for use of STRNCPY(). (John Marriott)
Solution:   Use mch_memmove() instead of STRNCPY().
b3de6c4a76
This commit is contained in:
erw7 2019-05-27 15:57:27 +09:00
parent 777c2a25ce
commit 6cee73195f

View File

@ -1164,9 +1164,9 @@ int do_search(
if (utf_iscomposing(utf_ptr2char(p))) {
// Use a space to draw the composing char on.
msgbuf[1] = ' ';
STRNCPY(msgbuf + 2, p, STRLEN(p));
memmove(msgbuf + 2, p, STRLEN(p));
} else {
STRNCPY(msgbuf + 1, p, STRLEN(p));
memmove(msgbuf + 1, p, STRLEN(p));
}
if (spats[0].off.line || spats[0].off.end || spats[0].off.off) {
p = msgbuf + STRLEN(p) + 1;
@ -4280,7 +4280,7 @@ static void search_stat(int dirc, pos_T *pos, char_u *msgbuf)
vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt);
}
}
STRNCPY(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t));
memmove(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t));
if (dirc == '?' && cur == 100) {
cur = -1;
}