Fix -Wformat error in Win-Clang build

rtc::PlatformThreadId is pid_t (32-bit signed int) on Linux and Mac,
but DWORD (32-bit unsigned int) on Windows.

Using the %d printf specifier is therefore not correct on Windows,
and Clang would warn about it:

..\..\third_party\webrtc\base\event_tracer.cc(124,46) :  error: format specifies
type 'int' but the argument has type 'rtc::PlatformThreadId' (aka 'unsigned
long') [-Werror,-Wformat]
                e.phase, e.timestamp, e.pid, e.tid);
                                             ^~~~~

This commit fixes the problem by explicitly casting to int before printing.

BUG=82385

Review URL: https://codereview.webrtc.org/1514253002 .

Cr-Commit-Position: refs/heads/master@{#10982}
This commit is contained in:
Niklas Enbom
2015-12-10 16:16:55 -08:00
parent cf846ad60a
commit 013e83b31c

View File

@ -121,7 +121,7 @@ class EventLogger final {
", \"pid\": %d"
", \"tid\": %d}\n",
has_logged_event ? "," : " ", e.name, e.category_enabled,
e.phase, e.timestamp, e.pid, e.tid);
e.phase, e.timestamp, static_cast<int>(e.pid), e.tid);
has_logged_event = true;
}
if (shutting_down)