From: Enji Cooper Date: Fri, 26 Apr 2019 10:59:54 +0000 (-0700) Subject: Address fallout from -Wsign-conversion work on Windows X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bd47c09b73d40f210238b73f925a8f9196e70675;p=googletest.git Address fallout from -Wsign-conversion work on Windows Some Windows users builds were broken after a0d60be. This change addresses the lingering -Wsign-conversion issues with those platforms by adding some missing `static_cast` calls as needed. Signed-off-by: Enji Cooper --- diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index e5b91fd..4015a1c 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -279,7 +279,7 @@ size_t GetThreadCount() { #if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS void SleepMilliseconds(int n) { - ::Sleep(n); + ::Sleep(static_cast(n)); } AutoHandle::AutoHandle() diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc index 40a8817..a7c5e00 100644 --- a/googletest/src/gtest-printers.cc +++ b/googletest/src/gtest-printers.cc @@ -144,7 +144,8 @@ inline bool IsPrintableAscii(wchar_t c) { // which is the type of c. template static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { - switch (static_cast(c)) { + wchar_t w_c = static_cast(c); + switch (w_c) { case L'\0': *os << "\\0"; break; @@ -176,7 +177,7 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { *os << "\\v"; break; default: - if (IsPrintableAscii(c)) { + if (IsPrintableAscii(w_c)) { *os << static_cast(c); return kAsIs; } else {