From 4ca4e0744c13d86ddaed1c6cc7a59d4e110fb9ac Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 12 Oct 2023 09:40:20 -0500 Subject: [PATCH] Fix some more invalid c_str usage --- src/port/ui/UIWidgets.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/port/ui/UIWidgets.cpp b/src/port/ui/UIWidgets.cpp index 384b14bf..dea9ffc5 100644 --- a/src/port/ui/UIWidgets.cpp +++ b/src/port/ui/UIWidgets.cpp @@ -10,7 +10,6 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include #include -#include "Utils/StringHelper.h" #include namespace UIWidgets { @@ -709,8 +708,8 @@ namespace UIWidgets { ImGui::PushID(label); bool dirty = false; float startX = ImGui::GetCursorPosX(); - auto format = StringHelper::Sprintf("##%s", label); - const char* invisibleLabel = format.c_str(); + std::string invisibleLabelStr = "##" + std::string(label); + const char* invisibleLabel = invisibleLabelStr.c_str(); ImGui::BeginDisabled(options.disabled); PushStyleCheckbox(options.color); if (options.alignment == ComponentAlignment::Right) { @@ -792,7 +791,8 @@ namespace UIWidgets { bool Combobox(const char* label, uint8_t* value, std::span comboArray, const ComboboxOptions& options) { bool dirty = false; float startX = ImGui::GetCursorPosX(); - const char* invisibleLabel = ("##" + std::string(label)).c_str(); + std::string invisibleLabelStr = "##" + std::string(label); + const char* invisibleLabel = invisibleLabelStr.c_str(); ImGui::PushID(label); ImGui::BeginGroup(); ImGui::BeginDisabled(options.disabled); @@ -891,7 +891,8 @@ namespace UIWidgets { bool CVarSliderInt(const char* label, const char* cvarName, int32_t min, int32_t max, const int32_t defaultValue, const SliderOptions& options){ bool dirty = false; - const char* invisibleLabel = ("##" + std::string(label)).c_str(); + std::string invisibleLabelStr = "##" + std::string(label); + const char* invisibleLabel = invisibleLabelStr.c_str(); int32_t value = CVarGetInteger(cvarName, defaultValue); ImGui::PushID(label); ImGui::BeginGroup();