Skip to content

Commit 7703d55

Browse files
Coverity issue fixes
1 parent 21f28f7 commit 7703d55

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Framework/Algorithms/src/DiscusMultipleScatteringCorrection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ std::tuple<std::vector<double>, std::vector<double>> DiscusMultipleScatteringCor
13841384
weightsM2[i] += deltas[i] * (weights[i] - weightsMeans[i]);
13851385
// calculate sample SD (M2/n-1)
13861386
// will give NaN for m_events=1, but that's correct
1387-
weightsErrors[i] = sqrt(weightsM2[i] / static_cast<double>(ie));
1387+
weightsErrors[i] = sqrt(weightsM2[i] / static_cast<double>(ie + 1));
13881388
}
13891389

13901390
} else
@@ -1441,7 +1441,7 @@ std::tuple<bool, std::vector<double>> DiscusMultipleScatteringCorrection::scatte
14411441
for (auto &SQWSMapping : currentComponentWorkspaces)
14421442
SQWSMapping.InvPOfQ = SQWSMapping.InvPOfQ->createCopy();
14431443
prepareCumulativeProbForQ(k, newComponentWorkspaces);
1444-
currentComponentWorkspaces = newComponentWorkspaces;
1444+
currentComponentWorkspaces = std::move(newComponentWorkspaces);
14451445
}
14461446
}
14471447
auto trackStillAlive =
@@ -1507,7 +1507,7 @@ std::tuple<bool, std::vector<double>> DiscusMultipleScatteringCorrection::scatte
15071507
const double q = qVector.norm();
15081508
const double finalW = fromWaveVector(k) - finalE;
15091509
auto componentWSIt = findMatchingComponent(componentWorkspaces, shapeObjectWithScatter);
1510-
auto componentWSMapping = *componentWSIt; // to help debugging
1510+
auto &componentWSMapping = *componentWSIt; // to help debugging
15111511
double SQ = Interpolate2D(componentWSMapping, q, finalW);
15121512
scatteringXSection = m_NormalizeSQ ? scatteringXSection / interpolateFlat(*(componentWSMapping.QSQScaleFactor), k)
15131513
: scatteringXSectionFull;

Framework/Crystal/src/RotateSampleShape.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ void RotateSampleShape::exec() {
7777
g_log.warning() << "Empty goniometer created; will always return an "
7878
"identity rotation matrix.\n";
7979

80-
const auto sampleShapeRotation = gon.getR();
80+
const auto &sampleShapeRotation = gon.getR();
8181
if (sampleShapeRotation == Kernel::Matrix<double>(3, 3, true)) {
8282
// If the resulting rotationMatrix is Identity, ignore the calculatrion
8383
g_log.warning("Rotation matrix set via RotateSampleShape is an Identity matrix. Ignored rotating sample shape");
8484
return;
8585
}
8686

87-
const auto oldRotation = ei->run().getGoniometer().getR();
87+
const auto &oldRotation = ei->run().getGoniometer().getR();
8888
auto newSampleShapeRot = sampleShapeRotation * oldRotation;
8989
if (isMeshShape) {
9090
auto meshShape = std::dynamic_pointer_cast<MeshObject>(ei->sample().getShapePtr());

0 commit comments

Comments
 (0)