Skip to content

Commit 78943b8

Browse files
Merge pull request #38397 from mantidproject/unread_variable_cppcheck
Some unusedVariiable cppckeck error removals.
2 parents 7be204a + 82fba0c commit 78943b8

16 files changed

+22
-75
lines changed

Framework/API/src/NumericAxis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ std::string NumericAxis::formatLabel(const double value) const {
163163
if (*it == '0') {
164164
it = numberLabel.erase(it);
165165
} else if (*it == '.') {
166-
it = numberLabel.erase(it);
166+
numberLabel.erase(it);
167167
break;
168168
} else {
169169
break;

Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ void CalculateCarpenterSampleCorrection::exec() {
159159
// Initialize progress reporting.
160160
Progress prog(this, 0.0, 1.0, NUM_HIST);
161161

162-
EventWorkspace_sptr inputWkspEvent = std::dynamic_pointer_cast<EventWorkspace>(inputWksp);
163-
164162
// Create the new correction workspaces
165163
MatrixWorkspace_sptr absWksp = createOutputWorkspace(inputWksp, "Attenuation factor");
166164
MatrixWorkspace_sptr msWksp = createOutputWorkspace(inputWksp, "Multiple scattering factor");

Framework/Algorithms/src/GroupWorkspaces.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ std::map<std::string, std::string> GroupWorkspaces::validateInputs() {
5858
std::map<std::string, std::string> results;
5959
const std::vector<std::string> inputWorkspaces = getProperty("InputWorkspaces");
6060
std::string globExpression = getProperty("GlobExpression");
61-
std::string outputWorkspace = getProperty("OutputWorkspace");
6261

6362
for (auto it = globExpression.begin(); it < globExpression.end(); ++it) {
6463
if (*it == '\\') {

Framework/Algorithms/src/InterpolatingRebin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::map<std::string, std::string> InterpolatingRebin::validateInputs() {
6666
MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace");
6767
std::vector<double> rbParams = getProperty("Params");
6868
try {
69-
std::vector<double> validParams = Rebin::rebinParamsFromInput(rbParams, *inputWS, g_log);
69+
Rebin::rebinParamsFromInput(rbParams, *inputWS, g_log);
7070
} catch (std::exception &err) {
7171
helpMessages["Params"] = err.what();
7272
}

Framework/Algorithms/src/SmoothNeighbours.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ void SmoothNeighbours::findNeighboursUbiquitous() {
314314
m_progress->resetNumSteps(m_inWS->getNumberHistograms(), 0.2, 0.5);
315315
this->progress(0.2, "Building Neighbour Map");
316316

317-
Instrument_const_sptr inst = m_inWS->getInstrument();
318317
const spec2index_map spec2index = m_inWS->getSpectrumToWorkspaceIndexMap();
319318

320319
// Resize the vector we are setting
@@ -379,7 +378,7 @@ void SmoothNeighbours::findNeighboursUbiquitous() {
379378
std::vector<weightedNeighbour> neighbours;
380379

381380
// Convert from spectrum numbers to workspace indices
382-
for (auto &specDistance : neighbSpectra) {
381+
for (const auto &specDistance : neighbSpectra) {
383382
specnum_t spec = specDistance.first;
384383

385384
// Use the weighting strategy to calculate the weight.

Framework/Algorithms/src/Stitch.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ using namespace Mantid::Kernel;
2626
namespace {
2727
static const std::string INPUT_WORKSPACE_PROPERTY = "InputWorkspaces";
2828
static const std::string REFERENCE_WORKSPACE_PROPERTY = "ReferenceWorkspace";
29-
static const std::string COMBINATION_BEHAVIOUR_PROPERTY = "CombinationBehaviour";
3029
static const std::string SCALE_FACTOR_CALCULATION_PROPERTY = "ScaleFactorCalculation";
3130
static const std::string MANUAL_SCALE_FACTORS_PROPERTY = "ManualScaleFactors";
3231
static const std::string TIE_SCALE_FACTORS_PROPERTY = "TieScaleFactors";
@@ -241,8 +240,6 @@ void Stitch::init() {
241240
"that is, the one that will not be scaled. If left blank, "
242241
"stitching will be performed left to right in the order of x-axes ascending, "
243242
"no matter the order of workspaces names in the input.");
244-
declareProperty(COMBINATION_BEHAVIOUR_PROPERTY, "Interleave",
245-
std::make_unique<ListValidator<std::string>>(std::array<std::string, 1>{"Interleave"}));
246243
declareProperty(SCALE_FACTOR_CALCULATION_PROPERTY, "MedianOfRatios",
247244
std::make_unique<ListValidator<std::string>>(std::array<std::string, 2>{"MedianOfRatios", "Manual"}));
248245
declareProperty(std::make_unique<ArrayProperty<double>>(MANUAL_SCALE_FACTORS_PROPERTY),
@@ -264,7 +261,6 @@ void Stitch::init() {
264261
*/
265262
void Stitch::exec() {
266263
const auto referenceName = getPropertyValue(REFERENCE_WORKSPACE_PROPERTY);
267-
const auto combinationBehaviour = getPropertyValue(COMBINATION_BEHAVIOUR_PROPERTY);
268264
const auto scaleFactorCalculation = getPropertyValue(SCALE_FACTOR_CALCULATION_PROPERTY);
269265
const auto inputs = RunCombinationHelper::unWrapGroups(getProperty(INPUT_WORKSPACE_PROPERTY));
270266
MatrixWorkspace_sptr scaleFactorsWorkspace;

Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ void WeightedMeanOfWorkspace::exec() {
6060
continue;
6161
auto &y = inputWS->y(i);
6262
auto &e = inputWS->e(i);
63-
double weight = 0.0;
6463
for (std::size_t j = 0; j < y.size(); ++j) {
6564
if (std::isfinite(y[j]) && std::isfinite(e[j])) {
66-
weight = 1.0 / (e[j] * e[j]);
65+
double weight = 1.0 / (e[j] * e[j]);
6766
averageValue += (y[j] * weight);
6867
weightSum += weight;
6968
}

Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ void GoniometerAnglesFromPhiRotation::exec() {
303303
double deg, ax1, ax2, ax3;
304304
Q1.getAngleAxis(deg, ax1, ax2, ax3);
305305
if (dphi * deg < 0) {
306-
deg = -deg;
307306
ax1 = -ax1;
308307
ax2 = -ax2;
309308
ax3 = -ax3;

Framework/DataHandling/src/LoadANSTOHelper.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,15 +432,13 @@ bool File::append(const std::string &path, const std::string &name, const void *
432432
else if (targetPosition != -1)
433433
throw std::runtime_error("format exception"); // it has to be the last file in the archive
434434

435-
FileInfo fileInfo;
436-
fileInfo.Offset = position;
437-
fileInfo.Size = header.readFileSize();
435+
auto fileSize = header.readFileSize();
438436

439-
auto offset = static_cast<size_t>(fileInfo.Size % 512);
437+
auto offset = static_cast<size_t>(fileSize % 512);
440438
if (offset != 0)
441439
offset = 512 - offset;
442440

443-
fileStatus &= 0 == fseek(handle.get(), static_cast<long>(fileInfo.Size + offset), SEEK_CUR);
441+
fileStatus &= 0 == fseek(handle.get(), static_cast<long>(fileSize + offset), SEEK_CUR);
444442
}
445443

446444
if (targetPosition < 0)

Framework/DataHandling/src/LoadTBL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void LoadTBL::csvParse(const std::string &line, std::vector<std::string> &cols,
160160
firstCell = false;
161161
} else {
162162
auto colVal = line.substr(lastComma + 1, pos - (lastComma + 1));
163-
cols.emplace_back(line.substr(lastComma + 1, pos - (lastComma + 1)));
163+
cols.emplace_back(colVal);
164164
}
165165
}
166166
lastComma = pos;

0 commit comments

Comments
 (0)