Log cleanup and reformatting for core/ (part 1)

Merge from Widevine repo of http://go/wvgerrit/81265

Types of cleanup:
  - Removed function / class prefixes from the logs.
  - Fixed log string format options to match the types passed
  - Added static_cast conversion on enumerations
  - _Tried_ to make the log format more consistent (open to feedback)
  - Corrected small spelling mistakes

This set of changes is very large, splitting change across several
submissions.  This change:
  - core/src/buffer_reader.cpp
  - core/src/cdm_engine.cpp
  - core/src/cdm_session.cpp

Test: WV linux unittests
Bug: 134460638
Change-Id: I16c3297b8e94a99c2b8650b129d0f9e8d96b177f
This commit is contained in:
Alex Dale
2019-06-21 15:22:16 -07:00
parent 6004c2a945
commit cbc1fba713
3 changed files with 277 additions and 369 deletions

View File

@@ -11,16 +11,12 @@ namespace wvcdm {
bool BufferReader::Read1(uint8_t* v) {
if (v == NULL) {
LOGE(
"BufferReader::Read1 : Failure during parse: Null output parameter "
"when expecting non-null");
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
if (!HasBytes(1)) {
LOGV(
"BufferReader::Read1 : Failure while parsing: "
"Not enough bytes (1)");
LOGV("Parse failure: No bytes available");
return false;
}
@@ -32,18 +28,13 @@ bool BufferReader::Read1(uint8_t* v) {
template <typename T>
bool BufferReader::Read(T* v) {
if (v == NULL) {
LOGE(
"BufferReader::Read<T> : Failure during parse: Null output parameter "
"when expecting non-null (%s)",
__PRETTY_FUNCTION__);
LOGE("Parse failure: Null output parameter when expecting non-null (%s)",
__PRETTY_FUNCTION__);
return false;
}
if (!HasBytes(sizeof(T))) {
LOGV(
"BufferReader::Read<T> : Failure during parse: "
"Not enough bytes (%u)",
sizeof(T));
LOGV("Parse failure: Not enough bytes (%zu)", sizeof(T));
return false;
}
@@ -65,17 +56,12 @@ bool BufferReader::Read8s(int64_t* v) { return Read(v); }
bool BufferReader::ReadString(std::string* str, size_t count) {
if (str == NULL) {
LOGE(
"BufferReader::ReadString : Failure during parse: Null output "
"parameter when expecting non-null");
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
if (!HasBytes(count)) {
LOGV(
"BufferReader::ReadString : Parse Failure: "
"Not enough bytes (%d)",
count);
LOGV("Parse failure: Not enough bytes (%zu)", count);
return false;
}
@@ -86,17 +72,12 @@ bool BufferReader::ReadString(std::string* str, size_t count) {
bool BufferReader::ReadVec(std::vector<uint8_t>* vec, size_t count) {
if (vec == NULL) {
LOGE(
"BufferReader::ReadVec : Failure during parse: Null output parameter "
"when expecting non-null");
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
if (!HasBytes(count)) {
LOGV(
"BufferReader::ReadVec : Parse Failure: "
"Not enough bytes (%d)",
count);
LOGV("Parse failure: Not enough bytes (%zu)", count);
return false;
}
@@ -108,10 +89,7 @@ bool BufferReader::ReadVec(std::vector<uint8_t>* vec, size_t count) {
bool BufferReader::SkipBytes(size_t bytes) {
if (!HasBytes(bytes)) {
LOGV(
"BufferReader::SkipBytes : Parse Failure: "
"Not enough bytes (%d)",
bytes);
LOGV("Parse failure: Not enough bytes (%zu)", bytes);
return false;
}
@@ -121,9 +99,7 @@ bool BufferReader::SkipBytes(size_t bytes) {
bool BufferReader::Read4Into8(uint64_t* v) {
if (v == NULL) {
LOGE(
"BufferReader::Read4Into8 : Failure during parse: Null output "
"parameter when expecting non-null");
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
@@ -137,9 +113,7 @@ bool BufferReader::Read4Into8(uint64_t* v) {
bool BufferReader::Read4sInto8s(int64_t* v) {
if (v == NULL) {
LOGE(
"BufferReader::Read4sInto8s : Failure during parse: Null output "
"parameter when expecting non-null");
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}