From 9194466bd5a4610149cc3e54c80b2a56411fa44a Mon Sep 17 00:00:00 2001 From: adriazalvarez Date: Wed, 28 Aug 2024 14:00:08 +0100 Subject: [PATCH] Fix auto causes copy coverity warnings --- Framework/DataHandling/src/LoadNexusProcessed.cpp | 6 +++--- .../Inelastic/Corrections/ContainerSubtraction.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index 5f05a4bf4f86..82e7dd805ae1 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -1037,7 +1037,7 @@ API::Workspace_sptr LoadNexusProcessed::loadLeanElasticPeaksEntry(const NXEntry for (int r = 0; r < numberPeaks; r++) { // Create individual LeanElasticPeak - const auto goniometer = peakWS->run().getGoniometer(); + const auto &goniometer = peakWS->run().getGoniometer(); LeanElasticPeak peak; peak.setGoniometerMatrix(goniometer.getR()); peak.setRunNumber(peakWS->getRunNumber()); @@ -1319,7 +1319,7 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(const NXEntry &entry) { // below this one) is set before QLabFrame as this causes Peak to ray trace // to find the location of the detector, which significantly increases // loading times. - const auto goniometer = peakWS->run().getGoniometer(); + const auto &goniometer = peakWS->run().getGoniometer(); Peak peak; peak.setInstrument(peakWS->getInstrument()); peak.setGoniometerMatrix(goniometer.getR()); @@ -1725,7 +1725,7 @@ API::MatrixWorkspace_sptr LoadNexusProcessed::loadNonEventEntry(NXData &wksp_cls // now check for NaN at end of X which would signify ragged binning for (size_t i = 0; i < local_workspace->getNumberHistograms(); i++) { - const auto x = local_workspace->readX(i); + const auto &x = local_workspace->readX(i); const auto idx = std::distance(x.rbegin(), std::find_if_not(x.rbegin(), x.rend(), [](auto val) { return std::isnan(val); })); if (idx > 0) diff --git a/qt/scientific_interfaces/Inelastic/Corrections/ContainerSubtraction.cpp b/qt/scientific_interfaces/Inelastic/Corrections/ContainerSubtraction.cpp index affea4d361e4..72f8aff9d467 100644 --- a/qt/scientific_interfaces/Inelastic/Corrections/ContainerSubtraction.cpp +++ b/qt/scientific_interfaces/Inelastic/Corrections/ContainerSubtraction.cpp @@ -51,7 +51,7 @@ ContainerSubtraction::ContainerSubtraction(QWidget *parent) : CorrectionsTab(par ContainerSubtraction::~ContainerSubtraction() { m_uiForm.ppPreview->watchADS(false); if (m_transformedContainerWS) { - auto const containerName = m_transformedContainerWS->getName(); + const auto &containerName = m_transformedContainerWS->getName(); // It is not safe to keep the signals connected (void)m_uiForm.dsContainer->disconnect();