From: Martin Ling Date: Fri, 24 Jan 2020 05:03:49 +0000 (+0000) Subject: windows: Fix a warning on conversion to unsigned int. X-Git-Tag: libserialport-0.1.2~39 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=41fc921ce47672ffc297c894c83e8469cfed6d3e;p=libserialport.git windows: Fix a warning on conversion to unsigned int. The result should be safe because we only use this function on time differences as part of timeout calculations, not on absolute times. Add an explicit cast to suppress the warning. --- diff --git a/timing.c b/timing.c index 3a5f5c7..25876d6 100644 --- a/timing.c +++ b/timing.c @@ -102,7 +102,7 @@ SP_PRIV unsigned int time_as_ms(const struct time *time) #ifdef _WIN32 LARGE_INTEGER frequency; QueryPerformanceFrequency(&frequency); - return time->ticks / (frequency.QuadPart / 1000); + return (unsigned int) (time->ticks / (frequency.QuadPart / 1000)); #else return time->tv.tv_sec * 1000 + time->tv.tv_usec / 1000; #endif