Bug 1060975 - Fix bad implicit constructors in security; r=bsmith
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 31 Aug 2014 19:26:27 -0400
changeset 202747 504e18c45b864be7c395d91a673cbb13dc1d096f
parent 202746 674b44ed649099c1604e296e01aef0a0a23050ba
child 202748 7f2131f9d67442142c6293fdad1ac2866c1279b8
push id48473
push usereakhgari@mozilla.com
push dateSun, 31 Aug 2014 23:26:50 +0000
treeherdermozilla-inbound@504e18c45b86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmith
bugs1060975
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 1060975 - Fix bad implicit constructors in security; r=bsmith
security/manager/boot/src/nsSecureBrowserUIImpl.cpp
security/manager/ssl/src/PSMContentListener.cpp
security/manager/ssl/src/SSLServerCertVerification.cpp
security/manager/ssl/src/SharedSSLState.cpp
security/manager/ssl/src/nsCertOverrideService.h
security/manager/ssl/src/nsClientAuthRemember.h
security/manager/ssl/src/nsNSSCertTrust.h
security/manager/ssl/src/nsNSSCertValidity.h
security/manager/ssl/src/nsNSSCertificate.h
security/manager/ssl/src/nsNSSCleaner.h
security/manager/ssl/src/nsNSSIOLayer.cpp
security/manager/ssl/src/nsPK11TokenDB.h
security/manager/ssl/src/nsPKCS11Slot.h
security/manager/ssl/src/nsSmartCardMonitor.h
security/manager/ssl/src/nsUsageArrayHelper.h
security/pkix/include/pkix/Time.h
--- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
@@ -92,17 +92,17 @@ static const PLDHashTableOps gMapOps = {
   PL_DHashClearEntryStub,
   PL_DHashFinalizeStub,
   RequestMapInitEntry
 };
 
 #ifdef DEBUG
 class nsAutoAtomic {
   public:
-    nsAutoAtomic(Atomic<int32_t> &i)
+    explicit nsAutoAtomic(Atomic<int32_t> &i)
     :mI(i) {
       mI++;
     }
 
     ~nsAutoAtomic() {
       mI--;
     }
 
@@ -1640,17 +1640,17 @@ nsSecureBrowserUIImpl::CheckPost(nsIURI 
 // as context for NSS calls
 //
 class nsUIContext : public nsIInterfaceRequestor
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINTERFACEREQUESTOR
 
-  nsUIContext(nsIDOMWindow *window);
+  explicit nsUIContext(nsIDOMWindow *window);
 
 protected:
   virtual ~nsUIContext();
 
 private:
   nsCOMPtr<nsIDOMWindow> mWindow;
 };
 
--- a/security/manager/ssl/src/PSMContentListener.cpp
+++ b/security/manager/ssl/src/PSMContentListener.cpp
@@ -30,17 +30,17 @@ extern PRLogModuleInfo* gPIPNSSLog;
 namespace mozilla { namespace psm {
 
 namespace {
 
 class PSMContentDownloader : public nsIStreamListener
 {
 public:
   PSMContentDownloader() {NS_ASSERTION(false, "don't use this constructor."); }
-  PSMContentDownloader(uint32_t type);
+  explicit PSMContentDownloader(uint32_t type);
   void setSilentDownload(bool flag);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
   enum {UNKNOWN_TYPE = 0};
   enum {X509_CA_CERT  = 1};
--- a/security/manager/ssl/src/SSLServerCertVerification.cpp
+++ b/security/manager/ssl/src/SSLServerCertVerification.cpp
@@ -592,17 +592,17 @@ CreateCertErrorRunnable(CertVerifier& ce
 // on both of these threads because it calls TransportSecurityInfo::GetInterface(),
 // which may call nsHttpConnection::GetInterface() through
 // TransportSecurityInfo::mCallbacks. nsHttpConnection::GetInterface must always
 // execute on the main thread, with the socket transport service thread
 // blocked.
 class CertErrorRunnableRunnable : public nsRunnable
 {
 public:
-  CertErrorRunnableRunnable(CertErrorRunnable* certErrorRunnable)
+  explicit CertErrorRunnableRunnable(CertErrorRunnable* certErrorRunnable)
     : mCertErrorRunnable(certErrorRunnable)
   {
   }
 private:
   NS_IMETHOD Run()
   {
     nsresult rv = mCertErrorRunnable->DispatchToMainThreadAndWait();
     // The result must run on the socket transport thread, which we are already
--- a/security/manager/ssl/src/SharedSSLState.cpp
+++ b/security/manager/ssl/src/SharedSSLState.cpp
@@ -88,17 +88,17 @@ void ClearPrivateSSLState()
 
 namespace psm {
 
 namespace {
 class PrivateBrowsingObserver : public nsIObserver {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
-  PrivateBrowsingObserver(SharedSSLState* aOwner) : mOwner(aOwner) {}
+  explicit PrivateBrowsingObserver(SharedSSLState* aOwner) : mOwner(aOwner) {}
 protected:
   virtual ~PrivateBrowsingObserver() {}
 private:
   SharedSSLState* mOwner;
 };
 
 SharedSSLState* gPublicState;
 SharedSSLState* gPrivateState;
--- a/security/manager/ssl/src/nsCertOverrideService.h
+++ b/security/manager/ssl/src/nsCertOverrideService.h
@@ -66,17 +66,17 @@ public:
 class nsCertOverrideEntry MOZ_FINAL : public PLDHashEntryHdr
 {
   public:
     // Hash methods
     typedef const char* KeyType;
     typedef const char* KeyTypePointer;
 
     // do nothing with aHost - we require mHead to be set before we're live!
-    nsCertOverrideEntry(KeyTypePointer aHostWithPortUTF8)
+    explicit nsCertOverrideEntry(KeyTypePointer aHostWithPortUTF8)
     {
     }
 
     nsCertOverrideEntry(const nsCertOverrideEntry& toCopy)
     {
       mSettings = toCopy.mSettings;
       mHostWithPort = toCopy.mHostWithPort;
     }
--- a/security/manager/ssl/src/nsClientAuthRemember.h
+++ b/security/manager/ssl/src/nsClientAuthRemember.h
@@ -47,17 +47,17 @@ public:
 class nsClientAuthRememberEntry MOZ_FINAL : public PLDHashEntryHdr
 {
   public:
     // Hash methods
     typedef const char* KeyType;
     typedef const char* KeyTypePointer;
 
     // do nothing with aHost - we require mHead to be set before we're live!
-    nsClientAuthRememberEntry(KeyTypePointer aHostWithCertUTF8)
+    explicit nsClientAuthRememberEntry(KeyTypePointer aHostWithCertUTF8)
     {
     }
 
     nsClientAuthRememberEntry(const nsClientAuthRememberEntry& toCopy)
     {
       mSettings = toCopy.mSettings;
     }
 
--- a/security/manager/ssl/src/nsNSSCertTrust.h
+++ b/security/manager/ssl/src/nsNSSCertTrust.h
@@ -13,17 +13,17 @@
  * 
  * Class for maintaining trust flags for an NSS certificate.
  */
 class nsNSSCertTrust
 {
 public:
   nsNSSCertTrust();
   nsNSSCertTrust(unsigned int ssl, unsigned int email, unsigned int objsign);
-  nsNSSCertTrust(CERTCertTrust *t);
+  explicit nsNSSCertTrust(CERTCertTrust *t);
   virtual ~nsNSSCertTrust();
 
   /* query */
   bool HasAnyCA();
   bool HasAnyUser();
   bool HasCA(bool checkSSL = true, 
                bool checkEmail = true,  
                bool checkObjSign = true);
--- a/security/manager/ssl/src/nsNSSCertValidity.h
+++ b/security/manager/ssl/src/nsNSSCertValidity.h
@@ -11,17 +11,17 @@
 
 class nsX509CertValidity : public nsIX509CertValidity
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIX509CERTVALIDITY
 
   nsX509CertValidity();
-  nsX509CertValidity(CERTCertificate *cert);
+  explicit nsX509CertValidity(CERTCertificate *cert);
 
 protected:
   virtual ~nsX509CertValidity();
   /* additional members */
 
 private:
   PRTime mNotBefore, mNotAfter;
   bool mTimesInitialized;
--- a/security/manager/ssl/src/nsNSSCertificate.h
+++ b/security/manager/ssl/src/nsNSSCertificate.h
@@ -35,17 +35,17 @@ public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIX509CERT
   NS_DECL_NSIIDENTITYINFO
   NS_DECL_NSISERIALIZABLE
   NS_DECL_NSICLASSINFO
 
   friend class nsNSSCertificateFakeTransport;
 
-  nsNSSCertificate(CERTCertificate* cert, SECOidTag* evOidPolicy = nullptr);
+  explicit nsNSSCertificate(CERTCertificate* cert, SECOidTag* evOidPolicy = nullptr);
   nsNSSCertificate();
   nsresult FormatUIStrings(const nsAutoString& nickname,
                            nsAutoString& nickWithSerial,
                            nsAutoString& details);
   static nsNSSCertificate* Create(CERTCertificate*cert = nullptr,
                                   SECOidTag* evOidPolicy = nullptr);
   static nsNSSCertificate* ConstructFromDER(char* certDER, int derLen);
 
--- a/security/manager/ssl/src/nsNSSCleaner.h
+++ b/security/manager/ssl/src/nsNSSCleaner.h
@@ -55,17 +55,17 @@
 class nsstype##Cleaner                             \
 {                                                  \
 private:                                           \
   nsstype##Cleaner(const nsstype##Cleaner&);       \
   nsstype##Cleaner();                              \
   void operator=(const nsstype##Cleaner&);         \
   nsstype *&object;                                \
 public:                                            \
-  nsstype##Cleaner(nsstype *&a_object)             \
+  explicit nsstype##Cleaner(nsstype *&a_object)    \
     :object(a_object) {}                           \
   ~nsstype##Cleaner() {                            \
     if (object) {                                  \
       cleanfunc(object);                           \
       object = nullptr;                             \
     }                                              \
   }                                                \
   void detach() {object=nullptr;}                   \
@@ -75,31 +75,31 @@ public:                                 
 class nsstype##Cleaner##namesuffix                 \
 {                                                  \
 private:                                           \
   nsstype##Cleaner##namesuffix(const nsstype##Cleaner##namesuffix &); \
   nsstype##Cleaner##namesuffix();                                     \
   void operator=(const nsstype##Cleaner##namesuffix &);               \
   nsstype *&object;                                \
 public:                                            \
-  nsstype##Cleaner##namesuffix(nsstype *&a_object) \
+  explicit nsstype##Cleaner##namesuffix(nsstype *&a_object)           \
     :object(a_object) {}                           \
   ~nsstype##Cleaner##namesuffix() {                \
     if (object) {                                  \
       cleanfunc(object, paramvalue);               \
       object = nullptr;                             \
     }                                              \
   }                                                \
   void detach() {object=nullptr;}                   \
 };
 
 #include "certt.h"
 
 class CERTVerifyLogContentsCleaner
 {
 public:
-  CERTVerifyLogContentsCleaner(CERTVerifyLog *&cvl);
+  explicit CERTVerifyLogContentsCleaner(CERTVerifyLog *&cvl);
   ~CERTVerifyLogContentsCleaner();
 private:
   CERTVerifyLog *&m_cvl;
 };
 
 #endif
--- a/security/manager/ssl/src/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
@@ -553,17 +553,17 @@ nsNSSSocketInfo::SetFileDescPtr(PRFileDe
   mFd = aFilePtr;
   return NS_OK;
 }
 
 #ifndef MOZ_NO_EV_CERTS
 class PreviousCertRunnable : public SyncRunnableBase
 {
 public:
-  PreviousCertRunnable(nsIInterfaceRequestor* callbacks)
+  explicit PreviousCertRunnable(nsIInterfaceRequestor* callbacks)
     : mCallbacks(callbacks)
   {
   }
 
   virtual void RunOnTargetThread()
   {
     nsCOMPtr<nsISecureBrowserUI> secureUI;
     getSecureBrowserUI(mCallbacks, getter_AddRefs(secureUI));
@@ -1436,17 +1436,17 @@ PSMAvailable64(void)
 }
 
 namespace {
 
 class PrefObserver : public nsIObserver {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOBSERVER
-  PrefObserver(nsSSLIOLayerHelpers* aOwner) : mOwner(aOwner) {}
+  explicit PrefObserver(nsSSLIOLayerHelpers* aOwner) : mOwner(aOwner) {}
 
 protected:
   virtual ~PrefObserver() {}
 private:
   nsSSLIOLayerHelpers* mOwner;
 };
 
 } // unnamed namespace
--- a/security/manager/ssl/src/nsPK11TokenDB.h
+++ b/security/manager/ssl/src/nsPK11TokenDB.h
@@ -18,17 +18,17 @@
 
 class nsPK11Token : public nsIPK11Token,
                     public nsNSSShutDownObject
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPK11TOKEN
 
-  nsPK11Token(PK11SlotInfo *slot);
+  explicit nsPK11Token(PK11SlotInfo *slot);
   /* additional members */
 
 protected:
   virtual ~nsPK11Token();
 
 private:
   friend class nsPK11TokenDB;
   void refreshTokenInfo();
--- a/security/manager/ssl/src/nsPKCS11Slot.h
+++ b/security/manager/ssl/src/nsPKCS11Slot.h
@@ -18,17 +18,17 @@
 
 class nsPKCS11Slot : public nsIPKCS11Slot,
                      public nsNSSShutDownObject
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPKCS11SLOT
 
-  nsPKCS11Slot(PK11SlotInfo *slot);
+  explicit nsPKCS11Slot(PK11SlotInfo *slot);
 
 protected:
   virtual ~nsPKCS11Slot();
 
 private:
 
   PK11SlotInfo *mSlot;
   nsString mSlotDesc, mSlotManID, mSlotHWVersion, mSlotFWVersion;
@@ -41,17 +41,17 @@ private:
 
 class nsPKCS11Module : public nsIPKCS11Module,
                        public nsNSSShutDownObject
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPKCS11MODULE
 
-  nsPKCS11Module(SECMODModule *module);
+  explicit nsPKCS11Module(SECMODModule *module);
 
 protected:
   virtual ~nsPKCS11Module();
 
 private:
   SECMODModule *mModule;
 
   virtual void virtualDestroyNSSReference();
--- a/security/manager/ssl/src/nsSmartCardMonitor.h
+++ b/security/manager/ssl/src/nsSmartCardMonitor.h
@@ -31,17 +31,17 @@ private:
 // monitor a Module for token insertion and removal
 //
 // NOTE: this provides the application the ability to dynamically add slots
 // on the fly as necessary.
 //
 class SmartCardMonitoringThread
 {
  public:
-  SmartCardMonitoringThread(SECMODModule* module);
+  explicit SmartCardMonitoringThread(SECMODModule* module);
   ~SmartCardMonitoringThread();
   
   nsresult Start();
   void Stop();
   
   void Execute();
   void Interrupt();
   
--- a/security/manager/ssl/src/nsUsageArrayHelper.h
+++ b/security/manager/ssl/src/nsUsageArrayHelper.h
@@ -8,17 +8,17 @@
 #include "CertVerifier.h"
 #include "nsNSSComponent.h"
 #include "certt.h"
 #include "pkix/Time.h"
 
 class nsUsageArrayHelper
 {
 public:
-  nsUsageArrayHelper(CERTCertificate *aCert);
+  explicit nsUsageArrayHelper(CERTCertificate *aCert);
 
   nsresult GetUsagesArray(const char *suffix,
                bool localOnly,
                uint32_t outArraySize,
                uint32_t *_verified,
                uint32_t *_count,
                char16_t **tmpUsages);
 
--- a/security/pkix/include/pkix/Time.h
+++ b/security/pkix/include/pkix/Time.h
@@ -44,17 +44,17 @@ public:
   // Construct an uninitilized instance.
   //
   // This will fail to compile because there is no default constructor:
   //    Time x;
   //
   // This will succeed, leaving the time uninitialized:
   //    Time x(Time::uninitialized);
   enum Uninitialized { uninitialized };
-  Time(Uninitialized) { }
+  explicit Time(Uninitialized) { }
 
   bool operator==(const Time& other) const
   {
     return elapsedSecondsAD == other.elapsedSecondsAD;
   }
   bool operator>(const Time& other) const
   {
     return elapsedSecondsAD > other.elapsedSecondsAD;