Bug 1047781 - Fix more bad implicit constructors in XPCOM; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 05 Aug 2014 09:21:27 -0400
changeset 197938 0f10ded995a781358e0ee20b32c4e55cc4803c6e
parent 197937 2dbeb8d5eeec4b6a1502036ed798c576fafb7528
child 197939 b81d755b1b376ea2b23b38fd0de5ac1d92c31239
push id27256
push userkwierso@gmail.com
push dateWed, 06 Aug 2014 00:06:20 +0000
treeherdermozilla-central@6cbdd4d523a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1047781
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1047781 - Fix more bad implicit constructors in XPCOM; r=froydnj
xpcom/build/FileLocation.h
xpcom/components/ManifestParser.cpp
xpcom/components/nsCategoryManager.h
xpcom/components/nsComponentManager.cpp
xpcom/components/nsComponentManager.h
xpcom/reflect/xptinfo/xptiprivate.h
--- a/xpcom/build/FileLocation.h
+++ b/xpcom/build/FileLocation.h
@@ -31,17 +31,17 @@ public:
    * of a file path.
    */
   FileLocation();
   ~FileLocation();
 
   /**
    * Constructor for plain files
    */
-  FileLocation(nsIFile *file);
+  explicit FileLocation(nsIFile *file);
 
   /**
    * Constructors for path within an archive. The archive can be given either
    * as nsIFile or nsZipArchive.
    */
   FileLocation(nsIFile *zip, const char *path);
 
   FileLocation(nsZipArchive *zip, const char *path);
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -148,17 +148,17 @@ static bool
 IsNewline(char aChar)
 {
   return aChar == '\n' || aChar == '\r';
 }
 
 namespace {
 struct AutoPR_smprintf_free
 {
-  AutoPR_smprintf_free(char* aBuf) : mBuf(aBuf) {}
+  explicit AutoPR_smprintf_free(char* aBuf) : mBuf(aBuf) {}
 
   ~AutoPR_smprintf_free()
   {
     if (mBuf) {
       PR_smprintf_free(mBuf);
     }
   }
 
--- a/xpcom/components/nsCategoryManager.h
+++ b/xpcom/components/nsCategoryManager.h
@@ -29,17 +29,17 @@ class nsIMemoryReporter;
  * we need to keep a "persistent value" (which will be written to the registry)
  * and a non-persistent value (for the current runtime): these are usually
  * the same, except when aPersist==false. The strings are permanently arena-
  * allocated, and will never go away.
  */
 class CategoryLeaf : public nsDepCharHashKey
 {
 public:
-  CategoryLeaf(const char* aKey) : nsDepCharHashKey(aKey), value(nullptr) {}
+  explicit CategoryLeaf(const char* aKey) : nsDepCharHashKey(aKey), value(nullptr) {}
   const char* value;
 };
 
 
 /**
  * CategoryNode keeps a hashtable of its entries.
  * the CategoryNode itself is permanently allocated in
  * the arena.
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -210,17 +210,17 @@ ArenaStrdup(const char* aStr, PLArenaPoo
 // without reentering it later in the block. This class supports that
 // style of early-exit that MutexAutoUnlock doesn't.
 
 namespace {
 
 class MOZ_STACK_CLASS MutexLock
 {
 public:
-  MutexLock(SafeMutex& aMutex)
+  explicit MutexLock(SafeMutex& aMutex)
     : mMutex(aMutex)
     , mLocked(false)
   {
     Lock();
   }
 
   ~MutexLock()
   {
--- a/xpcom/components/nsComponentManager.h
+++ b/xpcom/components/nsComponentManager.h
@@ -73,17 +73,17 @@ extern const mozilla::Module kXPCOMModul
  * This is a wrapper around mozilla::Mutex which provides runtime
  * checking for a deadlock where the same thread tries to lock a mutex while
  * it is already locked. This checking is present in both debug and release
  * builds.
  */
 class SafeMutex
 {
 public:
-  SafeMutex(const char* aName)
+  explicit SafeMutex(const char* aName)
     : mMutex(aName)
     , mOwnerThread(nullptr)
   {
   }
 
   ~SafeMutex() {}
 
   void Lock()
@@ -207,24 +207,24 @@ public:
     KnownModule(const mozilla::Module* aModule, mozilla::FileLocation& aFile)
       : mModule(aModule)
       , mFile(aFile)
       , mLoaded(false)
       , mFailed(false)
     {
     }
 
-    KnownModule(const mozilla::Module* aModule)
+    explicit KnownModule(const mozilla::Module* aModule)
       : mModule(aModule)
       , mLoaded(false)
       , mFailed(false)
     {
     }
 
-    KnownModule(mozilla::FileLocation& aFile)
+    explicit KnownModule(mozilla::FileLocation& aFile)
       : mModule(nullptr)
       , mFile(aFile)
       , mLoader(nullptr)
       , mLoaded(false)
       , mFailed(false)
     {
     }
 
--- a/xpcom/reflect/xptinfo/xptiprivate.h
+++ b/xpcom/reflect/xptinfo/xptiprivate.h
@@ -102,17 +102,17 @@ public:
         NS_ASSERTION(i < GetEntryCount(),"bad param!");
         mEntryArray[i] = ptr;
     }        
 
     xptiInterfaceEntry* GetEntryAt(uint16_t i);
     const char* GetEntryNameAt(uint16_t i);
 
 private:
-    xptiTypelibGuts(XPTHeader* aHeader)
+    explicit xptiTypelibGuts(XPTHeader* aHeader)
         : mHeader(aHeader)
     { }
     ~xptiTypelibGuts();
 
 private:
     XPTHeader*           mHeader;        // hold pointer into arena
     xptiInterfaceEntry*  mEntryArray[1]; // Always last. Sized to fit.
 };
@@ -123,17 +123,17 @@ private:
 
 // This class exists to help xptiInterfaceInfo store a 4-state (2 bit) value 
 // and a set of bitflags in one 8bit value. See below.
 
 class xptiInfoFlags
 {
     enum {STATE_MASK = 3};
 public:
-    xptiInfoFlags(uint8_t n) : mData(n) {}
+    explicit xptiInfoFlags(uint8_t n) : mData(n) {}
     xptiInfoFlags(const xptiInfoFlags& r) : mData(r.mData) {}
 
     static uint8_t GetStateMask()
         {return uint8_t(STATE_MASK);}
     
     void Clear()
         {mData = 0;}
 
@@ -329,17 +329,17 @@ public:
     NS_IMETHOD IsIID(const nsIID * IID, bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsIID(IID, _retval); }
     NS_IMETHOD GetNameShared(const char **name) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetNameShared(name); }
     NS_IMETHOD GetIIDShared(const nsIID * *iid) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDShared(iid); }
     NS_IMETHOD IsFunction(bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsFunction(_retval); }
     NS_IMETHOD HasAncestor(const nsIID * iid, bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->HasAncestor(iid, _retval); }
     NS_IMETHOD GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParamNoAlloc(methodIndex, param, iid); }
 
 public:
-    xptiInterfaceInfo(xptiInterfaceEntry* entry);
+    explicit xptiInterfaceInfo(xptiInterfaceEntry* entry);
 
     void Invalidate() 
         {NS_IF_RELEASE(mParent); mEntry = nullptr;}
 
 private:
 
     ~xptiInterfaceInfo();