mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-18 09:14:47 +01:00
Various minor fixes following a pass of cppcheck static analyzer
This commit is contained in:
parent
3aa4a108ed
commit
4e3c6f64c0
@ -79,7 +79,6 @@ bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_b
|
|||||||
if (use_base85_encoding)
|
if (use_base85_encoding)
|
||||||
{
|
{
|
||||||
fprintf(out, "static const char %s_%sdata_base85[%d+1] =\n \"", symbol, compressed_str, (int)((compressed_sz+3)/4)*5);
|
fprintf(out, "static const char %s_%sdata_base85[%d+1] =\n \"", symbol, compressed_str, (int)((compressed_sz+3)/4)*5);
|
||||||
int column = 0;
|
|
||||||
for (int i = 0; i < compressed_sz; i += 4)
|
for (int i = 0; i < compressed_sz; i += 4)
|
||||||
{
|
{
|
||||||
unsigned int d = *(unsigned int*)(compressed + i);
|
unsigned int d = *(unsigned int*)(compressed + i);
|
||||||
|
@ -774,7 +774,7 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|||||||
const int wchars_buf_len = sizeof(ImGuiIO::InputCharacters) / sizeof(ImWchar);
|
const int wchars_buf_len = sizeof(ImGuiIO::InputCharacters) / sizeof(ImWchar);
|
||||||
ImWchar wchars[wchars_buf_len];
|
ImWchar wchars[wchars_buf_len];
|
||||||
ImTextStrFromUtf8(wchars, wchars_buf_len, utf8_chars, NULL);
|
ImTextStrFromUtf8(wchars, wchars_buf_len, utf8_chars, NULL);
|
||||||
for (int i = 0; wchars[i] != 0 && i < wchars_buf_len; i++)
|
for (int i = 0; i < wchars_buf_len && wchars[i] != 0; i++)
|
||||||
AddInputCharacter(wchars[i]);
|
AddInputCharacter(wchars[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7323,7 +7323,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool value_changed = false;
|
bool value_changed = false;
|
||||||
bool cancel_edit = false;
|
|
||||||
bool enter_pressed = false;
|
bool enter_pressed = false;
|
||||||
|
|
||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id)
|
||||||
@ -7388,6 +7387,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle various key-presses
|
// Handle various key-presses
|
||||||
|
bool cancel_edit = false;
|
||||||
const int k_mask = (is_shift_down ? STB_TEXTEDIT_K_SHIFT : 0);
|
const int k_mask = (is_shift_down ? STB_TEXTEDIT_K_SHIFT : 0);
|
||||||
const bool is_ctrl_only = is_ctrl_down && !is_alt_down && !is_shift_down;
|
const bool is_ctrl_only = is_ctrl_down && !is_alt_down && !is_shift_down;
|
||||||
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed(is_ctrl_down ? STB_TEXTEDIT_K_WORDLEFT | k_mask : STB_TEXTEDIT_K_LEFT | k_mask); }
|
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed(is_ctrl_down ? STB_TEXTEDIT_K_WORDLEFT | k_mask : STB_TEXTEDIT_K_LEFT | k_mask); }
|
||||||
|
@ -462,6 +462,7 @@ struct ImGuiState
|
|||||||
SetNextWindowCollapsedVal = false;
|
SetNextWindowCollapsedVal = false;
|
||||||
SetNextWindowPosCond = 0;
|
SetNextWindowPosCond = 0;
|
||||||
SetNextWindowSizeCond = 0;
|
SetNextWindowSizeCond = 0;
|
||||||
|
SetNextWindowContentSizeCond = 0;
|
||||||
SetNextWindowCollapsedCond = 0;
|
SetNextWindowCollapsedCond = 0;
|
||||||
SetNextWindowFocus = false;
|
SetNextWindowFocus = false;
|
||||||
SetNextTreeNodeOpenedVal = false;
|
SetNextTreeNodeOpenedVal = false;
|
||||||
@ -482,6 +483,7 @@ struct ImGuiState
|
|||||||
ModalWindowDarkeningRatio = 0.0f;
|
ModalWindowDarkeningRatio = 0.0f;
|
||||||
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
|
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
|
||||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||||
|
memset(MouseCursorData, 0, sizeof(MouseCursorData));
|
||||||
|
|
||||||
LogEnabled = false;
|
LogEnabled = false;
|
||||||
LogFile = NULL;
|
LogFile = NULL;
|
||||||
@ -493,6 +495,7 @@ struct ImGuiState
|
|||||||
FramerateSecPerFrameIdx = 0;
|
FramerateSecPerFrameIdx = 0;
|
||||||
FramerateSecPerFrameAccum = 0.0f;
|
FramerateSecPerFrameAccum = 0.0f;
|
||||||
CaptureMouseNextFrame = CaptureKeyboardNextFrame = false;
|
CaptureMouseNextFrame = CaptureKeyboardNextFrame = false;
|
||||||
|
memset(TempBuffer, 0, sizeof(TempBuffer));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user