From 9483fecc42a7122444204d0e122139c14b31df20 Mon Sep 17 00:00:00 2001 From: "Jerry (Xinyu Hou)" Date: Wed, 8 Jul 2015 15:46:13 -0700 Subject: [PATCH] Fixed code style Revert "Moved note into either warning or info #4745" This reverts commit d3a4ce1f112cdee64def242c3247df81e5c9a9d4. Revert "Changed note to notify #4745" This reverts commit 5006adedfecedd16c07543d32acffe36aeaf61bb. Conflicts: src/test/unittests/ipc/IpcLogOutputterTests.cpp Shortened transmission log #4858 Revert "Added code to throw an error if the plugin can't be deleted or written to #4696" This reverts commit 5696497bc0835106c2df9a9a9de1bbd75821d885. --- src/lib/arch/win32/ArchMiscWindows.cpp | 19 ++++++++++++++----- src/lib/arch/win32/ArchSystemWindows.cpp | 15 +++++++++------ src/lib/base/EventQueue.cpp | 2 +- src/lib/platform/MSWindowsDropTarget.cpp | 4 ++-- src/lib/platform/MSWindowsScreen.cpp | 4 ++-- src/lib/plugin/ns/ns.cpp | 2 +- src/lib/server/ClientListener.cpp | 4 ++-- src/lib/synwinhk/synwinhk.cpp | 6 +++--- 8 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/lib/arch/win32/ArchMiscWindows.cpp b/src/lib/arch/win32/ArchMiscWindows.cpp index 92aad1a4..556ffe04 100644 --- a/src/lib/arch/win32/ArchMiscWindows.cpp +++ b/src/lib/arch/win32/ArchMiscWindows.cpp @@ -228,8 +228,11 @@ void ArchMiscWindows::setValue(HKEY key, const TCHAR* name, const std::string& value) { - assert(key != NULL); - if(key ==NULL) return; // TODO: throw exception + assert(key != NULL); + if (key == NULL) { + // TODO: throw exception + return; + } RegSetValueEx(key, name, 0, REG_SZ, reinterpret_cast(value.c_str()), (DWORD)value.size() + 1); @@ -238,8 +241,11 @@ ArchMiscWindows::setValue(HKEY key, void ArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value) { - assert(key != NULL); - if(key ==NULL) return; // TODO: throw exception + assert(key != NULL); + if (key == NULL) { + // TODO: throw exception + return; + } RegSetValueEx(key, name, 0, REG_DWORD, reinterpret_cast(&value), sizeof(DWORD)); @@ -251,7 +257,10 @@ ArchMiscWindows::setValueBinary(HKEY key, { assert(key != NULL); assert(name != NULL); - if(key ==NULL || name==NULL) return; // TODO: throw exception + if (key == NULL || name == NULL) { + // TODO: throw exception + return; + } RegSetValueEx(key, name, 0, REG_BINARY, reinterpret_cast(value.data()), (DWORD)value.size()); diff --git a/src/lib/arch/win32/ArchSystemWindows.cpp b/src/lib/arch/win32/ArchSystemWindows.cpp index 391726ec..5540e40c 100644 --- a/src/lib/arch/win32/ArchSystemWindows.cpp +++ b/src/lib/arch/win32/ArchSystemWindows.cpp @@ -61,16 +61,19 @@ ArchSystemWindows::getOSName() const case VER_PLATFORM_WIN32_NT: #if WINVER >= _WIN32_WINNT_WIN2K if (info.dwMajorVersion == 6) { - if(info.dwMinorVersion == 0) { + if (info.dwMinorVersion == 0) { if (info.wProductType == VER_NT_WORKSTATION) { return "Microsoft Windows Vista"; - } else { + } + else { return "Microsoft Windows Server 2008"; } - } else if(info.dwMinorVersion == 1) { + } + else if (info.dwMinorVersion == 1) { if (info.wProductType == VER_NT_WORKSTATION) { return "Microsoft Windows 7"; - } else { + } + else { return "Microsoft Windows Server 2008 R2"; } } @@ -102,7 +105,7 @@ std::string ArchSystemWindows::getPlatformName() const { #ifdef _X86_ - if(isWOW64()) + if (isWOW64()) return "x86 (WOW64)"; else return "x86"; @@ -146,7 +149,7 @@ ArchSystemWindows::isWOW64() const (LPFN_ISWOW64PROCESS) GetProcAddress(hModule, "IsWow64Process"); BOOL bIsWow64 = FALSE; - if(NULL != fnIsWow64Process && + if (NULL != fnIsWow64Process && fnIsWow64Process(GetCurrentProcess(), &bIsWow64) && bIsWow64) { diff --git a/src/lib/base/EventQueue.cpp b/src/lib/base/EventQueue.cpp index e6d8bdbb..bc3b9bc6 100644 --- a/src/lib/base/EventQueue.cpp +++ b/src/lib/base/EventQueue.cpp @@ -566,7 +566,7 @@ EventQueue::waitForReady() const Lock lock(m_readyMutex); while (!m_readyCondVar->wait()) { - if(ARCH->time() > timeout) { + if (ARCH->time() > timeout) { throw std::runtime_error("event queue is not ready within 5 sec"); } } diff --git a/src/lib/platform/MSWindowsDropTarget.cpp b/src/lib/platform/MSWindowsDropTarget.cpp index d938391c..8cb8caa4 100644 --- a/src/lib/platform/MSWindowsDropTarget.cpp +++ b/src/lib/platform/MSWindowsDropTarget.cpp @@ -116,8 +116,8 @@ getDropData(IDataObject* dataObject) STGMEDIUM stgMed; // See if the dataobject contains any DROP stored as a HGLOBAL - if(dataObject->QueryGetData(&fmtEtc) == S_OK) { - if(dataObject->GetData(&fmtEtc, &stgMed) == S_OK) { + if (dataObject->QueryGetData(&fmtEtc) == S_OK) { + if (dataObject->GetData(&fmtEtc, &stgMed) == S_OK) { // get data here PVOID data = GlobalLock(stgMed.hGlobal); diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index efb92266..5473feb3 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -310,7 +310,7 @@ MSWindowsScreen::enter() // and that the screen is not in powersave mode. ArchMiscWindows::wakeupDisplay(); - if(m_screensaver != NULL && m_screensaverActive) + if (m_screensaver != NULL && m_screensaverActive) { m_screensaver->deactivate(); m_screensaverActive = 0; @@ -923,7 +923,7 @@ void MSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id) { ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo)); - if(info == NULL) { + if (info == NULL) { LOG((CLOG_ERR "malloc failed on %s:%s", __FILE__, __LINE__ )); return; } diff --git a/src/lib/plugin/ns/ns.cpp b/src/lib/plugin/ns/ns.cpp index 7409a147..7498ef0d 100644 --- a/src/lib/plugin/ns/ns.cpp +++ b/src/lib/plugin/ns/ns.cpp @@ -105,7 +105,7 @@ invoke(const char* command, void** args) g_secureListenSocket = NULL; } } - else if(strcmp(command, "version") == 0) { + else if (strcmp(command, "version") == 0) { return (void*) kSynergyVers; } diff --git a/src/lib/server/ClientListener.cpp b/src/lib/server/ClientListener.cpp index c84cb9e4..fee90578 100644 --- a/src/lib/server/ClientListener.cpp +++ b/src/lib/server/ClientListener.cpp @@ -151,8 +151,8 @@ ClientListener::handleClientConnecting(const Event&, void*) if (m_useSecureNetwork) { LOG((CLOG_DEBUG2 "attempting sercure Connection")); - while(!socket->isReady()) { - if(socket->isFatal()) { + while (!socket->isReady()) { + if (socket->isFatal()) { m_listen->deleteSocket(socket); return; } diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index 1d1630aa..8638f244 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -334,7 +334,7 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam) // map the key event to a character. we have to put the dead // key back first and this has the side effect of removing it. if (g_deadVirtKey != 0) { - if(ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, g_deadKeyState, &c, flags) == 2) { // If ToAscii returned 2, it means that we accidentally removed @@ -366,7 +366,7 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam) PostThreadMessage(g_threadID, SYNERGY_MSG_DEBUG, wParam | 0x05000000, lParam); if (g_deadVirtKey != 0) { - if(ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, g_deadKeyState, &c, flags) == 2) { ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, @@ -397,7 +397,7 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam) default: // key is a dead key - if(lParam & 0x80000000u) + if (lParam & 0x80000000u) // This handles the obscure situation where a key has been // pressed which is both a dead key and a normal character // depending on which modifiers have been pressed. We