From c2c9452cdd6f50923c02d59c68087add8d17f03a Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 30 Jun 2021 11:53:50 -0700 Subject: Fix notable warnings (from gcc) --- core/src/UI/UI_Items.cpp | 4 ---- core/src/UI/UI_Templates.cpp | 13 +++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'core/src/UI') diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp index 2685c82..5b84cb8 100644 --- a/core/src/UI/UI_Items.cpp +++ b/core/src/UI/UI_Items.cpp @@ -32,8 +32,6 @@ ActionResult ItemEditor(ItemList& list, T* item) t.GetEmail(); }; - auto& gs = GlobalStates::GetInstance(); - static bool duplicateName = false; static std::string name; @@ -116,8 +114,6 @@ void ItemListEntries(ItemList& list, int& selectedIdx) }; constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail + kHasStock + kHasPrice; - auto& gs = GlobalStates::GetInstance(); - if (ImGui::BeginTable("", kColumns, ImGuiTableFlags_Borders)) { ImGui::TableSetupColumn(I18N_TEXT("Name", L10N_ITEM_COLUMN_NAME)); diff --git a/core/src/UI/UI_Templates.cpp b/core/src/UI/UI_Templates.cpp index b4e3aa5..0320ea0 100644 --- a/core/src/UI/UI_Templates.cpp +++ b/core/src/UI/UI_Templates.cpp @@ -194,7 +194,6 @@ private: if (!IsSelected()) { ImGui::Text(I18N_TEXT("Select a cell to edit", L10N_TABLE_CELL_SELECT_MSG)); } else if (mSelectionTL == mSelectionBR) { - auto& selectCell = mTable->GetCell(mSelectionTL); DisplayCellProperties(mSelectionTL); } else { DisplayRangeProperties(mSelectionTL, mSelectionBR); @@ -260,9 +259,9 @@ private: int dividend = column; int modulo; - char* lastChar = bufferEnd - 1; - *lastChar = '\0'; - char* writeHead = lastChar - 1; + char* writeHead = bufferEnd - 1; + *writeHead = '\0'; + --writeHead; while (dividend > 0) { if (writeHead < bufferBegin) { @@ -730,17 +729,19 @@ std::unique_ptr TemplateUI::CreateByKind(Template::Kind kind, std::u #define UNIQUE_CAST(TargetType, input) std::unique_ptr(static_cast(input.release())) switch (kind) { case Template::KD_Table: return std::make_unique(UNIQUE_CAST(TableTemplate, tmpl)); - case Template::InvalidKind: return nullptr; + case Template::InvalidKind: break; } #pragma pop_macro("UNIQUE_CAST") + return nullptr; } std::unique_ptr TemplateUI::CreateByKind(Template::Kind kind) { switch (kind) { case Template::KD_Table: return std::make_unique(std::make_unique()); - case Template::InvalidKind: return nullptr; + case Template::InvalidKind: break; } + return nullptr; } } // namespace -- cgit v1.2.3-70-g09d2