Patch 8.1.0021
Problem: Clang warns for undefined behavior.
Solution: Move #ifdef outside of sprintf() call.(suggestion by Michael
Jarvis, closes #2956)
Files: src/term.c
*** ../vim-8.1.0020/src/term.c 2018-05-10 14:39:42.000000000 +0200
--- src/term.c 2018-05-23 20:26:41.770633594 +0200
***************
*** 2872,2885 ****
#else
char *format = "%s%s%%dm";
#endif
! sprintf(buf, format,
! 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"));
OUT_STR(tgoto(buf, 0, n >= 16 ? n : n - 8));
}
else
--- 2872,2886 ----
#else
char *format = "%s%s%%dm";
#endif
! 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";
! 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
*** ../vim-8.1.0020/src/version.c 2018-05-22 20:35:13.566009271 +0200
--- src/version.c 2018-05-23 20:30:12.982576453 +0200
***************
*** 763,764 ****
--- 763,766 ----
{ /* Add new patch number below this line */
+ /**/
+ 21,
/**/
--
BEDEVERE: And what do you burn, apart from witches?
FOURTH VILLAGER: ... Wood?
BEDEVERE: So why do witches burn?
SECOND VILLAGER: (pianissimo) ... Because they're made of wood...?
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.