Merge "Fix performance-for-range-copy warnings"

This commit is contained in:
Chih-hung Hsieh 2018-12-17 21:14:26 +00:00 committed by Gerrit Code Review
commit d01f7050ac
9 changed files with 28 additions and 28 deletions

View file

@ -218,7 +218,7 @@ void VehicleHalManager::onHalPropertySetError(StatusCode errorCode,
const auto& clients =
mSubscriptionManager.getSubscribedClients(property, SubscribeFlags::EVENTS_FROM_CAR);
for (auto client : clients) {
for (const auto& client : clients) {
client->getCallback()->onPropertySetError(errorCode, property, areaId);
}
}
@ -312,7 +312,7 @@ bool VehicleHalManager::checkReadPermission(const VehiclePropConfig &config) con
void VehicleHalManager::handlePropertySetEvent(const VehiclePropValue& value) {
auto clients =
mSubscriptionManager.getSubscribedClients(value.prop, SubscribeFlags::EVENTS_FROM_ANDROID);
for (auto client : clients) {
for (const auto& client : clients) {
client->getCallback()->onPropertySet(value);
}
}

View file

@ -66,7 +66,7 @@ public:
static std::list<sp<IVehicleCallback>> extractCallbacks(
const std::list<sp<HalClient>>& clients) {
std::list<sp<IVehicleCallback>> callbacks;
for (auto c : clients) {
for (const auto& c : clients) {
callbacks.push_back(c->getCallback());
}
return callbacks;

View file

@ -262,7 +262,7 @@ Return<void> CameraDevice::open(const sp<ICameraDeviceCallback>& callback, open_
session->getInterface()->interfaceChain([](
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
ALOGV("Session interface chain:");
for (auto iface : interfaceChain) {
for (const auto& iface : interfaceChain) {
ALOGV(" %s", iface.c_str());
}
});

View file

@ -49,7 +49,7 @@ sp<V3_2::implementation::CameraDeviceSession> CameraDevice::createSession(camera
session->getInterface()->interfaceChain([](
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
ALOGV("Session interface chain:");
for (auto iface : interfaceChain) {
for (const auto& iface : interfaceChain) {
ALOGV(" %s", iface.c_str());
}
});

View file

@ -49,7 +49,7 @@ sp<V3_2::implementation::CameraDeviceSession> CameraDevice::createSession(camera
session->getInterface()->interfaceChain([](
::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
ALOGV("Session interface chain:");
for (auto iface : interfaceChain) {
for (const auto& iface : interfaceChain) {
ALOGV(" %s", iface.c_str());
}
});

View file

@ -83,7 +83,7 @@ std::vector<uint32_t> getHubIds() {
sp<IContexthub> hubApi = ::testing::VtsHalHidlTargetTestBase::getService<IContexthub>();
if (hubApi != nullptr) {
for (ContextHub hub : getHubsSync(hubApi)) {
for (const ContextHub& hub : getHubsSync(hubApi)) {
hubIds.push_back(hub.hubId);
}
}
@ -206,7 +206,7 @@ TEST_F(ContexthubHidlTestBase, TestGetHubs) {
hidl_vec<ContextHub> hubs = getHubsSync(hubApi);
ALOGD("System reports %zu hubs", hubs.size());
for (ContextHub hub : hubs) {
for (const ContextHub& hub : hubs) {
ALOGD("Checking hub ID %" PRIu32, hub.hubId);
EXPECT_FALSE(hub.name.empty());

View file

@ -177,7 +177,7 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> {
TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) {
const char* kVendorStr = "Vendor module ";
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.serverUrl.size() > 0) << kVendorStr
<< "has no serverUrl";
@ -186,7 +186,7 @@ TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) {
ASSERT_TRUE(config.mimeType.size() > 0) << kVendorStr
<< "has no mime type";
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
<< " has zero length keyId";
ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
@ -245,7 +245,7 @@ TEST_P(DrmHalVendorFactoryTest, InvalidContentTypeNotSupported) {
*/
TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (const auto& config : contentConfigurations) {
EXPECT_TRUE(drmFactory->isContentTypeSupported(config.mimeType));
}
}
@ -610,7 +610,7 @@ TEST_P(DrmHalVendorPluginTest, RemoveKeysNewSession) {
*/
TEST_P(DrmHalVendorPluginTest, RestoreKeys) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (const auto& config : contentConfigurations) {
if (config.policy.allowOffline) {
auto sessionId = openSession();
hidl_vec<uint8_t> keySetId =
@ -645,7 +645,7 @@ TEST_P(DrmHalVendorPluginTest, RestoreKeysNull) {
*/
TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (const auto& config : contentConfigurations) {
if (config.policy.allowOffline) {
auto sessionId = openSession();
hidl_vec<uint8_t> keySetId =
@ -1022,8 +1022,8 @@ TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) {
*/
TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderConfig) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (auto key : config.keys) {
for (const auto& config : contentConfigurations) {
for (const auto& key : config.keys) {
if (key.isSecure) {
EXPECT_TRUE(cryptoPlugin->requiresSecureDecoderComponent(config.mimeType));
break;
@ -1471,7 +1471,7 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusWithNoKeys) {
*/
TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (const auto& config : contentConfigurations) {
auto sessionId = openSession();
loadKeys(sessionId, config);
auto keyStatus = queryKeyStatus(sessionId);
@ -1485,8 +1485,8 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
*/
TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (auto key : config.keys) {
for (const auto& config : contentConfigurations) {
for (const auto& key : config.keys) {
const size_t kSegmentSize = 1024;
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
const Pattern noPattern = {0, 0};
@ -1513,8 +1513,8 @@ TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
*/
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (auto key : config.keys) {
for (const auto& config : contentConfigurations) {
for (const auto& key : config.keys) {
const size_t kSegmentSize = 1024;
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
const Pattern noPattern = {0, 0};
@ -1540,8 +1540,8 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
*/
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (auto key : config.keys) {
for (const auto& config : contentConfigurations) {
for (const auto& key : config.keys) {
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
const Pattern noPattern = {0, 0};
const vector<SubSample> subSamples = {{.numBytesOfClearData = 256,
@ -1567,8 +1567,8 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
*/
TEST_P(DrmHalVendorDecryptTest, AttemptDecryptWithKeysRemoved) {
RETURN_IF_SKIPPED;
for (auto config : contentConfigurations) {
for (auto key : config.keys) {
for (const auto& config : contentConfigurations) {
for (const auto& key : config.keys) {
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
const Pattern noPattern = {0, 0};
const vector<SubSample> subSamples = {{.numBytesOfClearData = 256,

View file

@ -228,13 +228,13 @@ protected:
const std::string& componentName, const VT& componentValue) {
bool validAttribute = false;
bool validComponent = false;
for (DrmMetricGroup::Attribute attribute : metric.attributes) {
for (const DrmMetricGroup::Attribute& attribute : metric.attributes) {
if (attribute.name == attributeName &&
ValueEquals(attribute.type, attributeValue, attribute)) {
validAttribute = true;
}
}
for (DrmMetricGroup::Value value : metric.values) {
for (const DrmMetricGroup::Value& value : metric.values) {
if (value.componentName == componentName &&
ValueEquals(value.type, componentValue, value)) {
validComponent = true;

View file

@ -78,9 +78,9 @@ std::unique_ptr<ComposerClient> Composer::createClient() {
ComposerClient::ComposerClient(const sp<IComposerClient>& client) : mClient(client) {}
ComposerClient::~ComposerClient() {
for (auto it : mDisplayResources) {
for (const auto& it : mDisplayResources) {
Display display = it.first;
DisplayResource& resource = it.second;
const DisplayResource& resource = it.second;
for (auto layer : resource.layers) {
EXPECT_EQ(Error::NONE, mClient->destroyLayer(display, layer))