Windows: Silence VS2013 code analysis warnings

* Also update Windows version report for Windows 10
This commit is contained in:
Pete Batard 2014-11-13 22:03:30 +00:00
parent ab8f71c03f
commit ada59db186
5 changed files with 13 additions and 9 deletions

View file

@ -1098,7 +1098,8 @@ int main(int argc, char** argv)
// but since we can't call on libusb_set_debug() before libusb_init(), we use the env variable method
old_dbg_str = getenv("LIBUSB_DEBUG");
if (debug_mode) {
putenv("LIBUSB_DEBUG=4"); // LIBUSB_LOG_LEVEL_DEBUG
if (putenv("LIBUSB_DEBUG=4") != 0) // LIBUSB_LOG_LEVEL_DEBUG
printf("Unable to set debug level");
}
version = libusb_get_version();

View file

@ -186,7 +186,8 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
// GetSystemTimeAsFileTime() is not available on CE
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &filetime);
if (!SystemTimeToFileTime(&st, &filetime))
return 0;
rtime.LowPart = filetime.dwLowDateTime;
rtime.HighPart = filetime.dwHighDateTime;
rtime.QuadPart -= epoch_time;

View file

@ -890,13 +890,13 @@ static void get_windows_version(void)
break;
case 0x63: w = (ws?"8.1":"2012_R2");
break;
case 0x64: w = (ws?"8.2":"2012_R3");
case 0x64: w = (ws?"10":"2015");
break;
default:
if (windows_version < 0x50)
windows_version = WINDOWS_UNSUPPORTED;
else
w = "9 or later";
w = "11 or later";
break;
}
}

View file

@ -26,10 +26,12 @@
#if defined(_MSC_VER)
// disable /W4 MSVC warnings that are benign
#pragma warning(disable:4127) // conditional expression is constant
#pragma warning(disable:4100) // unreferenced formal parameter
#pragma warning(disable:4214) // bit field types other than int
#pragma warning(disable:4201) // nameless struct/union
#pragma warning(disable:4100) // unreferenced formal parameter
#pragma warning(disable:4127) // conditional expression is constant
#pragma warning(disable:4201) // nameless struct/union
#pragma warning(disable:4214) // bit field types other than int
#pragma warning(disable:4996) // deprecated API calls
#pragma warning(disable:28159) // more deprecated API calls
#endif
// Missing from MSVC6 setupapi.h

View file

@ -1 +1 @@
#define LIBUSB_NANO 10921
#define LIBUSB_NANO 10922