From c4c86a9307e29c003f1154cf3943654dbde6684c Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Wed, 14 Dec 2022 15:05:01 -0500 Subject: [PATCH] MuonGeoModelTest: Fix cppcheck warnings. Uninitialized variable. throw without exception. --- MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx | 6 ++++-- MuonSpectrometer/MuonGeoModelTest/test/CheckDifferences.cxx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx index ba24b820013..c58417f2bee 100644 --- a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx +++ b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -2495,7 +2495,9 @@ void MuonGMCheck::buildCscRegionSelectorMap() { if (aux1 == 0 || aux3 == 0) { ATH_MSG_ERROR("There is something wrong in buildCscRegionSelectorMap!"); ATH_MSG_ERROR("Variables aux1 and/or aux3 not initialized - Taking emergency exit!"); - throw; + throw std::runtime_error("There is something wrong in buildCscRegionSelectorMap! " + "Variables aux1 and/or aux3 not initialized"); + } ATH_MSG_INFO(extid << " hash Id " << Idhash << " new format " << new_extid); diff --git a/MuonSpectrometer/MuonGeoModelTest/test/CheckDifferences.cxx b/MuonSpectrometer/MuonGeoModelTest/test/CheckDifferences.cxx index 75f163f7f52..912c53fae2e 100644 --- a/MuonSpectrometer/MuonGeoModelTest/test/CheckDifferences.cxx +++ b/MuonSpectrometer/MuonGeoModelTest/test/CheckDifferences.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include <fstream> @@ -258,7 +258,7 @@ int MaterialMap::readMapRecord() { } std::string::size_type locapri; - std::string::size_type locchiudi; + std::string::size_type locchiudi = 0; if ((locapri = s.find('(')) != std::string::npos) { if ((locchiudi = s.find(')', locapri + 1)) != std::string::npos) { if (print_level < 1) std::cout << "first ( is at " << locapri << " first ) at " << locchiudi << std::endl; -- GitLab