diff --git a/include/utils/Condition.h b/include/utils/Condition.h index a42018555..5650598f0 100644 --- a/include/utils/Condition.h +++ b/include/utils/Condition.h @@ -54,7 +54,7 @@ public: }; Condition(); - Condition(int type); + explicit Condition(int type); ~Condition(); // Wait on the condition variable. Lock the mutex before calling. status_t wait(Mutex& mutex); diff --git a/include/utils/Mutex.h b/include/utils/Mutex.h index 9b0b734d6..8c4683c02 100644 --- a/include/utils/Mutex.h +++ b/include/utils/Mutex.h @@ -52,8 +52,8 @@ public: }; Mutex(); - Mutex(const char* name); - Mutex(int type, const char* name = NULL); + explicit Mutex(const char* name); + explicit Mutex(int type, const char* name = NULL); ~Mutex(); // lock or unlock the mutex @@ -77,8 +77,8 @@ public: // constructed and released when Autolock goes out of scope. class Autolock { public: - inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } - inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } + inline explicit Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } + inline explicit Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } inline ~Autolock() { mLock.unlock(); } private: Mutex& mLock; diff --git a/include/utils/RWLock.h b/include/utils/RWLock.h index e743b1c8c..d5b81d3a8 100644 --- a/include/utils/RWLock.h +++ b/include/utils/RWLock.h @@ -47,8 +47,8 @@ public: }; RWLock(); - RWLock(const char* name); - RWLock(int type, const char* name = NULL); + explicit RWLock(const char* name); + explicit RWLock(int type, const char* name = NULL); ~RWLock(); status_t readLock(); @@ -59,7 +59,7 @@ public: class AutoRLock { public: - inline AutoRLock(RWLock& rwlock) : mLock(rwlock) { mLock.readLock(); } + inline explicit AutoRLock(RWLock& rwlock) : mLock(rwlock) { mLock.readLock(); } inline ~AutoRLock() { mLock.unlock(); } private: RWLock& mLock; @@ -67,7 +67,7 @@ public: class AutoWLock { public: - inline AutoWLock(RWLock& rwlock) : mLock(rwlock) { mLock.writeLock(); } + inline explicit AutoWLock(RWLock& rwlock) : mLock(rwlock) { mLock.writeLock(); } inline ~AutoWLock() { mLock.unlock(); } private: RWLock& mLock; diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h index c82e7d956..950dbd072 100644 --- a/include/utils/RefBase.h +++ b/include/utils/RefBase.h @@ -222,12 +222,12 @@ public: inline wp() : m_ptr(0) { } - wp(T* other); + wp(T* other); // NOLINT(implicit) wp(const wp& other); - wp(const sp& other); - template wp(U* other); - template wp(const sp& other); - template wp(const wp& other); + explicit wp(const sp& other); + template wp(U* other); // NOLINT(implicit) + template wp(const sp& other); // NOLINT(implicit) + template wp(const wp& other); // NOLINT(implicit) ~wp(); diff --git a/include/utils/StrongPointer.h b/include/utils/StrongPointer.h index 50fde35b0..d90b788b1 100644 --- a/include/utils/StrongPointer.h +++ b/include/utils/StrongPointer.h @@ -60,12 +60,12 @@ class sp { public: inline sp() : m_ptr(0) { } - sp(T* other); + sp(T* other); // NOLINT(implicit) sp(const sp& other); sp(sp&& other); - template sp(U* other); - template sp(const sp& other); - template sp(sp&& other); + template sp(U* other); // NOLINT(implicit) + template sp(const sp& other); // NOLINT(implicit) + template sp(sp&& other); // NOLINT(implicit) ~sp(); diff --git a/include/utils/Thread.h b/include/utils/Thread.h index 3792db7ba..a261fc8d9 100644 --- a/include/utils/Thread.h +++ b/include/utils/Thread.h @@ -41,7 +41,7 @@ class Thread : virtual public RefBase public: // Create a Thread object, but doesn't create or start the associated // thread. See the run() method. - Thread(bool canCallJava = true); + explicit Thread(bool canCallJava = true); virtual ~Thread(); // Start the thread in threadLoop() which needs to be implemented. diff --git a/include/utils/TypeHelpers.h b/include/utils/TypeHelpers.h index 61d618e70..64d25c5db 100644 --- a/include/utils/TypeHelpers.h +++ b/include/utils/TypeHelpers.h @@ -240,7 +240,7 @@ struct key_value_pair_t { key_value_pair_t() { } key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { } key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { } - key_value_pair_t(const KEY& k) : key(k) { } + explicit key_value_pair_t(const KEY& k) : key(k) { } inline bool operator < (const key_value_pair_t& o) const { return strictly_order_type(key, o.key); } diff --git a/include/utils/VectorImpl.h b/include/utils/VectorImpl.h index 21ad71ce6..4dd91fd29 100644 --- a/include/utils/VectorImpl.h +++ b/include/utils/VectorImpl.h @@ -132,7 +132,7 @@ class SortedVectorImpl : public VectorImpl { public: SortedVectorImpl(size_t itemSize, uint32_t flags); - SortedVectorImpl(const VectorImpl& rhs); + explicit SortedVectorImpl(const VectorImpl& rhs); virtual ~SortedVectorImpl(); SortedVectorImpl& operator = (const SortedVectorImpl& rhs);