]> granicus.if.org Git - curl/commitdiff
timeval: Disable MSVC Analyzer GetTickCount warning
authorMichael Kujawa <kujo@insightfulengine.com>
Sat, 5 Jan 2019 01:18:25 +0000 (20:18 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 28 Jan 2019 06:16:00 +0000 (01:16 -0500)
Compiling with msvc /analyze and a recent Windows SDK warns against
using GetTickCount (Suggests to use GetTickCount64 instead.)

Since GetTickCount is only being used when GetTickCount64 isn't
available, I am disabling that warning.

Fixes https://github.com/curl/curl/issues/3437
Closes https://github.com/curl/curl/pull/3440

lib/timeval.c

index f1cbfe6773feb78003a586d445b8c939e7fe1a39..2569f175c345dbb9af00a41a827b178cca696089 100644 (file)
@@ -47,7 +47,16 @@ struct curltime Curl_now(void)
       (int)((count.QuadPart % freq.QuadPart) * 1000000 / freq.QuadPart);
   }
   else {
+    /* Disable /analyze warning that GetTickCount64 is preferred  */
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:28159)
+#endif
     DWORD milliseconds = GetTickCount();
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
     now.tv_sec = milliseconds / 1000;
     now.tv_usec = (milliseconds % 1000) * 1000;
   }