diff --git a/GaudiSvc/src/THistSvc/THistSvc.cpp b/GaudiSvc/src/THistSvc/THistSvc.cpp index e25bd5ab023ba0b8396dde473797c8e927fca4f7..e032fddabed4aa7f73df4db8a748670489da3ece 100644 --- a/GaudiSvc/src/THistSvc/THistSvc.cpp +++ b/GaudiSvc/src/THistSvc/THistSvc.cpp @@ -405,7 +405,7 @@ StatusCode THistSvc::regTree( const std::string& id ) StatusCode THistSvc::regTree( const std::string& id, std::unique_ptr<TTree> tree ) { StatusCode sc = regHist_i( std::move( tree ), id, false ); - TTree* tr; + TTree* tr = nullptr; if ( getTree( id, tr ).isSuccess() && sc.isSuccess() ) { if ( m_autoSave != 0 ) { tr->SetAutoSave( m_autoSave ); @@ -1169,7 +1169,7 @@ StatusCode THistSvc::io_reinit() } } - void* vf; + void* vf = nullptr; Option_t* opts = f->GetOption(); int r = p_fileMgr->open( Io::ROOT, name(), fname, Io::WRITE, vf, "HIST" ); if ( r != 0 ) { @@ -1606,7 +1606,7 @@ void THistSvc::MergeRootFile( TDirectory* target, TDirectory* source ) // loop over all keys in this directory TList* lkeys = current_sourcedir->GetListOfKeys(); int nkeys = lkeys->GetEntries(); - TKey* key; + TKey* key = nullptr; for ( int jj = 0; jj < nkeys; jj++ ) { key = (TKey*)lkeys->At( jj ); std::string pathnameinsource = current_sourcedir->GetPath() + std::string( "/" ) + key->GetName(); diff --git a/GaudiSvc/src/THistSvc/THistSvc.icc b/GaudiSvc/src/THistSvc/THistSvc.icc index 1e6f6b1f355c46582d286dc6828a15b718c57088..6c34454bbc45b8fadc0f7bc7efc8ebbb670f0731 100644 --- a/GaudiSvc/src/THistSvc/THistSvc.icc +++ b/GaudiSvc/src/THistSvc/THistSvc.icc @@ -16,7 +16,7 @@ template <typename T> StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist, const std::string& id, bool shared ) { - THistID* hid; + THistID* hid = nullptr ; return regHist_i( std::move(hist), id, shared, hid ); } @@ -176,7 +176,7 @@ T* THistSvc::getHist_i( const std::string& id, const size_t& ind, bool quiet ) c GlobalDirectoryRestore restore( m_svcMut ); T* hist = nullptr; - const THistID* hid; + const THistID* hid = nullptr; size_t num = findHistID( id, hid, ind ); if ( num == 0 ) { // no matches found @@ -220,7 +220,7 @@ T* THistSvc::readHist_i( const std::string& id ) const removeDoubleSlash( idr ); std::string stream, rem, dir, fdir, bdir, fdir2; - TFile* file; + TFile* file = nullptr; if ( !findStream( idr, stream, rem, file ) ) { return nullptr; @@ -272,10 +272,10 @@ template <typename T> LockedHandle<T> THistSvc::regShared_i( const std::string& id, std::unique_ptr<T> hist ) { LockedHandle<T> lh( nullptr, nullptr ); - const THistID* hid; + const THistID* hid = nullptr; if ( findHistID( id, hid ) == 0 ) { T* phist = hist.get(); - THistID* phid; + THistID* phid = nullptr; if ( regHist_i( std::move(hist), id, true, phid ).isSuccess() ) { lh.set( phist, phid->mutex ); @@ -308,7 +308,7 @@ LockedHandle<T> THistSvc::getShared_i( const std::string& name ) const { GlobalDirectoryRestore restore( m_svcMut ); - const THistID* hid; + const THistID* hid = nullptr; size_t i = findHistID( name, hid ); LockedHandle<T> hist( nullptr, nullptr );