Enabled log formatting warnings.
[ Merge of http://go/wvgerrit/105025 ] Clang and GCC allow for warnings against the arguments for printf-like functions (e.i. LOGx). These validate that the format type specified in the format string match the corresponding argument type. Most of the time, format specifer errors are benign; hence why they haven't been seen as an error so far. However, with the enabling of specifier warnings and the enabling of warnings as errors on certain platforms, these existing errors need to be addressed. This CL enables format specifier warnings for most of the Widevine code, with the OEMCrypto L3 implementation which has a single error which requires a fix in the haystack code before being fixed in the Widevine branch. Strict format string warnings are not enabled for non-LP64 systems. Bug: 137583127 Test: Compiled for Linux and Android Change-Id: I051398332d31a20457b86563a90ad8f6d428445f
This commit is contained in:
@@ -109,7 +109,7 @@ class WvCdmEnginePreProvTest : public WvCdmTestBase {
|
||||
LicenseRequest license_request;
|
||||
license_request.GetDrmMessage(http_response, *response);
|
||||
|
||||
LOGV("response: size=%u, string:\n%s\n", response->size(),
|
||||
LOGV("response: size = %zu, string =\n%s\n", response->size(),
|
||||
Base64SafeEncode(
|
||||
std::vector<uint8_t>(response->begin(), response->end()))
|
||||
.c_str());
|
||||
@@ -239,7 +239,7 @@ class WvCdmEngineTest : public WvCdmEnginePreProvTest {
|
||||
std::string drm_msg;
|
||||
LicenseRequest lic_request;
|
||||
lic_request.GetDrmMessage(response, drm_msg);
|
||||
LOGV("drm msg: %u bytes\r\n%s", drm_msg.size(),
|
||||
LOGV("drm msg: %zu bytes\r\n%s", drm_msg.size(),
|
||||
HexEncode(reinterpret_cast<const uint8_t*>(drm_msg.data()),
|
||||
drm_msg.size())
|
||||
.c_str());
|
||||
|
||||
@@ -41,7 +41,7 @@ void ConcatenateChunkedResponse(const std::string http_response,
|
||||
sscanf(&http_response[chunk_size_pos], "%zx", &chunk_size);
|
||||
if (chunk_size > http_response.size()) {
|
||||
// precaution, in case we misread chunk size
|
||||
LOGE("invalid chunk size %u", chunk_size);
|
||||
LOGE("Invalid chunk size %zu", chunk_size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void ConcatenateChunkedResponse(const std::string http_response,
|
||||
sscanf(&http_response[chunk_size_pos], "%zx", &chunk_size);
|
||||
if (chunk_size > http_response.size()) {
|
||||
// precaution, in case we misread chunk size
|
||||
LOGE("invalid chunk size %u", chunk_size);
|
||||
LOGE("Invalid chunk size %zu", chunk_size);
|
||||
break;
|
||||
}
|
||||
chunk_pos = http_response.find(kCrLf, chunk_size_pos);
|
||||
@@ -104,11 +104,12 @@ bool UrlRequest::GetResponse(std::string* message) {
|
||||
// non-blocking mode.
|
||||
while (true) {
|
||||
char read_buffer[kReadBufferSize];
|
||||
int bytes = socket_.Read(read_buffer, sizeof(read_buffer), kReadTimeoutMs);
|
||||
const int bytes =
|
||||
socket_.Read(read_buffer, sizeof(read_buffer), kReadTimeoutMs);
|
||||
if (bytes > 0) {
|
||||
response.append(read_buffer, bytes);
|
||||
} else if (bytes < 0) {
|
||||
LOGE("read error, errno = %d", errno);
|
||||
LOGE("Read error, errno = %d", errno);
|
||||
return false;
|
||||
} else {
|
||||
// end of stream.
|
||||
@@ -117,7 +118,7 @@ bool UrlRequest::GetResponse(std::string* message) {
|
||||
}
|
||||
|
||||
ConcatenateChunkedResponse(response, message);
|
||||
LOGV("HTTP response from %s://%s:%d%s: (%zd): %s", socket_.scheme().c_str(),
|
||||
LOGV("HTTP response from %s://%s:%d%s: (%zu): %s", socket_.scheme().c_str(),
|
||||
socket_.domain_name().c_str(), socket_.port(),
|
||||
socket_.resource_path().c_str(), message->size(), message->c_str());
|
||||
return true;
|
||||
@@ -204,7 +205,7 @@ bool UrlRequest::PostRequestWithPath(const std::string& path,
|
||||
|
||||
const int ret =
|
||||
socket_.Write(request.c_str(), request.size(), kWriteTimeoutMs);
|
||||
LOGV("HTTP request: (%d): %s", request.size(), b2a_hex(request).c_str());
|
||||
LOGV("HTTP request: (%zu): %s", request.size(), b2a_hex(request).c_str());
|
||||
return ret != -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user