Fix compiler warnings
Merge from Widevine repo of http://go/wvgerrit/43420 Remove or mark unused variables. Fix unsigned/signed comparisons. bug: 73390805 test: unit tests Change-Id: Ic523400a5decf82fae733042b260e0c39a087cd3
This commit is contained in:
@@ -43,7 +43,7 @@ class SubLicenseKeySession : public KeySession {
|
|||||||
CdmCipherMode* cipher_mode,
|
CdmCipherMode* cipher_mode,
|
||||||
const std::string& srm_requirement);
|
const std::string& srm_requirement);
|
||||||
|
|
||||||
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>& keys) {
|
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>& /*keys*/) {
|
||||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
|||||||
open_sessions_stream << number_of_open_sessions;
|
open_sessions_stream << number_of_open_sessions;
|
||||||
*query_response = open_sessions_stream.str();
|
*query_response = open_sessions_stream.str();
|
||||||
} else if (query_token == QUERY_KEY_MAX_NUMBER_OF_SESSIONS) {
|
} else if (query_token == QUERY_KEY_MAX_NUMBER_OF_SESSIONS) {
|
||||||
size_t maximum_number_of_sessions;
|
size_t maximum_number_of_sessions = 0;
|
||||||
if (!crypto_session.GetMaxNumberOfSessions(&maximum_number_of_sessions)) {
|
if (!crypto_session.GetMaxNumberOfSessions(&maximum_number_of_sessions)) {
|
||||||
LOGW("CdmEngine::QueryStatus: GetMaxNumberOfOpenSessions failed");
|
LOGW("CdmEngine::QueryStatus: GetMaxNumberOfOpenSessions failed");
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
|
|||||||
@@ -1658,7 +1658,7 @@ bool CryptoSession::GetMaxNumberOfSessions(size_t* max) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t max_sessions;
|
size_t max_sessions = 0;
|
||||||
OEMCryptoResult status = OEMCrypto_GetMaxNumberOfSessions(
|
OEMCryptoResult status = OEMCrypto_GetMaxNumberOfSessions(
|
||||||
requested_security_level_, &max_sessions);
|
requested_security_level_, &max_sessions);
|
||||||
if (OEMCrypto_SUCCESS != status) {
|
if (OEMCrypto_SUCCESS != status) {
|
||||||
|
|||||||
@@ -759,10 +759,10 @@ class Adapter {
|
|||||||
OEMCrypto_INITIALIZED_USING_L3_COULD_NOT_OPEN_FACTORY_KEYBOX);
|
OEMCrypto_INITIALIZED_USING_L3_COULD_NOT_OPEN_FACTORY_KEYBOX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint8_t keybox[size];
|
std::vector<uint8_t> keybox(size);
|
||||||
ssize_t size_read = file->Read(reinterpret_cast<char*>(keybox), size);
|
ssize_t size_read = file->Read(reinterpret_cast<char*>(&keybox[0]), size);
|
||||||
file->Close();
|
file->Close();
|
||||||
if (level1_.InstallKeybox(keybox, size) != OEMCrypto_SUCCESS) {
|
if (level1_.InstallKeybox(&keybox[0], size_read) != OEMCrypto_SUCCESS) {
|
||||||
LOGE("Could NOT install keybox from %s. Falling Back to L3.",
|
LOGE("Could NOT install keybox from %s. Falling Back to L3.",
|
||||||
filename.c_str());
|
filename.c_str());
|
||||||
level1_.Terminate();
|
level1_.Terminate();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void Log(const char* file, const char* function, int line, LogPriority level,
|
|||||||
int len = snprintf(buf, LOG_BUF_SIZE, "[%s(%d):%s] ", filename, line,
|
int len = snprintf(buf, LOG_BUF_SIZE, "[%s(%d):%s] ", filename, line,
|
||||||
function);
|
function);
|
||||||
if (len < 0) len = 0;
|
if (len < 0) len = 0;
|
||||||
if (len < sizeof(buf)) {
|
if (static_cast<unsigned int>(len) < sizeof(buf)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vsnprintf(buf+len, LOG_BUF_SIZE-len, format, ap);
|
vsnprintf(buf+len, LOG_BUF_SIZE-len, format, ap);
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ namespace {
|
|||||||
|
|
||||||
// HTTP response codes.
|
// HTTP response codes.
|
||||||
const int kHttpOk = 200;
|
const int kHttpOk = 200;
|
||||||
const int kHttpBadRequest = 400;
|
// The following two responses are unused, but left here for human debuggers.
|
||||||
const int kHttpInternalServerError = 500;
|
// const int kHttpBadRequest = 400;
|
||||||
|
// const int kHttpInternalServerError = 500;
|
||||||
|
|
||||||
const uint32_t kMinute = 60;
|
const uint32_t kMinute = 60;
|
||||||
const uint32_t kClockTolerance = 10;
|
const uint32_t kClockTolerance = 10;
|
||||||
const uint32_t kTwoMinutes = 120;
|
|
||||||
|
|
||||||
const uint32_t kMaxUsageTableSize = 50;
|
const uint32_t kMaxUsageTableSize = 50;
|
||||||
|
|
||||||
@@ -932,7 +932,6 @@ TEST_F(WvCdmExtendedDurationTest, DecryptionCloseSessionConcurrencyTest) {
|
|||||||
|
|
||||||
TEST_F(WvCdmExtendedDurationTest, UsageOverflowTest) {
|
TEST_F(WvCdmExtendedDurationTest, UsageOverflowTest) {
|
||||||
Provision();
|
Provision();
|
||||||
SubSampleInfo* data = &kEncryptedStreamingClip5SubSample;
|
|
||||||
TestWvCdmClientPropertySet client_property_set;
|
TestWvCdmClientPropertySet client_property_set;
|
||||||
TestWvCdmClientPropertySet* property_set = NULL;
|
TestWvCdmClientPropertySet* property_set = NULL;
|
||||||
|
|
||||||
@@ -959,7 +958,6 @@ TEST_F(WvCdmExtendedDurationTest, UsageOverflowTest) {
|
|||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t num_usage_info = 0;
|
|
||||||
CdmUsageInfo usage_info;
|
CdmUsageInfo usage_info;
|
||||||
CdmUsageInfoReleaseMessage release_msg;
|
CdmUsageInfoReleaseMessage release_msg;
|
||||||
CdmResponseType status = decryptor_.GetUsageInfo(
|
CdmResponseType status = decryptor_.GetUsageInfo(
|
||||||
@@ -1003,9 +1001,6 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnTimerEvent) {
|
|||||||
uint32_t initial_open_sessions =
|
uint32_t initial_open_sessions =
|
||||||
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
|
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
|
||||||
|
|
||||||
uint32_t max_sessions =
|
|
||||||
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_MAX_NUMBER_OF_SESSIONS);
|
|
||||||
|
|
||||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||||
&session_id_);
|
&session_id_);
|
||||||
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
|
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
|
||||||
@@ -1059,9 +1054,6 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnOpenSession) {
|
|||||||
uint32_t initial_open_sessions =
|
uint32_t initial_open_sessions =
|
||||||
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
|
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
|
||||||
|
|
||||||
uint32_t max_sessions =
|
|
||||||
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_MAX_NUMBER_OF_SESSIONS);
|
|
||||||
|
|
||||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||||
&session_id_);
|
&session_id_);
|
||||||
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
|
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
|
||||||
@@ -1398,7 +1390,6 @@ TEST_P(WvCdmStreamingUsageReportTest, UsageTest) {
|
|||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
// Create usage report and validate
|
// Create usage report and validate
|
||||||
uint32_t num_usage_info = 0;
|
|
||||||
CdmUsageInfo usage_info;
|
CdmUsageInfo usage_info;
|
||||||
CdmUsageInfoReleaseMessage release_msg;
|
CdmUsageInfoReleaseMessage release_msg;
|
||||||
CdmResponseType status = decryptor_.GetUsageInfo(
|
CdmResponseType status = decryptor_.GetUsageInfo(
|
||||||
|
|||||||
@@ -47,12 +47,11 @@ namespace {
|
|||||||
|
|
||||||
#define N_ELEM(a) (sizeof(a) / sizeof(a[0]))
|
#define N_ELEM(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
const char kPathDelimiter = '/';
|
|
||||||
|
|
||||||
// HTTP response codes.
|
// HTTP response codes.
|
||||||
const int kHttpOk = 200;
|
const int kHttpOk = 200;
|
||||||
const int kHttpBadRequest = 400;
|
// The following two responses are unused, but left here for human debuggers.
|
||||||
const int kHttpInternalServerError = 500;
|
// const int kHttpBadRequest = 400;
|
||||||
|
// const int kHttpInternalServerError = 500;
|
||||||
|
|
||||||
// Default license server, can be configured using --server command line option
|
// Default license server, can be configured using --server command line option
|
||||||
// Default key id (pssh), can be configured using --keyid command line option
|
// Default key id (pssh), can be configured using --keyid command line option
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ namespace {
|
|||||||
|
|
||||||
#define N_ELEM(a) (sizeof(a)/sizeof(a[0]))
|
#define N_ELEM(a) (sizeof(a)/sizeof(a[0]))
|
||||||
|
|
||||||
const char kPathDelimiter = '/';
|
|
||||||
|
|
||||||
// HTTP response codes.
|
// HTTP response codes.
|
||||||
const int kHttpOk = 200;
|
const int kHttpOk = 200;
|
||||||
const int kHttpBadRequest = 400;
|
const int kHttpBadRequest = 400;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-DDYNAMIC_ADAPTER \
|
-DDYNAMIC_ADAPTER \
|
||||||
-Wno-unused
|
-Wno-unused \
|
||||||
|
-Wno-unused-parameter
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
system/core/include \
|
system/core/include \
|
||||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-DDYNAMIC_ADAPTER \
|
-DDYNAMIC_ADAPTER \
|
||||||
-Wno-unused
|
-Wno-unused \
|
||||||
|
-Wno-unused-parameter
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
system/core/include \
|
system/core/include \
|
||||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-DDYNAMIC_ADAPTER \
|
-DDYNAMIC_ADAPTER \
|
||||||
-Wno-unused
|
-Wno-unused \
|
||||||
|
-Wno-unused-parameter
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
system/core/include \
|
system/core/include \
|
||||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-DDYNAMIC_ADAPTER \
|
-DDYNAMIC_ADAPTER \
|
||||||
-Wno-unused
|
-Wno-unused \
|
||||||
|
-Wno-unused-parameter
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
system/core/include \
|
system/core/include \
|
||||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-DDYNAMIC_ADAPTER \
|
-DDYNAMIC_ADAPTER \
|
||||||
-Wno-unused
|
-Wno-unused \
|
||||||
|
-Wno-unused-parameter
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
system/core/include \
|
system/core/include \
|
||||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-DDYNAMIC_ADAPTER \
|
-DDYNAMIC_ADAPTER \
|
||||||
-Wno-unused
|
-Wno-unused \
|
||||||
|
-Wno-unused-parameter
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
system/core/include \
|
system/core/include \
|
||||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||||
|
|||||||
@@ -475,7 +475,6 @@ TEST_F(WVCryptoPluginTest, CommunicatesSecureBufferRequest) {
|
|||||||
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
|
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
|
||||||
|
|
||||||
uint32_t bytesWritten = 0;
|
uint32_t bytesWritten = 0;
|
||||||
Status err = Status::OK;
|
|
||||||
std::string errorDetailMessage;
|
std::string errorDetailMessage;
|
||||||
DestinationBuffer hDestination;
|
DestinationBuffer hDestination;
|
||||||
hDestination.type = BufferType::SHARED_MEMORY;
|
hDestination.type = BufferType::SHARED_MEMORY;
|
||||||
@@ -590,7 +589,6 @@ TEST_F(WVCryptoPluginTest, SetsFlagsForMinimumSubsampleRuns) {
|
|||||||
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
|
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
|
||||||
|
|
||||||
uint32_t bytesWritten = 0;
|
uint32_t bytesWritten = 0;
|
||||||
Status err = Status::OK;
|
|
||||||
std::string errorDetailMessage;
|
std::string errorDetailMessage;
|
||||||
DestinationBuffer hDestination;
|
DestinationBuffer hDestination;
|
||||||
hDestination.type = BufferType::SHARED_MEMORY;
|
hDestination.type = BufferType::SHARED_MEMORY;
|
||||||
@@ -705,7 +703,6 @@ TEST_F(WVCryptoPluginTest, AllowsSessionIdChanges) {
|
|||||||
WVCryptoPlugin plugin(blank, 0, cdm.get());
|
WVCryptoPlugin plugin(blank, 0, cdm.get());
|
||||||
|
|
||||||
uint32_t bytesWritten = 0;
|
uint32_t bytesWritten = 0;
|
||||||
Status err = Status::OK;
|
|
||||||
std::string errorDetailMessage;
|
std::string errorDetailMessage;
|
||||||
DestinationBuffer hDestination;
|
DestinationBuffer hDestination;
|
||||||
hDestination.type = BufferType::SHARED_MEMORY;
|
hDestination.type = BufferType::SHARED_MEMORY;
|
||||||
|
|||||||
@@ -730,7 +730,6 @@ TEST_F(WVDrmPluginTest, QueriesKeyStatus) {
|
|||||||
for (std::map<std::string, std::string>::iterator itr =
|
for (std::map<std::string, std::string>::iterator itr =
|
||||||
expectedLicenseStatus.begin();
|
expectedLicenseStatus.begin();
|
||||||
itr != expectedLicenseStatus.end(); ++itr) {
|
itr != expectedLicenseStatus.end(); ++itr) {
|
||||||
const std::string& key = itr->first;
|
|
||||||
keyValuePair.value = hLicenseStatus[i++].value;
|
keyValuePair.value = hLicenseStatus[i++].value;
|
||||||
EXPECT_EQ(itr->second.c_str(), std::string(keyValuePair.value.c_str()));
|
EXPECT_EQ(itr->second.c_str(), std::string(keyValuePair.value.c_str()));
|
||||||
}
|
}
|
||||||
@@ -1409,7 +1408,6 @@ TEST_F(WVDrmPluginTest, FailsGenericMethodsWithoutAnAlgorithmSet) {
|
|||||||
std::vector<uint8_t> input;
|
std::vector<uint8_t> input;
|
||||||
std::vector<uint8_t> iv;
|
std::vector<uint8_t> iv;
|
||||||
std::vector<uint8_t> output;
|
std::vector<uint8_t> output;
|
||||||
bool match;
|
|
||||||
|
|
||||||
// Provide expected behavior to support session creation
|
// Provide expected behavior to support session creation
|
||||||
EXPECT_CALL(*cdm, OpenSession(StrEq("com.widevine"), _, _, _, _))
|
EXPECT_CALL(*cdm, OpenSession(StrEq("com.widevine"), _, _, _, _))
|
||||||
@@ -1697,7 +1695,6 @@ TEST_F(WVDrmPluginTest, CallsGenericVerify) {
|
|||||||
message.assign(messageRaw, messageRaw + kDataSize);
|
message.assign(messageRaw, messageRaw + kDataSize);
|
||||||
std::vector<uint8_t> signature;
|
std::vector<uint8_t> signature;
|
||||||
signature.assign(signatureRaw, signatureRaw + kSignatureSize);
|
signature.assign(signatureRaw, signatureRaw + kSignatureSize);
|
||||||
bool match;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
InSequence calls;
|
InSequence calls;
|
||||||
@@ -2364,7 +2361,6 @@ TEST_F(WVDrmPluginTest, CanSetSessionSharing) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
||||||
Status res;
|
|
||||||
|
|
||||||
// Test turning on session sharing
|
// Test turning on session sharing
|
||||||
Status status = plugin.setPropertyString(hidl_string("sessionSharing"),
|
Status status = plugin.setPropertyString(hidl_string("sessionSharing"),
|
||||||
@@ -2461,4 +2457,3 @@ TEST_F(WVDrmPluginTest, AllowsStoringOfSessionSharingId) {
|
|||||||
} // namespace drm
|
} // namespace drm
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace wvdrm
|
} // namespace wvdrm
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user