From 013e83b31c697c861dec83a4fe78b06e836984dd Mon Sep 17 00:00:00 2001 From: Niklas Enbom Date: Thu, 10 Dec 2015 16:16:55 -0800 Subject: [PATCH] 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} --- webrtc/base/event_tracer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/base/event_tracer.cc b/webrtc/base/event_tracer.cc index dbf85a4e9a..dec323dab1 100644 --- a/webrtc/base/event_tracer.cc +++ b/webrtc/base/event_tracer.cc @@ -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(e.pid), e.tid); has_logged_event = true; } if (shutting_down)