From 1c563d96f000876d77b2d33fbfb03c241bc503e1 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Fri, 29 Apr 2016 15:44:04 -0700 Subject: [PATCH] Fix google-explicit-constructor warnings. Bug: 28341362 Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86 --- adb/fdevent.cpp | 2 +- fastboot/socket.cpp | 2 +- fastboot/tcp.cpp | 2 +- fastboot/udp.cpp | 2 +- fastboot/usb_linux.cpp | 2 +- fingerprintd/IFingerprintDaemonCallback.cpp | 2 +- gatekeeperd/IUserManager.cpp | 2 +- init/action.cpp | 4 ++-- libbacktrace/BacktraceOffline.cpp | 2 +- libmemunreachable/PtracerThread.cpp | 2 +- libutils/RefBase.cpp | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/adb/fdevent.cpp b/adb/fdevent.cpp index 902548ec5..04cd8651c 100644 --- a/adb/fdevent.cpp +++ b/adb/fdevent.cpp @@ -55,7 +55,7 @@ struct PollNode { fdevent* fde; adb_pollfd pollfd; - PollNode(fdevent* fde) : fde(fde) { + explicit PollNode(fdevent* fde) : fde(fde) { memset(&pollfd, 0, sizeof(pollfd)); pollfd.fd = fde->fd; diff --git a/fastboot/socket.cpp b/fastboot/socket.cpp index 14ecd937a..e56ffcf4b 100644 --- a/fastboot/socket.cpp +++ b/fastboot/socket.cpp @@ -167,7 +167,7 @@ ssize_t UdpSocket::Receive(void* data, size_t length, int timeout_ms) { // Implements the Socket interface for TCP. class TcpSocket : public Socket { public: - TcpSocket(cutils_socket_t sock) : Socket(sock) {} + explicit TcpSocket(cutils_socket_t sock) : Socket(sock) {} bool Send(const void* data, size_t length) override; bool Send(std::vector buffers) override; diff --git a/fastboot/tcp.cpp b/fastboot/tcp.cpp index e42c4e1af..dd6fbf828 100644 --- a/fastboot/tcp.cpp +++ b/fastboot/tcp.cpp @@ -66,7 +66,7 @@ class TcpTransport : public Transport { int Close() override; private: - TcpTransport(std::unique_ptr sock) : socket_(std::move(sock)) {} + explicit TcpTransport(std::unique_ptr sock) : socket_(std::move(sock)) {} // Connects to the device and performs the initial handshake. Returns false and fills |error| // on failure. diff --git a/fastboot/udp.cpp b/fastboot/udp.cpp index b36bd605c..53fb3472f 100644 --- a/fastboot/udp.cpp +++ b/fastboot/udp.cpp @@ -111,7 +111,7 @@ class UdpTransport : public Transport { int Close() override; private: - UdpTransport(std::unique_ptr socket) : socket_(std::move(socket)) {} + explicit UdpTransport(std::unique_ptr socket) : socket_(std::move(socket)) {} // Performs the UDP initialization procedure. Returns true on success. bool InitializeProtocol(std::string* error); diff --git a/fastboot/usb_linux.cpp b/fastboot/usb_linux.cpp index d4824fb2a..6db1e2727 100644 --- a/fastboot/usb_linux.cpp +++ b/fastboot/usb_linux.cpp @@ -89,7 +89,7 @@ struct usb_handle class LinuxUsbTransport : public Transport { public: - LinuxUsbTransport(std::unique_ptr handle) : handle_(std::move(handle)) {} + explicit LinuxUsbTransport(std::unique_ptr handle) : handle_(std::move(handle)) {} ~LinuxUsbTransport() override = default; ssize_t Read(void* data, size_t len) override; diff --git a/fingerprintd/IFingerprintDaemonCallback.cpp b/fingerprintd/IFingerprintDaemonCallback.cpp index 44d8020ae..dfd2abcdf 100644 --- a/fingerprintd/IFingerprintDaemonCallback.cpp +++ b/fingerprintd/IFingerprintDaemonCallback.cpp @@ -27,7 +27,7 @@ namespace android { class BpFingerprintDaemonCallback : public BpInterface { public: - BpFingerprintDaemonCallback(const sp& impl) : + explicit BpFingerprintDaemonCallback(const sp& impl) : BpInterface(impl) { } virtual status_t onEnrollResult(int64_t devId, int32_t fpId, int32_t gpId, int32_t rem) { diff --git a/gatekeeperd/IUserManager.cpp b/gatekeeperd/IUserManager.cpp index 8645fc2c9..8167d1919 100644 --- a/gatekeeperd/IUserManager.cpp +++ b/gatekeeperd/IUserManager.cpp @@ -27,7 +27,7 @@ namespace android { class BpUserManager : public BpInterface { public: - BpUserManager(const sp& impl) : + explicit BpUserManager(const sp& impl) : BpInterface(impl) { } virtual int32_t getCredentialOwnerProfile(int32_t user_id) { diff --git a/init/action.cpp b/init/action.cpp index 510ea897f..b7e431c34 100644 --- a/init/action.cpp +++ b/init/action.cpp @@ -264,7 +264,7 @@ void Action::DumpState() const { class EventTrigger : public Trigger { public: - EventTrigger(const std::string& trigger) : trigger_(trigger) { + explicit EventTrigger(const std::string& trigger) : trigger_(trigger) { } bool CheckTriggers(const Action& action) const override { return action.CheckEventTrigger(trigger_); @@ -288,7 +288,7 @@ private: class BuiltinTrigger : public Trigger { public: - BuiltinTrigger(Action* action) : action_(action) { + explicit BuiltinTrigger(Action* action) : action_(action) { } bool CheckTriggers(const Action& action) const override { return action_ == &action; diff --git a/libbacktrace/BacktraceOffline.cpp b/libbacktrace/BacktraceOffline.cpp index 9a4f62224..c2b68bc84 100644 --- a/libbacktrace/BacktraceOffline.cpp +++ b/libbacktrace/BacktraceOffline.cpp @@ -665,7 +665,7 @@ static bool IsValidApkPath(const std::string& apk_path) { class ScopedZiparchiveHandle { public: - ScopedZiparchiveHandle(ZipArchiveHandle handle) : handle_(handle) { + explicit ScopedZiparchiveHandle(ZipArchiveHandle handle) : handle_(handle) { } ~ScopedZiparchiveHandle() { diff --git a/libmemunreachable/PtracerThread.cpp b/libmemunreachable/PtracerThread.cpp index aa5b344a3..4e3c41e54 100644 --- a/libmemunreachable/PtracerThread.cpp +++ b/libmemunreachable/PtracerThread.cpp @@ -37,7 +37,7 @@ class Stack { public: - Stack(size_t size) : size_(size) { + explicit Stack(size_t size) : size_(size) { int prot = PROT_READ | PROT_WRITE; int flags = MAP_PRIVATE | MAP_ANONYMOUS; page_size_ = sysconf(_SC_PAGE_SIZE); diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp index ea1e4db84..22162fac7 100644 --- a/libutils/RefBase.cpp +++ b/libutils/RefBase.cpp @@ -71,7 +71,7 @@ public: #if !DEBUG_REFS - weakref_impl(RefBase* base) + explicit weakref_impl(RefBase* base) : mStrong(INITIAL_STRONG_VALUE) , mWeak(0) , mBase(base)