From 275b3ac04dbe5654a38de47e7f4ee6b9b7ca7b8e Mon Sep 17 00:00:00 2001 From: jtattermusch Date: Tue, 9 Dec 2014 15:54:14 -0800 Subject: Getting rid of MS C++ warning when compiling GPR on Windows. 1>c:\users\jtattermusch\grpc_tar\src\core\support\sync_win32.c(97): warning C4244: 'function' : conversion from 'gpr_int64' to 'DWORD', possible loss of data Change on 2014/12/09 by jtattermusch ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=81724253 --- src/core/support/sync_win32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/support/sync_win32.c b/src/core/support/sync_win32.c index eadaa970c9..b2e922565f 100644 --- a/src/core/support/sync_win32.c +++ b/src/core/support/sync_win32.c @@ -83,6 +83,7 @@ void gpr_cv_destroy(gpr_cv *cv) { int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline) { int timeout = 0; + DWORD timeout_max_ms; if (gpr_time_cmp(abs_deadline, gpr_inf_future) == 0) { SleepConditionVariableCS(cv, &mu->cs, INFINITE); } else { @@ -93,9 +94,9 @@ int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline) { if (now_ms >= deadline_ms) { timeout = 1; } else { - timeout = - (SleepConditionVariableCS(cv, &mu->cs, deadline_ms - now_ms) == 0 && - GetLastError() == ERROR_TIMEOUT); + timeout_max_ms = (DWORD)min(deadline_ms - now_ms, INFINITE - 1); + timeout = (SleepConditionVariableCS(cv, &mu->cs, timeout_max_ms) == 0 && + GetLastError() == ERROR_TIMEOUT); } } return timeout; -- cgit v1.2.3