summaryrefslogtreecommitdiff
path: root/keystore/include
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2019-01-04 13:34:17 -0800
committerChih-Hung Hsieh <chh@google.com>2019-01-04 13:34:55 -0800
commit4fa39ef416ab918858b098a5dcac00d254a19c69 (patch)
tree493ea7f0f54bf31f194c87fa698d73cb47d51ce4 /keystore/include
parent4cf3bf237a19d9f0351abb97543935c930c6cef3 (diff)
downloadsecurity-4fa39ef416ab918858b098a5dcac00d254a19c69.tar.gz
Fix/suppress system/security google-explicit-constructor warnings
* Add explicit to conversion constructors/operators * Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters Bug: 28341362 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor Change-Id: I4ed5aea36fcdcd8dbda9a4be9607c5af606f2a08
Diffstat (limited to 'keystore/include')
-rw-r--r--keystore/include/keystore/KeyAttestationApplicationId.h4
-rw-r--r--keystore/include/keystore/KeyCharacteristics.h2
-rw-r--r--keystore/include/keystore/KeymasterArguments.h1
-rw-r--r--keystore/include/keystore/KeystoreResponse.h1
-rw-r--r--keystore/include/keystore/Signature.h2
-rw-r--r--keystore/include/keystore/keystore_concurrency.h5
-rw-r--r--keystore/include/keystore/keystore_return_types.h6
-rw-r--r--keystore/include/keystore/utils.h8
8 files changed, 21 insertions, 8 deletions
diff --git a/keystore/include/keystore/KeyAttestationApplicationId.h b/keystore/include/keystore/KeyAttestationApplicationId.h
index dc914c1b..861c2e15 100644
--- a/keystore/include/keystore/KeyAttestationApplicationId.h
+++ b/keystore/include/keystore/KeyAttestationApplicationId.h
@@ -33,8 +33,8 @@ class KeyAttestationApplicationId : public Parcelable {
typedef std::vector<std::unique_ptr<KeyAttestationPackageInfo>> PackageInfoVector;
KeyAttestationApplicationId();
// Following c'tors are for initializing instances containing test data.
- KeyAttestationApplicationId(std::unique_ptr<KeyAttestationPackageInfo> package);
- KeyAttestationApplicationId(PackageInfoVector packages);
+ explicit KeyAttestationApplicationId(std::unique_ptr<KeyAttestationPackageInfo> package);
+ explicit KeyAttestationApplicationId(PackageInfoVector packages);
status_t writeToParcel(Parcel*) const override;
status_t readFromParcel(const Parcel* parcel) override;
diff --git a/keystore/include/keystore/KeyCharacteristics.h b/keystore/include/keystore/KeyCharacteristics.h
index 40d495c6..9c90b8a1 100644
--- a/keystore/include/keystore/KeyCharacteristics.h
+++ b/keystore/include/keystore/KeyCharacteristics.h
@@ -27,7 +27,7 @@ namespace keymaster {
// Parcelable version of keystore::KeyCharacteristics
struct KeyCharacteristics : public ::android::Parcelable {
KeyCharacteristics(){};
- KeyCharacteristics(::keystore::KeyCharacteristics&& other) {
+ explicit KeyCharacteristics(::keystore::KeyCharacteristics&& other) {
softwareEnforced = std::move(other.softwareEnforced);
hardwareEnforced = std::move(other.hardwareEnforced);
}
diff --git a/keystore/include/keystore/KeymasterArguments.h b/keystore/include/keystore/KeymasterArguments.h
index b453b113..3d22f5f1 100644
--- a/keystore/include/keystore/KeymasterArguments.h
+++ b/keystore/include/keystore/KeymasterArguments.h
@@ -26,6 +26,7 @@ namespace keymaster {
// struct for serializing/deserializing a list of KeyParameters
struct KeymasterArguments : public Parcelable {
KeymasterArguments(){};
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeymasterArguments(hardware::hidl_vec<::keystore::KeyParameter>&& other);
explicit KeymasterArguments(const hardware::hidl_vec<::keystore::KeyParameter>& other);
diff --git a/keystore/include/keystore/KeystoreResponse.h b/keystore/include/keystore/KeystoreResponse.h
index 5ad260d4..20f72745 100644
--- a/keystore/include/keystore/KeystoreResponse.h
+++ b/keystore/include/keystore/KeystoreResponse.h
@@ -34,6 +34,7 @@ struct KeystoreResponse : public ::android::Parcelable {
: response_code_(response_code), error_msg_(std::make_unique<String16>(error_msg)) {}
explicit KeystoreResponse(const int response_code)
: response_code_(response_code), error_msg_() {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeystoreResponse(const ::keystore::KeyStoreServiceReturnCode& rc)
: response_code_(rc.getErrorCode()), error_msg_() {}
KeystoreResponse(const KeystoreResponse& other)
diff --git a/keystore/include/keystore/Signature.h b/keystore/include/keystore/Signature.h
index 31ecdeff..f39acecf 100644
--- a/keystore/include/keystore/Signature.h
+++ b/keystore/include/keystore/Signature.h
@@ -27,7 +27,7 @@ class Signature : public Parcelable {
public:
Signature() = default;
// Intended for initializing instances containing test data.
- Signature(std::vector<uint8_t> signature_data);
+ explicit Signature(std::vector<uint8_t> signature_data);
status_t writeToParcel(Parcel*) const override;
status_t readFromParcel(const Parcel* parcel) override;
diff --git a/keystore/include/keystore/keystore_concurrency.h b/keystore/include/keystore/keystore_concurrency.h
index b60b7a6e..039ca313 100644
--- a/keystore/include/keystore/keystore_concurrency.h
+++ b/keystore/include/keystore/keystore_concurrency.h
@@ -85,9 +85,10 @@ template <typename Implementation> class ProxyLock {
public:
ProxyLock() : impl_() {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
template <typename... Args> ProxyLock(Args&&... args) : impl_{std::forward<Args>(args)...} {}
- ProxyLock(Implementation&& impl) : impl_(std::move(impl)) {}
- operator bool() const { return impl_.value() != nullptr; }
+ explicit ProxyLock(Implementation&& impl) : impl_(std::move(impl)) {}
+ explicit operator bool() const { return impl_.value() != nullptr; }
template <typename T = typename Implementation::lockedType>
std::enable_if_t<!std::is_const<typename Implementation::lockedType>::value, T*> operator->() {
diff --git a/keystore/include/keystore/keystore_return_types.h b/keystore/include/keystore/keystore_return_types.h
index e091447f..f8cf1cc4 100644
--- a/keystore/include/keystore/keystore_return_types.h
+++ b/keystore/include/keystore/keystore_return_types.h
@@ -41,10 +41,13 @@ class KeyStoreNativeReturnCode;
class KeyStoreServiceReturnCode {
public:
KeyStoreServiceReturnCode() : errorCode_(0) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeyStoreServiceReturnCode(const ErrorCode& errorCode) : errorCode_(int32_t(errorCode)) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeyStoreServiceReturnCode(const ResponseCode& errorCode) : errorCode_(int32_t(errorCode)) {}
KeyStoreServiceReturnCode(const KeyStoreServiceReturnCode& errorCode)
: errorCode_(errorCode.errorCode_) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeyStoreServiceReturnCode(const KeyStoreNativeReturnCode& errorCode);
explicit inline KeyStoreServiceReturnCode(const int32_t& errorCode) : errorCode_(errorCode) {}
inline KeyStoreServiceReturnCode& operator=(const ErrorCode& errorCode) {
@@ -115,11 +118,14 @@ inline std::ostream& operator<<(std::ostream& out, const KeyStoreServiceReturnCo
class KeyStoreNativeReturnCode {
public:
KeyStoreNativeReturnCode() : errorCode_(0) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeyStoreNativeReturnCode(const ErrorCode& errorCode) : errorCode_(int32_t(errorCode)) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeyStoreNativeReturnCode(const ResponseCode& errorCode) : errorCode_(int32_t(errorCode)) {}
KeyStoreNativeReturnCode(const KeyStoreNativeReturnCode& errorCode)
: errorCode_(errorCode.errorCode_) {}
explicit inline KeyStoreNativeReturnCode(const int32_t& errorCode) : errorCode_(errorCode) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
KeyStoreNativeReturnCode(const KeyStoreServiceReturnCode& errorcode);
inline KeyStoreNativeReturnCode& operator=(const ErrorCode& errorCode) {
errorCode_ = int32_t(errorCode);
diff --git a/keystore/include/keystore/utils.h b/keystore/include/keystore/utils.h
index 1d8208a7..544dd21a 100644
--- a/keystore/include/keystore/utils.h
+++ b/keystore/include/keystore/utils.h
@@ -29,8 +29,12 @@ class SharedNullableIterator {
typedef std::shared_ptr<CollectionType> CollectionPtr;
SharedNullableIterator() {}
- SharedNullableIterator(const std::shared_ptr<CollectionType>& coll) : coll_(coll) { init(); }
- SharedNullableIterator(std::shared_ptr<CollectionType>&& coll) : coll_(coll) { init(); }
+ explicit SharedNullableIterator(const std::shared_ptr<CollectionType>& coll) : coll_(coll) {
+ init();
+ }
+ explicit SharedNullableIterator(std::shared_ptr<CollectionType>&& coll) : coll_(coll) {
+ init();
+ }
SharedNullableIterator(const SharedNullableIterator& other)
: coll_(other.coll_), cur_(other.cur_) {}