From 916bcbe9ce3c0bb57c405089392fd245897f1eb5 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Sat, 10 Apr 2021 11:03:47 -0400 Subject: [PATCH] AthenaPoolCnvSvc: Fix cppcheck warnings. Fix cppcheck warnings. --- .../T_AthenaPoolAuxContainerCnv.icc | 4 ++-- .../AthenaPoolCnvSvc/T_AthenaPoolTPCnvCnv.icc | 6 +++--- .../AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx | 14 +++++++------- .../test/T_AthenaPoolAuxContainerCnv_test.cxx | 3 +-- .../test/T_AthenaPoolTPCnvCnv_test.cxx | 3 +-- .../test/T_AthenaPoolViewVectorCnv_test.cxx | 3 +-- .../test/T_AthenaPoolxAODCnv_test.cxx | 3 +-- .../test/T_AuxContainerCopyTPCnv_test.cxx | 4 ++-- 8 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolAuxContainerCnv.icc b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolAuxContainerCnv.icc index b42868087bde..f96a4f82637b 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolAuxContainerCnv.icc +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolAuxContainerCnv.icc @@ -20,9 +20,9 @@ */ template <class AUXSTORE, class ... TPCNVS> T_AthenaPoolAuxContainerCnv<AUXSTORE, TPCNVS...>::T_AthenaPoolAuxContainerCnv( ISvcLocator* svcLoc ) - : Base( svcLoc ) + : Base( svcLoc ), + m_guid (AthenaPoolCnvSvc::guidFromTypeinfo (typeid (AUXSTORE))) { - m_guid = AthenaPoolCnvSvc::guidFromTypeinfo (typeid (AUXSTORE)); } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolTPCnvCnv.icc b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolTPCnvCnv.icc index 6ba026c27970..ab54348c5510 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolTPCnvCnv.icc +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolTPCnvCnv.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -17,9 +17,9 @@ */ template <class TRANS, class TPCNV_CUR, class ... TPCNVS> T_AthenaPoolTPCnvCnv<TRANS, TPCNV_CUR, TPCNVS...>::T_AthenaPoolTPCnvCnv( ISvcLocator* svcLoc ) - : Base( svcLoc ) + : Base( svcLoc ), + m_guid (AthenaPoolCnvSvc::guidFromTypeinfo (typeid (Pers_t))) { - m_guid = AthenaPoolCnvSvc::guidFromTypeinfo (typeid (Pers_t)); } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx index 643354ddd27f..b55f33ab19c5 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** @file AuxDiscoverySvc.cxx @@ -73,7 +73,7 @@ bool AuxDiscoverySvc::setData(SG::auxid_t auxid, void* data, const RootType& typ } else { // Move the data to the dynamic store. std::unique_ptr<SG::IAuxTypeVector> vec(registry.makeVectorFromData(auxid, data, false, true)); - m_storeInt->addVector(auxid, std::move(vec), false); data = nullptr; + m_storeInt->addVector(auxid, std::move(vec), false); } return true; } @@ -217,22 +217,22 @@ StatusCode AuxDiscoverySvc::sendStore(const IAthenaSerializeSvc* serSvc, return(StatusCode::FAILURE); } } - for (SG::auxid_set_t::const_iterator iter = auxIDs.begin(), last = auxIDs.end(); iter != last; iter++) { - const std::string& dataStr = this->getAttrName(*iter) + "\n" + this->getTypeName(*iter) + "\n" + this->getElemName(*iter); + for (SG::auxid_t auxid : auxIDs) { + const std::string& dataStr = this->getAttrName(auxid) + "\n" + this->getTypeName(auxid) + "\n" + this->getElemName(auxid); if (!ipcTool->putObject(dataStr.c_str(), dataStr.size() + 1, num).isSuccess()) { return(StatusCode::FAILURE); } - const std::type_info* tip = this->getType(*iter); + const std::type_info* tip = this->getType(auxid); if (tip == nullptr) { return(StatusCode::FAILURE); } RootType type(*tip); StatusCode sc = StatusCode::FAILURE; if (type.IsFundamental()) { - sc = ipcTool->putObject(this->getData(*iter), type.SizeOf(), num); + sc = ipcTool->putObject(this->getData(auxid), type.SizeOf(), num); } else { size_t nbytes = 0; - void* buffer = serSvc->serialize(this->getData(*iter), type, nbytes); + void* buffer = serSvc->serialize(this->getData(auxid), type, nbytes); sc = ipcTool->putObject(buffer, nbytes, num); delete [] static_cast<char*>(buffer); buffer = nullptr; } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx index c82597113a1b..7d1c5c0e4152 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** @@ -61,7 +61,6 @@ public: std::abort(); } - std::string m_name; YAuxCont_v1* m_pers1; YAuxCont_v2* m_pers2; }; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx index a75b13c22154..b34b662bdb51 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** * @file AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx @@ -59,7 +59,6 @@ public: std::abort(); } - std::string m_name; XCont* m_pers0; XCont_p1* m_pers1; XCont_p2* m_pers2; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx index ba57e7647d90..f17cc26a676a 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** * @file AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx @@ -113,7 +113,6 @@ public: } } - std::string m_name; ViewVector<DataVector<Y_v2> >* m_pers; YCont_v2_pers2* m_pers_old; }; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx index ad32a48ed695..c0757b9db73c 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** @@ -65,7 +65,6 @@ public: std::abort(); } - std::string m_name; DataVector<Y_v1>* m_pers1; DataVector<Y_v2>* m_pers2; }; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AuxContainerCopyTPCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AuxContainerCopyTPCnv_test.cxx index 069f05faf17d..d78bd957f7e8 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AuxContainerCopyTPCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AuxContainerCopyTPCnv_test.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration. */ /** * @file AthenaPoolCnvSvc/test/T_AuxContainerCopyTPCnv_test.cxx @@ -48,9 +48,9 @@ class OldData public: OldData(); OldData (const OldData&) = default; + // cppcheck-suppress operatorEqVarError OldData& operator= (const OldData&) { return *this; } - SG::auxid_t m_i1_auxid; SG::auxid_t m_i2_auxid; }; -- GitLab