Kaydet (Commit) de63cac2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: If341fc7d18bb6f07d76dd259f5dd77b447c93566
üst 26f05d59
...@@ -185,7 +185,7 @@ class SingletonRef ...@@ -185,7 +185,7 @@ class SingletonRef
}; };
template< class SingletonClass > template< class SingletonClass >
SingletonClass* SingletonRef< SingletonClass >::m_pInstance = 0; SingletonClass* SingletonRef< SingletonClass >::m_pInstance = NULL;
template< class SingletonClass > template< class SingletonClass >
sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0; sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
......
...@@ -128,7 +128,7 @@ void Test::testCondition() { ...@@ -128,7 +128,7 @@ void Test::testCondition() {
void Test::testConditionModifier() { void Test::testConditionModifier() {
salhelper::ConditionModifier * p = 0; salhelper::ConditionModifier * p = nullptr;
CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionModifier)); CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionModifier));
CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionModifier *)); CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionModifier *));
CPPUNIT_ASSERT( CPPUNIT_ASSERT(
...@@ -143,7 +143,7 @@ void Test::testConditionModifier() { ...@@ -143,7 +143,7 @@ void Test::testConditionModifier() {
} }
void Test::testConditionWaiter() { void Test::testConditionWaiter() {
salhelper::ConditionWaiter * p = 0; salhelper::ConditionWaiter * p = nullptr;
CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionWaiter)); CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionWaiter));
CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionWaiter *)); CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionWaiter *));
CPPUNIT_ASSERT( CPPUNIT_ASSERT(
...@@ -177,7 +177,7 @@ void Test::testConditionWaiterTimedout() { ...@@ -177,7 +177,7 @@ void Test::testConditionWaiterTimedout() {
} }
void Test::testORealDynamicLoader() { void Test::testORealDynamicLoader() {
salhelper::ORealDynamicLoader * p = 0; salhelper::ORealDynamicLoader * p = nullptr;
CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader)); CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader));
CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ORealDynamicLoader *)); CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ORealDynamicLoader *));
CPPUNIT_ASSERT( CPPUNIT_ASSERT(
...@@ -222,14 +222,14 @@ void Test::testSimpleReferenceObject() { ...@@ -222,14 +222,14 @@ void Test::testSimpleReferenceObject() {
void Test::testDerivedCondition() { void Test::testDerivedCondition() {
osl::Mutex mutex; osl::Mutex mutex;
std::unique_ptr< salhelper::Condition > p(new DerivedCondition(mutex)); std::unique_ptr< salhelper::Condition > p(new DerivedCondition(mutex));
CPPUNIT_ASSERT(dynamic_cast< DerivedCondition * >(p.get()) != 0); CPPUNIT_ASSERT(dynamic_cast< DerivedCondition * >(p.get()) != nullptr);
} }
void Test::testDerivedConditionWaiterTimedout() { void Test::testDerivedConditionWaiterTimedout() {
std::unique_ptr< salhelper::ConditionWaiter::timedout > p( std::unique_ptr< salhelper::ConditionWaiter::timedout > p(
new DerivedConditionWaiterTimedout); new DerivedConditionWaiterTimedout);
CPPUNIT_ASSERT( CPPUNIT_ASSERT(
dynamic_cast< DerivedConditionWaiterTimedout * >(p.get()) != 0); dynamic_cast< DerivedConditionWaiterTimedout * >(p.get()) != nullptr);
try { try {
throw DerivedConditionWaiterTimedout(); throw DerivedConditionWaiterTimedout();
} catch (salhelper::ConditionWaiter::timedout &) { } catch (salhelper::ConditionWaiter::timedout &) {
...@@ -241,7 +241,7 @@ void Test::testDerivedConditionWaiterTimedout() { ...@@ -241,7 +241,7 @@ void Test::testDerivedConditionWaiterTimedout() {
void Test::testDerivedSimpleReferenceObject() { void Test::testDerivedSimpleReferenceObject() {
salhelper::SimpleReferenceObject * p = new DerivedSimpleReferenceObject; salhelper::SimpleReferenceObject * p = new DerivedSimpleReferenceObject;
try { try {
CPPUNIT_ASSERT(dynamic_cast< DerivedSimpleReferenceObject * >(p) != 0); CPPUNIT_ASSERT(dynamic_cast< DerivedSimpleReferenceObject * >(p) != nullptr);
} catch (...) { } catch (...) {
delete static_cast< DerivedSimpleReferenceObject * >(p); delete static_cast< DerivedSimpleReferenceObject * >(p);
throw; throw;
......
...@@ -86,7 +86,7 @@ ConditionWaiter::ConditionWaiter(Condition& aCond) ...@@ -86,7 +86,7 @@ ConditionWaiter::ConditionWaiter(Condition& aCond)
: m_aCond(aCond) : m_aCond(aCond)
{ {
while(true) { while(true) {
osl_waitCondition(m_aCond.m_aCondition,0); osl_waitCondition(m_aCond.m_aCondition,nullptr);
m_aCond.m_aMutex.acquire(); m_aCond.m_aMutex.acquire();
if(m_aCond.applies()) if(m_aCond.applies())
......
...@@ -55,7 +55,7 @@ ORealDynamicLoader* ORealDynamicLoader::newInstance(ORealDynamicLoader ** ppSetT ...@@ -55,7 +55,7 @@ ORealDynamicLoader* ORealDynamicLoader::newInstance(ORealDynamicLoader ** ppSetT
if ( !pModule ) if ( !pModule )
{ {
return NULL; return nullptr;
} }
initFunc = reinterpret_cast<ApiInitFunction>(osl_getFunctionSymbol( initFunc = reinterpret_cast<ApiInitFunction>(osl_getFunctionSymbol(
...@@ -64,7 +64,7 @@ ORealDynamicLoader* ORealDynamicLoader::newInstance(ORealDynamicLoader ** ppSetT ...@@ -64,7 +64,7 @@ ORealDynamicLoader* ORealDynamicLoader::newInstance(ORealDynamicLoader ** ppSetT
if ( !initFunc ) if ( !initFunc )
{ {
osl_unloadModule(pModule); osl_unloadModule(pModule);
return NULL; return nullptr;
} }
return(new ORealDynamicLoader(ppSetToZeroInDestructor, moduleName, return(new ORealDynamicLoader(ppSetToZeroInDestructor, moduleName,
...@@ -78,14 +78,14 @@ ORealDynamicLoader::~ORealDynamicLoader() ...@@ -78,14 +78,14 @@ ORealDynamicLoader::~ORealDynamicLoader()
{ {
// set the address to zero // set the address to zero
if( ppSetToZeroInDestructor ) if( ppSetToZeroInDestructor )
*ppSetToZeroInDestructor = 0; *ppSetToZeroInDestructor = nullptr;
if (m_pModule) if (m_pModule)
{ {
#ifndef DISABLE_DYNLOADING #ifndef DISABLE_DYNLOADING
osl_unloadModule(m_pModule); osl_unloadModule(m_pModule);
#endif #endif
m_pModule = NULL; m_pModule = nullptr;
} }
} }
......
...@@ -83,7 +83,7 @@ Timer::Timer() ...@@ -83,7 +83,7 @@ Timer::Timer()
: m_aTimeOut( 0 ), : m_aTimeOut( 0 ),
m_aExpired( 0 ), m_aExpired( 0 ),
m_aRepeatDelta( 0 ), m_aRepeatDelta( 0 ),
m_pNext( NULL ) m_pNext( nullptr )
{ {
} }
...@@ -91,7 +91,7 @@ Timer::Timer( const TTimeValue& rTime ) ...@@ -91,7 +91,7 @@ Timer::Timer( const TTimeValue& rTime )
: m_aTimeOut( rTime ), : m_aTimeOut( rTime ),
m_aExpired( 0 ), m_aExpired( 0 ),
m_aRepeatDelta( 0 ), m_aRepeatDelta( 0 ),
m_pNext( NULL ) m_pNext( nullptr )
{ {
} }
...@@ -99,7 +99,7 @@ Timer::Timer( const TTimeValue& rTime, const TTimeValue& Repeat ) ...@@ -99,7 +99,7 @@ Timer::Timer( const TTimeValue& rTime, const TTimeValue& Repeat )
: m_aTimeOut( rTime ), : m_aTimeOut( rTime ),
m_aExpired( 0 ), m_aExpired( 0 ),
m_aRepeatDelta( Repeat ), m_aRepeatDelta( Repeat ),
m_pNext( NULL ) m_pNext( nullptr )
{ {
} }
...@@ -119,7 +119,7 @@ void Timer::start() ...@@ -119,7 +119,7 @@ void Timer::start()
OSL_ASSERT(pManager); OSL_ASSERT(pManager);
if ( pManager != 0 ) if ( pManager != nullptr )
{ {
pManager->registerTimer(this); pManager->registerTimer(this);
} }
...@@ -132,7 +132,7 @@ void Timer::stop() ...@@ -132,7 +132,7 @@ void Timer::stop()
OSL_ASSERT(pManager); OSL_ASSERT(pManager);
if ( pManager != 0 ) if ( pManager != nullptr )
{ {
pManager->unregisterTimer(this); pManager->unregisterTimer(this);
} }
...@@ -164,7 +164,7 @@ sal_Bool Timer::expiresBefore(const Timer* pTimer) const ...@@ -164,7 +164,7 @@ sal_Bool Timer::expiresBefore(const Timer* pTimer) const
{ {
OSL_ASSERT(pTimer); OSL_ASSERT(pTimer);
if ( pTimer != 0 ) if ( pTimer != nullptr )
{ {
return m_aExpired < pTimer->m_aExpired; return m_aExpired < pTimer->m_aExpired;
} }
...@@ -242,17 +242,17 @@ namespace ...@@ -242,17 +242,17 @@ namespace
struct theTimerManagerMutex : public rtl::Static< osl::Mutex, theTimerManagerMutex> {}; struct theTimerManagerMutex : public rtl::Static< osl::Mutex, theTimerManagerMutex> {};
} }
TimerManager* salhelper::TimerManager::m_pManager = NULL; TimerManager* salhelper::TimerManager::m_pManager = nullptr;
TimerManager::TimerManager() TimerManager::TimerManager()
{ {
osl::MutexGuard Guard(theTimerManagerMutex::get()); osl::MutexGuard Guard(theTimerManagerMutex::get());
OSL_ASSERT(m_pManager == 0); OSL_ASSERT(m_pManager == nullptr);
m_pManager = this; m_pManager = this;
m_pHead= 0; m_pHead= nullptr;
m_notEmpty.reset(); m_notEmpty.reset();
...@@ -265,7 +265,7 @@ TimerManager::~TimerManager() ...@@ -265,7 +265,7 @@ TimerManager::~TimerManager()
osl::MutexGuard Guard(theTimerManagerMutex::get()); osl::MutexGuard Guard(theTimerManagerMutex::get());
if ( m_pManager == this ) if ( m_pManager == this )
m_pManager = 0; m_pManager = nullptr;
} }
void TimerManager::onTerminated() void TimerManager::onTerminated()
...@@ -287,7 +287,7 @@ bool TimerManager::registerTimer(Timer* pTimer) ...@@ -287,7 +287,7 @@ bool TimerManager::registerTimer(Timer* pTimer)
{ {
OSL_ASSERT(pTimer); OSL_ASSERT(pTimer);
if ( pTimer == 0 ) if ( pTimer == nullptr )
{ {
return false; return false;
} }
...@@ -328,7 +328,7 @@ bool TimerManager::unregisterTimer(Timer* pTimer) ...@@ -328,7 +328,7 @@ bool TimerManager::unregisterTimer(Timer* pTimer)
{ {
OSL_ASSERT(pTimer); OSL_ASSERT(pTimer);
if ( pTimer == 0 ) if ( pTimer == nullptr )
{ {
return false; return false;
} }
...@@ -356,7 +356,7 @@ bool TimerManager::lookupTimer(const Timer* pTimer) ...@@ -356,7 +356,7 @@ bool TimerManager::lookupTimer(const Timer* pTimer)
{ {
OSL_ASSERT(pTimer); OSL_ASSERT(pTimer);
if ( pTimer == 0 ) if ( pTimer == nullptr )
{ {
return false; return false;
} }
...@@ -365,7 +365,7 @@ bool TimerManager::lookupTimer(const Timer* pTimer) ...@@ -365,7 +365,7 @@ bool TimerManager::lookupTimer(const Timer* pTimer)
osl::MutexGuard Guard(m_Lock); osl::MutexGuard Guard(m_Lock);
// check the list // check the list
for (Timer* pIter = m_pHead; pIter != 0; pIter= pIter->m_pNext) for (Timer* pIter = m_pHead; pIter != nullptr; pIter= pIter->m_pNext)
{ {
if (pIter == pTimer) if (pIter == pTimer)
{ {
...@@ -381,7 +381,7 @@ void TimerManager::checkForTimeout() ...@@ -381,7 +381,7 @@ void TimerManager::checkForTimeout()
m_Lock.acquire(); m_Lock.acquire();
if ( m_pHead == 0 ) if ( m_pHead == nullptr )
{ {
m_Lock.release(); m_Lock.release();
return; return;
...@@ -434,19 +434,19 @@ void TimerManager::run() ...@@ -434,19 +434,19 @@ void TimerManager::run()
while (schedule()) while (schedule())
{ {
TTimeValue delay; TTimeValue delay;
TTimeValue* pDelay=0; TTimeValue* pDelay=nullptr;
m_Lock.acquire(); m_Lock.acquire();
if (m_pHead != 0) if (m_pHead != nullptr)
{ {
delay = m_pHead->getRemainingTime(); delay = m_pHead->getRemainingTime();
pDelay=&delay; pDelay=&delay;
} }
else else
{ {
pDelay=0; pDelay=nullptr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment