From a771bf8ee84f293c166d3e377d852e9705c12725 Mon Sep 17 00:00:00 2001 From: dcheng Date: Wed, 1 Jul 2015 17:52:10 -0700 Subject: [PATCH] Fix some clang warnings with -Wmissing-braces in WebRTC. Clang warns if there are missing braces around a subobject initializer. The most common idiom that triggers this is: STRUCT s = {0}; if the first field of STRUCT is itself a struct. This can be more simply written as: STRUCT s = {}; which also prevents the warning from firing. Other instances of the warning have been fixed by adding braces where appropriate. BUG=505297 TBR=jiayl@webrtc.org Review URL: https://codereview.webrtc.org/1216353002 Cr-Commit-Position: refs/heads/master@{#9529} --- webrtc/base/win32.h | 2 +- webrtc/modules/desktop_capture/desktop_frame_win.cc | 2 +- webrtc/system_wrappers/source/clock.cc | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webrtc/base/win32.h b/webrtc/base/win32.h index 1fc4221aec..9824f6b1db 100644 --- a/webrtc/base/win32.h +++ b/webrtc/base/win32.h @@ -86,7 +86,7 @@ bool Utf8ToWindowsFilename(const std::string& utf8, std::wstring* filename); // Convert a FILETIME to a UInt64 inline uint64 ToUInt64(const FILETIME& ft) { - ULARGE_INTEGER r = {ft.dwLowDateTime, ft.dwHighDateTime}; + ULARGE_INTEGER r = {{ft.dwLowDateTime, ft.dwHighDateTime}}; return r.QuadPart; } diff --git a/webrtc/modules/desktop_capture/desktop_frame_win.cc b/webrtc/modules/desktop_capture/desktop_frame_win.cc index 98bc902c4b..c6d7ccfcb9 100644 --- a/webrtc/modules/desktop_capture/desktop_frame_win.cc +++ b/webrtc/modules/desktop_capture/desktop_frame_win.cc @@ -35,7 +35,7 @@ DesktopFrameWin* DesktopFrameWin::Create(DesktopSize size, int bytes_per_row = size.width() * kBytesPerPixel; // Describe a device independent bitmap (DIB) that is the size of the desktop. - BITMAPINFO bmi = {0}; + BITMAPINFO bmi = {}; bmi.bmiHeader.biHeight = -size.height(); bmi.bmiHeader.biWidth = size.width(); bmi.bmiHeader.biPlanes = 1; diff --git a/webrtc/system_wrappers/source/clock.cc b/webrtc/system_wrappers/source/clock.cc index a7f261a8b2..31c5226348 100644 --- a/webrtc/system_wrappers/source/clock.cc +++ b/webrtc/system_wrappers/source/clock.cc @@ -155,9 +155,9 @@ class WindowsRealTimeClock : public RealTimeClock { } static ReferencePoint GetSystemReferencePoint() { - ReferencePoint ref = {0}; - FILETIME ft0 = {0}; - FILETIME ft1 = {0}; + ReferencePoint ref = {}; + FILETIME ft0 = {}; + FILETIME ft1 = {}; // Spin waiting for a change in system time. As soon as this change happens, // get the matching call for timeGetTime() as soon as possible. This is // assumed to be the most accurate offset that we can get between