From d6373aa6758d485c777700e3aab26061de838eb0 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Mon, 22 Jan 2024 10:19:28 -0500 Subject: [PATCH] Start fixing some of the gcc 12 warnings --- src/CurlManager.cpp | 3 ++- src/channeloutput/PixelString.cpp | 5 +++-- src/common.cpp | 4 ++-- src/oled/FPPMainMenu.cpp | 12 ++++++------ src/oled/NetworkOLEDPage.cpp | 2 +- src/scripts.cpp | 4 ++-- src/settings.cpp | 4 ++-- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/CurlManager.cpp b/src/CurlManager.cpp index af3de29ab..5e53d4ca4 100644 --- a/src/CurlManager.cpp +++ b/src/CurlManager.cpp @@ -262,7 +262,8 @@ std::string CurlManager::doPut(const std::string& furl, const std::string& conte std::string cl = "Content-Length: " + std::to_string(data.size()); head = curl_slist_append(head, cl.c_str()); - curl_easy_setopt(curl, CURLOPT_PUT, 1L); + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + //curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, head); ReadDataInfo dta; diff --git a/src/channeloutput/PixelString.cpp b/src/channeloutput/PixelString.cpp index 2418af148..84a3a3a48 100644 --- a/src/channeloutput/PixelString.cpp +++ b/src/channeloutput/PixelString.cpp @@ -620,7 +620,8 @@ void PixelString::AutoCreateOverlayModels(const std::vector& strin desc = "String-" + std::to_string(s + 1); if (strings[s]->m_virtualStrings.size() > 1) { desc.append(1, vsnum); - desc += "-" + std::to_string(vsidx + 1); + desc += std::string("-"); + desc += std::to_string(vsidx + 1); if (strings[s]->m_virtualStrings[vs].receiverNum == -1) { vsidx++; } else if (vs != 0) { @@ -675,7 +676,7 @@ void PixelString::AutoCreateOverlayModels(const std::vector& strin if (name.find("Tree") != std::string::npos || name.find("TREE") != std::string::npos || name.find("tree") != std::string::npos || name.find("Vert") != std::string::npos || name.find("vert") != std::string::npos) { // some common names that are usually vertical oriented - orientation = "V"; + orientation = std::string("V"); } if ((channelCount > 0) && (rn == -1)) { diff --git a/src/common.cpp b/src/common.cpp index 661b8c419..c4287acc1 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -886,9 +886,9 @@ std::string ReplaceKeywords(std::string str, std::map& std::string key; for (auto& k : keywords) { - key = "%"; + key = std::string("%"); key += k.first; - key += "%"; + key += std::string("%"); ReplaceString(str, key, k.second); } diff --git a/src/oled/FPPMainMenu.cpp b/src/oled/FPPMainMenu.cpp index c9aa86c48..df519238b 100644 --- a/src/oled/FPPMainMenu.cpp +++ b/src/oled/FPPMainMenu.cpp @@ -116,7 +116,7 @@ class BridgeStatsPage : public ListOLEDPage { Json::Value result; if (LoadJsonFromString(d, result)) { items.clear(); - items.push_back("Univ Pckts Err"); + items.emplace_back("Univ Pckts Err"); for (int x = 0; x < result["universes"].size(); x++) { Json::Value u = result["universes"][x]; std::string l = u["id"].asString(); @@ -345,16 +345,16 @@ void FPPMainMenu::itemSelected(const std::string& item) { std::string nvresults; std::string nv = "http://127.0.0.1/api/settings/EnableTethering"; if (nitem == "Automatic") { - nvdata = "0"; + nvdata = std::string("0"); } else if (nitem == "On") { - nvdata = "1"; + nvdata = std::string("1"); } else if (nitem == "Off") { - nvdata = "2"; + nvdata = std::string("2"); } else { - nvdata = "0"; + nvdata = std::string("0"); } urlPut(nv, nvdata, nvresults); - nvdata = "1"; + nvdata = std::string("1"); urlPut("http://127.0.0.1/api/settings/rebootFlag", "1", nvresults); RebootPromptPage* pg = new RebootPromptPage("Reboot Required", "Reboot FPPD?", this); diff --git a/src/oled/NetworkOLEDPage.cpp b/src/oled/NetworkOLEDPage.cpp index db302148d..51ea3295a 100644 --- a/src/oled/NetworkOLEDPage.cpp +++ b/src/oled/NetworkOLEDPage.cpp @@ -219,7 +219,7 @@ void FPPNetworkOLEDPage::setParameterIP(const std::string& tp, const std::string v = v.substr(1); } if (v.empty()) { - v = "0"; + v = std::string("0"); } } if (x < 3) { diff --git a/src/scripts.cpp b/src/scripts.cpp index bf4c81c0e..67f40b1d6 100644 --- a/src/scripts.cpp +++ b/src/scripts.cpp @@ -76,11 +76,11 @@ pid_t RunScript(std::string script, std::string scriptArgs, std::vector