From c73b9094063400522e6583419b6a5d75d4109117 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Mon, 23 May 2022 20:25:13 +0200 Subject: [PATCH] uniform local var 'result', not 'ret' --- Base/Spin/SpinMatrix.cpp | 6 +++--- Device/Coord/ICoordSystem.cpp | 6 +++--- Device/Histo/IOFactory.cpp | 14 +++++++------- GUI/Model/Data/DataViewUtils.cpp | 6 +++--- GUI/Model/Model/FitParameterModel.cpp | 12 ++++++------ Sample/Aggregate/ParticleLayout.cpp | 6 +++--- Wrap/Swig/doxy2swig.py | 10 +++++----- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Base/Spin/SpinMatrix.cpp b/Base/Spin/SpinMatrix.cpp index 650f5197fa9..442b31260b9 100644 --- a/Base/Spin/SpinMatrix.cpp +++ b/Base/Spin/SpinMatrix.cpp @@ -70,9 +70,9 @@ SpinMatrix SpinMatrix::operator*(const SpinMatrix& o) const SpinMatrix SpinMatrix::operator*=(const SpinMatrix& o) { - const SpinMatrix ret(*this * o); - *this = ret; - return ret; + const SpinMatrix tmp(*this * o); + *this = tmp; + return *this; } Spinor SpinMatrix::operator*(const Spinor& s) const diff --git a/Device/Coord/ICoordSystem.cpp b/Device/Coord/ICoordSystem.cpp index 2a60be6f36e..81985b0529e 100644 --- a/Device/Coord/ICoordSystem.cpp +++ b/Device/Coord/ICoordSystem.cpp @@ -25,10 +25,10 @@ std::vector<IAxis*> ICoordSystem::defaultAxes() const std::vector<IAxis*> ICoordSystem::convertedAxes(Coords units) const { - std::vector<IAxis*> ret; + std::vector<IAxis*> result; for (size_t i = 0; i < rank(); ++i) - ret.emplace_back(createConvertedAxis(i, units)); - return ret; + result.emplace_back(createConvertedAxis(i, units)); + return result; } std::string ICoordSystem::axisName(size_t i_axis, const Coords units) const diff --git a/Device/Histo/IOFactory.cpp b/Device/Histo/IOFactory.cpp index 35d7cb81092..a361d0c62e9 100644 --- a/Device/Histo/IOFactory.cpp +++ b/Device/Histo/IOFactory.cpp @@ -43,18 +43,18 @@ Powerfield<double>* IOFactory::readPowerfield(const std::string& file_name, Load && fileTypeMatchesLoaderSelector(file_name, testForSelector)); }; - Powerfield<double>* ret = nullptr; + Powerfield<double>* result = nullptr; if (readAs(bornagain)) - ret = readPowerfield(file_name, + result = readPowerfield(file_name, [](std::istream& s) { return ReadWriteINT().readPowerfield(s); }); else if (readAs(nicos)) - ret = readPowerfield(file_name, [](std::istream& s) { return IO::readNicosData(s); }); + result = readPowerfield(file_name, [](std::istream& s) { return IO::readNicosData(s); }); #ifdef BA_TIFF_SUPPORT else if (readAs(tiff)) - ret = readPowerfield(file_name, + result = readPowerfield(file_name, [](std::istream& s) { return ReadWriteTiff().readPowerfield(s); }); #endif @@ -62,11 +62,11 @@ Powerfield<double>* IOFactory::readPowerfield(const std::string& file_name, Load // Try to read ASCII by default. Binary maps to ASCII. // If the file is not actually a matrix of numbers, // the error will be thrown during the reading. - ret = readPowerfield(file_name, + result = readPowerfield(file_name, [](std::istream& s) { return ReadWriteNumpyTXT().readPowerfield(s); }); - ASSERT(ret); - return ret; + ASSERT(result); + return result; } Powerfield<double>* IOFactory::readReflectometryData(const std::string& file_name) diff --git a/GUI/Model/Data/DataViewUtils.cpp b/GUI/Model/Data/DataViewUtils.cpp index 4994b928f0c..24071f66e66 100644 --- a/GUI/Model/Data/DataViewUtils.cpp +++ b/GUI/Model/Data/DataViewUtils.cpp @@ -59,9 +59,9 @@ GUI::Model::DataViewUtils::getTranslatedData(Data1DViewItem* view_item, DataItem auto* converter = getConverter(view_item); auto current_units = selectedUnits(view_item); - auto ret = std::make_unique<Powerfield<double>>(converter->convertedAxes(current_units)); + auto result = std::make_unique<Powerfield<double>>(converter->convertedAxes(current_units)); - ret->setRawDataVector(data_item->getPowerfield()->getRawDataVector()); + result->setRawDataVector(data_item->getPowerfield()->getRawDataVector()); - return ret; + return result; } diff --git a/GUI/Model/Model/FitParameterModel.cpp b/GUI/Model/Model/FitParameterModel.cpp index 19f20a127f2..21b93176f34 100644 --- a/GUI/Model/Model/FitParameterModel.cpp +++ b/GUI/Model/Model/FitParameterModel.cpp @@ -64,28 +64,28 @@ Qt::ItemFlags FitParameterModel::flags(const QModelIndex& index) const if (!m_parameterContainer) return Qt::NoItemFlags; - Qt::ItemFlags returnVal = Qt::ItemIsEnabled | Qt::ItemIsSelectable; + Qt::ItemFlags result = Qt::ItemIsEnabled | Qt::ItemIsSelectable; if (SessionItem* item = itemForIndex(index)) { if (item->isEditable() && index.column() != COL_NAME) - returnVal |= Qt::ItemIsEditable; + result |= Qt::ItemIsEditable; if (item->parent()->hasModelType<FitParameterLinkItem>() && index.column() == COL_NAME) - returnVal |= Qt::ItemIsDragEnabled; + result |= Qt::ItemIsDragEnabled; const bool allow_one_fit_parameter_to_have_more_than_one_link = true; if (allow_one_fit_parameter_to_have_more_than_one_link) { // drop is allowed to fit parameter container, and, to FitParameterItem itself. // (i.e. we can have more than one link in single FitParameterItem) if (item->hasModelType<FitParameterItem>() || item->hasModelType<FitParameterContainerItem>()) { - returnVal |= Qt::ItemIsDropEnabled; + result |= Qt::ItemIsDropEnabled; } } else { // drop is allowed only to fit parameter container // (i.e. only one link is allowed in FitParameterItem) if (item->hasModelType<FitParameterContainerItem>()) - returnVal |= Qt::ItemIsDropEnabled; + result |= Qt::ItemIsDropEnabled; } } - return returnVal; + return result; } QModelIndex FitParameterModel::index(int row, int column, const QModelIndex& parent) const diff --git a/Sample/Aggregate/ParticleLayout.cpp b/Sample/Aggregate/ParticleLayout.cpp index 509bb67b539..56d08d7aeb9 100644 --- a/Sample/Aggregate/ParticleLayout.cpp +++ b/Sample/Aggregate/ParticleLayout.cpp @@ -63,10 +63,10 @@ void ParticleLayout::addParticle(const IParticle& particle, double abundance) std::vector<const IParticle*> ParticleLayout::particles() const { - std::vector<const IParticle*> ret; + std::vector<const IParticle*> result; for (const IParticle* p : m_particles) - ret.emplace_back(p); - return ret; + result.emplace_back(p); + return result; } const IInterference* ParticleLayout::interferenceFunction() const diff --git a/Wrap/Swig/doxy2swig.py b/Wrap/Swig/doxy2swig.py index 397c85d91d0..e155662d1aa 100755 --- a/Wrap/Swig/doxy2swig.py +++ b/Wrap/Swig/doxy2swig.py @@ -343,18 +343,18 @@ class Doxy2SWIG: ret.append(i) _data = "".join(ret) - ret = [] + result = [] for i in _data.split('\n\n'): if i == 'Parameters:': - ret.extend(['Parameters:\n-----------', '\n\n']) + result.extend(['Parameters:\n-----------', '\n\n']) elif i.find('// File:') > -1: # leave comments alone. - ret.extend([i, '\n']) + result.extend([i, '\n']) else: #_tmp = textwrap.fill(i.strip()) _tmp = i.strip() _tmp = self.lead_spc.sub(r'\1"\2', _tmp) - ret.extend([_tmp, '\n\n']) - return ret + result.extend([_tmp, '\n\n']) + return result def main(input, output): -- GitLab