mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-09 16:02:46 +08:00
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:
@@ -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);
|
||||
|
||||
@@ -129,16 +129,19 @@ bool
|
||||
CArchSystemWindows::isWOW64() const
|
||||
{
|
||||
#if WINVER >= _WIN32_WINNT_WINXP
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
LPFN_ISWOW64PROCESS fnIsWow64Process =
|
||||
(LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
|
||||
|
||||
BOOL bIsWow64 = FALSE;
|
||||
if(NULL != fnIsWow64Process &&
|
||||
fnIsWow64Process(GetCurrentProcess(), &bIsWow64) &&
|
||||
bIsWow64)
|
||||
{
|
||||
return true;
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
HMODULE hModule = GetModuleHandle(TEXT("kernel32"));
|
||||
if (!hModule) return FALSE;
|
||||
|
||||
LPFN_ISWOW64PROCESS fnIsWow64Process =
|
||||
(LPFN_ISWOW64PROCESS) GetProcAddress(hModule, "IsWow64Process");
|
||||
|
||||
BOOL bIsWow64 = FALSE;
|
||||
if(NULL != fnIsWow64Process &&
|
||||
fnIsWow64Process(GetCurrentProcess(), &bIsWow64) &&
|
||||
bIsWow64)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user