From a635ff39b2ebc3581d2e64955c641abd92533f1c Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:36:59 -0400 Subject: [PATCH] Bug 1048280 - Fix more bad implicit constructors in XPCOM; r=froydnj --- xpcom/build/IOInterposer.cpp | 2 +- xpcom/build/IOInterposerPrivate.h | 6 +++--- xpcom/build/LateWriteChecks.cpp | 2 +- xpcom/build/NSPRInterposer.cpp | 2 +- xpcom/io/nsPipe3.cpp | 4 ++-- xpcom/io/nsUnicharInputStream.cpp | 2 +- xpcom/tests/TestCOMArray.cpp | 2 +- xpcom/tests/TestHarness.h | 4 ++-- xpcom/tests/TestHashtables.cpp | 4 ++-- xpcom/tests/TestObserverService.cpp | 2 +- xpcom/tests/TestRacingServiceManager.cpp | 2 +- xpcom/tests/TestThreadPoolListener.cpp | 2 +- xpcom/threads/TimerThread.cpp | 2 +- xpcom/threads/nsThread.cpp | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/xpcom/build/IOInterposer.cpp b/xpcom/build/IOInterposer.cpp index 03f8944cafe..d33ee03b96e 100644 --- a/xpcom/build/IOInterposer.cpp +++ b/xpcom/build/IOInterposer.cpp @@ -79,7 +79,7 @@ public: class PerThreadData { public: - PerThreadData(bool aIsMainThread = false) + explicit PerThreadData(bool aIsMainThread = false) : mIsMainThread(aIsMainThread) , mIsHandlingObservation(false) , mCurrentGeneration(0) diff --git a/xpcom/build/IOInterposerPrivate.h b/xpcom/build/IOInterposerPrivate.h index 0ba84abc7d0..84a80512267 100644 --- a/xpcom/build/IOInterposerPrivate.h +++ b/xpcom/build/IOInterposerPrivate.h @@ -71,7 +71,7 @@ private: class MonitorAutoLock { public: - MonitorAutoLock(Monitor &aMonitor) + explicit MonitorAutoLock(Monitor &aMonitor) : mMonitor(aMonitor) { mMonitor.Lock(); @@ -99,7 +99,7 @@ private: class MonitorAutoUnlock { public: - MonitorAutoUnlock(Monitor &aMonitor) + explicit MonitorAutoUnlock(Monitor &aMonitor) : mMonitor(aMonitor) { mMonitor.Unlock(); @@ -145,7 +145,7 @@ private: class AutoLock { public: - AutoLock(Mutex& aLock) + explicit AutoLock(Mutex& aLock) : mLock(aLock) { mLock.Lock(); diff --git a/xpcom/build/LateWriteChecks.cpp b/xpcom/build/LateWriteChecks.cpp index 891998314c3..dfdc8661f38 100644 --- a/xpcom/build/LateWriteChecks.cpp +++ b/xpcom/build/LateWriteChecks.cpp @@ -94,7 +94,7 @@ static void RecordStackWalker(void *aPC, void *aSP, void *aClosure) class LateWriteObserver MOZ_FINAL : public IOInterposeObserver { public: - LateWriteObserver(const char* aProfileDirectory) + explicit LateWriteObserver(const char* aProfileDirectory) : mProfileDirectory(PL_strdup(aProfileDirectory)) { } diff --git a/xpcom/build/NSPRInterposer.cpp b/xpcom/build/NSPRInterposer.cpp index dfa57b20fa1..3b55da149f1 100644 --- a/xpcom/build/NSPRInterposer.cpp +++ b/xpcom/build/NSPRInterposer.cpp @@ -27,7 +27,7 @@ PRFileInfo64FN sFileInfo64Fn = nullptr; class NSPRIOAutoObservation : public IOInterposeObserver::Observation { public: - NSPRIOAutoObservation(IOInterposeObserver::Operation aOp) + explicit NSPRIOAutoObservation(IOInterposeObserver::Operation aOp) : IOInterposeObserver::Observation(aOp, "NSPRIOInterposer") { } diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index 009bbda1f29..327f51daec5 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -109,7 +109,7 @@ public: NS_DECL_NSISEARCHABLEINPUTSTREAM NS_DECL_NSICLASSINFO - nsPipeInputStream(nsPipe* aPipe) + explicit nsPipeInputStream(nsPipe* aPipe) : mPipe(aPipe) , mReaderRefCnt(0) , mLogicalOffset(0) @@ -176,7 +176,7 @@ public: NS_DECL_NSIASYNCOUTPUTSTREAM NS_DECL_NSICLASSINFO - nsPipeOutputStream(nsPipe* aPipe) + explicit nsPipeOutputStream(nsPipe* aPipe) : mPipe(aPipe) , mWriterRefCnt(0) , mLogicalOffset(0) diff --git a/xpcom/io/nsUnicharInputStream.cpp b/xpcom/io/nsUnicharInputStream.cpp index cfe6fe6184c..ee302948945 100644 --- a/xpcom/io/nsUnicharInputStream.cpp +++ b/xpcom/io/nsUnicharInputStream.cpp @@ -26,7 +26,7 @@ class StringUnicharInputStream MOZ_FINAL : public nsIUnicharInputStream { public: - StringUnicharInputStream(const nsAString& aString) : + explicit StringUnicharInputStream(const nsAString& aString) : mString(aString), mPos(0), mLen(aString.Length()) { } NS_DECL_ISUPPORTS diff --git a/xpcom/tests/TestCOMArray.cpp b/xpcom/tests/TestCOMArray.cpp index 545990650f7..c3be1f63f4e 100644 --- a/xpcom/tests/TestCOMArray.cpp +++ b/xpcom/tests/TestCOMArray.cpp @@ -29,7 +29,7 @@ class Foo MOZ_FINAL : public IFoo { public: - Foo(int32_t aID); + explicit Foo(int32_t aID); // nsISupports implementation NS_DECL_ISUPPORTS diff --git a/xpcom/tests/TestHarness.h b/xpcom/tests/TestHarness.h index b20b3d1e2e5..564504c078a 100644 --- a/xpcom/tests/TestHarness.h +++ b/xpcom/tests/TestHarness.h @@ -100,8 +100,8 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2 public: NS_DECL_ISUPPORTS - ScopedXPCOM(const char* testName, - nsIDirectoryServiceProvider *dirSvcProvider = nullptr) + explicit ScopedXPCOM(const char* testName, + nsIDirectoryServiceProvider *dirSvcProvider = nullptr) : mDirSvcProvider(dirSvcProvider) { mTestName = testName; diff --git a/xpcom/tests/TestHashtables.cpp b/xpcom/tests/TestHashtables.cpp index 5d3ac01b912..ef5eefd138c 100644 --- a/xpcom/tests/TestHashtables.cpp +++ b/xpcom/tests/TestHashtables.cpp @@ -21,7 +21,7 @@ namespace TestHashtables { class TestUniChar // for nsClassHashtable { public: - TestUniChar(uint32_t aWord) + explicit TestUniChar(uint32_t aWord) { printf(" TestUniChar::TestUniChar() %u\n", aWord); mWord = aWord; @@ -70,7 +70,7 @@ public: typedef const char* KeyType; typedef const char* KeyTypePointer; - EntityToUnicodeEntry(const char* aKey) { mNode = nullptr; } + explicit EntityToUnicodeEntry(const char* aKey) { mNode = nullptr; } EntityToUnicodeEntry(const EntityToUnicodeEntry& aEntry) { mNode = aEntry.mNode; } ~EntityToUnicodeEntry() { } diff --git a/xpcom/tests/TestObserverService.cpp b/xpcom/tests/TestObserverService.cpp index ebe2b3f3499..4c1058e95b7 100644 --- a/xpcom/tests/TestObserverService.cpp +++ b/xpcom/tests/TestObserverService.cpp @@ -34,7 +34,7 @@ class TestObserver MOZ_FINAL : public nsIObserver, public nsSupportsWeakReference { public: - TestObserver( const nsAString &name ) + explicit TestObserver( const nsAString &name ) : mName( name ) { } NS_DECL_ISUPPORTS diff --git a/xpcom/tests/TestRacingServiceManager.cpp b/xpcom/tests/TestRacingServiceManager.cpp index 1852cf34d83..23ba19981fb 100644 --- a/xpcom/tests/TestRacingServiceManager.cpp +++ b/xpcom/tests/TestRacingServiceManager.cpp @@ -67,7 +67,7 @@ bool gMainThreadWaiting = false; class AutoCreateAndDestroyReentrantMonitor { public: - AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) + explicit AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) : mReentrantMonitorPtr(aReentrantMonitorPtr) { *aReentrantMonitorPtr = new ReentrantMonitor("TestRacingServiceManager::AutoMon"); diff --git a/xpcom/tests/TestThreadPoolListener.cpp b/xpcom/tests/TestThreadPoolListener.cpp index 05a91293c0a..9b0b10a4125 100644 --- a/xpcom/tests/TestThreadPoolListener.cpp +++ b/xpcom/tests/TestThreadPoolListener.cpp @@ -115,7 +115,7 @@ Listener::OnThreadShuttingDown() class AutoCreateAndDestroyReentrantMonitor { public: - AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) + explicit AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) : mReentrantMonitorPtr(aReentrantMonitorPtr) { *aReentrantMonitorPtr = new ReentrantMonitor("TestThreadPoolListener::AutoMon"); TEST_ASSERTION(*aReentrantMonitorPtr, "Out of memory!"); diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index 767f0e5c2bb..3ac8f24473e 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -51,7 +51,7 @@ namespace { class TimerObserverRunnable : public nsRunnable { public: - TimerObserverRunnable(nsIObserver* aObserver) + explicit TimerObserverRunnable(nsIObserver* aObserver) : mObserver(aObserver) { } diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index d62e923160e..f3f7fe2d1ad 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -243,7 +243,7 @@ struct nsThreadShutdownContext class nsThreadShutdownAckEvent : public nsRunnable { public: - nsThreadShutdownAckEvent(nsThreadShutdownContext* aCtx) + explicit nsThreadShutdownAckEvent(nsThreadShutdownContext* aCtx) : mShutdownContext(aCtx) { }