diff options
author | 2016-09-01 11:32:35 -0700 | |
---|---|---|
committer | 2016-09-01 11:32:35 -0700 | |
commit | 38fc101331d15dde716f80f2f64b4317ea1e22f1 (patch) | |
tree | 09b6ed7685f56008537bcaf349cf06a14e56e7d5 | |
parent | 0322a7176f4c432cae50c72657ad31a8c3b43016 (diff) |
Fix google-explicit-constructor warnings in sensorservice.
* Add explicit keyword to conversion constructors,
or use NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1
Change-Id: Ie7c4dfcdbd069809e103f0dd008ae2fb4b0502f4
-rw-r--r-- | services/sensorservice/RecentEventLogger.h | 4 | ||||
-rw-r--r-- | services/sensorservice/RingBuffer.h | 2 | ||||
-rw-r--r-- | services/sensorservice/RotationVectorSensor.h | 2 | ||||
-rw-r--r-- | services/sensorservice/SensorEventAckReceiver.h | 2 | ||||
-rw-r--r-- | services/sensorservice/SensorInterface.h | 4 | ||||
-rw-r--r-- | services/sensorservice/mat.h | 10 | ||||
-rw-r--r-- | services/sensorservice/vec.h | 4 |
7 files changed, 14 insertions, 14 deletions
diff --git a/services/sensorservice/RecentEventLogger.h b/services/sensorservice/RecentEventLogger.h index 4f9bc4af1a..973a247a63 100644 --- a/services/sensorservice/RecentEventLogger.h +++ b/services/sensorservice/RecentEventLogger.h @@ -35,7 +35,7 @@ namespace SensorServiceUtil { // behavior. class RecentEventLogger : public Dumpable { public: - RecentEventLogger(int sensorType); + explicit RecentEventLogger(int sensorType); void addEvent(const sensors_event_t& event); bool populateLastEvent(sensors_event_t *event) const; bool isEmpty() const; @@ -46,7 +46,7 @@ public: protected: struct SensorEventLog { - SensorEventLog(const sensors_event_t& e); + explicit SensorEventLog(const sensors_event_t& e); timespec mWallTime; sensors_event_t mEvent; }; diff --git a/services/sensorservice/RingBuffer.h b/services/sensorservice/RingBuffer.h index ec98a01413..a60eb90053 100644 --- a/services/sensorservice/RingBuffer.h +++ b/services/sensorservice/RingBuffer.h @@ -39,7 +39,7 @@ public: /** * Construct a RingBuffer that can grow up to the given length. */ - RingBuffer(size_t length); + explicit RingBuffer(size_t length); /** * Forward iterator to this class. Implements an std:forward_iterator. diff --git a/services/sensorservice/RotationVectorSensor.h b/services/sensorservice/RotationVectorSensor.h index 3cc224888b..265b4c410e 100644 --- a/services/sensorservice/RotationVectorSensor.h +++ b/services/sensorservice/RotationVectorSensor.h @@ -34,7 +34,7 @@ namespace android { class RotationVectorSensor : public VirtualSensor { public: - RotationVectorSensor(int mode = FUSION_9AXIS); + explicit RotationVectorSensor(int mode = FUSION_9AXIS); virtual bool process(sensors_event_t* outEvent, const sensors_event_t& event) override; virtual status_t activate(void* ident, bool enabled) override; virtual status_t setDelay(void* ident, int handle, int64_t ns) override; diff --git a/services/sensorservice/SensorEventAckReceiver.h b/services/sensorservice/SensorEventAckReceiver.h index 998597a84b..20fa4c7911 100644 --- a/services/sensorservice/SensorEventAckReceiver.h +++ b/services/sensorservice/SensorEventAckReceiver.h @@ -27,7 +27,7 @@ class SensorService::SensorEventAckReceiver : public Thread { sp<SensorService> const mService; public: virtual bool threadLoop(); - SensorEventAckReceiver(const sp<SensorService>& service) + explicit SensorEventAckReceiver(const sp<SensorService>& service) : mService(service) { } }; diff --git a/services/sensorservice/SensorInterface.h b/services/sensorservice/SensorInterface.h index dafcf2ddca..0867dc278b 100644 --- a/services/sensorservice/SensorInterface.h +++ b/services/sensorservice/SensorInterface.h @@ -47,7 +47,7 @@ public: class BaseSensor : public SensorInterface { public: - BaseSensor(const sensor_t& sensor); + explicit BaseSensor(const sensor_t& sensor); BaseSensor(const sensor_t& sensor, const uint8_t (&uuid)[16]); // Not all sensors need to support batching. @@ -74,7 +74,7 @@ protected: class HardwareSensor : public BaseSensor { public: - HardwareSensor(const sensor_t& sensor); + explicit HardwareSensor(const sensor_t& sensor); HardwareSensor(const sensor_t& sensor, const uint8_t (&uuid)[16]); virtual ~HardwareSensor(); diff --git a/services/sensorservice/mat.h b/services/sensorservice/mat.h index a76fc91cb0..495c14e67e 100644 --- a/services/sensorservice/mat.h +++ b/services/sensorservice/mat.h @@ -139,13 +139,13 @@ public: mat() { } mat(const mat& rhs) : base(rhs) { } - mat(const base& rhs) : base(rhs) { } + mat(const base& rhs) : base(rhs) { } // NOLINT(implicit) // ----------------------------------------------------------------------- // conversion constructors // sets the diagonal to the value, off-diagonal to zero - mat(pTYPE rhs) { + mat(pTYPE rhs) { // NOLINT(implicit) helpers::doAssign(*this, rhs); } @@ -220,7 +220,7 @@ public: template<size_t PREV_COLUMN> struct column_builder { mat& matrix; - column_builder(mat& matrix) : matrix(matrix) { } + explicit column_builder(mat& matrix) : matrix(matrix) { } }; // operator << is not a method of column_builder<> so we can @@ -265,9 +265,9 @@ public: enum { ROWS = R, COLS = 1 }; mat() { } - mat(const base& rhs) : base(rhs) { } + explicit mat(const base& rhs) : base(rhs) { } mat(const mat& rhs) : base(rhs) { } - mat(const TYPE& rhs) { helpers::doAssign(*this, rhs); } + explicit mat(const TYPE& rhs) { helpers::doAssign(*this, rhs); } mat& operator=(const mat& rhs) { base::operator=(rhs); return *this; } mat& operator=(const base& rhs) { base::operator=(rhs); return *this; } mat& operator=(const TYPE& rhs) { return helpers::doAssign(*this, rhs); } diff --git a/services/sensorservice/vec.h b/services/sensorservice/vec.h index a142bad3a1..9e5d2809c3 100644 --- a/services/sensorservice/vec.h +++ b/services/sensorservice/vec.h @@ -322,12 +322,12 @@ public: vec() { } vec(const vec& rhs) : base(rhs) { } - vec(const base& rhs) : base(rhs) { } + vec(const base& rhs) : base(rhs) { } // NOLINT(implicit) // ----------------------------------------------------------------------- // conversion constructors - vec(pTYPE rhs) { + vec(pTYPE rhs) { // NOLINT(implicit) for (size_t i=0 ; i<SIZE ; i++) base::operator[](i) = rhs; } |