]> git-server-git.apps.pok.os.sepia.ceph.com Git - googletest.git/commitdiff
Address fallout from -Wsign-conversion work on Windows
authorEnji Cooper <yaneurabeya@gmail.com>
Fri, 26 Apr 2019 10:59:54 +0000 (03:59 -0700)
committerEnji Cooper <yaneurabeya@gmail.com>
Fri, 26 Apr 2019 11:08:16 +0000 (04:08 -0700)
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 <yaneurabeya@gmail.com>
googletest/src/gtest-port.cc
googletest/src/gtest-printers.cc

index e5b91fd04bd4181cc336a49564019f48ba7a38b9..4015a1c11e38c80c9b6515d648a55b169c67087f 100644 (file)
@@ -279,7 +279,7 @@ size_t GetThreadCount() {
 #if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
 
 void SleepMilliseconds(int n) {
-  ::Sleep(n);
+  ::Sleep(static_cast<DWORD>(n));
 }
 
 AutoHandle::AutoHandle()
index 40a8817e127d7ca40c4df280634c91193cd82e18..a7c5e0021d1f6c2c56883ad19eeaed935a6f1d7e 100644 (file)
@@ -144,7 +144,8 @@ inline bool IsPrintableAscii(wchar_t c) {
 // which is the type of c.
 template <typename UnsignedChar, typename Char>
 static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
-  switch (static_cast<wchar_t>(c)) {
+  wchar_t w_c = static_cast<wchar_t>(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<char>(c);
         return kAsIs;
       } else {