Added "/analyze" flag for compile in order to activate Code Analysis in Visual Studio 2008+. Resolved some of these warnings.
This commit is contained in:
parent
ba7ec582c3
commit
9face38556
|
@ -4,6 +4,7 @@ SET(VERSION_MINOR 3)
|
|||
SET(VERSION_REV 5)
|
||||
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
|
||||
|
||||
|
||||
# The check for 2.6 may be too strict (consider lowering).
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7)
|
||||
|
||||
|
@ -39,3 +40,8 @@ INCLUDE(${cmake_dir}/CMakeLists_launcher.txt)
|
|||
|
||||
# Setup the CPack config.
|
||||
INCLUDE(${cmake_dir}/CMakeLists_cpack.txt)
|
||||
|
||||
# add /analyze in order to unconver potential bugs in the source code
|
||||
# Details: http://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /analyze")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /analyze")
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "CConfig.h"
|
||||
#include "CHotkeyOptions.h"
|
||||
#include "CStringUtil.h"
|
||||
#include "CLog.h"
|
||||
#include "LaunchUtil.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
@ -713,7 +714,10 @@ CHotkeyOptions::CConditionDialog::getChar(WPARAM wParam, LPARAM lParam)
|
|||
BYTE keyState[256];
|
||||
UINT virtualKey = (UINT)wParam;
|
||||
UINT scanCode = (UINT)((lParam & 0x0ff0000u) >> 16);
|
||||
GetKeyboardState(keyState);
|
||||
if (!GetKeyboardState(keyState)) {
|
||||
LOG((CLOG_WARN "GetKeyboardState failed on CHotkeyOptions::CConditionDialog::getChar"));
|
||||
return kKeyNone;
|
||||
}
|
||||
|
||||
// reset modifier state
|
||||
keyState[VK_SHIFT] = 0;
|
||||
|
@ -730,7 +734,7 @@ CHotkeyOptions::CConditionDialog::getChar(WPARAM wParam, LPARAM lParam)
|
|||
|
||||
// translate virtual key to character
|
||||
int n;
|
||||
KeyID id;
|
||||
KeyID id = kKeyNone;
|
||||
if (CArchMiscWindows::isWindows95Family()) {
|
||||
// XXX -- how do we get characters not in Latin-1?
|
||||
WORD ascii;
|
||||
|
@ -747,6 +751,10 @@ CHotkeyOptions::CConditionDialog::getChar(WPARAM wParam, LPARAM lParam)
|
|||
ToUnicode_t s_ToUnicode = NULL;
|
||||
if (s_ToUnicode == NULL) {
|
||||
HMODULE userModule = GetModuleHandle("user32.dll");
|
||||
if(userModule == NULL) {
|
||||
LOG((CLOG_ERR "GetModuleHandle(\"user32.dll\") returned NULL"));
|
||||
return kKeyNone;
|
||||
}
|
||||
s_ToUnicode =
|
||||
(ToUnicode_t)GetProcAddress(userModule, "ToUnicode");
|
||||
}
|
||||
|
@ -1355,8 +1363,10 @@ CHotkeyOptions::CActionDialog::getChar(WPARAM wParam, LPARAM lParam)
|
|||
BYTE keyState[256];
|
||||
UINT virtualKey = (UINT)wParam;
|
||||
UINT scanCode = (UINT)((lParam & 0x0ff0000u) >> 16);
|
||||
GetKeyboardState(keyState);
|
||||
|
||||
if (!GetKeyboardState(keyState)) {
|
||||
LOG((CLOG_WARN "GetKeyboardState failed on CHotkeyOptions::CActionDialog::getChar"));
|
||||
return kKeyNone;
|
||||
}
|
||||
// reset modifier state
|
||||
keyState[VK_SHIFT] = 0;
|
||||
keyState[VK_LSHIFT] = 0;
|
||||
|
@ -1389,6 +1399,10 @@ CHotkeyOptions::CActionDialog::getChar(WPARAM wParam, LPARAM lParam)
|
|||
ToUnicode_t s_ToUnicode = NULL;
|
||||
if (s_ToUnicode == NULL) {
|
||||
HMODULE userModule = GetModuleHandle("user32.dll");
|
||||
if(userModule==NULL) {
|
||||
LOG((CLOG_ERR "GetModuleHandle(\"user32.dll\") returned NULL"));
|
||||
return kKeyNone;
|
||||
}
|
||||
s_ToUnicode =
|
||||
(ToUnicode_t)GetProcAddress(userModule, "ToUnicode");
|
||||
}
|
||||
|
|
|
@ -556,8 +556,8 @@ mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
// see if the configuration changed
|
||||
if (isConfigNewer(s_configTime, s_userConfig)) {
|
||||
CString message = getString(IDS_CONFIG_CHANGED);
|
||||
if (askVerify(hwnd, message)) {
|
||||
CString message2 = getString(IDS_CONFIG_CHANGED);
|
||||
if (askVerify(hwnd, message2)) {
|
||||
time_t configTime;
|
||||
bool userConfig;
|
||||
CConfig newConfig;
|
||||
|
@ -567,8 +567,8 @@ mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
s_lastConfig = ARG->m_config;
|
||||
}
|
||||
else {
|
||||
message = getString(IDS_LOAD_FAILED);
|
||||
showError(hwnd, message);
|
||||
message2 = getString(IDS_LOAD_FAILED);
|
||||
showError(hwnd, message2);
|
||||
s_lastConfig = CConfig();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -601,6 +601,12 @@ parse(int argc, const char* const* argv)
|
|||
assert(argv != NULL);
|
||||
assert(argc >= 1);
|
||||
|
||||
if(ARG->m_pname != NULL
|
||||
|| argv != NULL
|
||||
|| argc >= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set defaults
|
||||
ARG->m_name = ARCH->getHostName();
|
||||
|
||||
|
|
|
@ -672,8 +672,8 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn)
|
|||
myArgv.push_back(argv[0]);
|
||||
|
||||
// get pointers
|
||||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
myArgv.push_back(args[i].c_str());
|
||||
for (size_t j = 0; j < args.size(); ++j) {
|
||||
myArgv.push_back(args[j].c_str());
|
||||
}
|
||||
|
||||
// adjust argc/argv
|
||||
|
|
|
@ -297,7 +297,7 @@ CArchMultithreadWindows::newThread(ThreadFunc func, void* data)
|
|||
thread->m_userData = data;
|
||||
|
||||
// create thread
|
||||
unsigned int id;
|
||||
unsigned int id = 0;
|
||||
thread->m_thread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
|
||||
threadFunc, (void*)thread, 0, &id));
|
||||
thread->m_id = static_cast<DWORD>(id);
|
||||
|
|
|
@ -130,8 +130,11 @@ CArchSystemWindows::isWOW64() const
|
|||
{
|
||||
#if WINVER >= _WIN32_WINNT_WINXP
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
HMODULE hModule = GetModuleHandle(TEXT("kernel32"));
|
||||
if (!hModule) return FALSE;
|
||||
|
||||
LPFN_ISWOW64PROCESS fnIsWow64Process =
|
||||
(LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
|
||||
(LPFN_ISWOW64PROCESS) GetProcAddress(hModule, "IsWow64Process");
|
||||
|
||||
BOOL bIsWow64 = FALSE;
|
||||
if(NULL != fnIsWow64Process &&
|
||||
|
|
|
@ -758,7 +758,8 @@ CMSWindowsDesks::deskThread(void* vdesk)
|
|||
|
||||
// a window on the primary screen with low-level hooks
|
||||
// should never activate.
|
||||
EnableWindow(desk->m_window, desk->m_lowLevel ? FALSE : TRUE);
|
||||
if (desk->m_window)
|
||||
EnableWindow(desk->m_window, desk->m_lowLevel ? FALSE : TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -868,7 +868,10 @@ void
|
|||
CMSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
|
||||
{
|
||||
BYTE keyState[256];
|
||||
GetKeyboardState(keyState);
|
||||
if (!GetKeyboardState(keyState)) {
|
||||
LOG((CLOG_ERR "GetKeyboardState returned false on pollPressedKeys"));
|
||||
return;
|
||||
}
|
||||
for (KeyButton i = 1; i < 256; ++i) {
|
||||
if ((keyState[i] & 0x80) != 0) {
|
||||
pressedKeys.insert(i);
|
||||
|
|
|
@ -370,7 +370,7 @@ CMSWindowsScreen::openScreensaver(bool notify)
|
|||
if (m_screensaverNotify) {
|
||||
m_desks->installScreensaverHooks(true);
|
||||
}
|
||||
else {
|
||||
else if (m_screensaver) {
|
||||
m_screensaver->disable();
|
||||
}
|
||||
}
|
||||
|
@ -393,6 +393,7 @@ void
|
|||
CMSWindowsScreen::screensaver(bool activate)
|
||||
{
|
||||
assert(m_screensaver != NULL);
|
||||
if (m_screensaver==NULL) return;
|
||||
|
||||
if (activate) {
|
||||
m_screensaver->activate();
|
||||
|
@ -836,6 +837,10 @@ void
|
|||
CMSWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id)
|
||||
{
|
||||
CClipboardInfo* info = (CClipboardInfo*)malloc(sizeof(CClipboardInfo));
|
||||
if(info == NULL) {
|
||||
LOG((CLOG_ERR "malloc failed on %s:%s", __FILE__, __LINE__ ));
|
||||
return;
|
||||
}
|
||||
info->m_id = id;
|
||||
info->m_sequenceNumber = m_sequenceNumber;
|
||||
sendEvent(type, info);
|
||||
|
|
|
@ -87,11 +87,11 @@ CConfig::renameScreen(const CString& oldName,
|
|||
|
||||
// update alias targets
|
||||
if (CStringUtil::CaselessCmp::equal(oldName, oldCanonical)) {
|
||||
for (CNameMap::iterator index = m_nameToCanonicalName.begin();
|
||||
index != m_nameToCanonicalName.end(); ++index) {
|
||||
for (CNameMap::iterator iter = m_nameToCanonicalName.begin();
|
||||
iter != m_nameToCanonicalName.end(); ++iter) {
|
||||
if (CStringUtil::CaselessCmp::equal(
|
||||
index->second, oldCanonical)) {
|
||||
index->second = newName;
|
||||
iter->second, oldCanonical)) {
|
||||
iter->second = newName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,10 +119,10 @@ CConfig::removeScreen(const CString& name)
|
|||
}
|
||||
|
||||
// remove aliases (and canonical name)
|
||||
for (CNameMap::iterator index = m_nameToCanonicalName.begin();
|
||||
index != m_nameToCanonicalName.end(); ) {
|
||||
if (index->second == canonical) {
|
||||
m_nameToCanonicalName.erase(index++);
|
||||
for (CNameMap::iterator iter = m_nameToCanonicalName.begin();
|
||||
iter != m_nameToCanonicalName.end(); ) {
|
||||
if (iter->second == canonical) {
|
||||
m_nameToCanonicalName.erase(iter++);
|
||||
}
|
||||
else {
|
||||
++index;
|
||||
|
|
Loading…
Reference in New Issue