mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 20:48:46 +02:00
Fixes zealous MSVC static analyzers warnings (#3938)
Other unfixed as I'm not happy with caving to false positives of every analyzers.
This commit is contained in:
11
imgui.cpp
11
imgui.cpp
@ -1133,11 +1133,18 @@ void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c)
|
||||
if (InputQueueSurrogate != 0)
|
||||
{
|
||||
if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate
|
||||
{
|
||||
InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
|
||||
else if (IM_UNICODE_CODEPOINT_MAX == (0xFFFF)) // Codepoint will not fit in ImWchar (extra parenthesis around 0xFFFF somehow fixes -Wunreachable-code with Clang)
|
||||
cp = IM_UNICODE_CODEPOINT_INVALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if IM_UNICODE_CODEPOINT_MAX == 0xFFFF
|
||||
cp = IM_UNICODE_CODEPOINT_INVALID; // Codepoint will not fit in ImWchar
|
||||
#else
|
||||
cp = (ImWchar)(((InputQueueSurrogate - 0xD800) << 10) + (c - 0xDC00) + 0x10000);
|
||||
#endif
|
||||
}
|
||||
|
||||
InputQueueSurrogate = 0;
|
||||
}
|
||||
InputQueueCharacters.push_back(cp);
|
||||
|
Reference in New Issue
Block a user