mirror of
https://github.com/neovim/neovim.git
synced 2025-12-06 22:52:42 +00:00
message: Fix PVS/V547: c is never equal to KS_ZERO
Since `c` there is a result of evaluating `TO_SPECIAL` macros it may be only one
of the following three things:
1. K_SPECIAL
2. K_ZERO (note: not KS_ZERO)
3. negative integer resulting from evaluating TERMCAP2KEY macro.
All variants here are negative and thus fail next !IS_SPECIAL(c) check (negative
is special). If `c` was really NUL it would fall into the `!IS_SPECIAL(c)` block
and use whatever character is third in `<80>{a}{b}` combo. For `<Nul>` it is
X (`<80><ff>X`).
This commit is contained in:
@@ -1382,9 +1382,6 @@ const char *str2special(const char **const sp, const bool replace_spaces,
|
|||||||
if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL) {
|
if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL) {
|
||||||
c = TO_SPECIAL((uint8_t)str[1], (uint8_t)str[2]);
|
c = TO_SPECIAL((uint8_t)str[1], (uint8_t)str[2]);
|
||||||
str += 2;
|
str += 2;
|
||||||
if (c == KS_ZERO) { // display <Nul> as ^@ or <Nul>
|
|
||||||
c = NUL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (IS_SPECIAL(c) || modifiers) { // Special key.
|
if (IS_SPECIAL(c) || modifiers) { // Special key.
|
||||||
special = true;
|
special = true;
|
||||||
@@ -1415,7 +1412,7 @@ const char *str2special(const char **const sp, const bool replace_spaces,
|
|||||||
|| (replace_lt && c == '<')) {
|
|| (replace_lt && c == '<')) {
|
||||||
return (const char *)get_special_key_name(c, modifiers);
|
return (const char *)get_special_key_name(c, modifiers);
|
||||||
}
|
}
|
||||||
buf[0] = c;
|
buf[0] = (char)c;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user