Skip to content

Commit b2a71d1

Browse files
committed
Fix compilers warnings
1 parent 2b53479 commit b2a71d1

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

Framework/CurveFitting/src/Algorithms/PlotPeakByLogValueHelper.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,15 @@ void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const st
159159
API::Axis *axis = ws->getAxis(1);
160160
if (axis->isSpectra()) {
161161
if (spectrumNumber < 0) {
162-
for (int i = 0; i < axis->length(); ++i) {
163-
auto s = double(axis->spectraNo(i));
164-
if (s >= start && s <= end) {
165-
nameList.emplace_back(name, i, s, -1, period, mws);
162+
for (size_t i = 0; i < axis->length(); ++i) {
163+
double spec = double(axis->spectraNo(i));
164+
int wsIdx = static_cast<int>(i);
165+
if (spec >= start && spec <= end) {
166+
nameList.emplace_back(name, wsIdx, spec, -1, period, mws);
166167
}
167168
}
168169
} else {
169-
for (int i = 0; i < axis->length(); ++i) {
170+
for (size_t i = 0; i < axis->length(); ++i) {
170171
int j = axis->spectraNo(i);
171172
if (j == spectrumNumber) {
172173
nameList.emplace_back(name, i, j, -1, period, mws);
@@ -179,10 +180,11 @@ void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const st
179180
start = (*axis)(0);
180181
end = (*axis)(axis->length() - 1);
181182
}
182-
for (int i = 0; i < axis->length(); ++i) {
183-
double s = (*axis)(i);
184-
if (s >= start && s <= end) {
185-
nameList.emplace_back(name, i, -1, s, period, mws);
183+
for (size_t i = 0; i < axis->length(); ++i) {
184+
double value = (*axis)(i);
185+
int wsIdx = static_cast<int>(i);
186+
if (value >= start && value <= end) {
187+
nameList.emplace_back(name, wsIdx, -1, value, period, mws);
186188
}
187189
}
188190
}

Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class PlotPeakByLogValueTest : public CxxTest::TestSuite {
525525
auto paramsNames = params->getNames();
526526
auto wsNames = fits->getNames();
527527

528-
for (int i = 0; i < matrices->getNames().size(); i++) {
528+
for (size_t i = 0; i < matrices->getNames().size(); i++) {
529529
auto specNum = std::to_string(i + 1);
530530
TS_ASSERT_EQUALS(matricesNames[i], "PLOTPEAKBYLOGVALUETEST_WS_sp" + specNum + "_NormalisedCovarianceMatrix");
531531
TS_ASSERT_EQUALS(paramsNames[i], "PLOTPEAKBYLOGVALUETEST_WS_sp" + specNum + "_Parameters");
@@ -571,7 +571,7 @@ class PlotPeakByLogValueTest : public CxxTest::TestSuite {
571571
auto paramsNames = params->getNames();
572572
auto wsNames = fits->getNames();
573573

574-
for (int i = 0; i < matrices->getNames().size(); i++) {
574+
for (size_t i = 0; i < matrices->getNames().size(); i++) {
575575
auto wsIdx = std::to_string(i);
576576
TS_ASSERT_EQUALS(matricesNames[i], "PlotPeakGroup_" + wsIdx + "_i1_NormalisedCovarianceMatrix");
577577
TS_ASSERT_EQUALS(paramsNames[i], "PlotPeakGroup_" + wsIdx + "_i1_Parameters");
@@ -621,7 +621,7 @@ class PlotPeakByLogValueTest : public CxxTest::TestSuite {
621621
auto paramsNames = params->getNames();
622622
auto wsNames = fits->getNames();
623623

624-
for (int i = 0; i < matrices->getNames().size(); i++) {
624+
for (size_t i = 0; i < matrices->getNames().size(); i++) {
625625
auto vIdx = std::to_string(i);
626626
TS_ASSERT_EQUALS(matricesNames[i], "PLOTPEAKBYLOGVALUETEST_WS_v" + vIdx + "_NormalisedCovarianceMatrix");
627627
TS_ASSERT_EQUALS(paramsNames[i], "PLOTPEAKBYLOGVALUETEST_WS_v" + vIdx + "_Parameters");

0 commit comments

Comments
 (0)