From 696792d94da3db7bffc62a92392446c8ee3175b7 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 3 Mar 2023 15:07:59 +0100 Subject: [PATCH] fix warning: '' may be used uninitialized --- .../interface/SiPixelPayloadInspectorHelper.h | 11 ++++++----- .../SiPixelDynamicInefficiency_PayloadInspector.cc | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h b/CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h index 3677898ca4441..e654f79166d54 100644 --- a/CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h +++ b/CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h @@ -36,7 +36,7 @@ namespace SiPixelPI { - enum phase { zero = 0, one = 1, two = 2 }; + enum phase { zero = 0, one = 1, two = 2, undefined = 999 }; // size of the phase-0 pixel detID list static const unsigned int phase0size = 1440; @@ -664,7 +664,7 @@ namespace SiPixelPI { int m_side; int m_ring; bool m_isInternal; - SiPixelPI::phase* m_Phase; + SiPixelPI::phase m_Phase; public: void init(); @@ -687,6 +687,7 @@ namespace SiPixelPI { inline void topolInfo::init() /*--------------------------------------------------------------------*/ { + m_Phase = SiPixelPI::undefined; m_rawid = 0; m_subdetid = -1; m_layer = -1; @@ -710,7 +711,7 @@ namespace SiPixelPI { /*--------------------------------------------------------------------*/ { // set the phase - m_Phase = const_cast(&ph); + m_Phase = ph; unsigned int subdetId = static_cast(detId.subdetId()); m_rawid = detId.rawId(); @@ -733,7 +734,7 @@ namespace SiPixelPI { { SiPixelPI::regions ret = SiPixelPI::NUM_OF_REGIONS; - if (m_Phase == nullptr) { + if (m_Phase == SiPixelPI::undefined) { throw cms::Exception("LogicError") << "Cannot call filterThePartition BEFORE filling the geometry info!"; } @@ -769,7 +770,7 @@ namespace SiPixelPI { m_side > 1 ? ret = SiPixelPI::FPixpL3 : ret = SiPixelPI::FPixmL3; break; default: - if (*m_Phase < SiPixelPI::phase::two) { + if (m_Phase < SiPixelPI::phase::two) { // warning message only if the phase2 is < 2 edm::LogWarning("LogicError") << "Unknow FPix disk: " << m_layer; } diff --git a/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc b/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc index 1804c126adb7c..e686b6b6f0c96 100644 --- a/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc +++ b/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc @@ -197,6 +197,8 @@ namespace { case SiPixelPI::phase::two: inputFile = "Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml"; break; + default: + throw cms::Exception("SiPixelDynamicInefficiency_PayloadInspector") << "checkPhase: unrecongnized phase!"; } // create the standalone tracker topology