From 5e686292c537275c8ea1399f311c082d905e8a63 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 13 Jun 2012 17:26:45 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@398 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/miranda.cpp | 28 ++++++++++++---------------- src/core/miranda.h | 4 ++-- src/core/modules.cpp | 10 +++++----- 3 files changed, 19 insertions(+), 23 deletions(-) (limited to 'src/core') diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index fe2dcaed32..f20bfe9810 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -272,10 +272,10 @@ static int MirandaWaitForMutex(HANDLE hEvent) TranslateMessage(&msg); DispatchMessage(&msg); } - } else if ( rc==WAIT_OBJECT_0 ) { + } else if ( rc == WAIT_OBJECT_0 ) { // got object return 1; - } else if ( rc==WAIT_ABANDONED_0 || rc == WAIT_FAILED ) return 0; + } else if ( rc == WAIT_ABANDONED_0 || rc == WAIT_FAILED ) return 0; } } @@ -401,7 +401,7 @@ INT_PTR UnwindThreadPush(WPARAM wParam,LPARAM lParam) INT_PTR UnwindThreadPop(WPARAM,LPARAM) { - if (WaitForSingleObject(hStackMutex,INFINITE)==WAIT_OBJECT_0) + if (WaitForSingleObject(hStackMutex,INFINITE) == WAIT_OBJECT_0) { DWORD dwThreadId=GetCurrentThreadId(); int j; @@ -432,7 +432,7 @@ INT_PTR UnwindThreadPop(WPARAM,LPARAM) INT_PTR MirandaIsTerminated(WPARAM, LPARAM) { - return WaitForSingleObject(hMirandaShutdown,0)==WAIT_OBJECT_0; + return WaitForSingleObject(hMirandaShutdown,0) == WAIT_OBJECT_0; } static void __cdecl compactHeapsThread(void*) @@ -452,7 +452,7 @@ static void __cdecl compactHeapsThread(void*) LRESULT CALLBACK APCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg==WM_NULL) SleepEx(0,TRUE); + if (msg == WM_NULL) SleepEx(0,TRUE); if (msg == WM_TIMECHANGE) RecalculateTime(); return DefWindowProc(hwnd,msg,wParam,lParam); } @@ -462,7 +462,7 @@ void (*SetIdleCallback) (void)=NULL; static INT_PTR SystemSetIdleCallback(WPARAM, LPARAM lParam) { - if (lParam && SetIdleCallback==NULL) { + if (lParam && SetIdleCallback == NULL) { SetIdleCallback=(void (*)(void))lParam; return 1; } @@ -595,11 +595,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) shAutoComplete = (pfnSHAutoComplete)GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); - if (IsWinVerXPPlus()) - { + if (IsWinVerXPPlus()) { hThemeAPI = LoadLibraryA("uxtheme.dll"); - if (hThemeAPI) - { + if (hThemeAPI) { openThemeData = (pfnOpenThemeData)GetProcAddress(hThemeAPI, "OpenThemeData"); isThemeBackgroundPartiallyTransparent = (pfnIsThemeBackgroundPartiallyTransparent)GetProcAddress(hThemeAPI, "IsThemeBackgroundPartiallyTransparent"); drawThemeParentBackground = (pfnDrawThemeParentBackground)GetProcAddress(hThemeAPI, "DrawThemeParentBackground"); @@ -621,11 +619,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) } } - if (IsWinVerVistaPlus()) - { + if (IsWinVerVistaPlus()) { hDwmApi = LoadLibraryA("dwmapi.dll"); - if (hDwmApi) - { + if (hDwmApi) { dwmExtendFrameIntoClientArea = (pfnDwmExtendFrameIntoClientArea)GetProcAddress(hDwmApi,"DwmExtendFrameIntoClientArea"); dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi,"DwmIsCompositionEnabled"); } @@ -680,7 +676,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) DWORD pid = 0; checkIdle(&msg); if ( h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid && - GetClassLongPtr(h, GCW_ATOM)==32770 ) + GetClassLongPtr(h, GCW_ATOM) == 32770 ) { if ( IsDialogMessage(h, &msg) ) continue; @@ -729,7 +725,7 @@ exit: static INT_PTR OkToExit(WPARAM, LPARAM) { - return NotifyEventHooks(hOkToExitEvent,0,0)==0; + return NotifyEventHooks(hOkToExitEvent,0,0) == 0; } static INT_PTR GetMirandaVersion(WPARAM, LPARAM) diff --git a/src/core/miranda.h b/src/core/miranda.h index 81c7c6d41f..4bb79bc57b 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -21,8 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define NEWSTR_ALLOCA(A) (A==NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A) -#define NEWTSTR_ALLOCA(A) (A==NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1)* sizeof(TCHAR)),A) +#define NEWSTR_ALLOCA(A) (A == NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A) +#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1)* sizeof(TCHAR)),A) typedef HMONITOR (WINAPI *pfnMyMonitorFromPoint)(POINT, DWORD); extern pfnMyMonitorFromPoint MyMonitorFromPoint; diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 7c5c35b999..7b2a833c32 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -534,7 +534,7 @@ int UnhookEvent( HANDLE hHook ) p->subscriber[subscriberId].type = 0; p->subscriber[subscriberId].pfnHook = NULL; p->subscriber[subscriberId].hOwner = NULL; - while( p->subscriberCount && p->subscriber[p->subscriberCount-1].type == 0 ) + while ( p->subscriberCount && p->subscriber[p->subscriberCount-1].type == 0 ) p->subscriberCount--; if ( p->subscriberCount == 0 ) { if ( p->subscriber ) mir_free( p->subscriber ); @@ -671,18 +671,18 @@ int ServiceExists(const char *name) INT_PTR CallService(const char *name,WPARAM wParam,LPARAM lParam) { #ifdef _DEBUG - if (name==NULL) { + if (name == NULL) { MessageBoxA(0,"Someone tried to CallService(NULL,..) see stack trace for details","",0); DebugBreak(); return CALLSERVICE_NOTFOUND; } #else - if (name==NULL) return CALLSERVICE_NOTFOUND; + if (name == NULL) return CALLSERVICE_NOTFOUND; #endif EnterCriticalSection(&csServices); TService *pService = FindServiceByName(name); - if (pService==NULL) { + if (pService == NULL) { LeaveCriticalSection(&csServices); #ifdef _DEBUG //MessageBoxA(NULL,"Attempt to call non-existant service",name,MB_OK); @@ -721,7 +721,7 @@ INT_PTR CallServiceSync(const char *name, WPARAM wParam, LPARAM lParam) { extern HWND hAPCWindow; - if (name==NULL) return CALLSERVICE_NOTFOUND; + if (name == NULL) return CALLSERVICE_NOTFOUND; // the service is looked up within the main thread, since the time it takes // for the APC queue to clear the service being called maybe removed. // even thou it may exists before the call, the critsec can't be locked between calls. -- cgit v1.2.3