From 15899f42a907d3a2a5519f37d4783af42168adb4 2017-11-21 13:58:45 From: Alexandre Leroux Date: 2017-11-21 13:58:45 Subject: [PATCH] Removes compilation warnings (with Meson) --- diff --git a/core/include/Common/SortUtils.h b/core/include/Common/SortUtils.h index f0fda7b..f042284 100644 --- a/core/include/Common/SortUtils.h +++ b/core/include/Common/SortUtils.h @@ -74,7 +74,7 @@ struct SortUtils { auto sortedData = Container{}; sortedData.reserve(containerSize); - for (auto i = 0, componentIndex = 0, permutationIndex = 0; i < containerSize; + for (auto i = 0u, componentIndex = 0u, permutationIndex = 0u; i < containerSize; ++i, componentIndex = i % nbValues, permutationIndex = i / nbValues) { auto insertIndex = sortPermutation.at(permutationIndex) * nbValues + componentIndex; sortedData.push_back(container.at(insertIndex)); diff --git a/core/include/Variable/VariableCacheStrategy.h b/core/include/Variable/VariableCacheStrategy.h index 54d401a..2487253 100644 --- a/core/include/Variable/VariableCacheStrategy.h +++ b/core/include/Variable/VariableCacheStrategy.h @@ -22,6 +22,7 @@ class Variable; class SCIQLOP_CORE_EXPORT VariableCacheStrategy { public: + virtual ~VariableCacheStrategy() noexcept = default; virtual std::pair computeRange(const SqpRange &vRange, const SqpRange &rangeRequested) = 0; diff --git a/core/include/Variable/VariableCacheStrategyFactory.h b/core/include/Variable/VariableCacheStrategyFactory.h index a7ec00c..249e7c3 100644 --- a/core/include/Variable/VariableCacheStrategyFactory.h +++ b/core/include/Variable/VariableCacheStrategyFactory.h @@ -37,6 +37,8 @@ public: qCCritical(LOG_VariableCacheStrategyFactory()) << QObject::tr("Unknown cache strategy"); } + + return nullptr; } }; diff --git a/core/meson.build b/core/meson.build index 2256757..2a527f6 100644 --- a/core/meson.build +++ b/core/meson.build @@ -9,7 +9,6 @@ core_moc_headers = [ 'include/Variable/VariableCacheController.h', 'include/Variable/VariableController.h', 'include/Variable/VariableAcquisitionWorker.h', - 'include/Variable/VariableCacheStrategy.h', 'include/Variable/VariableSynchronizationGroup.h', 'include/Variable/VariableModel.h', 'include/Visualization/VisualizationController.h' diff --git a/core/src/Data/OptionalAxis.cpp b/core/src/Data/OptionalAxis.cpp index eedbe56..e085bea 100644 --- a/core/src/Data/OptionalAxis.cpp +++ b/core/src/Data/OptionalAxis.cpp @@ -65,8 +65,6 @@ std::pair OptionalAxis::bounds() const return SortUtils::maxCompareWithNaN(it1.first(), it2.first()); }); - auto pair = std::make_pair(minIt->first(), maxIt->first()); - return std::make_pair(minIt->first(), maxIt->first()); } } diff --git a/core/src/Data/VectorSeries.cpp b/core/src/Data/VectorSeries.cpp index ab86bad..de3fd28 100644 --- a/core/src/Data/VectorSeries.cpp +++ b/core/src/Data/VectorSeries.cpp @@ -29,7 +29,7 @@ std::vector flatten(std::vector xValues, std::vector yVa auto result = std::vector(); result.reserve(xValues.size() * 3); - for (int i = 0; i < xValues.size(); i++) { + for (auto i = 0u; i < xValues.size(); ++i) { result.push_back(xValues[i]); result.push_back(yValues[i]); result.push_back(zValues[i]); diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index 848d1f2..b5a2eef 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -358,6 +358,9 @@ VariableController::createVariable(const QString &name, const QVariantHash &meta return newVariable; } + + qCCritical(LOG_VariableController()) << tr("Impossible to create variable"); + return nullptr; } void VariableController::onDateTimeOnSelection(const SqpRange &dateTime) diff --git a/core/src/Variable/VariableModel.cpp b/core/src/Variable/VariableModel.cpp index 9c91f18..490ebc8 100644 --- a/core/src/Variable/VariableModel.cpp +++ b/core/src/Variable/VariableModel.cpp @@ -146,7 +146,9 @@ void VariableModel::deleteVariable(std::shared_ptr variable) noexcept std::shared_ptr VariableModel::variable(int index) const { - return (index >= 0 && index < impl->m_Variables.size()) ? impl->m_Variables[index] : nullptr; + return (index >= 0u && static_cast(index) < impl->m_Variables.size()) + ? impl->m_Variables[index] + : nullptr; } std::vector > VariableModel::variables() const diff --git a/core/tests/Data/DataSeriesUtils.cpp b/core/tests/Data/DataSeriesUtils.cpp index b4162e8..25abb3e 100644 --- a/core/tests/Data/DataSeriesUtils.cpp +++ b/core/tests/Data/DataSeriesUtils.cpp @@ -14,7 +14,7 @@ void validateRange(DataSeriesIterator first, DataSeriesIterator last, const Data { QVERIFY(std::equal(first, last, xData.cbegin(), xData.cend(), [](const auto &it, const auto &expectedX) { return it.x() == expectedX; })); - for (auto i = 0; i < valuesData.size(); ++i) { + for (auto i = 0u; i < valuesData.size(); ++i) { auto componentData = valuesData.at(i); QVERIFY(std::equal( diff --git a/core/tests/Data/TestTwoDimArrayData.cpp b/core/tests/Data/TestTwoDimArrayData.cpp index b608a98..3c64c32 100644 --- a/core/tests/Data/TestTwoDimArrayData.cpp +++ b/core/tests/Data/TestTwoDimArrayData.cpp @@ -21,8 +21,8 @@ InputData flatten(const Container &container) auto result = DataContainer{}; result.reserve(componentSize * containerSize); - for (auto i = 0; i < componentSize; ++i) { - for (auto j = 0; j < containerSize; ++j) { + for (auto i = 0u; i < componentSize; ++i) { + for (auto j = 0u; j < containerSize; ++j) { result.push_back(container.at(j).at(i)); } } @@ -40,7 +40,7 @@ void verifyArrayData(const ArrayData<2> &arrayData, const Container &expectedDat })); }; - for (auto i = 0; i < expectedData.size(); ++i) { + for (auto i = 0u; i < expectedData.size(); ++i) { verifyComponent(expectedData.at(i), [i](const auto &seriesIt, const auto &value) { return seriesIt.at(i) == value; }); diff --git a/gui/meson.build b/gui/meson.build index a3bf57f..35c2317 100644 --- a/gui/meson.build +++ b/gui/meson.build @@ -1,17 +1,14 @@ gui_moc_headers = [ 'include/DataSource/DataSourceWidget.h', - 'include/DataSource/DataSourceTreeWidget.h', 'include/Settings/SqpSettingsDialog.h', 'include/Settings/SqpSettingsGeneralWidget.h', 'include/SidePane/SqpSidePane.h', 'include/SqpApplication.h', - 'include/DragAndDrop/DragDropHelper.h', 'include/DragAndDrop/DragDropScroller.h', 'include/DragAndDrop/DragDropTabSwitcher.h', 'include/TimeWidget/TimeWidget.h', 'include/Variable/VariableInspectorWidget.h', - 'include/Variable/VariableInspectorTableView.h', 'include/Variable/RenameVariableDialog.h', 'include/Visualization/qcustomplot.h', 'include/Visualization/VisualizationGraphWidget.h', diff --git a/gui/src/SqpApplication.cpp b/gui/src/SqpApplication.cpp index aa0e813..6ddf460 100644 --- a/gui/src/SqpApplication.cpp +++ b/gui/src/SqpApplication.cpp @@ -17,9 +17,9 @@ class SqpApplication::SqpApplicationPrivate { public: SqpApplicationPrivate() : m_DataSourceController{std::make_unique()}, - m_NetworkController{std::make_unique()}, - m_TimeController{std::make_unique()}, m_VariableController{std::make_unique()}, + m_TimeController{std::make_unique()}, + m_NetworkController{std::make_unique()}, m_VisualizationController{std::make_unique()}, m_DragDropHelper{std::make_unique()} { diff --git a/gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp b/gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp index e6bb455..8090c56 100644 --- a/gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp +++ b/gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp @@ -17,9 +17,9 @@ struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate { QMenu *menu, std::shared_ptr variable, std::set variableContainers) : m_Variable{variable}, + m_VariableContainers{std::move(variableContainers)}, m_PlotMenuBuilder{menu}, - m_UnplotMenuBuilder{menu}, - m_VariableContainers{std::move(variableContainers)} + m_UnplotMenuBuilder{menu} { } diff --git a/plugins/amda/src/AmdaResultParserHelper.cpp b/plugins/amda/src/AmdaResultParserHelper.cpp index b31985a..b463a43 100644 --- a/plugins/amda/src/AmdaResultParserHelper.cpp +++ b/plugins/amda/src/AmdaResultParserHelper.cpp @@ -88,7 +88,7 @@ void tryReadResult(std::vector &xAxisData, std::vector &valuesDa auto lineData = line.split(RESULT_LINE_SEPARATOR, QString::SkipEmptyParts); // Checks that the line contains expected number of values + x-axis value - if (lineData.size() == valuesIndexes.size() + 1) { + if (static_cast(lineData.size()) == valuesIndexes.size() + 1) { // X : the data is converted from date to double (in secs) auto x = doubleDate(lineData.at(0));