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:
@ -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)
|
||||
|
Reference in New Issue
Block a user