From 3b32e717d91934f2906c99269949efa9d88e82c8 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 15 Apr 2018 21:32:26 +0300 Subject: 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 `` it is X (`<80>X`). --- src/nvim/message.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/nvim/message.c b/src/nvim/message.c index 04528629c7..abe21193d6 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -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) { c = TO_SPECIAL((uint8_t)str[1], (uint8_t)str[2]); str += 2; - if (c == KS_ZERO) { // display as ^@ or - c = NUL; - } } if (IS_SPECIAL(c) || modifiers) { // Special key. special = true; @@ -1415,7 +1412,7 @@ const char *str2special(const char **const sp, const bool replace_spaces, || (replace_lt && c == '<')) { return (const char *)get_special_key_name(c, modifiers); } - buf[0] = c; + buf[0] = (char)c; buf[1] = NUL; return buf; } -- cgit