From 2c3b603b8842dfa9289eb16f77870962e24fa929 Mon Sep 17 00:00:00 2001 From: Christopher Hewitt Date: Tue, 25 Jan 2022 14:02:52 -0700 Subject: [PATCH] Satisfy GCC -Wformat-security with string literals --- core/src/gui/menus/module_manager.cpp | 8 ++++---- core/src/gui/menus/vfo_color.cpp | 4 ++-- core/src/gui/style.cpp | 4 ++-- core/src/gui/widgets/waterfall.cpp | 2 +- decoder_modules/m17_decoder/src/main.cpp | 6 +++--- misc_modules/frequency_manager/src/main.cpp | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/src/gui/menus/module_manager.cpp b/core/src/gui/menus/module_manager.cpp index f750d750..4a4f7dae 100644 --- a/core/src/gui/menus/module_manager.cpp +++ b/core/src/gui/menus/module_manager.cpp @@ -43,10 +43,10 @@ namespace module_manager_menu { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - ImGui::Text(name.c_str()); + ImGui::Text("%s", name.c_str()); ImGui::TableSetColumnIndex(1); - ImGui::Text(inst.module.info->name); + ImGui::Text("%s", inst.module.info->name); ImGui::TableSetColumnIndex(2); ImVec2 origPos = ImGui::GetCursorPos(); @@ -69,7 +69,7 @@ namespace module_manager_menu { } ImGui::GenericDialog("module_mgr_error_", errorOpen, GENERIC_DIALOG_BUTTONS_OK, []() { - ImGui::Text(errorMessage.c_str()); + ImGui::Text("%s", errorMessage.c_str()); }); // Add module row with slightly different settings @@ -114,4 +114,4 @@ namespace module_manager_menu { core::configManager.release(true); } } -} \ No newline at end of file +} diff --git a/core/src/gui/menus/vfo_color.cpp b/core/src/gui/menus/vfo_color.cpp index 00afe8c1..24bf2339 100644 --- a/core/src/gui/menus/vfo_color.cpp +++ b/core/src/gui/menus/vfo_color.cpp @@ -129,8 +129,8 @@ namespace vfo_color_menu { core::configManager.release(true); } ImGui::SameLine(); - ImGui::Text(name.c_str()); + ImGui::Text("%s", name.c_str()); } ImGui::EndTable(); } -} \ No newline at end of file +} diff --git a/core/src/gui/style.cpp b/core/src/gui/style.cpp index 407cfa0c..fd033192 100644 --- a/core/src/gui/style.cpp +++ b/core/src/gui/style.cpp @@ -49,7 +49,7 @@ namespace ImGui { void LeftLabel(const char* text) { float vpos = ImGui::GetCursorPosY(); ImGui::SetCursorPosY(vpos + GImGui->Style.FramePadding.y); - ImGui::Text(text); + ImGui::Text("%s", text); ImGui::SameLine(); ImGui::SetCursorPosY(vpos); } @@ -57,4 +57,4 @@ namespace ImGui { void FillWidth() { ImGui::SetNextItemWidth(ImGui::GetContentRegionAvailWidth()); } -} \ No newline at end of file +} diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index 5e95c899..3bd884e7 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -433,7 +433,7 @@ namespace ImGui { char buf[128]; ImGui::BeginTooltip(); - ImGui::Text(name.c_str()); + ImGui::Text("%s", name.c_str()); if (ImGui::IsKeyDown(GLFW_KEY_LEFT_CONTROL) || ImGui::IsKeyDown(GLFW_KEY_RIGHT_CONTROL)) { ImGui::Separator(); diff --git a/decoder_modules/m17_decoder/src/main.cpp b/decoder_modules/m17_decoder/src/main.cpp index c95a598a..4eef152c 100644 --- a/decoder_modules/m17_decoder/src/main.cpp +++ b/decoder_modules/m17_decoder/src/main.cpp @@ -193,19 +193,19 @@ private: ImGui::TableSetColumnIndex(0); ImGui::Text("Source"); ImGui::TableSetColumnIndex(1); - ImGui::Text(_this->lsf.src.c_str()); + ImGui::Text("%s", _this->lsf.src.c_str()); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("Destination"); ImGui::TableSetColumnIndex(1); - ImGui::Text(_this->lsf.dst.c_str()); + ImGui::Text("%s", _this->lsf.dst.c_str()); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("Data Type"); ImGui::TableSetColumnIndex(1); - ImGui::Text(M17DataTypesTxt[_this->lsf.dataType]); + ImGui::Text("%s", M17DataTypesTxt[_this->lsf.dataType]); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); diff --git a/misc_modules/frequency_manager/src/main.cpp b/misc_modules/frequency_manager/src/main.cpp index a793c447..aa04462f 100644 --- a/misc_modules/frequency_manager/src/main.cpp +++ b/misc_modules/frequency_manager/src/main.cpp @@ -738,7 +738,7 @@ private: } ImGui::BeginTooltip(); - ImGui::Text(hoveredBookmarkName.c_str()); + ImGui::Text("%s", hoveredBookmarkName.c_str()); ImGui::Separator(); ImGui::Text("List: %s", hoveredBookmark.listName.c_str()); ImGui::Text("Frequency: %s", utils::formatFreq(hoveredBookmark.bookmark.frequency).c_str()); @@ -863,4 +863,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) { MOD_EXPORT void _END_() { config.disableAutoSave(); config.save(); -} \ No newline at end of file +}