From 344c8c6457457491a357fcba168df67c2f1ad668 Mon Sep 17 00:00:00 2001 From: Seth Troisi Date: Sun, 13 Feb 2022 00:30:56 -0800 Subject: [PATCH] --Code Change -Fix compiler warnings in XmlToEmber --- Builds/QtCreator/defaults.pri | 5 ++++- Source/Ember/EmberToXml.cpp | 4 +--- Source/Ember/PaletteList.cpp | 2 +- Source/Ember/Spline.cpp | 2 +- Source/Ember/Variations05.h | 2 +- Source/Ember/Xform.h | 6 ++---- Source/Ember/XmlToEmber.cpp | 26 ++++++++++---------------- Source/EmberCommon/EmberCommon.h | 2 +- Source/EmberCommon/EmberOptions.h | 1 - Source/Fractorium/FractoriumMenus.cpp | 2 +- 10 files changed, 22 insertions(+), 30 deletions(-) diff --git a/Builds/QtCreator/defaults.pri b/Builds/QtCreator/defaults.pri index 038feec..567c789 100644 --- a/Builds/QtCreator/defaults.pri +++ b/Builds/QtCreator/defaults.pri @@ -198,7 +198,10 @@ win32 { QMAKE_CXXFLAGS += -Wmain QMAKE_CXXFLAGS += -Wfatal-errors QMAKE_CXXFLAGS += -Wall -fpermissive - QMAKE_CXXFLAGS += -Wold-style-cast + + # CL has lots of old-style-cast which clogs up warning logs + #QMAKE_CXXFLAGS += -Wold-style-cast + QMAKE_CXXFLAGS += -Wno-unused-parameter QMAKE_CXXFLAGS += -Wno-unused-function QMAKE_CXXFLAGS += -Wold-style-cast diff --git a/Source/Ember/EmberToXml.cpp b/Source/Ember/EmberToXml.cpp index 977a1c4..55d2b2f 100644 --- a/Source/Ember/EmberToXml.cpp +++ b/Source/Ember/EmberToXml.cpp @@ -53,8 +53,6 @@ bool EmberToXml::Save(const string& filename, C, Alloc>& embers, siz if (f.is_open()) { - const auto prev = embers.begin(); - //Always ensure times make sense. for (auto& ember : embers) ember.m_Time = t++; @@ -922,4 +920,4 @@ EXPORT_EMBER_TO_XML(float) #ifdef DO_DOUBLE EXPORT_EMBER_TO_XML(double) #endif -} \ No newline at end of file +} diff --git a/Source/Ember/PaletteList.cpp b/Source/Ember/PaletteList.cpp index 74bff99..b7182d8 100644 --- a/Source/Ember/PaletteList.cpp +++ b/Source/Ember/PaletteList.cpp @@ -36,7 +36,7 @@ bool PaletteList::AddPaletteFile(const string& filename, const vector Spline::Interpolate(const std::vector& newX) { std::vector output; output.resize(newX.size()); - for (int i = 0; i < newX.size(); i++) + for (size_t i = 0; i < newX.size(); i++) output[i] = Interpolate(newX[i]); return output; diff --git a/Source/Ember/Variations05.h b/Source/Ember/Variations05.h index 2f3cf80..30fe274 100644 --- a/Source/Ember/Variations05.h +++ b/Source/Ember/Variations05.h @@ -3608,7 +3608,6 @@ public: } T tempx, tempy; - T boost = 1;//Boost is the separation distance between the two planes. T sumX, sumY; if (m_VarType == eVariationType::VARTYPE_REG) @@ -3629,6 +3628,7 @@ public: //Creating Z factors relative to the planes. These will be added, whereas x and y will be assigned. //Original does += z *, so using z on the right side of = is intentional. if (m_MajPlane == 2) + //Boost is the separation distance between the two planes. helper.Out.z = helper.In.z * T(0.5) * m_ZLift + (posNeg * m_Boost); else helper.Out.z = helper.In.z * T(0.5) * m_ZLift; diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h index d5401e7..7af3bee 100644 --- a/Source/Ember/Xform.h +++ b/Source/Ember/Xform.h @@ -490,7 +490,6 @@ public: /// The variation if found, else nullptr. Variation* RemoveVariationById(eVariationId id) { - bool found = false; Variation* var = nullptr; AllVarsFunc([&](vector*>& variations, bool & keepGoing) { @@ -736,9 +735,8 @@ public: else { //There are no variations, so the affine transformed points can be assigned directly to the output points. - T inX = inPoint->m_X; - outPoint->m_X = 0;//(m_Affine.A() * inX) + (m_Affine.B() * inPoint->m_Y) + m_Affine.C(); - outPoint->m_Y = 0;//(m_Affine.D() * inX) + (m_Affine.E() * inPoint->m_Y) + m_Affine.F(); + outPoint->m_X = 0;//(m_Affine.A() * inPoint->m_X) + (m_Affine.B() * inPoint->m_Y) + m_Affine.C(); + outPoint->m_Y = 0;//(m_Affine.D() * inPoint->m_X) + (m_Affine.E() * inPoint->m_Y) + m_Affine.F(); outPoint->m_Z = 0;//inPoint->m_Z; } diff --git a/Source/Ember/XmlToEmber.cpp b/Source/Ember/XmlToEmber.cpp index 46b8d46..1bbdb3e 100644 --- a/Source/Ember/XmlToEmber.cpp +++ b/Source/Ember/XmlToEmber.cpp @@ -682,7 +682,7 @@ static const char* CheckNameVal(xmlNode* node, const char* name) } return nullptr; -}; +} /// /// Helper function to verify that the name of a node @@ -697,7 +697,7 @@ static xmlNode* CheckNodeName(xmlNode* node, const char* name) return node; return nullptr; -}; +} /// /// Helper function to get the value of the name field of a node. @@ -713,7 +713,7 @@ static const char* GetNameVal(xmlNode* node, const char* name = "name") return CCX(attStr); return nullptr; -}; +} /// /// Helper function to get the child of a node based on the value of its name field. @@ -729,7 +729,7 @@ static xmlNode* GetChildNode(xmlNode* node, const char* name) return childNode; return nullptr; -}; +} /// /// Helper function to get the child of a node based on the name of the child node. @@ -745,7 +745,7 @@ static xmlNode* GetChildNodeByNodeName(xmlNode* node, const char* name) return node; return nullptr; -}; +} /// /// Helper function to parse the content of a field of a node and convert the string into a value of type T and store in the passed in val parameter. @@ -849,7 +849,6 @@ void XmlToEmber::ScanForChaosNodes(xmlNode* curNode, const char* parentFile, currentEmber.m_Name = embername; const auto childNode = thisNode; - bool ret = true; parseEmberSuccess = ParseEmberElementFromChaos(childNode, currentEmber); if (!parseEmberSuccess) @@ -888,10 +887,7 @@ void XmlToEmber::ScanForChaosNodes(xmlNode* curNode, const char* parentFile, template bool XmlToEmber::ParseEmberElementFromChaos(xmlNode* emberNode, Ember& currentEmber) { - bool fromEmber = false, ret = true; const char* loc = __FUNCTION__; - int soloXform = -1; - size_t count = 0, index = 0; T sensorWidth = 2; xmlAttrPtr att; currentEmber.m_Palette.Clear();//Wipe out the current palette. @@ -918,7 +914,6 @@ bool XmlToEmber::ParseEmberElementFromChaos(xmlNode* emberNode, Ember& cur if (!varname.empty()) { - const T weight = 1; const auto corrvarname = GetCorrectedVariationName(m_BadVariationNames, varname); const auto corrwprefix = !StartsWith(corrvarname, prefix) ? prefix + corrvarname : corrvarname; @@ -1264,7 +1259,6 @@ bool XmlToEmber::ParseEmberElementFromChaos(xmlNode* emberNode, Ember& cur if (const auto curvesnode = GetChildNodeByNodeName(childNode, "curves")) { - T val = 0; auto curvenodesfunc = [&](xmlNode * node, int index) { float x, y; @@ -1289,15 +1283,15 @@ bool XmlToEmber::ParseEmberElementFromChaos(xmlNode* emberNode, Ember& cur { bool haveknots = false, havevals = false; - for (auto childNode = node->children; childNode; childNode = childNode->next) + for (auto innerChildNode = node->children; innerChildNode; innerChildNode = innerChildNode->next) { - if (childNode->type == XML_ELEMENT_NODE) + if (innerChildNode->type == XML_ELEMENT_NODE) { - if (const auto node = CheckNodeName(childNode, "table")) + if (const auto innernode = CheckNodeName(innerChildNode, "table")) { if (!haveknots) { - if (const auto knotvalsnode = GetChildNodeByNodeName(node, "values")) + if (const auto knotvalsnode = GetChildNodeByNodeName(innernode, "values")) { if (knotvalsnode->children) { @@ -1310,7 +1304,7 @@ bool XmlToEmber::ParseEmberElementFromChaos(xmlNode* emberNode, Ember& cur } else if (!havevals) { - if (const auto valvalsnode = GetChildNodeByNodeName(node, "values")) + if (const auto valvalsnode = GetChildNodeByNodeName(innernode, "values")) { if (valvalsnode->children) { diff --git a/Source/EmberCommon/EmberCommon.h b/Source/EmberCommon/EmberCommon.h index c58bad6..21a4a2b 100644 --- a/Source/EmberCommon/EmberCommon.h +++ b/Source/EmberCommon/EmberCommon.h @@ -137,7 +137,7 @@ static string GetExePath(const char* argv0) cerr << "Could not discern full path from executable.\n"; #else - auto fullsize = readlink("/proc/self/exe", v.data(), v.size()); + readlink("/proc/self/exe", v.data(), v.size()); fullpath = string(v.data()); #endif #endif diff --git a/Source/EmberCommon/EmberOptions.h b/Source/EmberCommon/EmberOptions.h index 3db1fae..40e2ca3 100644 --- a/Source/EmberCommon/EmberOptions.h +++ b/Source/EmberCommon/EmberOptions.h @@ -250,7 +250,6 @@ struct NoDelimiters : std::ctype static std::ctype_base::mask const* GetTable() { typedef std::ctype cctype; - static const cctype::mask* const_rc = cctype::classic_table(); static cctype::mask rc[cctype::table_size]; std::memset(rc, 0, cctype::table_size * sizeof(cctype::mask)); return &rc[0]; diff --git a/Source/Fractorium/FractoriumMenus.cpp b/Source/Fractorium/FractoriumMenus.cpp index fc43da9..cb91efa 100644 --- a/Source/Fractorium/FractoriumMenus.cpp +++ b/Source/Fractorium/FractoriumMenus.cpp @@ -185,7 +185,6 @@ template void FractoriumEmberController::CreateReferenceFile() { bool nv = false; - size_t i; StopAllPreviewRenderers(); auto temppal = m_Ember.m_Palette; m_EmberFile.Clear(); @@ -258,6 +257,7 @@ void FractoriumEmberController::CreateReferenceFile() m_EmberFile.m_Embers.push_back(ember); }; + size_t i; for (i = 0; i < count; i++) { addsquaresfunc(i, regVars[i]);