0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.1.0021: clang warns for undefined behavior

Problem:    Clang warns for undefined behavior.
Solution:   Move #ifdef outside of sprintf() call.(suggestion by Michael
            Jarvis, closes #2956)
This commit is contained in:
Bram Moolenaar
2018-05-23 20:30:56 +02:00
parent 0b0f0992d4
commit d315cf551f
2 changed files with 9 additions and 6 deletions

View File

@@ -2872,14 +2872,15 @@ term_color(char_u *s, int n)
#else
char *format = "%s%s%%dm";
#endif
sprintf(buf, format,
i == 2 ?
char *lead = i == 2 ? (
#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
s[1] == '|' ? IF_EB("\033|", ESC_STR "|") :
#endif
IF_EB("\033[", ESC_STR "[") : "\233",
s[i] == '3' ? (n >= 16 ? "38;5;" : "9")
: (n >= 16 ? "48;5;" : "10"));
IF_EB("\033[", ESC_STR "[")) : "\233";
char *tail = s[i] == '3' ? (n >= 16 ? "38;5;" : "9")
: (n >= 16 ? "48;5;" : "10");
sprintf(buf, format, lead, tail);
OUT_STR(tgoto(buf, 0, n >= 16 ? n : n - 8));
}
else

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
21,
/**/
20,
/**/