diff options
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index b18459a2b5..d5907da2ed 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// mbyte.c: Code specifically for handling multi-byte characters. /// Multibyte extensions partly by Sung-Hoon Baek /// @@ -356,10 +359,10 @@ int bomb_size(void) */ void remove_bom(char_u *s) { - char_u *p = s; + char *p = (char *)s; - while ((p = vim_strbyte(p, 0xef)) != NULL) { - if (p[1] == 0xbb && p[2] == 0xbf) { + while ((p = strchr(p, 0xef)) != NULL) { + if ((uint8_t)p[1] == 0xbb && (uint8_t)p[2] == 0xbf) { STRMOVE(p, p + 3); } else { p++; @@ -1364,7 +1367,7 @@ int utf16_to_utf8(const WCHAR *strw, char **str) return GetLastError(); } - *str = xmalloc(utf8_len); + *str = xmallocz(utf8_len); // Convert to UTF-8. utf8_len = WideCharToMultiByte(CP_UTF8, |