Log cleanup and reformatting for core/ (Part 2-6)

[ Merge of http://go/wvgerrit/83423 ]
[ Merge of http://go/wvgerrit/83424 ]
[ Merge of http://go/wvgerrit/83425 ]
[ Merge of http://go/wvgerrit/83426 ]
[ Merge of http://go/wvgerrit/83427 ]

Types of cleanup:
  - Removed function / class prefixes from the logs.
  - Fixed log string format options to match the types passed
  - Corrected small spelling mistakes / typos
  - _Tried_ to make the log format more consistent
  - Added static_cast<int> conversion on enumerations when logged
  - Changed several LOGE to LOGW and vice versa
      - Used LOGE if the triggering condition stops the method/function
        from completing its task
      - Used LOGW if the triggering condition changes the expected
        outcome but does not stop the rest of the method/function's
        task
  - Changed several instances of `NULL` to `nullptr`
  - Ran clang-format on files after cleanup

This is part of a larger code quality effort in Widevine DRM.

Test: WV linux unittests and WV Android unit tests
Bug: 134460638
Bug: 134365840
Bug: 136123217
Change-Id: I958ec70ef99eef95c38dbebd7a1acd62ef304145
This commit is contained in:
Alex Dale
2019-08-01 11:18:12 -07:00
parent 79a28e5ddb
commit f4360552b7
15 changed files with 871 additions and 1132 deletions

View File

@@ -39,8 +39,8 @@ using video_widevine::ProvisioningResponse;
using video_widevine::SignedProvisioningMessage;
CdmResponseType ClientIdentification::Init(CryptoSession* crypto_session) {
if (crypto_session == NULL) {
LOGE("ClientIdentification::Init: crypto_session not provided");
if (crypto_session == nullptr) {
LOGE("Crypto session not provided");
return PARAMETER_NULL;
}
@@ -52,13 +52,13 @@ CdmResponseType ClientIdentification::Init(CryptoSession* crypto_session) {
CdmResponseType ClientIdentification::Init(const std::string& client_token,
const std::string& device_id,
CryptoSession* crypto_session) {
if (crypto_session == NULL) {
LOGE("ClientIdentification::Init: crypto_session not provided");
if (crypto_session == nullptr) {
LOGE("Crypto session not provided");
return PARAMETER_NULL;
}
if (client_token.empty()) {
LOGE("ClientIdentification::Init: crypto_session not provided");
LOGE("Client token is empty");
return PARAMETER_NULL;
}
@@ -84,9 +84,7 @@ CdmResponseType ClientIdentification::Prepare(
} else {
video_widevine::ClientIdentification::TokenType token_type;
if (!GetProvisioningTokenType(&token_type)) {
LOGE(
"ClientIdentification::Prepare: failure getting provisioning token "
"type");
LOGE("Failed to get provisioning token type");
return CLIENT_IDENTIFICATION_TOKEN_ERROR_1;
}
client_id->set_type(token_type);
@@ -94,10 +92,8 @@ CdmResponseType ClientIdentification::Prepare(
std::string token;
CdmResponseType status = crypto_session_->GetProvisioningToken(&token);
if (status != NO_ERROR) {
LOGE(
"ClientIdentification::Prepare: failure getting provisioning token: "
"%d",
status);
LOGE("Failed to get provisioning token: status = %d",
static_cast<int>(status));
return status;
}
client_id->set_token(token);
@@ -223,10 +219,8 @@ CdmResponseType ClientIdentification::Prepare(
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_NO_DIGITAL_OUTPUT);
break;
default:
LOGW(
"ClientIdentification::PrepareClientId: unexpected HDCP max "
"capability version %d",
max_version);
LOGW("Unexpected HDCP max capability version: max_version = %d",
static_cast<int>(max_version));
}
}
}
@@ -304,10 +298,7 @@ bool ClientIdentification::GetProvisioningTokenType(
case kClientTokenDrmCert:
default:
// shouldn't happen
LOGE(
"CertificateProvisioning::GetProvisioningTokenType: unexpected "
"provisioning type: %d",
token);
LOGE("Unexpected provisioning type: %d", static_cast<int>(token));
return false;
}
}