Skip to content

Commit bd47c09

Browse files
committed
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 <[email protected]>
1 parent 84d9865 commit bd47c09

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

googletest/src/gtest-port.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ size_t GetThreadCount() {
279279
#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
280280

281281
void SleepMilliseconds(int n) {
282-
::Sleep(n);
282+
::Sleep(static_cast<DWORD>(n));
283283
}
284284

285285
AutoHandle::AutoHandle()

googletest/src/gtest-printers.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ inline bool IsPrintableAscii(wchar_t c) {
144144
// which is the type of c.
145145
template <typename UnsignedChar, typename Char>
146146
static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
147-
switch (static_cast<wchar_t>(c)) {
147+
wchar_t w_c = static_cast<wchar_t>(c);
148+
switch (w_c) {
148149
case L'\0':
149150
*os << "\\0";
150151
break;
@@ -176,7 +177,7 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
176177
*os << "\\v";
177178
break;
178179
default:
179-
if (IsPrintableAscii(c)) {
180+
if (IsPrintableAscii(w_c)) {
180181
*os << static_cast<char>(c);
181182
return kAsIs;
182183
} else {

0 commit comments

Comments
 (0)