diff --git a/Database/APR/RootCollection/src/RootCollection.cpp b/Database/APR/RootCollection/src/RootCollection.cpp index 837647462d4500c7126571338f962ad140bb17e3..0216037688d9ab5efbf135e7e078e951d083c935 100755 --- a/Database/APR/RootCollection/src/RootCollection.cpp +++ b/Database/APR/RootCollection/src/RootCollection.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RootCollection.h" @@ -79,7 +79,7 @@ namespace pool { } - void RootCollection::delayedFileOpen( std::string method ) + void RootCollection::delayedFileOpen( const std::string& method ) { if( m_open && !m_file && m_session && m_mode != ICollection::READ ) { m_file = TFile::Open(m_fileName.c_str(), poolOptToRootOpt[m_mode] ); @@ -434,7 +434,7 @@ namespace pool { string RootCollection::retrievePFN() const { - if(m_name.find("PFN:")!=0) + if (m_name.substr (0, 4) != "PFN:") throw pool::Exception( "In CREATE mode a PFN has to be provided", "RootCollection::open", "RootCollection"); @@ -447,17 +447,19 @@ namespace pool { FileCatalog::FileID fid=""; string fileType=""; - if(m_name.find("PFN:")==0){ + if (m_name.substr (0, 4) == "PFN:") { string pfn = m_name.substr(4,string::npos); m_fileCatalog->start(); m_fileCatalog->lookupFileByPFN(pfn,fid,fileType); m_fileCatalog->commit(); - }else if(m_name.find("LFN:")==0){ + } + else if (m_name.substr (0, 4) == "LFN:") { string lfn = m_name.substr(4,string::npos); m_fileCatalog->start(); m_fileCatalog->lookupFileByLFN(lfn,fid); m_fileCatalog->commit(); - }else if(m_name.find("FID:")==0){ + } + else if (m_name.substr (0, 4) == "FID:") { fid = m_name.substr(4,string::npos); }else throw pool::Exception( "A FID, PFN or and LFN has to be provided", diff --git a/Database/APR/RootCollection/src/RootCollection.h b/Database/APR/RootCollection/src/RootCollection.h index b927679ff8b047f51ee6344f58ff1b416076eddb..e78822e3ece62536ae78fecb51e4fb187f7c62fa 100755 --- a/Database/APR/RootCollection/src/RootCollection.h +++ b/Database/APR/RootCollection/src/RootCollection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ROOTCOLLECTION_ROOTCOLLECTION_H @@ -188,7 +188,7 @@ namespace pool { /// copying unimplemented in this class. RootCollection & operator = (const RootCollection &); - void delayedFileOpen( std::string method ); + void delayedFileOpen( const std::string& method ); TTree* getCollectionTree(); void setupTree() const; void readAttributeListSpecification() const; diff --git a/Database/APR/RootCollection/src/RootCollectionQuery.cpp b/Database/APR/RootCollection/src/RootCollectionQuery.cpp index b224669ea3c6852dd703cc9205fa75ca7c735d1e..cf67393fd26705de803ed15f49de1aa66fbac277 100644 --- a/Database/APR/RootCollection/src/RootCollectionQuery.cpp +++ b/Database/APR/RootCollection/src/RootCollectionQuery.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RootCollectionQuery.h" @@ -113,9 +113,7 @@ pool::RootCollection::RootCollectionQuery::selectAll() void pool::RootCollection::RootCollectionQuery::addToCollectionFragmentList( const std::string& fragmentName ) { - if( m_collectionFragmentNames.find( fragmentName ) == m_collectionFragmentNames.end() ) { - m_collectionFragmentNames.insert( fragmentName ); - + if (m_collectionFragmentNames.insert (fragmentName).second) { /* // Add data table associated with collection fragment to query table list. std::string dataTableName = ( m_dataTableNameForCollectionFragmentName.find( fragmentName ) )->second; diff --git a/Database/APR/RootCollection/src/RootCollectionSchemaEditor.cpp b/Database/APR/RootCollection/src/RootCollectionSchemaEditor.cpp index 2b41f3e291dde3cf4ebed9b100e84c8e61d8c4bd..29d40f3a34cd20b7f9b17b6b31cb6c60b54d7164 100644 --- a/Database/APR/RootCollection/src/RootCollectionSchemaEditor.cpp +++ b/Database/APR/RootCollection/src/RootCollectionSchemaEditor.cpp @@ -301,7 +301,7 @@ renameCollectionFragment( const std::string& /* oldName */, const std::string& / void pool::RootCollection::RootCollectionSchemaEditor:: -addTreeBranch( const std::string& name, const std::string type_name ) +addTreeBranch( const std::string& name, const std::string& type_name ) { static std::map< std::string, char > typeDict; if( !typeDict.size() ) { diff --git a/Database/APR/RootCollection/src/RootCollectionSchemaEditor.h b/Database/APR/RootCollection/src/RootCollectionSchemaEditor.h index edf8eb8eabc7eccb28647c024a404f1ebd5c01a0..473c5d967c1e77f35857738fb85f1a22d0f94d9b 100644 --- a/Database/APR/RootCollection/src/RootCollectionSchemaEditor.h +++ b/Database/APR/RootCollection/src/RootCollectionSchemaEditor.h @@ -256,7 +256,7 @@ namespace pool { virtual ~RootCollectionSchemaEditor(); protected: - void addTreeBranch( const std::string& name, const std::string type_name ); + void addTreeBranch( const std::string& name, const std::string& type_name ); void readSchema(); void createTreeBranches(); void writeSchema();