Fix -Wshorten-64-to-32 errors in test code
(This is a merge of http://go/wvgerrit/134316.) This patch fixes code that would trigger -Wshorten-64-to-32 by implicitly narrowing a variable from 64 to 32 bits. Most of the time, it does this by making the implicit conversion explicit. Occasionally, where it makes sense, it does this by expanding the code to operate on a 64-bit value. This patch removes LicenseKeysTest::NumContentKeys(), which no one was using, as all the tests access content_key_count_ directly. Bug: 194971260 Test: x86-64 Change-Id: Iae7685c10b9db989253b349cab693728b438798d
This commit is contained in:
@@ -3230,7 +3230,7 @@ TEST_P(OEMCryptoLicenseTest, AntiRollbackHardwareRequired) {
|
||||
TEST_P(OEMCryptoLicenseTest, MinimumKeys) {
|
||||
const size_t num_keys = GetResourceValue(kMaxKeysPerSession);
|
||||
ASSERT_LE(num_keys, kMaxNumKeys) << "Test constants need updating.";
|
||||
license_messages_.set_num_keys(num_keys);
|
||||
license_messages_.set_num_keys(static_cast<uint32_t>(num_keys));
|
||||
ASSERT_NO_FATAL_FAILURE(session_.GenerateNonce());
|
||||
ASSERT_NO_FATAL_FAILURE(license_messages_.SignAndVerifyRequest());
|
||||
ASSERT_NO_FATAL_FAILURE(license_messages_.CreateDefaultResponse());
|
||||
@@ -3258,7 +3258,7 @@ void TestMaxKeys(SessionUtil* util, size_t num_keys_per_session) {
|
||||
new LicenseRoundTrip(sessions[i].get())));
|
||||
const size_t num_keys =
|
||||
std::min(max_total_keys - total_keys, num_keys_per_session);
|
||||
licenses[i]->set_num_keys(num_keys);
|
||||
licenses[i]->set_num_keys(static_cast<uint32_t>(num_keys));
|
||||
total_keys += num_keys;
|
||||
ASSERT_NO_FATAL_FAILURE(sessions[i]->open());
|
||||
ASSERT_NO_FATAL_FAILURE(util->InstallTestRSAKey(sessions[i].get()));
|
||||
|
||||
Reference in New Issue
Block a user