FS-10167: Updated libks windows project and test projects to utilize the latest build toolset, and added code analysis to identify potential issues before they occur.

This commit is contained in:
Shane Bryldt committed 2017-03-30 10:44:36 -06:00
1 parent 7accfd2a69
commit 3bde4769cc
14 files changed
+59 -52

No files matched your search

+3
View File
@@ -46,6 +46,9 @@ KS_BEGIN_EXTERN_C
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
#define __WINDOWS__
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#endif
#endif
#ifndef _GNU_SOURCE
+1 -1
View File
@@ -81,7 +81,7 @@ KS_DECLARE(ks_status_t) ks_init(void)
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD(2, 2);
WSAStartup(wVersionRequested, &wsaData);
ks_assert(!WSAStartup(wVersionRequested, &wsaData));
#endif
return KS_STATUS_SUCCESS;
-5
View File
@@ -17,11 +17,6 @@
*
*/
#ifdef WIN32
/* required for TryEnterCriticalSection definition. Must be defined before windows.h include */
#define _WIN32_WINNT 0x0400
#endif
#include "ks.h"
#ifdef WIN32
+9 -6
View File
@@ -34,6 +34,8 @@
#include <ks.h>
#ifdef WIN32
#include <VersionHelpers.h>
static CRITICAL_SECTION timer_section;
static ks_time_t win32_tick_time_since_start = -1;
static DWORD win32_last_get_time_tick = 0;
@@ -51,9 +53,10 @@ static inline void win32_init_timers(void)
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
/* Check if we should use timeGetTime() (pre-Vista) or QueryPerformanceCounter() (Vista and later) */
if (GetVersionEx((OSVERSIONINFO*) &version_info)) {
if (version_info.dwPlatformId == VER_PLATFORM_WIN32_NT && version_info.dwMajorVersion >= 6) {
//if (GetVersionEx((OSVERSIONINFO*) &version_info)) {
if (IsWindowsVistaOrGreater()) {
//if (version_info.dwPlatformId == VER_PLATFORM_WIN32_NT && version_info.dwMajorVersion >= 6) {
if (QueryPerformanceFrequency((LARGE_INTEGER*)&win32_qpc_freq) && win32_qpc_freq > 0) {
/* At least Vista, and QueryPerformanceFrequency() suceeded, enable qpc */
win32_use_qpc = 1;
@@ -61,10 +64,10 @@ static inline void win32_init_timers(void)
/* At least Vista, but QueryPerformanceFrequency() failed, disable qpc */
win32_use_qpc = 0;
}
} else {
//} else {
/* Older then Vista, disable qpc */
win32_use_qpc = 0;
}
//win32_use_qpc = 0;
//}
} else {
/* Unknown version - we want at least Vista, disable qpc */
win32_use_qpc = 0;