diff options
author | Chih-Hung Hsieh <chh@google.com> | 2016-08-15 15:05:45 -0700 |
---|---|---|
committer | Chih-hung Hsieh <chh@google.com> | 2016-08-25 22:13:49 +0000 |
commit | c14c2c32badc9bb6f8521bfcd1a40cbbaec8f43e (patch) | |
tree | 1243c9baf7c2ce7eba6d0ddeecb76e7a631bfe9a | |
parent | 3f676b3e40288720dd1a9f1f22d43442e9ca8b2a (diff) | |
download | weaved-master.tar.gz |
Fix clang-tidy performance warnings in libweaved.HEADandroid-n-mr2-preview-2android-n-mr2-preview-1android-n-mr1-preview-2android-n-mr1-preview-1mastermain
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1
Change-Id: I36db541ef5b063bc59ef639097119dc488936d5a
-rw-r--r-- | buffet/shill_client.cc | 3 | ||||
-rw-r--r-- | buffet/shill_client.h | 2 | ||||
-rw-r--r-- | common/binder_utils.cc | 3 | ||||
-rw-r--r-- | common/binder_utils.h | 3 | ||||
-rw-r--r-- | libweaved/command.cc | 4 | ||||
-rw-r--r-- | libweaved/command.h | 4 |
6 files changed, 11 insertions, 8 deletions
diff --git a/buffet/shill_client.cc b/buffet/shill_client.cc index afaebba..eb75901 100644 --- a/buffet/shill_client.cc +++ b/buffet/shill_client.cc @@ -185,7 +185,8 @@ void ShillClient::Connect(const string& ssid, } void ShillClient::ConnectToServiceError( - std::shared_ptr<org::chromium::flimflam::ServiceProxy> connecting_service) { + const std::shared_ptr<org::chromium::flimflam::ServiceProxy>& + connecting_service) { if (connecting_service != connecting_service_ || connect_done_callback_.is_null()) { return; diff --git a/buffet/shill_client.h b/buffet/shill_client.h index 63cdd98..ea63bed 100644 --- a/buffet/shill_client.h +++ b/buffet/shill_client.h @@ -107,7 +107,7 @@ class ShillClient final : public weave::provider::Network, void CleanupConnectingService(); void ConnectToServiceError( - std::shared_ptr<org::chromium::flimflam::ServiceProxy> + const std::shared_ptr<org::chromium::flimflam::ServiceProxy>& connecting_service); const scoped_refptr<dbus::Bus> bus_; diff --git a/common/binder_utils.cc b/common/binder_utils.cc index 44f1c59..3c334f5 100644 --- a/common/binder_utils.cc +++ b/common/binder_utils.cc @@ -28,7 +28,8 @@ android::binder::Status ToStatus(bool success, weave::ErrorPtr* error) { 1, android::String8{error->get()->GetMessage().c_str()}); } -bool StatusToError(android::binder::Status status, brillo::ErrorPtr* error) { +bool StatusToError(const android::binder::Status& status, + brillo::ErrorPtr* error) { if (status.isOk()) return true; brillo::Error::AddTo(error, FROM_HERE, "binder", diff --git a/common/binder_utils.h b/common/binder_utils.h index 3aa5eda..2764aa6 100644 --- a/common/binder_utils.h +++ b/common/binder_utils.h @@ -41,7 +41,8 @@ android::binder::Status ToStatus(bool success, weave::ErrorPtr* error); // Converts a binder status code to a Brillo error object. Returns true if the // status was isOk(), otherwise returns false and provides error information // in the |error| object. -bool StatusToError(android::binder::Status status, brillo::ErrorPtr* error); +bool StatusToError(const android::binder::Status& status, + brillo::ErrorPtr* error); // Converts binder's UTF16 string into a regular UTF8-encoded standard string. inline std::string ToString(const android::String16& value) { diff --git a/libweaved/command.cc b/libweaved/command.cc index fc2a88d..bf64db9 100644 --- a/libweaved/command.cc +++ b/libweaved/command.cc @@ -154,7 +154,7 @@ bool Command::AbortWithCustomError(const brillo::Error* command_error, return Abort(error_code, command_error->GetMessage(), error); } -bool Command::AbortWithCustomError(android::binder::Status status, +bool Command::AbortWithCustomError(const android::binder::Status& status, brillo::ErrorPtr* error) { std::string error_code = BinderExceptionString(status.exceptionCode()); return Abort(error_code, status.exceptionMessage().string(), error); @@ -182,7 +182,7 @@ bool Command::SetCustomError(const brillo::Error* command_error, return SetError(error_code, command_error->GetMessage(), error); } -bool Command::SetCustomError(android::binder::Status status, +bool Command::SetCustomError(const android::binder::Status& status, brillo::ErrorPtr* error) { std::string error_code = BinderExceptionString(status.exceptionCode()); return SetError(error_code, status.exceptionMessage().string(), error); diff --git a/libweaved/command.h b/libweaved/command.h index e6ffe57..9bbe63e 100644 --- a/libweaved/command.h +++ b/libweaved/command.h @@ -108,7 +108,7 @@ class LIBWEAVED_EXPORT Command final { brillo::ErrorPtr* error); // AbortWithCustomError overload for specifying the error information as // binder::Status. - bool AbortWithCustomError(android::binder::Status status, + bool AbortWithCustomError(const android::binder::Status& status, brillo::ErrorPtr* error); // Cancels command execution. @@ -133,7 +133,7 @@ class LIBWEAVED_EXPORT Command final { bool SetCustomError(const brillo::Error* command_error, brillo::ErrorPtr* error); // SetError overload for specifying the error information as binder::Status. - bool SetCustomError(android::binder::Status status, + bool SetCustomError(const android::binder::Status& status, brillo::ErrorPtr* error); protected: |