From de268915026b15c41a1530d76a69c68dc8ff9a11 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 9 Dec 2024 19:24:03 +0100 Subject: [PATCH] Add const when possible in the writer and add [[maybe_unused]] for released pointer values --- k4FWCore/components/Writer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/k4FWCore/components/Writer.cpp b/k4FWCore/components/Writer.cpp index b5da0604..cb9d6762 100644 --- a/k4FWCore/components/Writer.cpp +++ b/k4FWCore/components/Writer.cpp @@ -156,7 +156,7 @@ class Writer final : public Gaudi::Functional::Consumername() == k4FWCore::frameLocation) { continue; } @@ -190,7 +190,7 @@ class Writer final : public Gaudi::Functional::ConsumerunregisterObject(p); + const auto sc = m_dataSvc->unregisterObject(p); if (!sc.isSuccess()) { error() << "Failed to unregister object" << endmsg; return; @@ -221,7 +221,7 @@ class Writer final : public Gaudi::Functional::ConsumerretrieveObject("/Event/" + coll, storeCollection).isFailure()) { error() << "Failed to retrieve collection " << coll << endmsg; @@ -233,12 +233,12 @@ class Writer final : public Gaudi::Functional::Consumer>*>(storeCollection); - storePtr->getData().release(); + const auto storePtr = dynamic_cast>*>(storeCollection); + [[maybe_unused]] auto releasedPtr = storePtr->getData().release(); delete storePtr; } - for (auto& coll : m_collectionsToAdd) { + for (const auto& coll : m_collectionsToAdd) { DataObject* storeCollection; if (m_dataSvc->retrieveObject("/Event/" + coll, storeCollection).isFailure()) { error() << "Failed to retrieve collection " << coll << endmsg;