Fix performance-for-range-copy warnings
Bug: 30413223 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance* Change-Id: I1b76a22eab100a31e77048626e48169fe7eeaf92
This commit is contained in:
parent
f529ba8dac
commit
65ab67312b
9 changed files with 28 additions and 28 deletions
|
@ -218,7 +218,7 @@ void VehicleHalManager::onHalPropertySetError(StatusCode errorCode,
|
||||||
const auto& clients =
|
const auto& clients =
|
||||||
mSubscriptionManager.getSubscribedClients(property, SubscribeFlags::EVENTS_FROM_CAR);
|
mSubscriptionManager.getSubscribedClients(property, SubscribeFlags::EVENTS_FROM_CAR);
|
||||||
|
|
||||||
for (auto client : clients) {
|
for (const auto& client : clients) {
|
||||||
client->getCallback()->onPropertySetError(errorCode, property, areaId);
|
client->getCallback()->onPropertySetError(errorCode, property, areaId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ bool VehicleHalManager::checkReadPermission(const VehiclePropConfig &config) con
|
||||||
void VehicleHalManager::handlePropertySetEvent(const VehiclePropValue& value) {
|
void VehicleHalManager::handlePropertySetEvent(const VehiclePropValue& value) {
|
||||||
auto clients =
|
auto clients =
|
||||||
mSubscriptionManager.getSubscribedClients(value.prop, SubscribeFlags::EVENTS_FROM_ANDROID);
|
mSubscriptionManager.getSubscribedClients(value.prop, SubscribeFlags::EVENTS_FROM_ANDROID);
|
||||||
for (auto client : clients) {
|
for (const auto& client : clients) {
|
||||||
client->getCallback()->onPropertySet(value);
|
client->getCallback()->onPropertySet(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
static std::list<sp<IVehicleCallback>> extractCallbacks(
|
static std::list<sp<IVehicleCallback>> extractCallbacks(
|
||||||
const std::list<sp<HalClient>>& clients) {
|
const std::list<sp<HalClient>>& clients) {
|
||||||
std::list<sp<IVehicleCallback>> callbacks;
|
std::list<sp<IVehicleCallback>> callbacks;
|
||||||
for (auto c : clients) {
|
for (const auto& c : clients) {
|
||||||
callbacks.push_back(c->getCallback());
|
callbacks.push_back(c->getCallback());
|
||||||
}
|
}
|
||||||
return callbacks;
|
return callbacks;
|
||||||
|
|
|
@ -262,7 +262,7 @@ Return<void> CameraDevice::open(const sp<ICameraDeviceCallback>& callback, open_
|
||||||
session->getInterface()->interfaceChain([](
|
session->getInterface()->interfaceChain([](
|
||||||
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
|
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
|
||||||
ALOGV("Session interface chain:");
|
ALOGV("Session interface chain:");
|
||||||
for (auto iface : interfaceChain) {
|
for (const auto& iface : interfaceChain) {
|
||||||
ALOGV(" %s", iface.c_str());
|
ALOGV(" %s", iface.c_str());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ sp<V3_2::implementation::CameraDeviceSession> CameraDevice::createSession(camera
|
||||||
session->getInterface()->interfaceChain([](
|
session->getInterface()->interfaceChain([](
|
||||||
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
|
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
|
||||||
ALOGV("Session interface chain:");
|
ALOGV("Session interface chain:");
|
||||||
for (auto iface : interfaceChain) {
|
for (const auto& iface : interfaceChain) {
|
||||||
ALOGV(" %s", iface.c_str());
|
ALOGV(" %s", iface.c_str());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ sp<V3_2::implementation::CameraDeviceSession> CameraDevice::createSession(camera
|
||||||
session->getInterface()->interfaceChain([](
|
session->getInterface()->interfaceChain([](
|
||||||
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
|
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
|
||||||
ALOGV("Session interface chain:");
|
ALOGV("Session interface chain:");
|
||||||
for (auto iface : interfaceChain) {
|
for (const auto& iface : interfaceChain) {
|
||||||
ALOGV(" %s", iface.c_str());
|
ALOGV(" %s", iface.c_str());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,7 +83,7 @@ std::vector<uint32_t> getHubIds() {
|
||||||
sp<IContexthub> hubApi = ::testing::VtsHalHidlTargetTestBase::getService<IContexthub>();
|
sp<IContexthub> hubApi = ::testing::VtsHalHidlTargetTestBase::getService<IContexthub>();
|
||||||
|
|
||||||
if (hubApi != nullptr) {
|
if (hubApi != nullptr) {
|
||||||
for (ContextHub hub : getHubsSync(hubApi)) {
|
for (const ContextHub& hub : getHubsSync(hubApi)) {
|
||||||
hubIds.push_back(hub.hubId);
|
hubIds.push_back(hub.hubId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ TEST_F(ContexthubHidlTestBase, TestGetHubs) {
|
||||||
hidl_vec<ContextHub> hubs = getHubsSync(hubApi);
|
hidl_vec<ContextHub> hubs = getHubsSync(hubApi);
|
||||||
ALOGD("System reports %zu hubs", hubs.size());
|
ALOGD("System reports %zu hubs", hubs.size());
|
||||||
|
|
||||||
for (ContextHub hub : hubs) {
|
for (const ContextHub& hub : hubs) {
|
||||||
ALOGD("Checking hub ID %" PRIu32, hub.hubId);
|
ALOGD("Checking hub ID %" PRIu32, hub.hubId);
|
||||||
|
|
||||||
EXPECT_FALSE(hub.name.empty());
|
EXPECT_FALSE(hub.name.empty());
|
||||||
|
|
|
@ -177,7 +177,7 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> {
|
||||||
TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) {
|
TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) {
|
||||||
const char* kVendorStr = "Vendor module ";
|
const char* kVendorStr = "Vendor module ";
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
ASSERT_TRUE(config.name.size() > 0) << kVendorStr << "has no name";
|
ASSERT_TRUE(config.name.size() > 0) << kVendorStr << "has no name";
|
||||||
ASSERT_TRUE(config.serverUrl.size() > 0) << kVendorStr
|
ASSERT_TRUE(config.serverUrl.size() > 0) << kVendorStr
|
||||||
<< "has no serverUrl";
|
<< "has no serverUrl";
|
||||||
|
@ -186,7 +186,7 @@ TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) {
|
||||||
ASSERT_TRUE(config.mimeType.size() > 0) << kVendorStr
|
ASSERT_TRUE(config.mimeType.size() > 0) << kVendorStr
|
||||||
<< "has no mime type";
|
<< "has no mime type";
|
||||||
ASSERT_TRUE(config.keys.size() >= 1) << kVendorStr << "has no keys";
|
ASSERT_TRUE(config.keys.size() >= 1) << kVendorStr << "has no keys";
|
||||||
for (auto key : config.keys) {
|
for (const auto& key : config.keys) {
|
||||||
ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
|
ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
|
||||||
<< " has zero length keyId";
|
<< " has zero length keyId";
|
||||||
ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
|
ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
|
||||||
|
@ -245,7 +245,7 @@ TEST_P(DrmHalVendorFactoryTest, InvalidContentTypeNotSupported) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) {
|
TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
EXPECT_TRUE(drmFactory->isContentTypeSupported(config.mimeType));
|
EXPECT_TRUE(drmFactory->isContentTypeSupported(config.mimeType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ TEST_P(DrmHalVendorPluginTest, RemoveKeysNewSession) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorPluginTest, RestoreKeys) {
|
TEST_P(DrmHalVendorPluginTest, RestoreKeys) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
if (config.policy.allowOffline) {
|
if (config.policy.allowOffline) {
|
||||||
auto sessionId = openSession();
|
auto sessionId = openSession();
|
||||||
hidl_vec<uint8_t> keySetId =
|
hidl_vec<uint8_t> keySetId =
|
||||||
|
@ -645,7 +645,7 @@ TEST_P(DrmHalVendorPluginTest, RestoreKeysNull) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) {
|
TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
if (config.policy.allowOffline) {
|
if (config.policy.allowOffline) {
|
||||||
auto sessionId = openSession();
|
auto sessionId = openSession();
|
||||||
hidl_vec<uint8_t> keySetId =
|
hidl_vec<uint8_t> keySetId =
|
||||||
|
@ -1022,8 +1022,8 @@ TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderConfig) {
|
TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderConfig) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
for (auto key : config.keys) {
|
for (const auto& key : config.keys) {
|
||||||
if (key.isSecure) {
|
if (key.isSecure) {
|
||||||
EXPECT_TRUE(cryptoPlugin->requiresSecureDecoderComponent(config.mimeType));
|
EXPECT_TRUE(cryptoPlugin->requiresSecureDecoderComponent(config.mimeType));
|
||||||
break;
|
break;
|
||||||
|
@ -1471,7 +1471,7 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusWithNoKeys) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
|
TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
auto sessionId = openSession();
|
auto sessionId = openSession();
|
||||||
loadKeys(sessionId, config);
|
loadKeys(sessionId, config);
|
||||||
auto keyStatus = queryKeyStatus(sessionId);
|
auto keyStatus = queryKeyStatus(sessionId);
|
||||||
|
@ -1485,8 +1485,8 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
|
TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
for (auto key : config.keys) {
|
for (const auto& key : config.keys) {
|
||||||
const size_t kSegmentSize = 1024;
|
const size_t kSegmentSize = 1024;
|
||||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||||
const Pattern noPattern = {0, 0};
|
const Pattern noPattern = {0, 0};
|
||||||
|
@ -1513,8 +1513,8 @@ TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
|
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
for (auto key : config.keys) {
|
for (const auto& key : config.keys) {
|
||||||
const size_t kSegmentSize = 1024;
|
const size_t kSegmentSize = 1024;
|
||||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||||
const Pattern noPattern = {0, 0};
|
const Pattern noPattern = {0, 0};
|
||||||
|
@ -1540,8 +1540,8 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
|
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
for (auto key : config.keys) {
|
for (const auto& key : config.keys) {
|
||||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||||
const Pattern noPattern = {0, 0};
|
const Pattern noPattern = {0, 0};
|
||||||
const vector<SubSample> subSamples = {{.numBytesOfClearData = 256,
|
const vector<SubSample> subSamples = {{.numBytesOfClearData = 256,
|
||||||
|
@ -1567,8 +1567,8 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
|
||||||
*/
|
*/
|
||||||
TEST_P(DrmHalVendorDecryptTest, AttemptDecryptWithKeysRemoved) {
|
TEST_P(DrmHalVendorDecryptTest, AttemptDecryptWithKeysRemoved) {
|
||||||
RETURN_IF_SKIPPED;
|
RETURN_IF_SKIPPED;
|
||||||
for (auto config : contentConfigurations) {
|
for (const auto& config : contentConfigurations) {
|
||||||
for (auto key : config.keys) {
|
for (const auto& key : config.keys) {
|
||||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||||
const Pattern noPattern = {0, 0};
|
const Pattern noPattern = {0, 0};
|
||||||
const vector<SubSample> subSamples = {{.numBytesOfClearData = 256,
|
const vector<SubSample> subSamples = {{.numBytesOfClearData = 256,
|
||||||
|
|
|
@ -228,13 +228,13 @@ protected:
|
||||||
const std::string& componentName, const VT& componentValue) {
|
const std::string& componentName, const VT& componentValue) {
|
||||||
bool validAttribute = false;
|
bool validAttribute = false;
|
||||||
bool validComponent = false;
|
bool validComponent = false;
|
||||||
for (DrmMetricGroup::Attribute attribute : metric.attributes) {
|
for (const DrmMetricGroup::Attribute& attribute : metric.attributes) {
|
||||||
if (attribute.name == attributeName &&
|
if (attribute.name == attributeName &&
|
||||||
ValueEquals(attribute.type, attributeValue, attribute)) {
|
ValueEquals(attribute.type, attributeValue, attribute)) {
|
||||||
validAttribute = true;
|
validAttribute = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (DrmMetricGroup::Value value : metric.values) {
|
for (const DrmMetricGroup::Value& value : metric.values) {
|
||||||
if (value.componentName == componentName &&
|
if (value.componentName == componentName &&
|
||||||
ValueEquals(value.type, componentValue, value)) {
|
ValueEquals(value.type, componentValue, value)) {
|
||||||
validComponent = true;
|
validComponent = true;
|
||||||
|
|
|
@ -78,9 +78,9 @@ std::unique_ptr<ComposerClient> Composer::createClient() {
|
||||||
ComposerClient::ComposerClient(const sp<IComposerClient>& client) : mClient(client) {}
|
ComposerClient::ComposerClient(const sp<IComposerClient>& client) : mClient(client) {}
|
||||||
|
|
||||||
ComposerClient::~ComposerClient() {
|
ComposerClient::~ComposerClient() {
|
||||||
for (auto it : mDisplayResources) {
|
for (const auto& it : mDisplayResources) {
|
||||||
Display display = it.first;
|
Display display = it.first;
|
||||||
DisplayResource& resource = it.second;
|
const DisplayResource& resource = it.second;
|
||||||
|
|
||||||
for (auto layer : resource.layers) {
|
for (auto layer : resource.layers) {
|
||||||
EXPECT_EQ(Error::NONE, mClient->destroyLayer(display, layer))
|
EXPECT_EQ(Error::NONE, mClient->destroyLayer(display, layer))
|
||||||
|
|
Loading…
Reference in a new issue