From aad80e0b9a9f481fb608f1681f6e8bc280872da8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 22 Nov 2015 08:15:34 +0200 Subject: cppcheck:useInitializationList Change-Id: I744ff3e268fbffca9499121f3567640934aaae51 Reviewed-on: https://gerrit.libreoffice.org/20110 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- configmgr/source/access.cxx | 3 +-- configmgr/source/childaccess.cxx | 8 ++++---- configmgr/source/components.cxx | 4 ++-- configmgr/source/configurationprovider.cxx | 8 ++++---- configmgr/source/rootaccess.cxx | 5 +++-- cppu/source/threadpool/jobqueue.cxx | 4 ++-- cppu/source/threadpool/threadpool.cxx | 4 ++-- desktop/source/lib/init.cxx | 5 +++-- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index ecfbe580c620..3f4f9cae37a4 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -1303,9 +1303,8 @@ css::uno::Reference< css::uno::XInterface > Access::createInstanceWithArguments( } Access::Access(Components & components): - components_(components), disposed_(false) + components_(components), disposed_(false), lock_( lock() ) { - lock_ = lock(); } Access::~Access() {} diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index a4e632f6ed2e..576fbb308b23 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -76,18 +76,18 @@ ChildAccess::ChildAccess( rtl::Reference< Access > const & parent, OUString const & name, rtl::Reference< Node > const & node): Access(components), root_(root), parent_(parent), name_(name), node_(node), - inTransaction_(false) + inTransaction_(false), + lock_( lock() ) { - lock_ = lock(); assert(root.is() && parent.is() && node.is()); } ChildAccess::ChildAccess( Components & components, rtl::Reference< RootAccess > const & root, rtl::Reference< Node > const & node): - Access(components), root_(root), node_(node), inTransaction_(false) + Access(components), root_(root), node_(node), inTransaction_(false), + lock_( lock() ) { - lock_ = lock(); assert(root.is() && node.is()); } diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 17df486e6814..b1b4b725c579 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -170,9 +170,9 @@ Components::WriteThread::WriteThread( rtl::Reference< WriteThread > * reference, Components & components, OUString const & url, Data const & data): Thread("configmgrWriter"), reference_(reference), components_(components), - url_(url), data_(data) + url_(url), data_(data), + lock_( lock() ) { - lock_ = lock(); assert(reference != nullptr); } diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index 364642dd6a99..65e33b7ce55d 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -93,9 +93,9 @@ class Service: public: explicit Service( css::uno::Reference< css::uno::XComponentContext > const context): - ServiceBase(m_aMutex), context_(context), default_(true) + ServiceBase(m_aMutex), context_(context), default_(true), + lock_( lock() ) { - lock_ = lock(); assert(context.is()); } @@ -103,9 +103,9 @@ public: css::uno::Reference< css::uno::XComponentContext > const context, OUString const & locale): ServiceBase(m_aMutex), context_(context), locale_(locale), - default_(false) + default_(false), + lock_( lock() ) { - lock_ = lock(); assert(context.is()); } diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index 08a33d8adf50..c00defc1d4a1 100644 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx @@ -61,9 +61,10 @@ RootAccess::RootAccess( Components & components, OUString const & pathRepresentation, OUString const & locale, bool update): Access(components), pathRepresentation_(pathRepresentation), - locale_(locale), update_(update), finalized_(false), alive_(true) + locale_(locale), + lock_( lock() ), + update_(update), finalized_(false), alive_(true) { - lock_ = lock(); } Path RootAccess::getAbsolutePath() { diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx index 094a55ef9372..447b0a20a532 100644 --- a/cppu/source/threadpool/jobqueue.cxx +++ b/cppu/source/threadpool/jobqueue.cxx @@ -28,9 +28,9 @@ namespace cppu_threadpool { JobQueue::JobQueue() : m_nToDo( 0 ), - m_bSuspended( false ) + m_bSuspended( false ), + m_DisposedCallerAdmin( DisposedCallerAdmin::getInstance() ) { - m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance(); } void JobQueue::add( void *pThreadSpecificData, RequestFun * doRequest ) diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx index 42a4ff0ff8a5..92252ccb1ea4 100644 --- a/cppu/source/threadpool/threadpool.cxx +++ b/cppu/source/threadpool/threadpool.cxx @@ -101,9 +101,9 @@ namespace cppu_threadpool - ThreadPool::ThreadPool() + ThreadPool::ThreadPool() : + m_DisposedCallerAdmin( DisposedCallerAdmin::getInstance() ) { - m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance(); } ThreadPool::~ThreadPool() diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index fd0a10d0f4ac..637e956d9b4d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -434,11 +434,12 @@ static void lo_registerCallback (LibreOfficeKit* pThis, static char* lo_getFilterTypes(LibreOfficeKit* pThis); LibLibreOffice_Impl::LibLibreOffice_Impl() - : maThread(nullptr) + : m_pOfficeClass( gOfficeClass.lock() ) + , maThread(nullptr) , mpCallback(nullptr) , mpCallbackData(nullptr) { - if(!(m_pOfficeClass = gOfficeClass.lock())) { + if(!m_pOfficeClass) { m_pOfficeClass.reset(new LibreOfficeKitClass); m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass); -- cgit