From d154673f93ad95197bce8cadb995daa5bc39f5d8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Jan 2014 20:04:48 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@7820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/miranda.cpp | 4 +- src/core/miranda.h | 1 + src/core/modules.cpp | 1 - src/modules/addcontact/addcontact.cpp | 2 +- src/modules/button/button.cpp | 12 +- src/modules/chat/log.cpp | 8 +- src/modules/clist/Docking.cpp | 18 +-- src/modules/clist/clc.cpp | 64 +++++----- src/modules/clist/clcfiledrop.cpp | 8 +- src/modules/clist/clcidents.cpp | 4 +- src/modules/clist/clcitems.cpp | 30 ++--- src/modules/clist/clcmsgs.cpp | 32 ++--- src/modules/clist/clcutils.cpp | 26 ++-- src/modules/clist/clistevents.cpp | 10 +- src/modules/clist/clistmenus.cpp | 40 +++--- src/modules/clist/clistmod.cpp | 6 +- src/modules/clist/clistsettings.cpp | 28 ++-- src/modules/clist/clisttray.cpp | 34 ++--- src/modules/clist/clui.cpp | 36 +++--- src/modules/clist/cluiservices.cpp | 2 +- src/modules/clist/contact.cpp | 2 +- src/modules/clist/contacts.cpp | 38 +++--- src/modules/clist/genmenu.cpp | 56 ++++---- src/modules/clist/genmenuopt.cpp | 20 +-- src/modules/clist/groups.cpp | 10 +- src/modules/clist/keyboard.cpp | 2 +- src/modules/clist/movetogroup.cpp | 2 +- src/modules/clist/protocolorder.cpp | 6 +- src/modules/database/database.cpp | 8 +- src/modules/database/dbintf.cpp | 2 +- src/modules/database/dbutils.cpp | 18 +-- src/modules/database/profilemanager.cpp | 2 +- src/modules/findadd/findadd.cpp | 14 +- src/modules/findadd/searchresults.cpp | 8 +- src/modules/fonts/FontOptions.cpp | 26 ++-- src/modules/fonts/services.cpp | 30 ++--- src/modules/icolib/extracticon.cpp | 14 +- src/modules/icolib/skin2icons.cpp | 44 +++---- src/modules/icolib/skin2opts.cpp | 34 ++--- src/modules/ignore/ignore.cpp | 2 +- src/modules/netlib/netlib.cpp | 4 +- src/modules/netlib/netlibautoproxy.cpp | 6 +- src/modules/netlib/netlibbind.cpp | 12 +- src/modules/netlib/netlibhttp.cpp | 72 +++++------ src/modules/netlib/netlibhttpproxy.cpp | 16 +-- src/modules/netlib/netliblog.cpp | 4 +- src/modules/netlib/netlibopenconn.cpp | 54 ++++---- src/modules/netlib/netlibopts.cpp | 12 +- src/modules/netlib/netlibpktrecver.cpp | 2 +- src/modules/netlib/netlibsecurity.cpp | 6 +- src/modules/netlib/netlibsock.cpp | 22 ++-- src/modules/netlib/netlibssl.cpp | 16 +-- src/modules/netlib/netlibupnp.cpp | 10 +- src/modules/options/descbutton.cpp | 4 +- src/modules/options/headerbar.cpp | 4 +- src/modules/options/iconheader.cpp | 8 +- src/modules/plugins/dll_sniffer.cpp | 18 +-- src/modules/plugins/newplugins.cpp | 78 +++++------ src/modules/plugins/pluginopts.cpp | 88 +++++++------ src/modules/protocols/protoaccs.cpp | 34 ++--- src/modules/protocols/protochains.cpp | 8 +- src/modules/protocols/protocols.cpp | 16 +-- src/modules/protocols/protoopts.cpp | 20 +-- src/modules/skin/hotkey_opts.cpp | 30 ++--- src/modules/skin/hotkeys.cpp | 14 +- src/modules/skin/skinicons.cpp | 6 +- src/modules/skin/sounds.cpp | 10 +- src/modules/utils/bmpfilter.cpp | 8 +- src/modules/utils/hyperlink.cpp | 18 +-- src/modules/utils/imgconv.cpp | 2 +- src/modules/utils/openurl.cpp | 4 +- src/modules/utils/path.cpp | 44 +++---- src/modules/utils/timezones.cpp | 18 +-- src/modules/utils/utils.cpp | 6 +- src/modules/visibility/visibility.cpp | 4 +- src/modules/xml/xmlApi.cpp | 2 +- src/modules/xml/xmlParser.cpp | 220 ++++++++++++++++---------------- 77 files changed, 802 insertions(+), 802 deletions(-) (limited to 'src') diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index cf6dec614e..ff0536c310 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -83,7 +83,7 @@ static void __cdecl compactHeapsThread(void*) { Thread_SetName("compactHeapsThread"); - while ( !Miranda_Terminated()) { + while (!Miranda_Terminated()) { HANDLE hHeaps[256]; DWORD hc; SleepEx((1000*60)*5, TRUE); // every 5 minutes @@ -273,7 +273,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int) if (SetIdleCallback != NULL) SetIdleCallback(); } - else if ( !dying) { + else if (!dying) { dying++; SetEvent(hMirandaShutdown); NotifyEventHooks(hPreShutdownEvent, 0, 0); diff --git a/src/core/miranda.h b/src/core/miranda.h index 68e7e9f363..af34963011 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -79,6 +79,7 @@ extern HANDLE hOkToExitEvent, hModulesLoadedEvent, hevLoadModule, hevUnloadModul char* GetPluginNameByInstance(HINSTANCE hInstance); int GetPluginFakeId(const MUUID &uuid, int hLangpack); +int LoadStdPlugins(void); /**** path.cpp *************************************************************************/ diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 5a991a6d39..75199b1c82 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -62,7 +62,6 @@ int LoadIcoLibModule(void); // ui: icons manager int LoadServiceModePlugin(void); int LoadDefaultServiceModePlugin(void); int LoadErrorsModule(void); -int LoadStdPlugins(void); void UnloadAccountsModule(void); void UnloadButtonModule(void); diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index 1bf3cce1b4..513cd00c83 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -65,7 +65,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp isSet = 1; } } - if ( !isSet) { + if (!isSet) { szName = (acs->handleType == HANDLE_EVENT) ? (tmpStr = mir_a2t(szUin)) : (acs->psr->id ? acs->psr->id : acs->psr->nick); } diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 437f24f925..b79a0386c8 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -94,7 +94,7 @@ static int TBStateConvert2Flat(int state) static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) { - if ( !hdcPaint) + if (!hdcPaint) return; RECT rcClient; @@ -222,7 +222,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) sz.cx -= szHot.cx; } if (ctl->arrow) - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+( !ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED); SelectObject(hdcMem, ctl->hFont); DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, @@ -406,7 +406,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR else return 0; case BM_SETCHECK: - if ( !bct->bIsPushBtn) break; + if (!bct->bIsPushBtn) break; if (wParam == BST_CHECKED) { bct->bIsPushed = 1; bct->stateId = PBS_PRESSED; @@ -425,7 +425,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case BUTTONSETARROW: // turn arrow on/off if (wParam) { - if ( !bct->arrow) { + if (!bct->arrow) { bct->arrow = LoadSkinIcon(SKINICON_OTHER_DOWNARROW); SetHwndPropInt(bct, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, ROLE_SYSTEM_BUTTONDROPDOWN); } @@ -463,7 +463,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case BUTTONADDTOOLTIP: if (wParam) { - if ( !bct->hwndToolTips) { + if (!bct->hwndToolTips) { TTooltips tt; tt.ThreadId = GetCurrentThreadId(); @@ -588,7 +588,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR POINT pt; GetCursorPos(&pt); - if ( !PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave + if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave PostMessage(hwnd, WM_MOUSELEAVE, 0, 0L); KillTimer(hwnd, BUTTON_POLLID); } } diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index e042d23f99..3a6ef5d0ac 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -165,7 +165,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff break; case 'C': case 'F': - if ( !g_Settings->bStripFormat && !streamData->bStripFormat) { + if (!g_Settings->bStripFormat && !streamData->bStripFormat) { int j = streamData->lin->bIsHighlighted ? 16 : EventToIndex(streamData->lin); if ( *line == 'C' ) mir_snprintf(szTemp, SIZEOF(szTemp), "\\cf%u ", j+1); @@ -176,21 +176,21 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff case 'b': case 'u': case 'i': - if ( !streamData->bStripFormat ) + if (!streamData->bStripFormat ) mir_snprintf(szTemp, SIZEOF(szTemp), (*line == 'u') ? "\\%cl " : "\\%c ", *line ); break; case 'B': case 'U': case 'I': - if ( !streamData->bStripFormat ) { + if (!streamData->bStripFormat ) { mir_snprintf( szTemp, SIZEOF(szTemp), (*line == 'U') ? "\\%cl0 " : "\\%c0 ", *line ); CharLowerA( szTemp ); } break; case 'r': - if ( !streamData->bStripFormat ) { + if (!streamData->bStripFormat ) { int index = EventToIndex(streamData->lin); mir_snprintf(szTemp, SIZEOF(szTemp), "%s ", Log_SetStyle(index)); } diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index 62fa64070a..cd69230f54 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -107,7 +107,7 @@ static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool else rc->left = rc->right - cx; - if ( !query) + if (!query) { Docking_PosCommand(hwnd, rc, false); dockPos = *(LPPOINT)rc; @@ -160,7 +160,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) } } - if ( !docked && msg->message != WM_CREATE && msg->message != WM_MOVING) + if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING) return 0; switch (msg->message) @@ -189,7 +189,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (vis) { - if ( !(wp->flags & (SWP_NOMOVE | SWP_NOSIZE))) + if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE))) { bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0; @@ -197,12 +197,12 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) GetWindowRect(msg->hwnd, &rc); int cx = rc.right - rc.left; - if ( !(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; } + if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; } if (addbar) Docking_RectToDock(&rc); - if ( !(wp->flags & SWP_NOSIZE)) + if (!(wp->flags & SWP_NOSIZE)) { rc.right = rc.left + wp->cx; rc.bottom = rc.top + wp->cy; @@ -211,8 +211,8 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_SetSize(msg->hwnd, &rc, !addbar, false); - if ( !(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; } - if ( !(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top; + if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; } + if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top; *((LRESULT *) lParam) = TRUE; return TRUE; @@ -247,7 +247,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (wp->flags & SWP_HIDEWINDOW) vis = false; - if ( !vis) + if (!vis) Docking_Command(msg->hwnd, ABM_REMOVE); else Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED); @@ -265,7 +265,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) break; case WM_MOVING: - if ( !docked) + if (!docked) { RECT rcMonitor; POINT ptCursor; diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 72dd0fd438..6e24efeb82 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -71,35 +71,35 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; if ((HANDLE)wParam == NULL) { - if ( !strcmp(cws->szModule, "CListGroups")) + if (!strcmp(cws->szModule, "CListGroups")) cli.pfnClcBroadcast(INTM_GROUPSCHANGED, wParam, lParam); return 0; } - if ( !strcmp(cws->szModule, "CList")) { - if ( !strcmp(cws->szSetting, "MyHandle")) { + if (!strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "MyHandle")) { cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam); } - else if ( !strcmp(cws->szSetting, "Group")) + else if (!strcmp(cws->szSetting, "Group")) cli.pfnClcBroadcast(INTM_GROUPCHANGED, wParam, lParam); - else if ( !strcmp(cws->szSetting, "Hidden")) + else if (!strcmp(cws->szSetting, "Hidden")) cli.pfnClcBroadcast(INTM_HIDDENCHANGED, wParam, lParam); - else if ( !strcmp(cws->szSetting, "NotOnList")) + else if (!strcmp(cws->szSetting, "NotOnList")) cli.pfnClcBroadcast(INTM_NOTONLISTCHANGED, wParam, lParam); - else if ( !strcmp(cws->szSetting, "Status")) + else if (!strcmp(cws->szSetting, "Status")) cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0); - else if ( !strcmp(cws->szSetting, "NameOrder")) + else if (!strcmp(cws->szSetting, "NameOrder")) cli.pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); } else { char *szProto = GetContactProto((HANDLE)wParam); if (szProto != NULL) { - if ( !strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) + if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam); // something is being written to a protocol module - if ( !strcmp(szProto, cws->szModule)) { + if (!strcmp(szProto, cws->szModule)) { // was a unique setting key written? char *id = (char *) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting)) @@ -108,12 +108,12 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) } if (szProto == NULL || strcmp(szProto, cws->szModule)) return 0; - if ( !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail") + if (!strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN")) cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam); - else if ( !strcmp(cws->szSetting, "ApparentMode")) + else if (!strcmp(cws->szSetting, "ApparentMode")) cli.pfnClcBroadcast(INTM_APPARENTMODECHANGED, wParam, lParam); - else if ( !strcmp(cws->szSetting, "IdleTS")) + else if (!strcmp(cws->szSetting, "IdleTS")) cli.pfnClcBroadcast(INTM_IDLECHANGED, wParam, lParam); } return 0; @@ -153,7 +153,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0); if (ack->result == ACKRESULT_SUCCESS) { for (int i=0; i < cli.hClcProtoCount; i++) { - if ( !lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) { + if (!lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) { cli.clcProto[i].dwStatus = (WORD) ack->lParam; break; } @@ -235,7 +235,7 @@ int LoadCLCModule(void) void UnloadClcModule() { - if ( !bModuleInitialized) return; + if (!bModuleInitialized) return; mir_free(cli.clcProto); @@ -285,7 +285,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->list.cl.increment = 30; dat->needsResort = 1; cli.pfnLoadClcOptions(hwnd, dat); - if ( !IsWindowVisible(hwnd)) + if (!IsWindowVisible(hwnd)) SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL); else { cli.pfnRebuildEntireList(hwnd, dat); @@ -474,7 +474,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, { WORD iExtraImage[EXTRA_ICON_COUNT]; BYTE flags = 0; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -517,11 +517,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, // this means an offline msg is flashing, so the contact should be shown DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b((HANDLE)wParam, "CList", "Hidden", 0)) - && ( !cli.pfnIsHiddenMode(dat, status) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); + && (!cli.pfnIsHiddenMode(dat, status) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); contact = NULL; group = NULL; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = cli.pfnContactToHItem(selcontact); @@ -538,7 +538,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, else { // item in list already if (contact->iImage == (WORD) lParam) break; - if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = cli.pfnContactToHItem(selcontact); cli.pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0); @@ -546,7 +546,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, } else { contact->iImage = (WORD) lParam; - if ( !cli.pfnIsHiddenMode(dat, status)) + if (!cli.pfnIsHiddenMode(dat, status)) contact->flags |= CONTACTF_ONLINE; else contact->flags &= ~CONTACTF_ONLINE; @@ -565,7 +565,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_NAMECHANGED: - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); @@ -574,7 +574,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_PROTOCHANGED: - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; contact->proto = GetContactProto((HANDLE)wParam); @@ -584,7 +584,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_NOTONLISTCHANGED: - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (contact->type == CLCIT_CONTACT) { @@ -698,7 +698,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, KillTimer(hwnd, TIMERID_RENAME); { UINT scrollLines; - if ( !SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE)) + if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE)) scrollLines = 3; cli.pfnScrollTo(hwnd, dat, dat->yScroll - (short) HIWORD(wParam) * dat->rowHeight * (signed) scrollLines / WHEEL_DELTA, 0); } @@ -769,7 +769,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, return 0; } if (selMoved) { - if ( !dat->filterSearch) + if (!dat->filterSearch) dat->szQuickSearch[0] = 0; if (dat->selection >= cli.pfnGetGroupContentsCount(&dat->list, 1)) dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1; @@ -921,7 +921,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnEndRename(hwnd, dat, 1); dat->ptDragStart.x = (short) LOWORD(lParam); dat->ptDragStart.y = (short) HIWORD(lParam); - if ( !dat->filterSearch) + if (!dat->filterSearch) dat->szQuickSearch[0] = 0; hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, &group, &hitFlags); @@ -966,7 +966,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags); SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); } - if ( !(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) { + if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) { NMCLISTCONTROL nm; nm.hdr.code = NM_CLICK; nm.hdr.hwndFrom = hwnd; @@ -1073,7 +1073,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (pt.x >= 0 && pt.x < clRect.right && ((pt.y < 0 && pt.y > -dat->dragAutoScrollHeight) || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) { - if ( !dat->dragAutoScrolling) { + if (!dat->dragAutoScrolling) { if (pt.y < 0) dat->dragAutoScrolling = -1; else @@ -1204,7 +1204,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnInvalidateRect(hwnd, NULL, FALSE); if (dat->selection != -1) cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0); - if ( !(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL))) + if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL))) break; UpdateWindow(hwnd); @@ -1310,14 +1310,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnHideInfoTip(hwnd, dat); { for (int i=0; i <= FONTID_MAX; i++) - if ( !dat->fontInfo[i].changed) + if (!dat->fontInfo[i].changed) DeleteObject(dat->fontInfo[i].hFont); } if (dat->himlHighlight) ImageList_Destroy(dat->himlHighlight); if (dat->hwndRenameEdit) DestroyWindow(dat->hwndRenameEdit); - if ( !dat->bkChanged && dat->hBmpBackground) + if (!dat->bkChanged && dat->hBmpBackground) DeleteObject(dat->hBmpBackground); cli.pfnFreeGroup(&dat->list); mir_free(dat); diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 7442a15bed..7f610710fd 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -83,7 +83,7 @@ static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, in return NULL; DWORD protoCaps = CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0); - if ( !(protoCaps & PF1_FILESEND)) + if (!(protoCaps & PF1_FILESEND)) return NULL; if (ID_STATUS_OFFLINE == db_get_w(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE)) return NULL; @@ -148,7 +148,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL shortPt.y = pt.y; hwnd = WindowFromPoint(shortPt); GetClassName(hwnd, szWindowClass, SIZEOF(szWindowClass)); - if ( !lstrcmp(szWindowClass, _T(CLISTCONTROL_CLASS))) { + if (!lstrcmp(szWindowClass, _T(CLISTCONTROL_CLASS))) { struct ClcData *dat; hwndCurrentDrag = hwnd; dat = (struct ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0); @@ -188,7 +188,7 @@ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR *szFil lstrcat(szPath, _T("\\*")); if (hFind = FindFirstFile(szPath, &fd)) { do { - if ( !lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T(".."))) + if (!lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T(".."))) continue; lstrcpy(szPath, szFilename); lstrcat(szPath, _T("\\")); @@ -234,7 +234,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt AddToFileList(&ppFiles, &totalCount, szFilename); } - if ( !CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles)) + if (!CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles)) *pdwEffect = DROPEFFECT_COPY; for (i=0; ppFiles[i]; i++) diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index d943b8065d..72279117ab 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -87,7 +87,7 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contac break; nowVisible = 1; for (tgroup = group; tgroup; tgroup = tgroup->parent) - if ( !group->expanded) { + if (!group->expanded) { nowVisible = 0; break; } @@ -104,7 +104,7 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contac && group->cl.items[group->scanIndex]->hContact == (HANDLE) ((UINT_PTR)hItem & ~HCONTACT_ISINFO))) { if (isVisible) { - if ( !nowVisible) + if (!nowVisible) *isVisible = 0; else { int posY = cli.pfnGetRowTopY(dat, index+1); diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index b56341a74c..8e4eb13939 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -46,7 +46,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD int i, compareResult; dat->needsResort = 1; - if ( !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS)) + if (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS)) return &dat->list; pNextField = (TCHAR*)szName; @@ -81,7 +81,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD } if (pNextField == NULL && group->cl.items[i]->groupId == 0) break; - if ( !(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && group->cl.items[i]->groupId > groupId) + if (!(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && group->cl.items[i]->groupId > groupId) break; } if (compareResult) { @@ -110,7 +110,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); - if ( !lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) + if (!lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) group->totalMembers++; } } @@ -235,7 +235,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd int i, len; DWORD groupFlags; TCHAR *szGroupName; - if ( !(style & CLS_HIDEEMPTYGROUPS)) { + if (!(style & CLS_HIDEEMPTYGROUPS)) { mir_free(dbv.ptszVal); return; } @@ -246,7 +246,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd mir_free(dbv.ptszVal); return; } - if ( !lstrcmp(szGroupName, dbv.ptszVal)) + if (!lstrcmp(szGroupName, dbv.ptszVal)) break; } if (groupFlags & GROUPF_HIDEOFFLINE) { @@ -260,10 +260,10 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd mir_free(dbv.ptszVal); return; } - if ( !lstrcmp(szGroupName, dbv.ptszVal)) + if (!lstrcmp(szGroupName, dbv.ptszVal)) break; len = lstrlen(szGroupName); - if ( !_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\') + if (!_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\') cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1); } group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, groupFlags, i, 1); @@ -316,10 +316,10 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0); dat->needsResort = 1; - if ( !cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) { + if (!cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) { DBVARIANT dbv; int i, nameOffset; - if ( !IsHContactContact(hItem)) + if (!IsHContactContact(hItem)) return; if (db_get_ts(hItem, "CList", "Group", &dbv)) return; @@ -332,7 +332,7 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) break; if (group->cl.items[i]->type == CLCIT_GROUP) { int len = lstrlen(group->cl.items[i]->szText); - if ( !_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) && + if (!_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) && (dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) { group->totalMembers--; if (dbv.ptszVal[nameOffset + len] == '\0') @@ -385,13 +385,13 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) if (_tcsstr(lowered_name, lowered_search)) cli.pfnAddContactToGroup(dat, group, hContact); } - else if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { + else if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { char *szProto = GetContactProto(hContact); if (szProto == NULL) { - if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) + if (!cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) cli.pfnAddContactToGroup(dat, group, hContact); } - else if ( !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + else if (!cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) cli.pfnAddContactToGroup(dat, group, hContact); } else cli.pfnAddContactToGroup(dat, group, hContact); @@ -438,7 +438,7 @@ int fnGetGroupContentsCount(ClcGroup *group, int visibleOnly) break; group = group->parent; } - else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ( !visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) { + else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) { group = group->cl.items[group->scanIndex]->group; group->scanIndex = 0; count += group->cl.count; @@ -685,7 +685,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) if (saveInfo[i].parentId == -1) group = &dat->list; else { - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) continue; group = contact->group; } diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index c60526cfc0..6845cd02e1 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -59,7 +59,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (cii->hParentGroup == NULL) group = &dat->list; else { - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL)) return (LRESULT)(HANDLE) NULL; group = groupContact->group; } @@ -97,7 +97,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { ClcContact *contact; ClcGroup *group, *tgroup; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -108,7 +108,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_EXPAND: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (contact->type != CLCIT_GROUP) break; @@ -117,12 +117,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_FINDCONTACT: - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL)) return (LRESULT)(HANDLE) NULL; return wParam; case CLM_FINDGROUP: - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL)) return (LRESULT)(HANDLE) NULL; return wParam | HCONTACT_ISGROUP; @@ -132,7 +132,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETCHECKMARK: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; return (contact->flags & CONTACTF_CHECKED) != 0; } @@ -146,7 +146,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETEXPAND: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return CLE_INVALID; if (contact->type != CLCIT_GROUP) return CLE_INVALID; @@ -190,7 +190,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETITEMTEXT: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; lstrcpy((TCHAR*) lParam, contact->szText); return lstrlen(contact->szText); @@ -199,7 +199,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETITEMTYPE: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return CLCIT_INVALID; return contact->type; } @@ -217,7 +217,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact; ClcGroup *group; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL)) return NULL; int i = List_IndexOf((SortedList*)&group->cl, contact); @@ -320,7 +320,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { ClcContact *contact; ClcGroup *group, *tgroup; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -330,7 +330,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_SETBKBITMAP: - if ( !dat->bkChanged && dat->hBmpBackground) { + if (!dat->bkChanged && dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } @@ -341,7 +341,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; case CLM_SETBKCOLOR: - if ( !dat->bkChanged && dat->hBmpBackground) { + if (!dat->bkChanged && dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } @@ -353,7 +353,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETCHECKMARK: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (lParam) contact->flags |= CONTACTF_CHECKED; @@ -375,7 +375,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETEXTRAIMAGE: if ( LOWORD(lParam) < dat->extraColumnsCount) { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); @@ -433,7 +433,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETITEMTEXT: { ClcContact *contact; - if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText)); cli.pfnSortCLC(hwnd, dat, 1); diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index f9031c55a6..e4258c8a11 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -87,7 +87,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ScreenToClient(hwndParent, &pt1); HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); if (h != hwndTemp) - if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) + if (!hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) return -1; } while (hwndParent); @@ -211,10 +211,10 @@ void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) desty = 0; if (abs(desty - dat->yScroll) < 4) noSmooth = 1; - if ( !noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) + if (!noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; previousy = dat->yScroll; - if ( !noSmooth) { + if (!noSmooth) { startTick = GetTickCount(); for (;;) { nowTick = GetTickCount(); @@ -372,7 +372,7 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); show = _tcsstr(lowered_szText, lowered_text) != NULL; } - else show = ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) || ( !prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))); + else show = ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))); if (show) { ClcGroup *contactGroup = group; @@ -382,7 +382,7 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex); } if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - if ( !(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) { + if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) { group = group->cl.items[group->scanIndex]->group; group->scanIndex = 0; continue; @@ -421,7 +421,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) else if (contact->type == CLCIT_CONTACT) { cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact); TCHAR* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE); - if ( !text[0] || !lstrcmp(otherName, text)) + if (!text[0] || !lstrcmp(otherName, text)) db_unset(contact->hContact, "CList", "MyHandle"); else db_set_ts(contact->hContact, "CList", "MyHandle", text); @@ -522,7 +522,7 @@ int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt) GetClientRect(hwnd, &clRect); dat->selection = dat->iDragItem; dat->iInsertionMark = -1; - if ( !PtInRect(&clRect, pt)) + if (!PtInRect(&clRect, pt)) return DROPTARGET_OUTSIDE; ClcContact *contact, *movecontact; @@ -691,7 +691,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) cli.pfnGetDefaultFontSetting(i, lf, colour); mir_snprintf(idstr, SIZEOF(idstr), "Font%dName", i); - if ( !db_get_ts(NULL, "CLC", idstr, &dbv)) { + if (!db_get_ts(NULL, "CLC", idstr, &dbv)) { lstrcpy(lf->lfFaceName, dbv.ptszVal); mir_free(dbv.pszVal); } @@ -723,7 +723,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) HDC hdc = GetDC(hwnd); for (int i=0; i <= FONTID_MAX; i++) { - if ( !dat->fontInfo[i].changed) + if (!dat->fontInfo[i].changed) DeleteObject(dat->fontInfo[i].hFont); cli.pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour); @@ -749,7 +749,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->noVScrollbar = db_get_b(NULL, "CLC", "NoVScrollBar", 0); dat->filterSearch = db_get_b(NULL, "CLC", "FilterSearch", 1); SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0); - if ( !dat->bkChanged) { + if (!dat->bkChanged) { DBVARIANT dbv; dat->bkColour = db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR); if (dat->hBmpBackground) { @@ -757,7 +757,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->hBmpBackground = NULL; } if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - if ( !db_get_s(NULL, "CLC", "BkBitmap", &dbv)) { + if (!db_get_s(NULL, "CLC", "BkBitmap", &dbv)) { dat->hBmpBackground = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM) dbv.pszVal); mir_free(dbv.pszVal); } @@ -810,7 +810,7 @@ void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat) } else if (group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->type == CLCIT_CONTACT) { group->scanIndex |= GSIF_HASMEMBERS; - if ( !(group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED)) + if (!(group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED)) group->scanIndex &= ~GSIF_ALLCHECKED; } group->scanIndex++; @@ -873,7 +873,7 @@ int fnGetRowHeight(struct ClcData *dat, int) int fnRowHitTest(struct ClcData *dat, int y) { - if ( !dat->rowHeight) + if (!dat->rowHeight) return y; return y / dat->rowHeight; } diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index bc541a87ab..3407be16df 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -92,7 +92,7 @@ static void ShowEventsInTray() char ** pTrayProtos; char nTrayProtoCnt; int nTrayCnt = cli.trayIconCount; - if ( !cli.events.count || !nTrayCnt) return; + if (!cli.events.count || !nTrayCnt) return; if (cli.events.count == 1 || nTrayCnt == 1) { ShowOneEventInTray(0); //for only one icon in tray show topmost event @@ -161,7 +161,7 @@ struct CListEvent* fnAddEvent(CLISTEVENT *cle) if (cle->flags & CLEF_URGENT) { for (i=0; i < cli.events.count; i++) - if ( !(cli.events.items[i]->cle.flags & CLEF_URGENT)) + if (!(cli.events.items[i]->cle.flags & CLEF_URGENT)) break; } else i = cli.events.count; @@ -307,10 +307,10 @@ int fnEventsProcessTrayDoubleClick(int index) char * eventProto = NULL; if (cli.events.items[i]->cle.hContact) eventProto = GetContactProto(cli.events.items[i]->cle.hContact); - if ( !eventProto) + if (!eventProto) eventProto = cli.events.items[i]->cle.lpszProtocol; - if ( !eventProto || !_strcmpi(eventProto, szProto)) { + if (!eventProto || !_strcmpi(eventProto, szProto)) { eventIndex = i; break; } @@ -324,7 +324,7 @@ int fnEventsProcessTrayDoubleClick(int index) char * eventProto = NULL; if (cli.events.items[i]->cle.hContact) eventProto = GetContactProto(cli.events.items[i]->cle.hContact); - if ( !eventProto) + if (!eventProto) eventProto = cli.events.items[i]->cle.lpszProtocol; if (eventProto) { for (j = 0; jszServiceName, "Help/AboutCommand")) + if (!lstrcmpA(mmep->szServiceName, "Help/AboutCommand")) mmep->Param1 = 0; CallService(mmep->szServiceName, mmep->Param1, lParam); @@ -284,10 +284,10 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) { TMO_MenuItem tmi; CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !cli.pfnConvertMenu(mi, &tmi)) + if (!cli.pfnConvertMenu(mi, &tmi)) return 0; - if ( !(mi->flags & CMIF_ROOTHANDLE)) { + if (!(mi->flags & CMIF_ROOTHANDLE)) { //old system tmi.flags |= CMIF_ROOTHANDLE; tmi.root = NULL; @@ -400,7 +400,7 @@ INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam) BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat) { - if ( !itdat) + if (!itdat) return FALSE; MENUITEMINFO mii = { sizeof(mii) }; @@ -432,11 +432,11 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itd INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) { PCheckProcParam pcpp = (PCheckProcParam)wParam; - if ( !pcpp) + if (!pcpp) return TRUE; PMO_IntMenuItem timi = MO_GetIntMenuItem(pcpp->MenuItemHandle); - if ( !timi) + if (!timi) return TRUE; StatusMenuExecParam *smep = (StatusMenuExecParam*)pcpp->MenuItemOwnerData; @@ -508,7 +508,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) else timi->mi.flags &= ~CMIF_CHECKED; } - else if (( !smep || smep->proto) && timi->mi.pszName) { + else if ((!smep || smep->proto) && timi->mi.pszName) { int curProtoStatus = 0; BOOL IconNeedDestroy = FALSE; char* prot; @@ -608,7 +608,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) for (int j=0; j < accounts.getCount(); j++) { PROTOACCOUNT* pa = accounts[j]; - if ( !Proto_IsAccountEnabled(pa)) + if (!Proto_IsAccountEnabled(pa)) continue; if (MenusProtoCount > 1 && Proto_IsAccountLocked(pa)) continue; @@ -661,7 +661,7 @@ static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam) { TMO_MenuItem tmi; CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !cli.pfnConvertMenu(mi, &tmi)) + if (!cli.pfnConvertMenu(mi, &tmi)) return 0; return MO_ModifyMenuItem((PMO_IntMenuItem)wParam, &tmi); @@ -680,7 +680,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) } } - if ( !(cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX)) + if (!(cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX)) return 0; // DO NOT process ids outside from clist menu id range v0.7.0.27+ //process old menu sys @@ -693,7 +693,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat) { - if ( !itdat) + if (!itdat) return FALSE; BOOL inSub = FALSE; @@ -812,7 +812,7 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos) _itoa(Pos, buf, 10); DBVARIANT dbv; - if ( !db_get_s(NULL, "Protocols", buf, &dbv)) { + if (!db_get_s(NULL, "Protocols", buf, &dbv)) { for (int p=0; p < protoCnt; p++) { if (lstrcmpA(proto[p]->szName, dbv.pszVal) == 0) { db_free(&dbv); @@ -869,7 +869,7 @@ void RebuildMenuOrder(void) PROTOACCOUNT* pa = accounts[i]; int pos = 0; - if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName)) + if (!bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName)) continue; DWORD flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0); @@ -936,7 +936,7 @@ void RebuildMenuOrder(void) pos += 500000; for (int j = 0; j < SIZEOF(statusModeList); j++) { - if ( !(flags & statusModePf2List[j])) + if (!(flags & statusModePf2List[j])) continue; //adding @@ -977,11 +977,11 @@ void RebuildMenuOrder(void) for (j = 0; j < SIZEOF(statusModeList); j++) { for (i=0; i < accounts.getCount(); i++) { PROTOACCOUNT* pa = accounts[i]; - if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName)) + if (!bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName)) continue; DWORD flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0); - if ( !(flags & statusModePf2List[j])) + if (!(flags & statusModePf2List[j])) continue; TMO_MenuItem tmi = { sizeof(tmi) }; @@ -1096,7 +1096,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) } for (int i=0; i < accounts.getCount(); i++) { - if ( !lstrcmpA(accounts[i]->szModuleName, ack->szModule)) { + if (!lstrcmpA(accounts[i]->szModuleName, ack->szModule)) { if (((int)ack->hProcess >= ID_STATUS_OFFLINE || (int)ack->hProcess == 0) && (int)ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) { int pos = statustopos((int)ack->hProcess); if (pos == -1) @@ -1153,7 +1153,7 @@ static MenuProto* FindProtocolMenu(const char* proto) return &cli.menuProtos[i]; if (cli.menuProtoCount == 1) - if ( !lstrcmpiA(cli.menuProtos[0].szProto, proto)) + if (!lstrcmpiA(cli.menuProtos[0].szProto, proto)) return &cli.menuProtos[0]; return NULL; @@ -1175,7 +1175,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; TMO_MenuItem tmi; - if ( !cli.pfnConvertMenu(mi, &tmi)) + if (!cli.pfnConvertMenu(mi, &tmi)) return 0; // for new style menus the pszPopupName contains the root menu handle diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 547fcc326d..3cd0e45693 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -117,7 +117,7 @@ static INT_PTR GetStatusModeDescription(WPARAM wParam, LPARAM lParam) { TCHAR* buf1 = cli.pfnGetStatusModeDescription(wParam, lParam); - if ( !(lParam & GSMDF_TCHAR)) { + if (!(lParam & GSMDF_TCHAR)) { static char szMode[64]; char *buf2 = mir_u2a(buf1); mir_snprintf(szMode, SIZEOF(szMode), "%s", buf2); @@ -366,7 +366,7 @@ int fnShowHide(WPARAM, LPARAM) switch (iVisibleState) { case GWVS_PARTIALLY_COVERED: //If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it. - if ( !db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) + if (!db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) break; case GWVS_COVERED: //Fall through (and we're already falling) case GWVS_HIDDEN: @@ -383,7 +383,7 @@ int fnShowHide(WPARAM, LPARAM) RECT rcWindow; ShowWindow(cli.hwndContactList, SW_RESTORE); - if ( !db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) + if (!db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) SetWindowPos(cli.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); else SetWindowPos(cli.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 16aff8469d..89ee1d5f75 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -68,7 +68,7 @@ void fnCheckCacheItem(ClcCacheEntry *p) { DBVARIANT dbv; if (p->tszGroup == NULL) { - if ( !db_get_ts(p->hContact, "CList", "Group", &dbv)) { + if (!db_get_ts(p->hContact, "CList", "Group", &dbv)) { p->tszGroup = mir_tstrdup(dbv.ptszVal); mir_free(dbv.ptszVal); } @@ -90,7 +90,7 @@ ClcCacheEntry* fnGetCacheEntry(HANDLE hContact) { ClcCacheEntry *p; int idx; - if ( !List_GetIndex(clistCache, &hContact, &idx)) { + if (!List_GetIndex(clistCache, &hContact, &idx)) { if ((p = cli.pfnCreateCacheItem(hContact)) != NULL) { List_Insert(clistCache, p, idx); cli.pfnInvalidateDisplayNameCacheEntry(p); @@ -135,7 +135,7 @@ TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode) if (ci.hContact == NULL) ci.szProto = "ICQ"; ci.dwFlag = ((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR; - if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { if (ci.type == CNFT_ASCIIZ) { if (cacheEntry != NULL) cacheEntry->tszName = ci.pszVal; @@ -181,7 +181,7 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) if (ci.hContact == NULL) // killme !!!!!!!!!! ci.szProto = "ICQ"; ci.dwFlag = ((lParam == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR; - if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { if (ci.type == CNFT_ASCIIZ) { strncpy(retVal, _T2A(ci.pszVal), SIZEOF(retVal)); if (cacheEntry == NULL) { @@ -237,15 +237,15 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) return 0; dbv.pszVal = NULL; - if ( !db_get(hContact, "Protocol", "p", &dbv)) { - if ( !strcmp(cws->szModule, dbv.pszVal)) { + if (!db_get(hContact, "Protocol", "p", &dbv)) { + if (!strcmp(cws->szModule, dbv.pszVal)) { cli.pfnInvalidateDisplayNameCacheEntry(hContact); - if ( !strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") + if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) { CallService(MS_CLUI_CONTACTRENAMED, wParam, 0); } - else if ( !strcmp(cws->szSetting, "Status")) { - if ( !db_get_b(hContact, "CList", "Hidden", 0)) { + else if (!strcmp(cws->szSetting, "Status")) { + if (!db_get_b(hContact, "CList", "Hidden", 0)) { if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing if (cws->value.wVal == ID_STATUS_OFFLINE) { @@ -267,8 +267,8 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) } } - if ( !strcmp(cws->szModule, "CList")) { - if ( !strcmp(cws->szSetting, "Hidden")) { + if (!strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "Hidden")) { if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { char *szProto = GetContactProto((HANDLE)wParam); cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1); @@ -276,12 +276,12 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) else CallService(MS_CLUI_CONTACTDELETED, wParam, 0); } - if ( !strcmp(cws->szSetting, "MyHandle")) + if (!strcmp(cws->szSetting, "MyHandle")) cli.pfnInvalidateDisplayNameCacheEntry(hContact); } - if ( !strcmp(cws->szModule, "Protocol")) { - if ( !strcmp(cws->szSetting, "p")) { + if (!strcmp(cws->szModule, "Protocol")) { + if (!strcmp(cws->szSetting, "p")) { char *szProto; if (cws->value.type == DBVT_DELETED) szProto = NULL; diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 670a7f8f51..17b017244f 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -39,7 +39,7 @@ static CRITICAL_SECTION trayLockCS; #define NIF_STATE 0x00000008 #define NIF_INFO 0x00000010 -#define initcheck if ( !fTrayInited) return +#define initcheck if (!fTrayInited) return #define SIZEOFNID ((cli.shellVersion >= 5) ? NOTIFYICONDATA_V2_SIZE : NOTIFYICONDATA_V1_SIZE) @@ -90,7 +90,7 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto) if (szPrefix && szPrefix[0]) { lstrcpyn(cli.szTip, szPrefix, MAX_TIP_SIZE); - if ( !db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) + if (!db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) return cli.szTip; } else cli.szTip[0] = '\0'; @@ -102,11 +102,11 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto) continue; PROTOACCOUNT *pa = accounts[i]; - if ( !cli.pfnGetProtocolVisibility(pa->szModuleName)) + if (!cli.pfnGetProtocolVisibility(pa->szModuleName)) continue; szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0), 0); - if ( !szStatus) + if (!szStatus) continue; if (mToolTipTrayTips) { @@ -191,7 +191,7 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s nid.uFlags |= NIF_INFO; cli.pfnTrayIconMakeTooltip(NULL, cli.trayIcon[i].szProto); - if ( !mToolTipTrayTips) + if (!mToolTipTrayTips) lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip); @@ -251,7 +251,7 @@ int fnTrayIconInit(HWND hwnd) if (trayIconSetting == SETTING_TRAYICON_SINGLE) { DBVARIANT dbv = { DBVT_DELETED }; char *szProto; - if ( !db_get_s(NULL, "CList", "PrimaryStatus", &dbv) + if (!db_get_s(NULL, "CList", "PrimaryStatus", &dbv) && (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysPrimary", 0))) szProto = dbv.pszVal; else @@ -338,7 +338,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer nid.hWnd = cli.hwndContactList; nid.uFlags = NIF_ICON | NIF_TIP; nid.hIcon = hNewIcon; - if ( !hNewIcon) + if (!hNewIcon) return -1; int i; @@ -352,7 +352,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto); mir_free(cli.trayIcon[i].ptszToolTip); cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip); - if ( !mToolTipTrayTips) + if (!mToolTipTrayTips) lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); Shell_NotifyIcon(NIM_MODIFY, &nid); @@ -374,7 +374,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto); mir_free(cli.trayIcon[i].ptszToolTip); cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip); - if ( !mToolTipTrayTips) + if (!mToolTipTrayTips) lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); Shell_NotifyIcon(NIM_MODIFY, &nid); @@ -399,7 +399,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) { - if ( !fTrayInited) { + if (!fTrayInited) { LBL_Error: DestroyIcon(hIcon); return -1; @@ -470,7 +470,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) { initcheck; if (szChangedProto == NULL) return; - if ( !cli.pfnGetProtocolVisibility(szChangedProto)) return; + if (!cli.pfnGetProtocolVisibility(szChangedProto)) return; int netProtoCount; mir_cslock lck(trayLockCS); @@ -482,7 +482,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) } for (int i=0; i < accounts.getCount(); i++) - if ( !lstrcmpA(szChangedProto, accounts[i]->szModuleName)) + if (!lstrcmpA(szChangedProto, accounts[i]->szModuleName)) cli.cycleStep = i; int changed = cli.pfnTrayCalcChanged(szChangedProto, averageMode, netProtoCount); @@ -519,7 +519,7 @@ int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoC ILD_NORMAL), NULL); case SETTING_TRAYICON_MULTI: - if ( !cli.trayIcon) + if (!cli.trayIcon) cli.pfnTrayIconRemove(NULL, NULL); else if ((cli.trayIconCount > 1 || netProtoCount == 1) || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoServiceInt(NULL,szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto); @@ -624,7 +624,7 @@ static void CALLBACK TrayHideToolTipTimerProc(HWND hwnd, UINT, UINT_PTR, DWORD) static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD) { - if ( !g_trayTooltipActive && !cli.bTrayMenuOnScreen) { + if (!g_trayTooltipActive && !cli.bTrayMenuOnScreen) { POINT pt; GetCursorPos(&pt); if (abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE) { @@ -698,7 +698,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) { if ((unsigned)cli.trayIcon[i].id == msg->wParam) { - if ( !cli.trayIcon[i].szProto) break; + if (!cli.trayIcon[i].szProto) break; int ind = 0; for (int j = 0; j < accounts.getCount(); j++) @@ -706,7 +706,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) int k = cli.pfnGetAccountIndexByPos(j); if (k >= 0) { - if ( !strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName)) + if (!strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName)) { HMENU hm = GetSubMenu(hMenu, ind); if (hm) hMenu = hm; @@ -811,7 +811,7 @@ int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn) if (msn->szProto) { for (int j = 0; j < cli.trayIconCount; j++) { if (cli.trayIcon[j].szProto != NULL) { - if ( !strcmp(msn->szProto, cli.trayIcon[j].szProto)) { + if (!strcmp(msn->szProto, cli.trayIcon[j].szProto)) { iconId = cli.trayIcon[j].id; break; } diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 569c8c9556..559e9b2b13 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -93,7 +93,7 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) HWND hwndClist = GetFocus(); GetClassName(hwndClist, cls, SIZEOF(cls)); - hwndClist = ( !lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList; + hwndClist = (!lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList; hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); Menu_ShowItem(hRenameMenuItem, hItem != 0); return 0; @@ -106,7 +106,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM) HWND hwndClist = GetFocus(); GetClassName(hwndClist, cls, SIZEOF(cls)); // worst case scenario, the rename is sent to the main contact list - hwndClist = ( !lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList; + hwndClist = (!lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList; hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); if (hItem) { SetFocus(hwndClist); @@ -336,7 +336,7 @@ int LoadCLUIModule(void) int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL); cli.hMenuMain = GetMenu(cli.hwndContactList); - if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) + if (!db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) SetMenu(cli.hwndContactList, NULL); if (state == SETTING_STATE_NORMAL) ShowWindow(cli.hwndContactList, SW_SHOW); @@ -550,12 +550,12 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } // drop thru case WM_MOVE: - if ( !IsIconic(hwnd)) { + if (!IsIconic(hwnd)) { RECT rc; GetWindowRect(hwnd, &rc); //if docked, dont remember pos (except for width) - if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { + if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { db_set_dw(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top)); db_set_dw(NULL, "CList", "x", (DWORD) rc.left); db_set_dw(NULL, "CList", "y", (DWORD) rc.top); @@ -586,7 +586,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_SETCURSOR: if (cluiopt.transparent) { - if ( !transparentFocus && GetForegroundWindow() != hwnd) { + if (!transparentFocus && GetForegroundWindow() != hwnd) { SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA); transparentFocus = 1; SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); @@ -628,7 +628,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } - if ( !transparentFocus) + if (!transparentFocus) KillTimer(hwnd, TM_AUTOALPHA); } return TRUE; @@ -638,7 +638,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; if (noRecurse) break; - if ( !db_get_b(NULL, "CLUI", "FadeInOut", 0)) + if (!db_get_b(NULL, "CLUI", "FadeInOut", 0)) break; if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) { DWORD thisTick, startTick; @@ -792,7 +792,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case CLN_DRAGGING: ClientToScreen(hwnd, &nmc->pt); - if ( !(nmc->flags & CLNF_ISGROUP)) + if (!(nmc->flags & CLNF_ISGROUP)) if (NotifyEventHooks(hContactDraggingEvent, (WPARAM) nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) { SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER))); return TRUE; @@ -800,13 +800,13 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case CLN_DRAGSTOP: - if ( !(nmc->flags & CLNF_ISGROUP)) + if (!(nmc->flags & CLNF_ISGROUP)) NotifyEventHooks(hContactDragStopEvent, (WPARAM) nmc->hItem, 0); break; case CLN_DROPPED: ClientToScreen(hwnd, &nmc->pt); - if ( !(nmc->flags & CLNF_ISGROUP)) + if (!(nmc->flags & CLNF_ISGROUP)) if (NotifyEventHooks(hContactDroppedEvent, (WPARAM) nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) { SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER))); return TRUE; @@ -830,7 +830,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcWindow, rcTree, rcWorkArea; int maxHeight, newHeight; - if ( !db_get_b(NULL, "CLUI", "AutoSize", 0)) + if (!db_get_b(NULL, "CLUI", "AutoSize", 0)) break; if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) break; @@ -868,7 +868,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y)); if (hItem) { if (hitFlags & CLCHT_ONITEMEXTRA) { - if ( !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) + if (!IsHContactGroup(hItem) && !IsHContactInfo(hItem)) if ( cli.pfnGetCacheEntry(nmc->hItem)) NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn+1); } @@ -930,7 +930,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int pos = LOWORD(wParam); POINT pt; GetCursorPos(&pt); - if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) { + if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && (!(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) { MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_SUBMENU; mii.hSubMenu = (HMENU)CallService((pos == 0) ? MS_CLIST_MENUGETMAIN : MS_CLIST_MENUGETSTATUS, 0, 0); @@ -952,7 +952,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // all this is done in screen-coords! GetCursorPos(&pt); // the mouse isnt near the window, so put it in the middle of the window - if ( !PtInRect(&rc, pt)) { + if (!PtInRect(&rc, pt)) { pt.x = rc.left + (rc.right - rc.left) / 2; pt.y = rc.top + (rc.bottom - rc.top) / 2; } @@ -1036,7 +1036,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } if (showOpts & 4) { TCHAR* szStatus = cli.pfnGetStatusModeDescription(status, 0); - if ( !szStatus) + if (!szStatus) szStatus = _T(""); GetTextExtentPoint32(dis->hDC, szStatus, lstrlen(szStatus), &textSize); TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, lstrlen(szStatus)); @@ -1060,12 +1060,12 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE; case WM_DESTROY: - if ( !IsIconic(hwnd)) { + if (!IsIconic(hwnd)) { RECT rc; GetWindowRect(hwnd, &rc); //if docked, dont remember pos (except for width) - if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { + if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { db_set_dw(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top)); db_set_dw(NULL, "CList", "x", (DWORD) rc.left); db_set_dw(NULL, "CList", "y", (DWORD) rc.top); diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index 01c82f9b86..e3702d61cc 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -44,7 +44,7 @@ static INT_PTR GroupAdded(WPARAM wParam, LPARAM lParam) HWND hwndFocus = GetFocus(); GetClassName(hwndFocus, szFocusClass, SIZEOF(szFocusClass)); - if ( !lstrcmp(szFocusClass, _T(CLISTCONTROL_CLASS))) { + if (!lstrcmp(szFocusClass, _T(CLISTCONTROL_CLASS))) { hItem = (HANDLE) SendMessage(hwndFocus, CLM_FINDGROUP, wParam, 0); if (hItem) SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM) hItem, 0); diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index 997061b117..4a7be77ba1 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -80,7 +80,7 @@ void fnLoadContactTree(void) int hideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int status = GetContactStatus(hContact); - if (( !hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0)) + if ((!hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0)) cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact), 1); } sortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT); diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index 845e8f2736..77e3145a0d 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -59,12 +59,12 @@ static int GetDatabaseString(CONTACTINFO *ci, const char* setting, DBVARIANT* db static int ProcessDatabaseValueDefault(CONTACTINFO *ci, const char* setting) { DBVARIANT dbv; - if ( !GetDatabaseString(ci, setting, &dbv)) { + if (!GetDatabaseString(ci, setting, &dbv)) { switch (dbv.type) { case DBVT_ASCIIZ: - if ( !dbv.pszVal[0]) break; + if (!dbv.pszVal[0]) break; case DBVT_WCHAR: - if ( !dbv.pwszVal[0]) break; + if (!dbv.pwszVal[0]) break; ci->type = CNFT_ASCIIZ; ci->pszVal = dbv.ptszVal; return 0; @@ -145,10 +145,10 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { } case CNF_COUNTRY: case CNF_COCOUNTRY: - if ( !GetDatabaseString(ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv)) + if (!GetDatabaseString(ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv)) return 0; - if ( !db_get(ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) { + if (!db_get(ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) { if (dbv.type == DBVT_WORD) { int i, countryCount; struct CountryListEntry *countries; @@ -176,9 +176,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { break; case CNF_FIRSTLAST: - if ( !GetDatabaseString(ci, "FirstName", &dbv)) { + if (!GetDatabaseString(ci, "FirstName", &dbv)) { DBVARIANT dbv2; - if ( !GetDatabaseString(ci, "LastName", &dbv2)) { + if (!GetDatabaseString(ci, "LastName", &dbv2)) { ci->type = CNFT_ASCIIZ; if (ci->dwFlag & CNF_UNICODE) { size_t len = wcslen(dbv.pwszVal) + wcslen(dbv2.pwszVal) + 2; @@ -206,18 +206,18 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { { char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) - if ( !ProcessDatabaseValueDefault(ci, uid)) + if (!ProcessDatabaseValueDefault(ci, uid)) return 0; break; } case CNF_DISPLAYUID: { - if ( !ProcessDatabaseValueDefault(ci, "display_uid")) + if (!ProcessDatabaseValueDefault(ci, "display_uid")) return 0; char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) - if ( !ProcessDatabaseValueDefault(ci, uid)) + if (!ProcessDatabaseValueDefault(ci, uid)) return 0; break; @@ -241,19 +241,19 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { break; } case 1: - if ( !ProcessDatabaseValueDefault(ci, "Nick")) // nick + if (!ProcessDatabaseValueDefault(ci, "Nick")) // nick return 0; break; case 2: - if ( !ProcessDatabaseValueDefault(ci, "FirstName")) // First Name + if (!ProcessDatabaseValueDefault(ci, "FirstName")) // First Name return 0; break; case 3: - if ( !ProcessDatabaseValueDefault(ci, "e-mail")) // E-mail + if (!ProcessDatabaseValueDefault(ci, "e-mail")) // E-mail return 0; break; case 4: - if ( !ProcessDatabaseValueDefault(ci, "LastName")) // Last Name + if (!ProcessDatabaseValueDefault(ci, "LastName")) // Last Name return 0; break; case 5: // Unique id @@ -261,7 +261,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { // protocol must define a PFLAG_UNIQUEIDSETTING char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) { - if ( !GetDatabaseString(ci, uid, &dbv)) { + if (!GetDatabaseString(ci, uid, &dbv)) { if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) { long value = (dbv.type == DBVT_BYTE) ? dbv.bVal:(dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal); if (ci->dwFlag & CNF_UNICODE) { @@ -293,9 +293,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { } case 6: // first + last name case 7: // last + first name - if ( !GetDatabaseString(ci, nameOrder[i] == 6 ? "FirstName" : "LastName", &dbv)) { + if (!GetDatabaseString(ci, nameOrder[i] == 6 ? "FirstName" : "LastName", &dbv)) { DBVARIANT dbv2; - if ( !GetDatabaseString(ci, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) { + if (!GetDatabaseString(ci, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) { ci->type = CNFT_ASCIIZ; if (ci->dwFlag & CNF_UNICODE) { @@ -350,7 +350,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { } case CNF_MYNOTES: { char* saveProto = ci->szProto; ci->szProto = "UserInfo"; - if ( !ProcessDatabaseValueDefault(ci, "MyNotes")) { + if (!ProcessDatabaseValueDefault(ci, "MyNotes")) { ci->szProto = saveProto; return 0; } @@ -506,7 +506,7 @@ int LoadContactsModule(void) nameOrder[i] = i; DBVARIANT dbv; - if ( !db_get(NULL, "Contact", "NameOrder", &dbv)) { + if (!db_get(NULL, "Contact", "NameOrder", &dbv)) { CopyMemory(nameOrder, dbv.pbVal, dbv.cpbVal); db_free(&dbv); } diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 3fa55b5f72..be411350a5 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -117,7 +117,7 @@ int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis) mis->itemWidth = 0; mis->itemHeight = 0; - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; if (mis == NULL) @@ -140,7 +140,7 @@ int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis) //lparam = LPDRAWITEMSTRUCT int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; if (dis == NULL) @@ -193,7 +193,7 @@ int MO_RemoveAllObjects() //wparam = MenuObjectHandle INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); @@ -210,7 +210,7 @@ INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM) //lparam = vKey INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); @@ -221,9 +221,9 @@ INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey) for (PMO_IntMenuItem pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next) { if (pimi->mi.hotKey == 0) continue; if (HIWORD(pimi->mi.hotKey) != vKey) continue; - if ( !(LOWORD(pimi->mi.hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue; - if ( !(LOWORD(pimi->mi.hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue; - if ( !(LOWORD(pimi->mi.hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue; + if (!(LOWORD(pimi->mi.hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue; + if (!(LOWORD(pimi->mi.hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue; + if (!(LOWORD(pimi->mi.hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue; MO_ProcessCommand(pimi, 0); return TRUE; @@ -249,7 +249,7 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) TIntMenuObject* pmo = g_menus[objidx]; for (PMO_IntMenuItem p = pmo->m_items.first; p != NULL; p = p->next) - if ( !lstrcmpA(p->UniqName, szProto)) + if (!lstrcmpA(p->UniqName, szProto)) return (INT_PTR)p; return NULL; @@ -260,7 +260,7 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam) { PMO_MenuItem mi = (PMO_MenuItem)lParam; - if ( !bIsGenMenuInited || mi == NULL) + if (!bIsGenMenuInited || mi == NULL) return -1; PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); @@ -282,7 +282,7 @@ static int FindDefaultItem(PMO_IntMenuItem pimi, void*) INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); @@ -296,7 +296,7 @@ int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi) { int oldflags; - if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem)) + if (!bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem)) return -1; mir_cslock lck(csMenuHook); @@ -354,7 +354,7 @@ int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi) //NULL on error. INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); @@ -390,7 +390,7 @@ static int FindMenuByCommand(PMO_IntMenuItem pimi, void* pCommand) int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; PMO_IntMenuItem pimi; @@ -408,7 +408,7 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; PMO_IntMenuItem pimi; @@ -424,7 +424,7 @@ INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; PMO_IntMenuItem pimi; @@ -442,7 +442,7 @@ int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam) int MO_SetOptionsMenuItem(PMO_IntMenuItem aHandle, int setting, INT_PTR value) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); @@ -460,7 +460,7 @@ int MO_SetOptionsMenuItem(PMO_IntMenuItem aHandle, int setting, INT_PTR value) int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); @@ -617,11 +617,11 @@ static int GetNextObjectMenuItemId() //return MenuItemHandle PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) { - if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem)) + if (!bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem)) return NULL; //old mode - if ( !(pmi->flags & CMIF_ROOTHANDLE)) + if (!(pmi->flags & CMIF_ROOTHANDLE)) return MO_AddOldNewMenuItem(menuobjecthandle, pmi); mir_cslock lck(csMenuHook); @@ -666,7 +666,7 @@ PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) else p->owner = &pmo->m_items; - if ( !p->owner->first) + if (!p->owner->first) p->owner->first = p; if (p->owner->last) p->owner->last->next = p; @@ -688,7 +688,7 @@ int FindRoot(PMO_IntMenuItem pimi, void* param) PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) { - if ( !bIsGenMenuInited || pmi == NULL) + if (!bIsGenMenuInited || pmi == NULL) return NULL; int objidx = GetMenuObjbyId((int)menuobjecthandle); @@ -793,7 +793,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l if (p != NULL && fType != MFT_SEPARATOR) { if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) { //but might be supposed to be after the next one instead - if ( !(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR)) + if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR)) InsertSeparator(hMenu, uItem); uItem++; } @@ -813,7 +813,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l int count = GetMenuItemCount(hMenu); if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) { - if ( !(mii.fMask & MIIM_FTYPE)) + if (!(mii.fMask & MIIM_FTYPE)) mii.fType = 0; mii.fMask |= MIIM_FTYPE; mii.fType |= MFT_MENUBARBREAK; @@ -832,7 +832,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) { - if ( !bIsGenMenuInited) + if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); @@ -912,14 +912,14 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para db_set_b(NULL, MenuNameItems, DBString, 1); pmi->OverrideShow = TRUE; - if ( !db_get_b(NULL, MenuNameItems, DBString, 1)) { + if (!db_get_b(NULL, MenuNameItems, DBString, 1)) { pmi->OverrideShow = FALSE; continue; // find out what value to return if not getting added } // mi.pszName mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName); - if ( !db_get_ts(NULL, MenuNameItems, DBString, &dbv)) { + if (!db_get_ts(NULL, MenuNameItems, DBString, &dbv)) { if (_tcslen(dbv.ptszVal) > 0) replaceStrT(pmi->CustomName, dbv.ptszVal); db_free(&dbv); @@ -1038,10 +1038,10 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*) TCHAR *uname = (pmi->UniqName) ? mir_a2t(pmi->UniqName) : mir_tstrdup(pmi->CustomName), *descr = GetMenuItemText(pmi); - if ( !uname && !descr) + if (!uname && !descr) return FALSE; - if ( !pmi->hIcolibItem) { + if (!pmi->hIcolibItem) { HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0); TCHAR sectionName[256]; diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 6511c2d2b5..d21c7c7fd5 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -70,7 +70,7 @@ static BOOL GetCurrentMenuObjectID(HWND hwndDlg, int* result) static int SaveTree(HWND hwndDlg) { int MenuObjectId; - if ( !GetCurrentMenuObjectID(hwndDlg, &MenuObjectId)) + if (!GetCurrentMenuObjectID(hwndDlg, &MenuObjectId)) return 0; HWND hTree = GetDlgItem(hwndDlg, IDC_MENUITEMS); @@ -255,7 +255,7 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) DBVARIANT dbv; mir_snprintf(buf, SIZEOF(buf), "%s_name", menuItemName); - if ( !db_get_ts(NULL, MenuNameItems, buf, &dbv)) { + if (!db_get_ts(NULL, MenuNameItems, buf, &dbv)) { PD->name = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -348,7 +348,7 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert TVITEM tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_PARAM; tvi.hItem = hItem; - if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi)) + if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi)) return NULL; if (hItem && hInsertAfter) { TVINSERTSTRUCT tvis; @@ -362,9 +362,9 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert tvis.item.cchTextMax = sizeof(name); tvis.item.hItem = hItem; tvis.item.iImage = tvis.item.iSelectedImage = ((MenuItemOptData*)tvi.lParam)->bShow; - if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item)) + if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item)) return NULL; - if ( !TreeView_DeleteItem(hTreeWnd, hItem)) + if (!TreeView_DeleteItem(hTreeWnd, hItem)) return NULL; tvis.hParent = NULL; tvis.hInsertAfter = hInsertAfter; @@ -391,7 +391,7 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam tvi.hItem = hti.hItem; TreeView_GetItem(tvw, &tvi); - if ( !((MenuItemOptData *)tvi.lParam)->bIsSelected) { /* is not Selected*/ + if (!((MenuItemOptData *)tvi.lParam)->bIsSelected) { /* is not Selected*/ // reset all selection except current HTREEITEM hit; hit = TreeView_GetRoot(tvw); @@ -738,7 +738,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_MOUSEMOVE: - if ( !dat || !dat->dragging) break; + if (!dat || !dat->dragging) break; { TVHITTESTINFO hti; @@ -751,7 +751,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM it = hti.hItem; hti.pt.y -= TreeView_GetItemHeight( GetDlgItem(hwndDlg, IDC_MENUITEMS))/2; TreeView_HitTest( GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); - if ( !(hti.flags&TVHT_ABOVE)) + if (!(hti.flags&TVHT_ABOVE)) TreeView_SetInsertMark( GetDlgItem(hwndDlg, IDC_MENUITEMS), hti.hItem, 1); else TreeView_SetInsertMark( GetDlgItem(hwndDlg, IDC_MENUITEMS), it, 0); @@ -765,7 +765,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_LBUTTONUP: - if ( !dat->dragging) + if (!dat->dragging) break; TreeView_SetInsertMark( GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0); @@ -814,7 +814,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (i=0; itszGroup, oldName)) { + if (!lstrcmp(cache->tszGroup, oldName)) { db_set_ts(hContact, "CList", "Group", szName); mir_free(cache->tszGroup); cache->tszGroup = 0; @@ -314,7 +314,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) _itoa(i, idstr, 10); if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) break; - if ( !_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) { + if (!_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) { mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2); RenameGroupWithMove(i, szNewName, 0); //luckily, child groups will never need reordering } @@ -335,7 +335,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) _itoa(i, idstr, 10); if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) break; - if ( !lstrcmp(dbv.ptszVal + 1, str)) { + if (!lstrcmp(dbv.ptszVal + 1, str)) { if (i < groupId) break; //is OK MoveGroupBefore(groupId + 1, i + 2); diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 13092615f6..d339e73c4a 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -35,7 +35,7 @@ static INT_PTR hkHideShow(WPARAM, LPARAM) INT_PTR hkSearch(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv = {0}; - if ( !db_get_s(NULL, "CList", "SearchUrl", &dbv)) { + if (!db_get_s(NULL, "CList", "SearchUrl", &dbv)) { CallService(MS_UTILS_OPENURL, db_get_b(NULL, "CList", "HKSearchNewWnd", 0), (LPARAM)dbv.pszVal); db_free(&dbv); } diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index b296a1c3a3..00d6817fb8 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -87,7 +87,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) int i; OBJLIST groups(10, GroupItemSort::compare); - if ( !hMoveToGroupItem) { + if (!hMoveToGroupItem) { CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 100000; mi.pszName = LPGEN("&Move to group"); diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index a2bf6dd2ea..747f81ddf4 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -106,7 +106,7 @@ bool CheckProtocolOrder(void) static bool ProtoToInclude(PROTOACCOUNT *pa) { - if ( !Proto_IsAccountEnabled(pa)) + if (!Proto_IsAccountEnabled(pa)) return false; PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName); @@ -130,7 +130,7 @@ static int FillTree(HWND hwnd) continue; PROTOACCOUNT *pa = accounts[idx]; - if ( !ProtoToInclude(pa)) + if (!ProtoToInclude(pa)) continue; ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); @@ -273,7 +273,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HTREEITEM it = hti.hItem; hti.pt.y -= TreeView_GetItemHeight(hwndProtoOrder) / 2; TreeView_HitTest(hwndProtoOrder, &hti); - if ( !(hti.flags & TVHT_ABOVE)) + if (!(hti.flags & TVHT_ABOVE)) TreeView_SetInsertMark(hwndProtoOrder, hti.hItem, 1); else TreeView_SetInsertMark(hwndProtoOrder, it, 0); diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 303198d9d0..21a958ecd4 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -137,12 +137,12 @@ static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cc _tcsncpy(buf, src, SIZEOF(buf)); TCHAR *p = _tcsrchr(buf, '\\'); if (p) ++p; else p = buf; - if ( !isValidProfileName(buf) && *p) + if (!isValidProfileName(buf) && *p) _tcscat(buf, _T(".dat")); TCHAR profileName[MAX_PATH], newProfileDir[MAX_PATH]; _tcscpy(profileName, p); - if ( !isValidProfileName(profileName) && *p) + if (!isValidProfileName(profileName) && *p) _tcscat(profileName, _T(".dat")); _tcscpy(profileName, p); @@ -329,7 +329,7 @@ char* makeFileName(const TCHAR* tszOriginalName) szResult = mir_t2a(tszProfile); } - if ( !szResult) + if (!szResult) szResult = szFileName; else mir_free(szFileName); @@ -438,7 +438,7 @@ int LoadDatabaseModule(void) szProfile[0] = 0; // find out which profile to load - if ( !getProfile(szProfile, SIZEOF(szProfile))) + if (!getProfile(szProfile, SIZEOF(szProfile))) return 1; EnsureCheckerLoaded(false); // unload dbchecker diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp index 35a0557362..58b86606b6 100644 --- a/src/modules/database/dbintf.cpp +++ b/src/modules/database/dbintf.cpp @@ -48,7 +48,7 @@ static INT_PTR srvGetContactCount(WPARAM, LPARAM) static INT_PTR srvDeleteContact(WPARAM wParam, LPARAM) { DBVARIANT dbv = {0}; - if ( !db_get_ts((HANDLE)wParam, "ContactPhoto", "File", &dbv)) { + if (!db_get_ts((HANDLE)wParam, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); db_free(&dbv); } diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index f57ce37446..977248f906 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -55,12 +55,12 @@ static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam) p->eventIcon = et->eventIcon; p->flags = et->flags; } - if ( !p->textService) { + if (!p->textService) { char szServiceName[100]; mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventText%d", p->module, p->eventType); p->textService = mir_strdup(szServiceName); } - if ( !p->iconService) { + if (!p->iconService) { char szServiceName[100]; mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType); p->iconService = mir_strdup(szServiceName); @@ -78,7 +78,7 @@ static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam) tmp.module = (char*)wParam; tmp.eventType = lParam; - if ( !List_GetIndex((SortedList*)&eventTypes, &tmp, &idx)) + if (!List_GetIndex((SortedList*)&eventTypes, &tmp, &idx)) return 0; return (INT_PTR)eventTypes[idx]; @@ -215,13 +215,13 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam) } if (et && et->eventIcon) icon = Skin_GetIconByHandle(et->eventIcon); - if ( !icon) { + if (!icon) { char szName[100]; mir_snprintf(szName, sizeof(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType); icon = Skin_GetIcon(szName); } - if ( !icon) { + if (!icon) { switch(dbei->eventType) { case EVENTTYPE_URL: icon = LoadSkinIcon(SKINICON_EVENT_URL); @@ -279,7 +279,7 @@ static INT_PTR DbDeleteModule(WPARAM, LPARAM lParam) static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam) { - if ( !wParam || !lParam) + if (!wParam || !lParam) return 1; char *dst = (char*)lParam; @@ -290,7 +290,7 @@ static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam) static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) { - if ( !wParam || !lParam) + if (!wParam || !lParam) return 1; char *dst = (char*)lParam; @@ -305,7 +305,7 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) static INT_PTR GetProfilePathW(WPARAM wParam, LPARAM lParam) { - if ( !wParam || !lParam) + if (!wParam || !lParam) return 1; wchar_t *dst = (wchar_t*)lParam; @@ -354,7 +354,7 @@ int LoadEventsModule() void UnloadEventsModule() { - if ( !bModuleInitialized) + if (!bModuleInitialized) return; for (int i=0; i < eventTypes.getCount(); i++) { diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index c69a89de89..66b721b2d2 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -101,7 +101,7 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA mir_sntprintf(buf, SIZEOF(buf), _T("%s\\%s\\%s.dat"), szProfileDir, ffd.cFileName, ffd.cFileName); if (_taccess(buf, 0) == 0) { mir_sntprintf(profile, SIZEOF(profile), _T("%s.dat"), ffd.cFileName); - if ( !callback(buf, profile, lParam)) + if (!callback(buf, profile, lParam)) break; } } diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 56cb499dca..bf91362ce0 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -358,14 +358,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR *szProto = NULL; DBVARIANT dbv; - if ( !db_get_ts(NULL, "FindAdd", "LastSearched", &dbv)){ + if (!db_get_ts(NULL, "FindAdd", "LastSearched", &dbv)){ szProto = NEWTSTR_ALLOCA(dbv.ptszVal); db_free(&dbv); /* free string szProto was fetched with */ } int i, index = 0, cbwidth = 0, netProtoCount = 0; for (i=0; i < accounts.getCount(); i++) { - if ( !Proto_IsAccountEnabled(accounts[i])) + if (!Proto_IsAccountEnabled(accounts[i])) continue; DWORD caps = (DWORD)CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); @@ -393,11 +393,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0; i < accounts.getCount(); i++) { PROTOACCOUNT* pa = accounts[i]; - if ( !Proto_IsAccountEnabled(pa)) + if (!Proto_IsAccountEnabled(pa)) continue; DWORD caps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); - if ( !(caps&PF1_BASICSEARCH) && !(caps&PF1_EXTSEARCH) && !(caps&PF1_SEARCHBYEMAIL) && !(caps&PF1_SEARCHBYNAME)) + if (!(caps&PF1_BASICSEARCH) && !(caps&PF1_EXTSEARCH) && !(caps&PF1_SEARCHBYEMAIL) && !(caps&PF1_SEARCHBYNAME)) continue; cbei.pszText = pa->tszAccountName; @@ -536,7 +536,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP (dat->showTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) || (dat->showName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) || (dat->showProtoId && IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)); - if ( !checkmarkVisible) { + if (!checkmarkVisible) { if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID); else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL); else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME); @@ -875,7 +875,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP bool isUnicode = (psr->flags & PSR_UNICODE) != 0; if (psr->id) { BOOL validPtr = isUnicode ? IsBadStringPtrW((wchar_t*)psr->id, 25) : IsBadStringPtrA((char*)psr->id, 25); - if ( !validPtr) { + if (!validPtr) { isUnicode = false; lsr->psr.id = NULL; } @@ -1006,7 +1006,7 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) // that is not good either... for (int i=0; i < accounts.getCount(); i++) { PROTOACCOUNT* pa = accounts[i]; - if ( !Proto_IsAccountEnabled(pa)) + if (!Proto_IsAccountEnabled(pa)) continue; int protoCaps = CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 9bf94d3713..57dcb2bc4f 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -138,7 +138,7 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa sortMultiplier = dat->bSortAscending?1:-1; sortCol = dat->iLastColumnSortIndex; - if ( !dat->bFlexSearchResult) + if (!dat->bFlexSearchResult) { lsr1 = (struct ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam1); lsr2 = (struct ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam2); @@ -214,9 +214,9 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * accounts.getCount()); for (int i=0; i < accounts.getCount();i++) { PROTOACCOUNT* pa = accounts[i]; - if ( !Proto_IsAccountEnabled(pa)) continue; + if (!Proto_IsAccountEnabled(pa)) continue; DWORD caps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); - if ( !(caps&requiredCapability)) continue; + if (!(caps&requiredCapability)) continue; dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(NULL,pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[dat->searchCount].szProto = pa->szModuleName; if (dat->search[dat->searchCount].hProcess == NULL) failures++; @@ -261,7 +261,7 @@ void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat) lstrcpy(str, TranslateT("Searching")); for (i=0; i < dat->searchCount; i++) { PROTOACCOUNT* pa = Proto_GetAccount(dat->search[i].szProto); - if ( !pa) + if (!pa) continue; lstrcat(str, i ? _T(", ") : _T(" ")); diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 3ab3696249..4b471ee47b 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -329,7 +329,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC else tvi.hItem = TreeView_GetRoot(hwndTree); - if ( !name) + if (!name) return tvi.hItem; tvi.mask = TVIF_TEXT; @@ -340,7 +340,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC { TreeView_GetItem(hwndTree, &tvi); - if ( !lstrcmp(tvi.pszText, name)) + if (!lstrcmp(tvi.pszText, name)) return tvi.hItem; tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); @@ -370,8 +370,8 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, pItemName = TranslateTH(hLangpack, pItemName); hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName); - if ( !sectionName || !hItem) { - if ( !hItem) { + if (!sectionName || !hItem) { + if (!hItem) { TVINSERTSTRUCT tvis = {0}; TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem)); treeItem->groupName = sectionName ? NULL : mir_tstrdup(groupName); @@ -675,7 +675,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (first_colour_index == -1) first_colour_index = colourId; - if ( !sttFsuiBindColourIdToFonts( GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) { + if (!sttFsuiBindColourIdToFonts( GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) { itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData)); itemData->colour_id = colourId; itemData->font_id = -1; @@ -689,7 +689,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } } - if ( !hBkgColourBrush) + if (!hBkgColourBrush) hBkgColourBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); for (effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++) { @@ -699,7 +699,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (first_effect_index == -1) first_effect_index = effectId; - if ( !sttFsuiBindEffectIdToFonts( GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) { + if (!sttFsuiBindEffectIdToFonts( GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) { itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData)); itemData->effect_id = effectId; itemData->font_id = -1; @@ -749,7 +749,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (itemData->colour_id >= 0) { int iItem = itemData->colour_id; - if ( !itemName) + if (!itemName) itemName = colour_id_list_w2[iItem].getName(); } @@ -786,7 +786,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (dis->CtlID != IDC_FONTLIST) break; - if ( !itemData) return FALSE; + if (!itemData) return FALSE; if (itemData->font_id >= 0) { int iItem = itemData->font_id; @@ -936,7 +936,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, bEnableEffect = 0; if (bEnableFont && (itemData->font_id < 0)) bEnableFont = 0; - if ( !bEnableFont || bEnableClText && (itemData->font_id < 0)) + if (!bEnableFont || bEnableClText && (itemData->font_id < 0)) bEnableClText = 0; if (bEnableReset && (itemData->font_id >= 0) && !(font_id_list_w2[itemData->font_id].flags&FIDF_DEFAULTVALID)) bEnableReset = 0; @@ -1156,7 +1156,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.lpstrDefExt = _T("ini"); if (GetSaveFileName(&ofn) == TRUE) - if ( !ExportSettings(hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list)) + if (!ExportSettings(hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list)) MessageBox(hwndDlg, TranslateT("Error writing file"), TranslateT("Error"), MB_ICONWARNING | MB_OK); } return TRUE; @@ -1275,7 +1275,7 @@ static FontInternal *sttFindFont(OBJLIST &fonts, char *module, cha for (int i=0; i < fonts.getCount(); i++) { FontInternal& F = fonts[i]; - if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix)) + if (!lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix)) return &F; } @@ -1318,7 +1318,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar break; } - if ( !pf) + if (!pf) break; HFONT hFont = NULL, hoFont = NULL; diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index e74b8a92f0..56b3300ede 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -145,7 +145,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR if (flags & FIDF_APPENDNAME) mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix); else mir_snprintf(idstr, SIZEOF(idstr), "%s", prefix); - if ( !db_get_ts(NULL, settings_group, idstr, &dbv)) { + if (!db_get_ts(NULL, settings_group, idstr, &dbv)) { _tcscpy(lf->lfFaceName, dbv.ptszVal); db_free(&dbv); } @@ -290,7 +290,7 @@ static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) for (int i=0; i < font_id_list.getCount(); i++) { FontInternal& F = font_id_list[i]; - if ( !lstrcmp(F.group, font_id->group) && !lstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER)) + if (!lstrcmp(F.group, font_id->group) && !lstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER)) return 1; } @@ -303,11 +303,11 @@ static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) memcpy(newItem, font_id, font_id->cbSize); newItem->hLangpack = hLangpack; - if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) { + if (!lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) { LOGFONT lf; SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE); lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace)); - if ( !newItem->deffontsettings.size) + if (!newItem->deffontsettings.size) newItem->deffontsettings.size = lf.lfHeight; } @@ -324,7 +324,7 @@ INT_PTR RegisterFontW(WPARAM wParam, LPARAM lParam) INT_PTR RegisterFont(WPARAM wParam, LPARAM lParam) { FontIDW temp; - if ( !ConvertFontID((FontID*)wParam, &temp)) return -1; + if (!ConvertFontID((FontID*)wParam, &temp)) return -1; return sttRegisterFontWorker(&temp, (int)lParam); } @@ -337,7 +337,7 @@ static INT_PTR sttGetFontWorker(FontIDW* font_id, LOGFONT* lf) for (int i=0; i < font_id_list.getCount(); i++) { FontInternal& F = font_id_list[i]; - if ( !_tcsncmp(F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp(F.group, font_id->group, SIZEOF(F.group))) { + if (!_tcsncmp(F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp(F.group, font_id->group, SIZEOF(F.group))) { if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) { CreateFromFontSettings(&F.deffontsettings, lf); colour = GetColorFromDefault(F.deffontsettings.colour); @@ -359,7 +359,7 @@ INT_PTR GetFontW(WPARAM wParam, LPARAM lParam) INT_PTR GetFont(WPARAM wParam, LPARAM lParam) { FontIDW temp; - if ( !ConvertFontID((FontID*)wParam, &temp)) + if (!ConvertFontID((FontID*)wParam, &temp)) return -1; LOGFONT lftemp; @@ -392,7 +392,7 @@ static INT_PTR sttRegisterColourWorker(ColourIDW* colour_id, int hLangpack) for (int i=0; i < colour_id_list.getCount(); i++) { ColourInternal& C = colour_id_list[i]; - if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) + if (!_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) return 1; } @@ -413,7 +413,7 @@ INT_PTR RegisterColourW(WPARAM wParam, LPARAM lParam) INT_PTR RegisterColour(WPARAM wParam, LPARAM lParam) { ColourIDW temp; - if ( !ConvertColourID((ColourID*)wParam, &temp)) return -1; + if (!ConvertColourID((ColourID*)wParam, &temp)) return -1; return sttRegisterColourWorker(&temp, (int)lParam); } @@ -424,7 +424,7 @@ static INT_PTR sttGetColourWorker(ColourIDW* colour_id) { for (int i=0; i < colour_id_list.getCount(); i++) { ColourInternal& C = colour_id_list[i]; - if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) + if (!_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) return db_get_dw(NULL, C.dbSettingsGroup, C.setting, GetColorFromDefault(C.defcolour)); } @@ -439,7 +439,7 @@ INT_PTR GetColourW(WPARAM wParam, LPARAM) INT_PTR GetColour(WPARAM wParam, LPARAM) { ColourIDW temp; - if ( !ConvertColourID((ColourID*)wParam, &temp)) return -1; + if (!ConvertColourID((ColourID*)wParam, &temp)) return -1; return sttGetColourWorker(&temp); } @@ -478,7 +478,7 @@ static INT_PTR sttRegisterEffectWorker(EffectIDW* effect_id, int hLangpack) for (int i=0; i < effect_id_list.getCount(); i++) { EffectInternal& E = effect_id_list[i]; - if ( !_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name)) + if (!_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name)) return 1; } @@ -499,7 +499,7 @@ INT_PTR RegisterEffectW(WPARAM wParam, LPARAM lParam) INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam) { EffectIDW temp; - if ( !ConvertEffectID((EffectID*)wParam, &temp)) return -1; + if (!ConvertEffectID((EffectID*)wParam, &temp)) return -1; return sttRegisterEffectWorker(&temp, (int)lParam); } @@ -510,7 +510,7 @@ static INT_PTR sttGetEffectWorker(EffectIDW* effect_id, FONTEFFECT* effect) { for (int i=0; i < effect_id_list.getCount(); i++) { EffectInternal& E = effect_id_list[i]; - if ( !_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group))) { + if (!_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group))) { FONTEFFECT temp; UpdateEffectSettings(effect_id, &temp); @@ -532,7 +532,7 @@ INT_PTR GetEffectW(WPARAM wParam, LPARAM lParam) INT_PTR GetEffect(WPARAM wParam, LPARAM lParam) { EffectIDW temp; - if ( !ConvertEffectID((EffectID*)wParam, &temp)) return -1; + if (!ConvertEffectID((EffectID*)wParam, &temp)) return -1; return sttGetEffectWorker(&temp, (FONTEFFECT*)lParam); } diff --git a/src/modules/icolib/extracticon.cpp b/src/modules/icolib/extracticon.cpp index 39113d2ef5..96973f0791 100644 --- a/src/modules/icolib/extracticon.cpp +++ b/src/modules/icolib/extracticon.cpp @@ -185,19 +185,19 @@ UINT _ExtractFromExe(HANDLE hFile, int iconIndex, int cxIconSize, int cyIconSize if ((DWORD)(pDosHeader->e_lfanew) >= fileLen) goto cleanup; pRes = _GetResourceTable(pDosHeader); - if ( !pRes) goto cleanup; - if ( !phicon) { + if (!pRes) goto cleanup; + if (!phicon) { retval = _FindResourceCount(pRes, (int)RT_GROUP_ICON); goto cleanup; } pIconDir = (NEWHEADER*)_FindResource(pDosHeader, pRes, iconIndex, (int)RT_GROUP_ICON, &cbSize); - if ( !pIconDir) goto cleanup; + if (!pIconDir) goto cleanup; if (pIconDir->Reserved || pIconDir->ResType != RES_ICON) goto cleanup; idIcon = LookupIconIdFromDirectoryEx((LPBYTE)pIconDir, TRUE, cxIconSize, cyIconSize, flags); pIcon = (LPBITMAPINFOHEADER)_FindResource(pDosHeader, pRes, -idIcon, (int)RT_ICON, &cbSize); - if ( !pIcon) goto cleanup; + if (!pIcon) goto cleanup; if (pIcon->biSize != sizeof(BITMAPINFOHEADER) && pIcon->biSize != sizeof(BITMAPCOREHEADER)) { _ASSERT(0); @@ -222,12 +222,12 @@ UINT _ExtractFromICO(LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, H return 0; // do we just want a count? - if ( !phicon) + if (!phicon) return 1; flags |= LR_LOADFROMFILE; hicon = (HICON)LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags); - if ( !hicon) + if (!hicon) return 0; *phicon = hicon; @@ -255,7 +255,7 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC return 0; // failed to read file signature - if ( !ReadFile(hFile, &magic, sizeof(magic), &read, NULL) || (read != sizeof(magic))) { + if (!ReadFile(hFile, &magic, sizeof(magic), &read, NULL) || (read != sizeof(magic))) { CloseHandle(hFile); return 0; } diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index e5a21e7a56..139a369eb2 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -115,7 +115,7 @@ IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath) { TCHAR fileFull[ MAX_PATH ]; - if ( !file) + if (!file) return NULL; if (isPath) @@ -185,7 +185,7 @@ static int InitializeBitmapInfoHeader(HBITMAP bitmap, BITMAPINFOHEADER* bi) bi->biPlanes = 1; if (bi->biClrImportant > bi->biClrUsed) bi->biClrImportant = bi->biClrUsed; - if ( !bi->biSizeImage) + if (!bi->biSizeImage) bi->biSizeImage = BytesPerScanLine(bi->biWidth, bi->biBitCount, 32) * abs(bi->biHeight); return 0; // Success } @@ -236,9 +236,9 @@ static int GetIconData(HICON icon, BYTE** data, int* size) int MonoInfoSize, ColorInfoSize; int MonoBitsSize, ColorBitsSize; - if ( !data || !size) return 1; // Failure + if (!data || !size) return 1; // Failure - if ( !GetIconInfo(icon, &iconInfo)) return 1; // Failure + if (!GetIconInfo(icon, &iconInfo)) return 1; // Failure if (InternalGetDIBSizes(iconInfo.hbmMask, &MonoInfoSize, &MonoBitsSize) || InternalGetDIBSizes(iconInfo.hbmColor, &ColorInfoSize, &ColorBitsSize)) { @@ -311,8 +311,8 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item) { if (item && item->icon_ref_count) { item->icon_ref_count--; - if ( !item->icon_ref_count) { - if ( !item->icon_size) + if (!item->icon_ref_count) { + if (!item->icon_size) if (GetIconData(item->icon, &item->icon_data, &item->icon_size)) item->icon_size = 0; // Failure SafeDestroyIcon(&item->icon); @@ -324,7 +324,7 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item) IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon) { - if ( !file) + if (!file) return NULL; IconSourceFile* r_file = IconSourceFile_Get(file, true); @@ -349,7 +349,7 @@ IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int c IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyIcon) { - if ( !path) + if (!path) return NULL; TCHAR file[ MAX_PATH ]; @@ -357,7 +357,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI TCHAR *comma = _tcsrchr(file, ','); int n; - if ( !comma) + if (!comma) n = 0; else { n = _ttoi(comma+1); @@ -393,7 +393,7 @@ int IconSourceItem_Release(IconSourceItem** pitem) if (pitem && *pitem && (*pitem)->ref_count) { IconSourceItem* item = *pitem; item->ref_count--; - if ( !item->ref_count) { + if (!item->ref_count) { int indx; if ((indx = iconSourceList.getIndex(item)) != -1) { IconSourceFile_Release(&item->file); @@ -414,7 +414,7 @@ int IconSourceItem_Release(IconSourceItem** pitem) static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new) { - if ( !sectionName) + if (!sectionName) return NULL; int indx; @@ -436,7 +436,7 @@ static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new) static void IcoLib_RemoveSection(SectionItem* section) { - if ( !section) + if (!section) return; int indx; @@ -480,14 +480,14 @@ IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big) static void IcoLib_FreeIcon(IcolibItem* icon) { - if ( !icon) return; + if (!icon) return; SAFE_FREE((void**)&icon->name); SAFE_FREE((void**)&icon->description); SAFE_FREE((void**)&icon->default_file); SAFE_FREE((void**)&icon->temp_file); if (icon->section) { - if ( !--icon->section->ref_count) + if (!--icon->section->ref_count) IcoLib_RemoveSection(icon->section); icon->section = NULL; } @@ -606,7 +606,7 @@ static INT_PTR IcoLib_RemoveIcon(WPARAM wParam, LPARAM lParam) void KillModuleIcons(int hLangpack) { - if ( !bModuleInitialized) + if (!bModuleInitialized) return; mir_cslock lck(csIconList); @@ -634,7 +634,7 @@ HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big) hIcon = IconSourceItem_GetIcon(item->source_small); } - if ( !hIcon && item->default_file) { + if (!hIcon && item->default_file) { int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON); int cy = item->cy ? item->cy : GetSystemMetrics(big ? SM_CYICON : SM_CYSMICON); IconSourceItem* def_icon = GetIconSourceItem(item->default_file, item->default_indx, cx, cy); @@ -679,7 +679,7 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) big = big && !item->cx; IconSourceItem* &source = big ? item->source_big : item->source_small; - if ( !source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) { + if (!source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) { TCHAR tszFullPath[MAX_PATH]; PathToAbsoluteT(dbv.ptszVal, tszFullPath); int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON); @@ -691,10 +691,10 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) if (source) hIcon = IconSourceItem_GetIcon(source); - if ( !hIcon) + if (!hIcon) hIcon = IconItem_GetDefaultIcon(item, big); - if ( !hIcon) + if (!hIcon) return hIconBlank; return hIcon; @@ -711,7 +711,7 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) HICON IcoLib_GetIcon(const char* pszIconName, bool big) { - if ( !pszIconName) + if (!pszIconName) return hIconBlank; mir_cslock lck(csIconList); @@ -725,7 +725,7 @@ HICON IcoLib_GetIcon(const char* pszIconName, bool big) HANDLE IcoLib_GetIconHandle(const char* pszIconName) { - if ( !pszIconName) + if (!pszIconName) return NULL; mir_cslock lck(csIconList); @@ -860,7 +860,7 @@ void UnloadIcoLibModule(void) { int i; - if ( !bModuleInitialized) return; + if (!bModuleInitialized) return; DestroyHookableEvent(hIconsChangedEvent); DestroyHookableEvent(hIcons2ChangedEvent); diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index a761d7854c..e61a8783d8 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -46,12 +46,12 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) int n; HICON hIcon; - if ( !path) + if (!path) return (HICON)NULL; lstrcpyn(file, path, SIZEOF(file)); comma = _tcsrchr(file, ','); - if ( !comma) + if (!comma) n = 0; else { n = _ttoi(comma+1); @@ -78,7 +78,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) if (szIconName) item = IcoLib_FindIcon(szIconName); - if ( !item && hIcon) // find by HICON + if (!item && hIcon) // find by HICON item = IcoLib_FindHIcon(hIcon, big); int res = 1; @@ -103,7 +103,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) { HICON hIcon = NULL; - if ( !item->temp_reset) { + if (!item->temp_reset) { HICON hRefIcon = IconItem_GetIcon(item, false); hIcon = CopyIcon(hRefIcon); if (item->source_small && item->source_small->icon == hRefIcon) @@ -119,7 +119,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) } } - if ( !hIcon && item->default_file) { + if (!hIcon && item->default_file) { IconSourceItem_Release(&item->default_icon); item->default_icon = GetIconSourceItem(item->default_file, item->default_indx, item->cx, item->cy); if (item->default_icon) { @@ -132,7 +132,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) } } - if ( !hIcon) + if (!hIcon) return CopyIcon(hIconBlank); } return hIcon; @@ -197,7 +197,7 @@ static void UndoChanges(int iconIndx, int cmd) { IcolibItem *item = iconList[ iconIndx ]; - if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE) + if (!item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE) item->temp_reset = FALSE; else { SAFE_FREE((void**)&item->temp_file); @@ -286,7 +286,7 @@ static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll) ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT; ofn.nMaxFile = MAX_PATH*2; - if ( !GetOpenFileName(&ofn)) + if (!GetOpenFileName(&ofn)) return NULL; return mir_tstrdup(file); @@ -343,7 +343,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR else tvi.hItem = TreeView_GetRoot(hwndTree); - if ( !name) + if (!name) return tvi.hItem; tvi.mask = TVIF_TEXT; @@ -354,7 +354,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR { TreeView_GetItem(hwndTree, &tvi); - if ( !lstrcmp(tvi.pszText, name)) + if (!lstrcmp(tvi.pszText, name)) return tvi.hItem; tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); @@ -470,7 +470,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { TCHAR str[MAX_PATH], *file; GetDlgItemText(hwndDlg, IDC_ICONSET, str, SIZEOF(str)); - if ( !(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE))) + if (!(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE))) break; SetDlgItemText(hwndDlg, IDC_ICONSET, file); SAFE_FREE((void**)&file); @@ -526,7 +526,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } } - if ( !onItem && dropHiLite != -1) { + if (!onItem && dropHiLite != -1) { ImageList_DragLeave(hwndDragOver); ListView_SetItemState(hPPreview, dropHiLite, 0, LVIS_DROPHILITED); UpdateWindow(hPPreview); @@ -584,7 +584,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_SIZE: // make the dlg resizeable - if ( !IsIconic(hwndDlg)) { + if (!IsIconic(hwndDlg)) { UTILRESIZEDIALOG urd = {0}; urd.cbSize = sizeof(urd); urd.hInstance = hInst; @@ -697,7 +697,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR itemName[1024]; HTREEITEM hSection; - if ( !hwndTree) break; + if (!hwndTree) break; TreeView_SelectItem(hwndTree, NULL); TreeView_DeleteAllItems(hwndTree); @@ -722,8 +722,8 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM pItemName = TranslateTS(pItemName); hItem = FindNamedTreeItemAt(hwndTree, hSection, pItemName); - if ( !sectionName || !hItem) { - if ( !hItem) { + if (!sectionName || !hItem) { + if (!hItem) { TVINSERTSTRUCT tvis = {0}; TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem)); treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE); @@ -822,7 +822,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { mir_cslock lck(csIconList); hIcon = iconList[lvi.lParam]->temp_icon; - if ( !hIcon) + if (!hIcon) hIcon = IconItem_GetIcon_Preview(iconList[lvi.lParam]); } diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index b797b1f9c5..3b63ba8b8c 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -180,7 +180,7 @@ static void SetAllContactIcons(HWND hwndList) } else proto1Caps = proto4Caps = 0; InitialiseItem(hwndList, hContact, hItem, proto1Caps, proto4Caps); - if ( !db_get_b(hContact, "CList", "Hidden", 0)) + if (!db_get_b(hContact, "CList", "Hidden", 0)) SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1); } } diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index dff3084348..47e3b13763 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -180,7 +180,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) thisUser->settings.proxyType = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyType", PROXYTYPE_SOCKS5); if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType == PROXYTYPE_HTTPS) thisUser->settings.proxyType = PROXYTYPE_HTTP; - if ( !(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) { + if (!(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) { thisUser->settings.useProxy = 0; thisUser->settings.proxyType = PROXYTYPE_SOCKS5; } @@ -236,7 +236,7 @@ void NetlibDoClose(NetlibConnection *nlc, bool noShutdown) NetlibLogf(nlc->nlu, "(%p:%u) Connection closed internal", nlc, nlc->s); if (nlc->hSsl) { - if ( !noShutdown) si.shutdown(nlc->hSsl); + if (!noShutdown) si.shutdown(nlc->hSsl); si.sfree(nlc->hSsl); nlc->hSsl = NULL; } diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp index 44cfde41cd..27054b3e8c 100644 --- a/src/modules/netlib/netlibautoproxy.cpp +++ b/src/modules/netlib/netlibautoproxy.cpp @@ -238,9 +238,9 @@ static void NetlibInitAutoProxy(void) { if (bAutoProxyInit) return; - if ( !hModJS) + if (!hModJS) { - if ( !(hModJS = LoadLibraryA("jsproxy.dll"))) + if (!(hModJS = LoadLibraryA("jsproxy.dll"))) return; pInternetInitializeAutoProxyDll = (pfnInternetInitializeAutoProxyDll) @@ -273,7 +273,7 @@ static void NetlibIeProxyThread(void *arg) IeProxyParam *param = (IeProxyParam*)arg; param->szProxy = NULL; - if ( !bAutoProxyInit) { + if (!bAutoProxyInit) { WaitForSingleObject(hIeProxyMutex, INFINITE); NetlibInitAutoProxy(); ReleaseMutex(hIeProxyMutex); diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index 2c2ebf1530..382a00ee37 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -78,7 +78,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn) ++portnum; if (s == INVALID_SOCKET) continue; - if ( !before && portnum <= *portn) continue; + if (!before && portnum <= *portn) continue; if (before && portnum >= *portn) return false; @@ -210,7 +210,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) they better have given wPort == 0, let's hope so */ if (nlu->settings.specifyIncomingPorts && nlu->settings.szIncomingPorts && nlb->wPort == 0) { - if ( !BindSocketToPort(nlu->settings.szIncomingPorts, nlbp->s, nlbp->s6, &nlu->outportnum)) + if (!BindSocketToPort(nlu->settings.szIncomingPorts, nlbp->s, nlbp->s6, &nlu->outportnum)) { NetlibLogf(nlu, "Netlib bind: Not enough ports for incoming connections specified"); SetLastError(WSAEADDRINUSE); @@ -232,7 +232,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) { SOCKADDR_IN sin = {0}; int len = sizeof(sin); - if ( !getsockname(nlbp->s, (PSOCKADDR)&sin, &len)) + if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len)) sin6.sin6_port = sin.sin_port; foundPort = 1; } @@ -240,7 +240,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (bind(nlbp->s6, (PSOCKADDR)&sin6, sizeof(sin6)) == 0) foundPort = 1; } - if ( !foundPort) + if (!foundPort) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError()); closesocket(nlbp->s); @@ -270,12 +270,12 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) { SOCKADDR_INET_M sin = {0}; int len = sizeof(sin); - if ( !getsockname(nlbp->s, (PSOCKADDR)&sin, &len)) + if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len)) { nlb->wPort = ntohs(sin.Ipv4.sin_port); nlb->dwInternalIP = ntohl(sin.Ipv4.sin_addr.S_un.S_addr); } - else if ( !getsockname(nlbp->s6, (PSOCKADDR)&sin, &len)) + else if (!getsockname(nlbp->s6, (PSOCKADDR)&sin, &len)) nlb->wPort = ntohs(sin.Ipv6.sin6_port); else { diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index d1d231d7a3..87e1278f86 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -109,7 +109,7 @@ static int RecvWithTimeoutTime(NetlibConnection *nlc, unsigned dwTimeoutTime, ch { DWORD dwTimeNow; - if ( !si.pending(nlc->hSsl)) { + if (!si.pending(nlc->hSsl)) { while ((dwTimeNow = GetTickCount()) < dwTimeoutTime) { unsigned dwDeltaTime = min(dwTimeoutTime - dwTimeNow, 1000); int res = WaitUntilReadable(nlc->s, dwDeltaTime); @@ -159,9 +159,9 @@ static char* NetlibHttpFindAuthHeader(NETLIBHTTPREQUEST *nlhrReply, const char * } } - if (szNegoHdr && ( !szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr; - if (szNtlmHdr && ( !szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr; - if ( !szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr; + if (szNegoHdr && (!szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr; + if (szNtlmHdr && (!szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr; + if (!szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr; return NULL; } @@ -204,7 +204,7 @@ static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUse bool httpProxy = !(nloc.flags & NLOCF_SSL) && nlc->proxyType == PROXYTYPE_HTTP; bool sameHost = lstrcmpA(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort; - if ( !httpProxy && !sameHost) { + if (!httpProxy && !sameHost) { NetlibDoClose(nlc); mir_free((char*)nlc->nloc.szHost); @@ -232,7 +232,7 @@ struct HttpSecurityContext void Destroy(void) { - if ( !m_hNtlmSecurity) return; + if (!m_hNtlmSecurity) return; NetlibDestroySecurityProvider(m_hNtlmSecurity); m_hNtlmSecurity = NULL; @@ -253,7 +253,7 @@ struct HttpSecurityContext if (m_hNtlmSecurity) { bool newAuth = !m_szProvider || !szProvider || _stricmp(m_szProvider, szProvider); - newAuth = newAuth || (m_szHost != szHost && ( !m_szHost || !szHost || _stricmp(m_szHost, szHost))); + newAuth = newAuth || (m_szHost != szHost && (!m_szHost || !szHost || _stricmp(m_szHost, szHost))); if (newAuth) Destroy(); } @@ -287,7 +287,7 @@ struct HttpSecurityContext szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity, szChallenge, szLogin, szPassw, true, complete); - if ( !szAuthHdr) { + if (!szAuthHdr) { NetlibLogf(NULL, "Security login %s failed, user: %S pssw: %S", szProvider, szLogin ? szLogin : _T("(no user)"), szPassw ? _T("(exist)") : _T("(no psw)")); } @@ -429,8 +429,8 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR; } - if ( !nlc->usingHttpGateway) - if ( !NetlibEnterNestedCS(nlc, NLNCS_SEND)) + if (!nlc->usingHttpGateway) + if (!NetlibEnterNestedCS(nlc, NLNCS_SEND)) return SOCKET_ERROR; const char *pszFullUrl = nlhr->szUrl; @@ -439,12 +439,12 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) unsigned complete = false; int count = 11; while (--count) { - if ( !NetlibReconnect(nlc)) { + if (!NetlibReconnect(nlc)) { bytesSent = SOCKET_ERROR; break; } - if ( !pszUrl) { + if (!pszUrl) { pszUrl = pszFullUrl; if (nlhr->flags & (NLHRF_SMARTREMOVEHOST | NLHRF_REMOVEHOST | NLHRF_GENERATEHOST)) { bool usingProxy = nlc->proxyType == PROXYTYPE_HTTP && !(nlhr->flags & NLHRF_SSL); @@ -503,11 +503,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) doneHostHeader = doneContentLengthHeader = doneProxyAuthHeader = doneAuthHeader = 0; for (i=0; i < nlhr->headersCount; i++) { NETLIBHTTPHEADER &p = nlhr->headers[i]; - if ( !lstrcmpiA(p.szName, "Host")) doneHostHeader = 1; - else if ( !lstrcmpiA(p.szName, "Content-Length")) doneContentLengthHeader = 1; - else if ( !lstrcmpiA(p.szName, "Proxy-Authorization")) doneProxyAuthHeader = 1; - else if ( !lstrcmpiA(p.szName, "Authorization")) doneAuthHeader = 1; - else if ( !lstrcmpiA(p.szName, "Connection")) continue; + if (!lstrcmpiA(p.szName, "Host")) doneHostHeader = 1; + else if (!lstrcmpiA(p.szName, "Content-Length")) doneContentLengthHeader = 1; + else if (!lstrcmpiA(p.szName, "Proxy-Authorization")) doneProxyAuthHeader = 1; + else if (!lstrcmpiA(p.szName, "Authorization")) doneAuthHeader = 1; + else if (!lstrcmpiA(p.szName, "Connection")) continue; if (p.szValue == NULL) continue; AppendToCharBuffer(&httpRequest, "%s: %s\r\n", p.szName, p.szValue); } @@ -535,7 +535,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) DWORD fflags = MSG_PEEK | MSG_NODUMP | ((nlhr->flags & NLHRF_NOPROXY) ? MSG_RAW : 0); DWORD dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout; - if ( !HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &nlhr->resultCode, NULL, NULL)) { + if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &nlhr->resultCode, NULL, NULL)) { NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", GetLastError(), count); DWORD err = GetLastError(); if (err == ERROR_TIMEOUT || err == ERROR_BAD_FORMAT || err == ERROR_BUFFER_OVERFLOW || lastFirstLineFail || nlc->termRequested || nlhr->requestType == REQUEST_CONNECT) { @@ -613,11 +613,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(pszAuthHdr); pszAuthHdr = NULL; if (nlhrReply) { char *szAuthStr = NULL; - if ( !complete) { + if (!complete) { szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate", httpSecurity.m_szProvider); if (szAuthStr) { char *szChallenge = strchr(szAuthStr, ' '); - if ( !szChallenge || !*lrtrimp(szChallenge)) + if (!szChallenge || !*lrtrimp(szChallenge)) complete = true; } } @@ -647,11 +647,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(pszProxyAuthHdr); pszProxyAuthHdr = NULL; if (nlhrReply) { char *szAuthStr = NULL; - if ( !complete) { + if (!complete) { szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate", httpSecurity.m_szProvider); if (szAuthStr) { char *szChallenge = strchr(szAuthStr, ' '); - if ( !szChallenge || !*lrtrimp(szChallenge + 1)) + if (!szChallenge || !*lrtrimp(szChallenge + 1)) complete = true; } } @@ -695,7 +695,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(szHost); mir_free(szNewUrl); - if ( !nlc->usingHttpGateway) + if (!nlc->usingHttpGateway) NetlibLeaveNestedCS(&nlc->ncsSend); return bytesSent; @@ -727,7 +727,7 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam) INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) { NetlibConnection *nlc = (struct NetlibConnection*)wParam; - if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV)) + if (!NetlibEnterNestedCS(nlc, NLNCS_RECV)) return 0; char *peol, *pbuffer; @@ -740,7 +740,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) nlhr->requestType = REQUEST_RESPONSE; int firstLineLength = 0; - if ( !HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) { + if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) { NetlibLeaveNestedCS(&nlc->ncsRecv); NetlibHttpFreeRequestStruct(0, (LPARAM)nlhr); return 0; @@ -857,12 +857,12 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) bool doneUserAgentHeader = NetlibHttpFindHeader(nlhr, "User-Agent") != NULL; bool doneAcceptEncoding = NetlibHttpFindHeader(nlhr, "Accept-Encoding") != NULL; - if ( !doneUserAgentHeader || !doneAcceptEncoding) { + if (!doneUserAgentHeader || !doneAcceptEncoding) { nlhrSend.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER) * (nlhrSend.headersCount + 2)); memcpy(nlhrSend.headers, nlhr->headers, sizeof(NETLIBHTTPHEADER) * nlhr->headersCount); } - if ( !doneUserAgentHeader) { + if (!doneUserAgentHeader) { nlhrSend.headers[nlhrSend.headersCount].szName = "User-Agent"; nlhrSend.headers[nlhrSend.headersCount].szValue = szUserAgent; ++nlhrSend.headersCount; @@ -876,18 +876,18 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) } else mir_snprintf(szUserAgent, SIZEOF(szUserAgent), "Miranda/%s", szMirandaVer); } - if ( !doneAcceptEncoding) { + if (!doneAcceptEncoding) { nlhrSend.headers[nlhrSend.headersCount].szName = "Accept-Encoding"; nlhrSend.headers[nlhrSend.headersCount].szValue = "deflate, gzip"; ++nlhrSend.headersCount; } if (NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) == SOCKET_ERROR) { - if ( !doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers); + if (!doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers); nlhr->resultCode = nlhrSend.resultCode; NetlibCloseHandle((WPARAM)nlc, 0); return 0; } - if ( !doneUserAgentHeader || !doneAcceptEncoding) + if (!doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers); dflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT:0) | @@ -1029,10 +1029,10 @@ next: for (i=0; iheadersCount; i++) { NETLIBHTTPHEADER &p = nlhrReply->headers[i]; - if ( !lstrcmpiA(p.szName, "Content-Length")) + if (!lstrcmpiA(p.szName, "Content-Length")) dataLen = atoi(p.szValue); - if ( !lstrcmpiA(p.szName, "Content-Encoding")) { + if (!lstrcmpiA(p.szName, "Content-Encoding")) { cenc = i; if (strstr(p.szValue, "gzip")) cenctype = 1; @@ -1040,10 +1040,10 @@ next: cenctype = 2; } - if ( !lstrcmpiA(p.szName, "Connection")) + if (!lstrcmpiA(p.szName, "Connection")) close = !lstrcmpiA(p.szValue, "close"); - if ( !lstrcmpiA(p.szName, "Transfer-Encoding") && + if (!lstrcmpiA(p.szName, "Transfer-Encoding") && !lstrcmpiA(p.szValue, "chunked")) { chunked = true; @@ -1052,7 +1052,7 @@ next: } } - if (nlhrReply->resultCode >= 200 && (dataLen > 0 || ( !isConnect && dataLen < 0))) { + if (nlhrReply->resultCode >= 200 && (dataLen > 0 || (!isConnect && dataLen < 0))) { int recvResult, chunksz = -1; int dataBufferAlloced; @@ -1161,7 +1161,7 @@ next: if (close && (nlc->proxyType != PROXYTYPE_HTTP || nlc->nloc.flags & NLOCF_SSL) && - ( !isConnect || nlhrReply->resultCode != 200)) + (!isConnect || nlhrReply->resultCode != 200)) NetlibDoClose(nlc); return nlhrReply; diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp index aebf65ee55..5980a1f5b1 100644 --- a/src/modules/netlib/netlibhttpproxy.cpp +++ b/src/modules/netlib/netlibhttpproxy.cpp @@ -42,7 +42,7 @@ static int HttpGatewayReadSetResult(NetlibConnection *nlc, char *buf, int num, i int rbytes = nlc->dataBufferLen - bytes; memcpy(buf, nlc->dataBuffer, bytes); - if ( !peek) + if (!peek) { memmove(nlc->dataBuffer, nlc->dataBuffer + bytes, rbytes); nlc->dataBufferLen = rbytes; @@ -121,13 +121,13 @@ static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, co bool sameHost = lstrcmpA(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort; - if ( !sameHost) + if (!sameHost) { NetlibDoClose(nlc); mir_free((char*)nlc->nloc.szHost); nlc->nloc = nloc; - if ( !NetlibDoConnect(nlc)) + if (!NetlibDoConnect(nlc)) return false; } else @@ -188,7 +188,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i nlcSend.wProxyPort = nlc->wProxyPort; nlcSend.proxyType = nlc->proxyType; - if ( !NetlibReconnect(&nlcSend)) return false; + if (!NetlibReconnect(&nlcSend)) return false; nlc->s2 = nlcSend.s; nlcSend.hOkToCloseEvent = CreateEvent(NULL, TRUE, TRUE, NULL); @@ -272,7 +272,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) { bool peek = (flags & MSG_PEEK) != 0; - if (nlc->dataBufferLen != 0 && ( !peek || nlc->dataBufferLen >= len)) + if (nlc->dataBufferLen != 0 && (!peek || nlc->dataBufferLen >= len)) { return HttpGatewayReadSetResult(nlc, buf, len, peek); } @@ -304,7 +304,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) int numPackets = 0; if (nlc->nlhpi.szHttpGetUrl) { - if ( !NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0)) + if (!NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0)) { if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested) break; @@ -315,7 +315,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) } else { - if ( !NetlibHttpGatewayStdPost(nlc, numPackets)) + if (!NetlibHttpGatewayStdPost(nlc, numPackets)) { if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested) break; @@ -422,7 +422,7 @@ int NetlibInitHttpConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENC return 0; } } - if ( !nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply)) + if (!nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply)) { NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply); return 0; diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index b09a6bdcb1..21c0bf6231 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -350,10 +350,10 @@ static INT_PTR NetlibLogW(WPARAM wParam, LPARAM lParam) void NetlibLogf(NetlibUser* nlu, const char *fmt, ...) { if (nlu == NULL) { - if ( !logOptions.toLog) + if (!logOptions.toLog) return; } - else if ( !nlu->toLog) + else if (!nlu->toLog) return; va_list va; diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 1f2530f8f4..ba0269065c 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -113,7 +113,7 @@ bool RecvUntilTimeout(NetlibConnection *nlc, char *buf, int len, int flags, DWOR static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc) { // http://www.socks.nec.com/protocol/socks4.protocol and http://www.socks.nec.com/protocol/socks4a.protocol - if ( !nloc->szHost || !nloc->szHost[0]) return 0; + if (!nloc->szHost || !nloc->szHost[0]) return 0; size_t nHostLen = strlen(nloc->szHost) + 1; size_t nUserLen = nlu->settings.szProxyAuthUser ? strlen(nlu->settings.szProxyAuthUser) + 1 : 1; @@ -130,7 +130,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE //if cannot resolve host, try resolving through proxy (requires SOCKS4a) DWORD ip = DnsLookup(nlu, nloc->szHost); *(PDWORD)&pInit[4] = ip ? ip : 0x01000000; - if ( !ip) { + if (!ip) { memcpy(&pInit[len], nloc->szHost, nHostLen); len += nHostLen; } @@ -141,7 +141,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE } char reply[8]; - if ( !RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + if (!RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -171,7 +171,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE } //confirmation of auth method - if ( !RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -200,7 +200,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE } mir_free(pAuthBuf); - if ( !RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -248,7 +248,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE } mir_free(pInit); - if ( !RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + if (!RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -289,7 +289,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE NetlibLogf(nlu, "%s %d: %s() unknown address type (%u)", __FILE__, __LINE__, "NetlibInitSocks5Connection", (int)buf[3]); return 0; } - if ( !RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + if (!RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -390,7 +390,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) sin.sin_family = AF_INET; if (nlc->proxyType) { - if ( !nlc->szProxyServer) return false; + if (!nlc->szProxyServer) return false; if (nloc) NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort); @@ -401,7 +401,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) he = gethostbyname(nlc->szProxyServer); } else { - if ( !nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false; + if (!nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false; NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort); sin.sin_port = htons(nloc->wPort); @@ -425,7 +425,7 @@ retry: return false; if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) { - if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum)) + if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum)) NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified"); } @@ -541,7 +541,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) } if (nlc->proxyType) { - if ( !nlc->szProxyServer) + if (!nlc->szProxyServer) return false; if (nloc) @@ -556,7 +556,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) } } else { - if ( !nloc || !nloc->szHost) + if (!nloc || !nloc->szHost) return false; NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort); @@ -583,7 +583,7 @@ retry: if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) { SOCKET s = ai->ai_family == AF_INET ? nlc->s : INVALID_SOCKET; SOCKET s6 = ai->ai_family == AF_INET6 ? nlc->s : INVALID_SOCKET; - if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum)) + if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum)) NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified"); } @@ -680,7 +680,7 @@ static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NE nlc->proxyAuthNeeded = false; nlc->proxyType = 0; mir_free(nlc->szProxyServer); nlc->szProxyServer = NULL; - if ( !my_connect(nlc, nloc)) { + if (!my_connect(nlc, nloc)) { NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError()); return false; } @@ -727,41 +727,41 @@ bool NetlibDoConnect(NetlibConnection *nlc) } if (usingProxy && !((nloc->flags & (NLOCF_HTTP | NLOCF_SSL)) == NLOCF_HTTP && (nlc->proxyType == PROXYTYPE_HTTP || nlc->proxyType == PROXYTYPE_HTTPS))) { - if ( !WaitUntilWritable(nlc->s, 30000)) + if (!WaitUntilWritable(nlc->s, 30000)) return false; switch (nlc->proxyType) { case PROXYTYPE_SOCKS4: - if ( !NetlibInitSocks4Connection(nlc, nlu, nloc)) + if (!NetlibInitSocks4Connection(nlc, nlu, nloc)) return false; break; case PROXYTYPE_SOCKS5: - if ( !NetlibInitSocks5Connection(nlc, nlu, nloc)) + if (!NetlibInitSocks5Connection(nlc, nlu, nloc)) return false; break; case PROXYTYPE_HTTPS: nlc->proxyAuthNeeded = true; - if ( !NetlibInitHttpsConnection(nlc, nlu, nloc)) { + if (!NetlibInitHttpsConnection(nlc, nlu, nloc)) { usingProxy = false; - if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc)) + if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc)) return false; } break; case PROXYTYPE_HTTP: nlc->proxyAuthNeeded = true; - if ( !(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL) { + if (!(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL) { //NLOCF_HTTP not specified and no HTTP gateway available: try HTTPS - if ( !NetlibInitHttpsConnection(nlc, nlu, nloc)) { + if (!NetlibInitHttpsConnection(nlc, nlu, nloc)) { //can't do HTTPS: try direct usingProxy = false; - if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc)) + if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc)) return false; } } - else if ( !NetlibInitHttpConnection(nlc, nlu, nloc)) + else if (!NetlibInitHttpConnection(nlc, nlu, nloc)) return false; break; @@ -773,7 +773,7 @@ bool NetlibDoConnect(NetlibConnection *nlc) } } else if (nloc->flags & NLOCF_HTTPGATEWAY) { - if ( !NetlibInitHttpConnection(nlc, nlu, nloc)) return false; + if (!NetlibInitHttpConnection(nlc, nlu, nloc)) return false; nlc->usingDirectHttpGateway = true; } @@ -804,11 +804,11 @@ bool NetlibReconnect(NetlibConnection *nlc) break; } - if ( !opened) + if (!opened) NetlibDoClose(nlc, true); } - if ( !opened) { + if (!opened) { if (Miranda_Terminated()) return false; @@ -850,7 +850,7 @@ INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam) NetlibInitializeNestedCS(&nlc->ncsSend); NetlibInitializeNestedCS(&nlc->ncsRecv); - if ( !NetlibDoConnect(nlc)) { + if (!NetlibDoConnect(nlc)) { FreePartiallyInitedConnection(nlc); return 0; } diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 208921475d..5d54ef3cde 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -166,7 +166,7 @@ static void ChangeSettingIntByCheckbox(HWND hwndDlg, UINT ctrlId, int iUser, int CheckDlgButton(hwndDlg, ctrlId, newValue ? BST_CHECKED : BST_UNCHECKED); if (iUser == -1) { for (int i=0; iflags & NUF_NOOPTIONS)) + if (!(tempSettings[i]->flags & NUF_NOOPTIONS)) *(int*)(((PBYTE)&tempSettings[i]->settings) + memberOffset) = newValue; } else *(int*)(((PBYTE)&tempSettings[iUser]->settings) + memberOffset) = newValue; @@ -180,7 +180,7 @@ static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int GetDlgItemTextA(hwndDlg, ctrlId, szNewValue, newValueLen+1); if (iUser == -1) { for (int i=0; iflags & NUF_NOOPTIONS)) { + if (!(tempSettings[i]->flags & NUF_NOOPTIONS)) { char **ppszNew = (char**)(((PBYTE)&tempSettings[i]->settings)+memberOffset); mir_free(*ppszNew); *ppszNew = mir_strdup(szNewValue); @@ -306,7 +306,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS4, settings.proxyType); AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS5, settings.proxyType); if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType); - if ( !(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType); + if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType); if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY) || !(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_IE, settings.proxyType); SetDlgItemTextA(hwndDlg, IDC_PROXYHOST, settings.szProxyServer?settings.szProxyServer:""); @@ -344,7 +344,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE); if (selectedProxyType == 0) { for (int i=0; i < tempSettings.getCount(); i++) { - if ( !tempSettings[i]->settings.useProxy || + if (!tempSettings[i]->settings.useProxy || tempSettings[i]->flags & NUF_NOOPTIONS || !(tempSettings[i]->flags & NUF_OUTGOING)) continue; @@ -444,7 +444,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int newValue = GetDlgItemInt(hwndDlg, LOWORD(wParam), NULL, FALSE); if (iUser == -1) { for (int i=0; i < tempSettings.getCount(); i++) - if ( !(tempSettings[i]->flags & NUF_NOOPTIONS)) + if (!(tempSettings[i]->flags & NUF_NOOPTIONS)) tempSettings[i]->settings.wProxyPort = newValue; } else tempSettings[iUser]->settings.wProxyPort = newValue; @@ -503,7 +503,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) { mir_cslock lck(csNetlibUser); for (int i=0; i < netlibUser.getCount(); i++) - if ( !(netlibUser[i]->user.flags & NUF_NOOPTIONS)) + if (!(netlibUser[i]->user.flags & NUF_NOOPTIONS)) ++optionsCount; } diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp index 99a6dcb7c1..9ba78d299a 100644 --- a/src/modules/netlib/netlibpktrecver.cpp +++ b/src/modules/netlib/netlibpktrecver.cpp @@ -75,7 +75,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam) nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed; } if (nlprParam->dwTimeout != INFINITE) { - if ( !si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) { + if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) { *nlprParam = nlpr->packetRecver; return SOCKET_ERROR; } diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 5dcb11d5ab..404453c2d4 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -183,7 +183,7 @@ void NetlibDestroySecurityProvider(HANDLE hSecurity) char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chlsz) { - if ( !szChallenge || !szChallenge[0]) return NULL; + if (!szChallenge || !szChallenge[0]) return NULL; NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity; unsigned char inDataBuffer[1024]; @@ -283,7 +283,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, if (login != NULL && login[0] != '\0' && !hNtlm->hasDomain) { NtlmType2packet* pkt = (NtlmType2packet*)token; - if ( !strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2) + if (!strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2) { wchar_t* domainName = (wchar_t*)&token[pkt->targetName.offset]; @@ -393,7 +393,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, szOutputToken = mir_base64_encode((PBYTE)outputSecurityToken.pvBuffer, outputSecurityToken.cbBuffer); } else { - if ( !login || !psw) return NULL; + if (!login || !psw) return NULL; char *szLogin = mir_t2a(login); char *szPassw = mir_t2a(psw); diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index 1bb6a2b936..e3afd442cd 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -39,12 +39,12 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR; } - if ( !NetlibEnterNestedCS(nlc, NLNCS_SEND)) + if (!NetlibEnterNestedCS(nlc, NLNCS_SEND)) return SOCKET_ERROR; if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW)) { - if ( !(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend) + if (!(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend) { NetlibDumpData(nlc, (PBYTE)nlb->buf, nlb->len, 1, nlb->flags); result = nlc->nlu->user.pfnHttpGatewayWrapSend((HANDLE)nlc, (PBYTE)nlb->buf, nlb->len, nlb->flags | MSG_NOHTTPGATEWAYWRAP, NetlibSend); @@ -77,7 +77,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR; } - if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV)) + if (!NetlibEnterNestedCS(nlc, NLNCS_RECV)) return SOCKET_ERROR; if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW)) @@ -139,7 +139,7 @@ INT_PTR NetlibSelect(WPARAM, LPARAM lParam) int pending = 0; fd_set readfd, writefd, exceptfd; WaitForSingleObject(hConnectionHeaderMutex, INFINITE); - if ( !ConnectionListToSocketList(nls->hReadConns, &readfd, pending) + if (!ConnectionListToSocketList(nls->hReadConns, &readfd, pending) || !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending) || !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending)) { @@ -169,7 +169,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) int pending = 0; fd_set readfd, writefd, exceptfd; - if ( !ConnectionListToSocketList(nls->hReadConns, &readfd, pending) + if (!ConnectionListToSocketList(nls->hReadConns, &readfd, pending) || !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending) || !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending)) { @@ -216,7 +216,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr) { - if ( !str) return false; + if (!str) return false; int len = sizeof(SOCKADDR_INET_M); return !WSAStringToAddressA((char*)str, AF_INET6, NULL, (PSOCKADDR)addr, &len); @@ -226,7 +226,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) { char saddr[128]; DWORD len = sizeof(saddr); - if ( !WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len)) + if (!WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len)) return mir_strdup(saddr); if (addr->si_family == AF_INET) { @@ -242,12 +242,12 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo) { - if ( !nlc || !connInfo || connInfo->cbSize < sizeof(NETLIBCONNINFO)) return; + if (!nlc || !connInfo || connInfo->cbSize < sizeof(NETLIBCONNINFO)) return; SOCKADDR_INET_M sin = {0}; int len = sizeof(sin); - if ( !getsockname(nlc->s, (PSOCKADDR)&sin, &len)) { + if (!getsockname(nlc->s, (PSOCKADDR)&sin, &len)) { connInfo->wPort = ntohs(sin.Ipv4.sin_port); connInfo->dwIpv4 = sin.si_family == AF_INET ? htonl(sin.Ipv4.sin_addr.s_addr) : 0; @@ -281,7 +281,7 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr; if (ai->ai_family == AF_INET || (ai->ai_family == AF_INET6 && - ( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr)))) + (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr)))) ++n; } @@ -294,7 +294,7 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr; if (ai->ai_family == AF_INET || (ai->ai_family == AF_INET6 && - ( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr)))) + (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr)))) { char* szIp = NetlibAddressToString(iaddr); diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp index 7f952b3ab6..eaf961912b 100644 --- a/src/modules/netlib/netlibssl.cpp +++ b/src/modules/netlib/netlibssl.cpp @@ -147,7 +147,7 @@ static bool SSL_library_init(void) WaitForSingleObject(g_hSslMutex, INFINITE); - if ( !bSslInitDone) + if (!bSslInitDone) { g_hSchannel = LoadLibraryA("schannel.dll"); if (g_hSchannel) @@ -203,7 +203,7 @@ BOOL NetlibSslPending(SslHandle *ssl) static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertFlags) { - if ( !fnCertGetCertificateChain) + if (!fnCertGetCertificateChain) return true; static LPSTR rgszUsages[] = @@ -239,7 +239,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF ChainPara.RequestedUsage.Usage.cUsageIdentifier = SIZEOF(rgszUsages); ChainPara.RequestedUsage.Usage.rgpszUsageIdentifier = rgszUsages; - if ( !fnCertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore, + if (!fnCertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore, &ChainPara, 0, NULL, &pChainContext)) { scRet = GetLastError(); @@ -256,7 +256,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF PolicyStatus.cbSize = sizeof(PolicyStatus); - if ( !fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext, + if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext, &PolicyPara, &PolicyStatus)) { scRet = GetLastError(); @@ -566,7 +566,7 @@ SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) DWORD dwFlags = 0; - if ( !host || inet_addr(host) != INADDR_NONE) + if (!host || inet_addr(host) != INADDR_NONE) dwFlags |= 0x00001000; bool res = SSL_library_init(); @@ -574,7 +574,7 @@ SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) if (res) res = ClientConnect(ssl, host); if (res && verify) res = VerifyCertificate(ssl, host, dwFlags); - if ( !res) + if (!res) { NetlibSslFree(ssl); ssl = NULL; @@ -664,7 +664,7 @@ static int NetlibSslReadSetResult(SslHandle *ssl, char *buf, int num, int peek) int rbytes = ssl->cbRecDataBuf - bytes; memcpy(buf, ssl->pbRecDataBuf, bytes); - if ( !peek) + if (!peek) { memmove(ssl->pbRecDataBuf, ssl->pbRecDataBuf + bytes, rbytes); ssl->cbRecDataBuf = rbytes; @@ -689,7 +689,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek) if (num <= 0) return 0; - if (ssl->state != sockOpen || (ssl->cbRecDataBuf != 0 && ( !peek || ssl->cbRecDataBuf >= num))) + if (ssl->state != sockOpen || (ssl->cbRecDataBuf != 0 && (!peek || ssl->cbRecDataBuf >= num))) { return NetlibSslReadSetResult(ssl, buf, num, peek); } diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index c0364adbbb..b10278e1dd 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -236,7 +236,7 @@ static void validateSocket(void) break; } - if ( !opened) + if (!opened) closeRouterConnection(); } @@ -350,7 +350,7 @@ retrycon: NetlibLogf(NULL, "UPnP connect timeout"); break; } - else if ( !FD_ISSET(sock, &wfd)) + else if (!FD_ISSET(sock, &wfd)) { closeRouterConnection(); NetlibLogf(NULL, "UPnP connect failed"); @@ -807,7 +807,7 @@ void NetlibUPnPCleanup(void*) break; } - if ( !incoming) + if (!incoming) return; } @@ -837,10 +837,10 @@ void NetlibUPnPCleanup(void*) if (httpTransact(szCtlUrl, szData, 4096, "GetGenericPortMappingEntry", ControlAction) != 200) break; - if ( !txtParseParam(szData, "", "<", buf, sizeof(buf)) || strcmp(buf, "Miranda") != 0) + if (!txtParseParam(szData, "", "<", buf, sizeof(buf)) || strcmp(buf, "Miranda") != 0) continue; - if ( !txtParseParam(szData, "", "<", buf, sizeof(buf)) || strcmp(buf, lip) != 0) + if (!txtParseParam(szData, "", "<", buf, sizeof(buf)) || strcmp(buf, lip) != 0) continue; if (txtParseParam(szData, "", "<", buf, sizeof(buf))) diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp index fe0aba9319..2e818ec135 100644 --- a/src/modules/options/descbutton.cpp +++ b/src/modules/options/descbutton.cpp @@ -107,7 +107,7 @@ static void MDescButton_SetupColors(MDescButtonCtrl *dat) dat->clSelBorder = RGB(dat->rgbSelTop.rgbRed, dat->rgbSelTop.rgbGreen, dat->rgbSelTop.rgbBlue); dat->clHotBorder = RGB(dat->rgbHotTop.rgbRed, dat->rgbHotTop.rgbGreen, dat->rgbHotTop.rgbBlue); - if ( !dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + if (!dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); } static void MDescButton_FillRect(HDC hdc, int x, int y, int width, int height, COLORREF cl) @@ -251,7 +251,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE; case WM_MOUSEMOVE: - if ( !dat->bMouseInside) { + if (!dat->bMouseInside) { TRACKMOUSEEVENT tme = {0}; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp index ee26fde856..f3d19c8bdc 100644 --- a/src/modules/options/headerbar.cpp +++ b/src/modules/options/headerbar.cpp @@ -95,7 +95,7 @@ static void MHeaderbar_SetupColors(MHeaderbarCtrl *dat) dat->clText = GetSysColor(COLOR_WINDOWTEXT); - if ( !dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + if (!dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); } static void MHeaderbar_FillRect(HDC hdc, int x, int y, int width, int height, COLORREF cl) @@ -308,7 +308,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam RECT rcChild; GetWindowRect(hChild, &rcChild); RECT rc; IntersectRect(&rc, &rcChild, &rcWnd); - if ( !IsRectEmpty(&rc)) + if (!IsRectEmpty(&rc)) { ++itc->nControlsToRedraw; itc->controlsToRedraw = (HWND *)mir_realloc(itc->controlsToRedraw, sizeof(HWND) * itc->nControlsToRedraw); diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index 8523481fe2..d5858d7e33 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -140,7 +140,7 @@ static void MIcoTab_SetupColors(MIcoTabCtrl *dat) dat->clSelBorder = RGB(dat->rgbSelTop.rgbRed, dat->rgbSelTop.rgbGreen, dat->rgbSelTop.rgbBlue); dat->clHotBorder = RGB(dat->rgbHotTop.rgbRed, dat->rgbHotTop.rgbGreen, dat->rgbHotTop.rgbBlue); - if ( !dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + if (!dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); } static void MIcoTab_FillRect(HDC hdc, int x, int y, int width, int height, COLORREF cl) @@ -360,7 +360,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return TRUE; case WM_MOUSEMOVE: - if ( !itc->bMouseInside) { + if (!itc->bMouseInside) { TRACKMOUSEEVENT tme = {0}; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; @@ -464,7 +464,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case ITCM_SETBACKGROUND: itc->hBkgBmp = (HBITMAP)lParam; - if ( !itc->hBkgDC) + if (!itc->hBkgDC) itc->hBkgDC = CreateCompatibleDC(NULL); itc->hBkgOldBmp = (HBITMAP)SelectObject(itc->hBkgDC, itc->hBkgBmp); { @@ -478,7 +478,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case ITCM_ADDITEM: { MIcoTab* pMit = (MIcoTab *)wParam; - if ( !pMit) + if (!pMit) return FALSE; MIcoTab* pListMit = (MIcoTab *)mir_calloc(sizeof(MIcoTab)); diff --git a/src/modules/plugins/dll_sniffer.cpp b/src/modules/plugins/dll_sniffer.cpp index b3345a39c8..7e16df10aa 100644 --- a/src/modules/plugins/dll_sniffer.cpp +++ b/src/modules/plugins/dll_sniffer.cpp @@ -48,11 +48,11 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) __try { __try { - if ( !hMap ) + if (!hMap ) __leave; DWORD dwHSize = 0, filesize = GetFileSize( hFile, &dwHSize ); - if ( !filesize || filesize == INVALID_FILE_SIZE || dwHSize) + if (!filesize || filesize == INVALID_FILE_SIZE || dwHSize) __leave; if ( filesize < sizeof(IMAGE_DOS_HEADER) + sizeof(IMAGE_NT_HEADERS) ) @@ -75,7 +75,7 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) __leave; int nSections = pINTH->FileHeader.NumberOfSections; - if ( !nSections ) + if (!nSections ) __leave; INT_PTR base; @@ -103,7 +103,7 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) BYTE* pImage = ptr + pIDH->e_lfanew + pINTH->FileHeader.SizeOfOptionalHeader + sizeof(IMAGE_NT_HEADERS) - sizeof(IMAGE_OPTIONAL_HEADER); IMAGE_SECTION_HEADER *pExp = getSectionByRVA((IMAGE_SECTION_HEADER *)pImage, nSections, pIDD); - if ( !pExp) __leave; + if (!pExp) __leave; BYTE *pSecStart = ptr + pExp->PointerToRawData - pExp->VirtualAddress; IMAGE_EXPORT_DIRECTORY *pED = (PIMAGE_EXPORT_DIRECTORY)&pSecStart[expvaddr]; @@ -115,18 +115,18 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) bool bHasLoad = false, bHasUnload = false, bHasInfo = false, bHasMuuids = false; for (size_t i=0; i < pED->NumberOfNames; i++, ptrRVA++, ptrOrdRVA++) { char *szName = (char*)&pSecStart[*ptrRVA]; - if ( !lstrcmpA(szName, "Load")) + if (!lstrcmpA(szName, "Load")) bHasLoad = true; - if ( !lstrcmpA(szName, "MirandaPluginInfoEx")) + if (!lstrcmpA(szName, "MirandaPluginInfoEx")) bHasInfo = true; - else if ( !lstrcmpA(szName, "Unload")) + else if (!lstrcmpA(szName, "Unload")) bHasUnload = true; - else if ( !lstrcmpA(szName, "MirandaInterfaces")) { + else if (!lstrcmpA(szName, "MirandaInterfaces")) { bHasMuuids = true; pIds = (MUUID*)&pSecStart[ ptrFuncList[*ptrOrdRVA]]; } // old plugin, skip it - else if ( !lstrcmpA(szName, "MirandaPluginInterfaces")) + else if (!lstrcmpA(szName, "MirandaPluginInterfaces")) __leave; } diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 07a29d6db4..6be0b7976e 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -137,11 +137,11 @@ int getDefaultPluginIdx(const MUUID& muuid) int LoadStdPlugins() { - for (int i=0; i < SIZEOF(pluginDefault); i++) { - if ( pluginDefault[i].pImpl ) + for (int i = 0; i < SIZEOF(pluginDefault); i++) { + if (pluginDefault[i].pImpl) continue; - if ( !LoadCorePlugin(pluginDefault[i])) { + if (!LoadCorePlugin(pluginDefault[i])) { TCHAR tszBuf[512]; mir_sntprintf(tszBuf, SIZEOF(tszBuf), TranslateT("Core plugin '%s' cannot be loaded or missing. Miranda will exit now"), pluginDefault[i].stdplugname); MessageBox(NULL, tszBuf, TranslateT("Fatal error"), MB_OK | MB_ICONSTOP); @@ -188,7 +188,7 @@ int GetPluginFakeId(const MUUID &uuid, int hLangpack) { for (int i=0; i < pluginList.getCount(); i++) { pluginEntry *p = pluginList[i]; - if ( !p->bpi.hInst) + if (!p->bpi.hInst) continue; if ( equalUUID(p->bpi.pluginInfo->uuid, uuid)) @@ -226,7 +226,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi) if (bpi->InfoEx == NULL || pi->cbSize != sizeof(PLUGININFOEX)) return FALSE; - if ( !validInterfaceList(bpi->Interfaces) || isPluginBanned(pi->uuid)) + if (!validInterfaceList(bpi->Interfaces) || isPluginBanned(pi->uuid)) return FALSE; if (pi->shortName == NULL || pi->description == NULL || pi->author == NULL || @@ -250,22 +250,16 @@ int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int ch bpi->InfoEx = (Miranda_Plugin_InfoEx) GetProcAddress(h, "MirandaPluginInfoEx"); // if they were present - if ( !bpi->Load || !bpi->Unload || !bpi->InfoEx) { + if (!bpi->Load || !bpi->Unload || !bpi->InfoEx) { LBL_Error: FreeLibrary(h); return 0; } bpi->Interfaces = (MUUID*) GetProcAddress(h, "MirandaInterfaces"); - if ( !bpi->Interfaces) { - typedef MUUID * (__cdecl * Miranda_Plugin_Interfaces) (void); - Miranda_Plugin_Interfaces pFunc = (Miranda_Plugin_Interfaces) GetProcAddress(h, "MirandaPluginInterfaces"); - if (pFunc) - bpi->Interfaces = pFunc(); - } PLUGININFOEX* pi = bpi->InfoEx(mirandaVersion); - if ( !checkPI(bpi, pi)) + if (!checkPI(bpi, pi)) goto LBL_Error; bpi->pluginInfo = pi; @@ -344,11 +338,11 @@ int Plugin_UnloadDyn(pluginEntry *p) Plugin_Uninit(p); - // load default plugins instead of the unloaded one - if ( !(p->pclass & PCLASS_CORE)) + // mark default plugins to be loaded + if (!(p->pclass & PCLASS_CORE)) for (int i=0; i < SIZEOF(pluginDefault); i++) if (pluginDefault[i].pImpl == p) - LoadCorePlugin( pluginDefault[i] ); + pluginDefault[i].pImpl = NULL; return TRUE; } @@ -380,7 +374,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) HANDLE hFind = FindFirstFile(search, &ffd); if (hFind != INVALID_HANDLE_VALUE) { do { - if ( !(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName)) + if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName)) cb(&ffd, exe, wParam, lParam); } while (FindNextFile(hFind, &ffd)); @@ -403,7 +397,7 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path) // map dll into the memory and check its exports bool bIsPlugin = false; mir_ptr pIds( GetPluginInterfaces(tszFullPath, bIsPlugin)); - if ( !bIsPlugin) { + if (!bIsPlugin) { p->pclass |= PCLASS_FAILED; // piece of shit return p; } @@ -486,14 +480,14 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) *slice = 0; CharLower(p->pluginname); - if ( !(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST))) { - if ( !bDynamic && !isPluginOnWhiteList(p->pluginname)) + if (!(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST))) { + if (!bDynamic && !isPluginOnWhiteList(p->pluginname)) return false; - if ( !(p->pclass & PCLASS_BASICAPI)) { + if (!(p->pclass & PCLASS_BASICAPI)) { BASIC_PLUGIN_INFO bpi; mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\%s\\%s"), (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname); - if ( !checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) { + if (!checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) { p->pclass |= PCLASS_FAILED; return false; } @@ -513,10 +507,8 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) } // we're loading new implementation dynamically, let the old one die - if ( !(p->pclass & PCLASS_CORE)) { + if (!(p->pclass & PCLASS_CORE)) Plugin_UnloadDyn(pluginDefault[idx].pImpl); - pluginDefault[idx].pImpl = NULL; - } } } } @@ -529,7 +521,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) if (p->bpi.Interfaces) { MUUID *piface = p->bpi.Interfaces; for (int i=0; !equalUUID(miid_last, piface[i]); i++) { - int idx = getDefaultPluginIdx( piface[i] ); + int idx = getDefaultPluginIdx(piface[i]); if (idx != -1) pluginDefault[idx].pImpl = p; } @@ -559,7 +551,7 @@ LBL_Error: pPlug->pclass |= PCLASS_CORE; - if ( !TryLoadPlugin(pPlug, true)) + if (!TryLoadPlugin(pPlug, true)) goto LBL_Error; if (bModulesLoadedFired) { @@ -601,7 +593,7 @@ static pluginEntry* getCListModule(TCHAR *exe, TCHAR *slice) pluginEntry *p = clistPlugins[i]; mir_sntprintf(slice, &exe[MAX_PATH] - slice, _T("\\Plugins\\%s"), p->pluginname); CharLower(p->pluginname); - if ( !isPluginOnWhiteList(p->pluginname)) + if (!isPluginOnWhiteList(p->pluginname)) continue; if ( loadClistModule(exe, p)) @@ -622,7 +614,7 @@ int UnloadPlugin(TCHAR* buf, int bufLen) { for (int i = pluginList.getCount()-1; i >= 0; i--) { pluginEntry *p = pluginList[i]; - if ( !_tcsicmp(p->pluginname, buf)) { + if (!_tcsicmp(p->pluginname, buf)) { GetModuleFileName(p->bpi.hInst, buf, bufLen); Plugin_Uninit(p); return TRUE; @@ -643,7 +635,7 @@ void SetServiceModePlugin(pluginEntry *p) static int LaunchServicePlugin(pluginEntry *p) { // plugin load failed - terminating Miranda - if ( !( p->pclass & PCLASS_LOADED)) { + if (!(p->pclass & PCLASS_LOADED)) { if (p->bpi.Load() != ERROR_SUCCESS) { Plugin_Uninit(p); return SERVICE_FAILED; @@ -669,7 +661,7 @@ int LoadDefaultServiceModePlugin() size_t cbLen = _tcslen(param); for (int i=0; i < servicePlugins.getCount(); i++) { pluginEntry *p = servicePlugins[i]; - if ( !_tcsnicmp(p->pluginname, param, cbLen)) { + if (!_tcsnicmp(p->pluginname, param, cbLen)) { int res = LaunchServicePlugin(p); if (res == SERVICE_ONLYDB) // load it later serviceModePlugin = p; @@ -687,13 +679,13 @@ int LoadServiceModePlugin() void EnsureCheckerLoaded(bool bEnable) { - for (int i=0; i < pluginList.getCount(); i++) { + for (int i = 0; i < pluginList.getCount(); i++) { pluginEntry *p = pluginList[i]; - if ( _tcsicmp(p->pluginname, _T("dbchecker.dll"))) + if (_tcsicmp(p->pluginname, _T("dbchecker.dll"))) continue; if (bEnable) { - if ( !(p->pclass & PCLASS_LOADED)) { + if (!(p->pclass & PCLASS_LOADED)) { if (p->bpi.Load() != ERROR_SUCCESS) Plugin_Uninit(p); else { @@ -714,9 +706,9 @@ void EnsureCheckerLoaded(bool bEnable) void UnloadNewPlugins(void) { // unload everything but the special db/clist plugins - for (int i = pluginList.getCount()-1; i >= 0; i--) { + for (int i = pluginList.getCount() - 1; i >= 0; i--) { pluginEntry *p = pluginList[i]; - if ( !(p->pclass & PCLASS_LAST) && (p->pclass & PCLASS_OK)) + if (!(p->pclass & PCLASS_LAST) && (p->pclass & PCLASS_OK)) Plugin_Uninit(p); } } @@ -735,11 +727,11 @@ int LoadNewPluginsModule(void) if (slice) *slice = 0; // remember some useful options - askAboutIgnoredPlugins = (UINT) GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini); + askAboutIgnoredPlugins = (UINT)GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini); // if Crash Dumper is present, load it to provide Crash Reports if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname)) - if ( !TryLoadPlugin(pluginList_crshdmp, false)) + if (!TryLoadPlugin(pluginList_crshdmp, false)) Plugin_Uninit(pluginList_crshdmp); // if freeimage is present, load it to provide the basic core functions @@ -770,13 +762,13 @@ int LoadNewPluginsModule(void) } /* enable and disable as needed */ - for (i=0; i < clistPlugins.getCount(); i++) + for (i = 0; i < clistPlugins.getCount(); i++) SetPluginOnWhiteList(clistPlugins[i]->pluginname, clist != clistPlugins[i] ? 0 : 1); /* now loop thru and load all the other plugins, do this in one pass */ - for (i=0; i < pluginList.getCount(); i++) { + for (i = 0; i < pluginList.getCount(); i++) { pluginEntry *p = pluginList[i]; - if ( !TryLoadPlugin(p, false)) { + if (!TryLoadPlugin(p, false)) { Plugin_Uninit(p); i--; } @@ -793,7 +785,7 @@ int LoadNewPluginsModule(void) static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM) { pluginEntry *p = OpenPlugin(fd->cFileName, _T("Plugins"), path); - if ( !(p->pclass & PCLASS_FAILED)) { + if (!(p->pclass & PCLASS_FAILED)) { if (pluginList_freeimg == NULL && lstrcmpi(fd->cFileName, _T("advaimg.dll")) == 0) pluginList_freeimg = p; @@ -842,7 +834,7 @@ void UnloadDatabase(void) void UnloadNewPluginsModule(void) { - if ( !bModuleInitialized) + if (!bModuleInitialized) return; UnloadPluginOptions(); diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index a79c532074..7512dc2e4e 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -68,7 +68,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM l if (checkAPI(buf, &pi, MIRANDA_VERSION_CORE, CHECKAPI_NONE) == 0) return TRUE; - PluginListItemData* dat = (PluginListItemData*)mir_alloc(sizeof(PluginListItemData)); + PluginListItemData *dat = (PluginListItemData*)mir_alloc(sizeof(PluginListItemData)); dat->hInst = hInst; dat->flags = pi.pluginInfo->flags; @@ -163,7 +163,7 @@ static void RemoveAllItems(HWND hwnd) lvi.mask = LVIF_PARAM; lvi.iItem = 0; while (ListView_GetItem(hwnd, &lvi)) { - PluginListItemData* dat = (PluginListItemData*)lvi.lParam; + PluginListItemData *dat = (PluginListItemData*)lvi.lParam; mir_free(dat->author); mir_free(dat->authorEmail); mir_free(dat->copyright); @@ -186,7 +186,7 @@ LBL_Error: return false; } - if ( !TryLoadPlugin(pPlug, true)) + if (!TryLoadPlugin(pPlug, true)) goto LBL_Error; if (CallPluginEventHook(pPlug->bpi.hInst, hModulesLoadedEvent, 0, 0) != 0) @@ -201,7 +201,7 @@ static bool UnloadPluginDynamically(PluginListItemData *dat) { pluginEntry *p = pluginList.find((pluginEntry*)dat->fileName); if (p) { - if ( !Plugin_UnloadDyn(p)) + if (!Plugin_UnloadDyn(p)) return false; dat->hInst = NULL; @@ -270,17 +270,18 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP lvi.mask = LVIF_IMAGE; PluginListItemData *dat = (PluginListItemData*)lvi.lParam; if (lvi.iImage == 3) { - if ( LoadPluginDynamically(dat)) { + if (LoadPluginDynamically(dat)) { lvi.iImage = 2; ListView_SetItem(hwnd, &lvi); } } else if (lvi.iImage == 2) { - if ( UnloadPluginDynamically(dat)) { + if (UnloadPluginDynamically(dat)) { lvi.iImage = 3; ListView_SetItem(hwnd, &lvi); } } + LoadStdPlugins(); } return mir_callNextSubclass(hwnd, PluginListWndProc, msg, wParam, lParam); @@ -355,7 +356,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_SetColumnWidth(hwndList, 2, 110); w = 110; } - int max = w < 110 ? 189+110-w:189; + int max = w < 110 ? 189 + 110 - w : 189; ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); // short name w = ListView_GetColumnWidth(hwndList, 3); if (w > max) @@ -367,7 +368,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_NOTIFY: if (lParam) { - NMLISTVIEW *hdr = (NMLISTVIEW *) lParam; + NMLISTVIEW *hdr = (NMLISTVIEW *)lParam; if (hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom)) { if (hdr->uOldState != 0 && (hdr->uNewState == 0x1000 || hdr->uNewState == 0x2000)) { HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST); @@ -375,7 +376,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar LVITEM it; it.mask = LVIF_PARAM | LVIF_STATE; it.iItem = hdr->iItem; - if ( !ListView_GetItem(hwndList, &it)) + if (!ListView_GetItem(hwndList, &it)) break; PluginListItemData *dat = (PluginListItemData*)it.lParam; @@ -392,11 +393,11 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar LVITEM dt; dt.mask = LVIF_PARAM; dt.iItem = iRow; - if ( !ListView_GetItem(hwndList, &dt)) + if (!ListView_GetItem(hwndList, &dt)) continue; PluginListItemData* dat2 = (PluginListItemData*)dt.lParam; - if ( !(dat2->stdPlugin & dat->stdPlugin)) // mask differs + if (!(dat2->stdPlugin & dat->stdPlugin)) // mask differs continue; // the lParam is unset, so when the check is unset the clist block doesnt trigger @@ -407,7 +408,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar } if (bOldMode) - ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), TRUE); // this here only in "ghazan mode" + ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), TRUE); // this here only in "ghazan mode" SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } @@ -423,30 +424,32 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar PluginListItemData* dat = (PluginListItemData*)lvi.lParam; ListView_GetItemText(hwndList, hdr->iItem, 1, buf, SIZEOF(buf)); - SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGININFOFRAME), sel ? buf : _T("")); + SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGININFOFRAME), sel ? buf : _T("")); - ptrT tszAuthor( latin2t(sel ? dat->author : NULL)); - SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), tszAuthor); + ptrT tszAuthor(latin2t(sel ? dat->author : NULL)); + SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), tszAuthor); - ptrT tszEmail( latin2t(sel ? dat->authorEmail : NULL)); - SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), tszEmail); + ptrT tszEmail(latin2t(sel ? dat->authorEmail : NULL)); + SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), tszEmail); - ptrT p( Langpack_PcharToTchar(dat->description)); - SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? (TCHAR*)p : _T("")); + ptrT p(Langpack_PcharToTchar(dat->description)); + SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? (TCHAR*)p : _T("")); - ptrT tszCopyright( latin2t(sel ? dat->copyright : NULL)); - SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINCPYR), tszCopyright); + ptrT tszCopyright(latin2t(sel ? dat->copyright : NULL)); + SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINCPYR), tszCopyright); - ptrT tszUrl( latin2t(sel ? dat->homepage : NULL)); - SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINURL), tszUrl); + ptrT tszUrl(latin2t(sel ? dat->homepage : NULL)); + SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINURL), tszUrl); - if ( !equalUUID(miid_last, dat->uuid)) { + if (!equalUUID(miid_last, dat->uuid)) { char szUID[128]; uuidToString(dat->uuid, szUID, sizeof(szUID)); - SetWindowTextA( GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? szUID : ""); + SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? szUID : ""); } - else SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? TranslateT("") : _T("")); - } } } + else SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? TranslateT("") : _T("")); + } + } + } if (hdr->hdr.code == PSN_APPLY) { bool needRestart = false; @@ -461,7 +464,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetPluginOnWhiteList(buf, (iState & 0x2000) ? 1 : 0); if (!bOldMode && iState != 0x3000) { - LVITEM lvi = {0}; + LVITEM lvi = { 0 }; lvi.mask = LVIF_IMAGE | LVIF_PARAM; lvi.stateMask = -1; lvi.iItem = iRow; @@ -476,18 +479,21 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (lvi.iImage == 3 && LoadPluginDynamically(dat)) { lvi.iImage = 2; ListView_SetItem(hwndList, &lvi); - } else { + } + else { bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf); needRestart = true; } } - } else { + } + else { // disabling plugin if (lvi.iImage == 2 || lvi.iImage == 4) { if (lvi.iImage == 2 && UnloadPluginDynamically(dat)) { lvi.iImage = 3; ListView_SetItem(hwndList, &lvi); - } else { + } + else { bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf); needRestart = true; } @@ -498,7 +504,9 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar iRow = ListView_GetNextItem(hwndList, iRow, LVNI_ALL); } - ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), needRestart); + LoadStdPlugins(); + + ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), needRestart); if (needRestart) { mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T("\n%s"), TranslateT("Do you want to restart it now?")); if (MessageBox(NULL, bufRestart, _T("Miranda NG"), MB_ICONWARNING | MB_YESNO) == IDYES) @@ -511,25 +519,25 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND: if (HIWORD(wParam) == STN_CLICKED) { switch (LOWORD(wParam)) { + case IDC_GETMOREPLUGINS: + CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://miranda-ng.org/downloads/"); + break; + case IDC_PLUGINEMAIL: case IDC_PLUGINURL: - { char buf[512]; char *p = &buf[7]; lstrcpyA(buf, "mailto:"); - if (GetWindowTextA( GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7)) - CallService(MS_UTILS_OPENURL, 0, (LPARAM) (LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p)); + if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7)) + CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p)); break; } - case IDC_GETMOREPLUGINS: - CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://miranda-ng.org/downloads/"); - break; - } } + } break; case WM_DESTROY: arPluginList.destroy(); - RemoveAllItems( GetDlgItem(hwndDlg, IDC_PLUGLIST)); + RemoveAllItems(GetDlgItem(hwndDlg, IDC_PLUGLIST)); break; } return FALSE; diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 6c763fc08b..57cd4cad41 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -45,8 +45,8 @@ LIST accounts(10, CompareAccounts); static int EnumDbModules(const char *szModuleName, DWORD ofsModuleName, LPARAM lParam) { DBVARIANT dbv; - if ( !db_get_s(NULL, szModuleName, "AM_BaseProto", &dbv)) { - if ( !Proto_GetAccount(szModuleName)) { + if (!db_get_s(NULL, szModuleName, "AM_BaseProto", &dbv)) { + if (!Proto_GetAccount(szModuleName)) { PROTOACCOUNT* pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT)); pa->cbSize = sizeof(*pa); pa->szModuleName = mir_strdup(szModuleName); @@ -92,7 +92,7 @@ void LoadDbAccounts(void) if (ver >= 4) { db_free(&dbv); _itoa(OFFSET_NAME+i, buf, 10); - if ( !db_get_ts(NULL, "Protocols", buf, &dbv)) { + if (!db_get_ts(NULL, "Protocols", buf, &dbv)) { pa->tszAccountName = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -100,19 +100,19 @@ void LoadDbAccounts(void) _itoa(OFFSET_ENABLED+i, buf, 10); pa->bIsEnabled = db_get_dw(NULL, "Protocols", buf, 1); - if ( !db_get_s(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) { + if (!db_get_s(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) { pa->szProtoName = mir_strdup(dbv.pszVal); db_free(&dbv); } } else pa->bIsEnabled = TRUE; - if ( !pa->szProtoName) { + if (!pa->szProtoName) { pa->szProtoName = mir_strdup(pa->szModuleName); db_set_s(NULL, pa->szModuleName, "AM_BaseProto", pa->szProtoName); } - if ( !pa->tszAccountName) + if (!pa->tszAccountName) pa->tszAccountName = mir_a2t(pa->szModuleName); accounts.insert(pa); @@ -225,12 +225,12 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) for (int i=0; i < accounts.getCount(); i++) { PROTOACCOUNT* pa = accounts[i]; - if ( !pa->ppro || !Proto_IsAccountEnabled(pa)) + if (!pa->ppro || !Proto_IsAccountEnabled(pa)) continue; pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0); - if ( !pa->bOldProto) + if (!pa->bOldProto) count++; } @@ -247,7 +247,7 @@ static int UninitializeStaticAccounts(WPARAM, LPARAM) { for (int i=0; i < accounts.getCount(); i++) { PROTOACCOUNT* pa = accounts[i]; - if ( !pa->ppro || !Proto_IsAccountEnabled(pa)) + if (!pa->ppro || !Proto_IsAccountEnabled(pa)) continue; pa->ppro->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0); @@ -268,10 +268,10 @@ int LoadAccountsModule(void) if (pa->ppro) continue; - if ( !Proto_IsAccountEnabled(pa)) + if (!Proto_IsAccountEnabled(pa)) continue; - if ( !ActivateAccount(pa)) + if (!ActivateAccount(pa)) pa->bDynDisabled = TRUE; } @@ -462,15 +462,15 @@ BOOL ActivateAccount(PROTOACCOUNT* pa) CreateProtoServiceEx(pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro); CreateProtoServiceEx(pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro); - if ( !ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFO)) + if (!ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFO)) if ( ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFOW)) CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro); - if ( !ProtoServiceExists(pa->szModuleName, PS_GETMYAVATAR)) + if (!ProtoServiceExists(pa->szModuleName, PS_GETMYAVATAR)) if ( ProtoServiceExists(pa->szModuleName, PS_GETMYAVATARW)) CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro); - if ( !ProtoServiceExists(pa->szModuleName, PS_SETMYAVATAR)) + if (!ProtoServiceExists(pa->szModuleName, PS_SETMYAVATAR)) if ( ProtoServiceExists(pa->szModuleName, PS_SETMYAVATARW)) CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro); @@ -570,7 +570,7 @@ void EraseAccount(const char* pszModuleName) if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)h1, (LPARAM)&dbcgs)) continue; - if ( !lstrcmpA(szProtoName, pszModuleName)) + if (!lstrcmpA(szProtoName, pszModuleName)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)h1, 0); } @@ -589,7 +589,7 @@ void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase) // szModuleName should be freed only on a program's exit. // otherwise many plugins dependand on static protocol names will crash! // do NOT fix this 'leak', please - if ( !bIsDynamic) { + if (!bIsDynamic) { mir_free(pa->szModuleName); mir_free(pa); } @@ -597,7 +597,7 @@ void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase) void UnloadAccountsModule() { - if ( !bModuleInitialized) return; + if (!bModuleInitialized) return; for (int i = accounts.getCount()-1; i >= 0; i--) { PROTOACCOUNT* pa = accounts[ i ]; diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index 95392c4331..56080253dc 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -197,12 +197,12 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam) return 0; char szContactProto[40]; - if ( !GetProtocolP((HANDLE)wParam, szContactProto, sizeof(szContactProto))) - if ( !_stricmp(szProto, szContactProto)) + if (!GetProtocolP((HANDLE)wParam, szContactProto, sizeof(szContactProto))) + if (!_stricmp(szProto, szContactProto)) return -1; for (int i=0; i < filters.getCount(); i++) - if ( !strcmp(szProto, filters[i]->szName)) + if (!strcmp(szProto, filters[i]->szName)) return i+1; return 0; @@ -241,7 +241,7 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam, LPARAM lParam) int LoadProtoChains(void) { - if ( !db_get_b(NULL, "Compatibility", "Filters", 0)) { + if (!db_get_b(NULL, "Compatibility", "Filters", 0)) { CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)"_Filters"); db_set_b(NULL, "Compatibility", "Filters", 1); } diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 4c86dead15..8ef8aadb2d 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -102,7 +102,7 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam) return 1; p = (PROTOCOLDESCRIPTOR*)mir_alloc(sizeof(PROTOCOLDESCRIPTOR)); - if ( !p) + if (!p) return 2; if (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) { @@ -205,7 +205,7 @@ static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam) static int Proto_ValidTypingContact(HANDLE hContact, char *szProto) { - if ( !hContact || !szProto) + if (!hContact || !szProto) return 0; return (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0; @@ -215,7 +215,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) { if (lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON) { char *szProto = GetContactProto((HANDLE)wParam); - if ( !szProto) + if (!szProto) return 0; if (Proto_ValidTypingContact((HANDLE)wParam, szProto)) @@ -229,7 +229,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) { int type = (int)lParam; char *szProto = GetContactProto((HANDLE)wParam); - if ( !szProto) + if (!szProto) return 0; if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_TYPINGNOTIFY)) @@ -566,9 +566,9 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s } } - if ( !strcmp(szService, PS_ADDTOLIST)) { + if (!strcmp(szService, PS_ADDTOLIST)) { PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam; - if ( !(psr->flags & PSR_UNICODE)) { + if (!(psr->flags & PSR_UNICODE)) { PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)mir_alloc(psr->cbSize); memcpy(psra, psr, psr->cbSize); psra->nick = (PROTOCHAR*)mir_u2a(psr->nick); @@ -591,7 +591,7 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s if (res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr(szService, 'W')) { TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService); - if ( !item) return res; + if (!item) return res; switch(item->id) { case 100: @@ -721,7 +721,7 @@ int LoadProtocolsModule(void) void UnloadProtocolsModule() { - if ( !bModuleInitialized) return; + if (!bModuleInitialized) return; if (hAccListChanged) { DestroyHookableEvent(hAccListChanged); diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index eddded512c..61fdd46177 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -184,7 +184,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam } pa->szModuleName = mir_strdup(buf); - if ( !pa->tszAccountName[0]) { + if (!pa->tszAccountName[0]) { mir_free(pa->tszAccountName); pa->tszAccountName = mir_a2t(buf); } @@ -194,7 +194,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam if ( ActivateAccount(pa)) { pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0); - if ( !db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) + if (!db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0); } } @@ -278,7 +278,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct TAccListData *dat = (struct TAccListData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if ( !dat) + if (!dat) return DefWindowProc(hwnd, msg, wParam, lParam); switch (msg) { @@ -329,7 +329,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA RECT rc; struct TAccMgrData *parentDat = (struct TAccMgrData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwnd, ListBox_GetCurSel(hwnd)); - if ( !pa || pa->bOldProto || pa->bDynDisabled) + if (!pa || pa->bOldProto || pa->bDynDisabled) return 0; ListBox_GetItemRect(hwnd, ListBox_GetCurSel(hwnd), &rc); @@ -423,7 +423,7 @@ static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat) ShowWindow( GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_HIDE); ShowWindow(pa->hwndAccMgrUI, SW_SHOW); } - else if ( !pa->ppro) { + else if (!pa->ppro) { ShowWindow( GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW); SetWindowText( GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT("Account is disabled. Please activate it to access options.")); } @@ -625,7 +625,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM ci.hContact = NULL; ci.szProto = acc->szModuleName; ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR; - if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { switch (ci.type) { case CNFT_ASCIIZ: mir_sntprintf(text, size, _T("%s: %s"), tszIdName, ci.pszVal); @@ -711,7 +711,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (iItem != LB_ERR) { PROTOACCOUNT* pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, iItem); HMENU hMenu = CreatePopupMenu(); - if ( !pa->bOldProto && !pa->bDynDisabled) + if (!pa->bOldProto && !pa->bDynDisabled) AppendMenu(hMenu, MF_STRING, 1, TranslateT("Rename")); AppendMenu(hMenu, MF_STRING, 3, TranslateT("Delete")); @@ -775,7 +775,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (pa->bIsEnabled) { if (ActivateAccount(pa)) { pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0); - if ( !db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) + if (!db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0); } } @@ -791,7 +791,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM } } - if ( !pa->bIsEnabled) + if (!pa->bIsEnabled) DeactivateAccount(pa, true, false); } @@ -1034,7 +1034,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM static INT_PTR OptProtosShow(WPARAM, LPARAM) { - if ( !hAccMgr) + if (!hAccMgr) hAccMgr = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGR), NULL, AccMgrDlgProc, 0); ShowWindow(hAccMgr, SW_RESTORE); diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index ef9f4fe690..53c7ba77fe 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -175,7 +175,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item) LVITEM lvi = {0}; lvi.iItem = idx; - if ( !item->rootHotkey) { + if (!item->rootHotkey) { lvi.mask = LVIF_TEXT|LVIF_IMAGE; lvi.iSubItem = COL_NAME; lvi.pszText = item->getDescr(); @@ -245,16 +245,16 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP if (ListView_GetItem((HWND)lParamSort, &lvi)) item2 = (THotkeyItem *)lvi.lParam; - if ( !item1 && !item2) + if (!item1 && !item2) return lstrcmp(title1, title2); - if ( !item1) { + if (!item1) { if (res = lstrcmp(title1, item2->getSection())) return res; return -1; } - if ( !item2) { + if (!item2) { if (res = lstrcmp(item1->getSection(), title2)) return res; return 1; @@ -314,7 +314,7 @@ static void sttOptionsSaveItem(THotkeyItem *item) char buf[MAXMODULELABELLENGTH]; if (item->rootHotkey) return; - if ( !item->OptChanged) return; + if (!item->OptChanged) return; item->Hotkey = item->OptHotkey; item->type = item->OptType; @@ -356,7 +356,7 @@ static void sttBuildHotkeyList(HWND hwndList) if (item->OptDeleted) continue; - if ( !i || lstrcmp(item->ptszSection, hotkeys[i-1]->ptszSection)) { + if (!i || lstrcmp(item->ptszSection, hotkeys[i-1]->ptszSection)) { lvi.mask = LVIF_TEXT|LVIF_PARAM; lvi.iItem = nItems++; lvi.iSubItem = 0; @@ -537,7 +537,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM; for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) { ListView_GetItem(hwndHotkey, &lvi); - if ( !lvi.lParam) continue; + if (!lvi.lParam) continue; if (((THotkeyItem *)lvi.lParam)->UnregisterHotkey) { ListView_DeleteItem(hwndHotkey, lvi.iItem); @@ -609,7 +609,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow( GetDlgItem(hwndDlg, IDC_HOTKEY), SW_HIDE); SetFocus(hwndHotkey); - if ( !wHotkey || (wHotkey == VK_ESCAPE) || (HIWORD(wParam) != 0)) + if (!wHotkey || (wHotkey == VK_ESCAPE) || (HIWORD(wParam) != 0)) break; lvi.mask = LVIF_PARAM; @@ -637,7 +637,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM; ListView_GetItem(hwndList, &lvi); - if ( !(item = (THotkeyItem *)lvi.lParam)) return FALSE; + if (!(item = (THotkeyItem *)lvi.lParam)) return FALSE; if ((pt.x == -1) && (pt.y == -1)) { RECT rc; @@ -667,7 +667,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, (UINT_PTR)MI_LOCAL, TranslateT("Miranda scope")); } AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); - if ( !item->rootHotkey) + if (!item->rootHotkey) AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_ADD, TranslateT("Add binding")); else AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_REMOVE, TranslateT("Remove")); @@ -775,7 +775,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_HitTest(lpnmia->hdr.hwndFrom, &lvhti); if (item && - ( !item->rootHotkey && (lpnmia->iSubItem == COL_NAME) && ((lvhti.flags & LVHT_ONITEM) == LVHT_ONITEMICON) || + (!item->rootHotkey && (lpnmia->iSubItem == COL_NAME) && ((lvhti.flags & LVHT_ONITEM) == LVHT_ONITEMICON) || item->rootHotkey && (lpnmia->iSubItem == COL_TYPE)) && ((item->OptType == HKT_GLOBAL) || (item->OptType == HKT_LOCAL))) { @@ -846,7 +846,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { LPNMLISTVIEW param = (LPNMLISTVIEW)lParam; THotkeyItem *item = (THotkeyItem *)param->lParam; - if ( !initialized || (param->uNewState>>12 == param->uOldState>>12)) + if (!initialized || (param->uNewState>>12 == param->uOldState>>12)) break; if (item && !item->rootHotkey) { @@ -854,7 +854,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttOptionsSetChanged(item); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } - else if ( !item) { + else if (!item) { TCHAR buf[256]; LVITEM lvi = {0}; lvi.mask = LVIF_TEXT; @@ -871,8 +871,8 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, THotkeyItem *item; ListView_GetItem(lpnmhdr->hwndFrom, &lvi); item = (THotkeyItem *)lvi.lParam; - if ( !item) continue; - if ( !lstrcmp( item->getSection(), buf)) { + if (!item) continue; + if (!lstrcmp( item->getSection(), buf)) { ListView_DeleteItem(lpnmhdr->hwndFrom, lvi.iItem); --lvi.iItem; --count; diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 279466dbf7..adab1fda71 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -33,7 +33,7 @@ static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2) return res; if (res = lstrcmp(p1->ptszDescription, p2->ptszDescription)) return res; - if ( !p1->rootHotkey && p2->rootHotkey) + if (!p1->rootHotkey && p2->rootHotkey) return -1; if (p1->rootHotkey && !p2->rootHotkey) return 1; @@ -189,14 +189,14 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) hotkeys.insert(item); - if ( !item->rootHotkey) { + if (!item->rootHotkey) { /* try to load alternatives from db */ int count, i; mir_snprintf(buf, SIZEOF(buf), "%s$count", item->pszName); count = (int)db_get_dw(NULL, DBMODULENAME, buf, -1); for (i=0; i < count; i++) { mir_snprintf(buf, SIZEOF(buf), "%s$%d", item->pszName, i); - if ( !db_get_w(NULL, DBMODULENAME, buf, 0)) + if (!db_get_w(NULL, DBMODULENAME, buf, 0)) continue; svcHotkeyRegister(wParam, lParam); @@ -225,7 +225,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) char *pszCurrentName = hotkeys[i]->rootHotkey ? hotkeys[i]->rootHotkey->pszName : hotkeys[i]->pszName; - if ( !pszCurrentName) continue; + if (!pszCurrentName) continue; hotkeys[i]->UnregisterHotkey = !lstrcmpA(pszCurrentName, pszName) || @@ -265,8 +265,8 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) BYTE hkMod, hkVk; if ((item->type != HKT_MANUAL) || lstrcmp(pszSection, item->ptszSection)) continue; sttWordToModAndVk(item->Hotkey, &hkMod, &hkVk); - if ( !hkVk) continue; - if ( !item->Enabled) continue; + if (!hkVk) continue; + if (!item->Enabled) continue; if ((vk == hkVk) && (mod == hkMod)) { mir_free(pszSection); return item->lParam; @@ -391,7 +391,7 @@ int LoadSkinHotkeys(void) void UnloadSkinHotkeys(void) { - if ( !bModuleInitialized) + if (!bModuleInitialized) return; DestroyHookableEvent(hEvChanged); diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index 3da738b389..2e6e071f02 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -136,7 +136,7 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) { HICON hResIcon = bShared ? LoadSmallIcon(hInstance, lpIconName) : LoadSmallIconShared(hInstance, lpIconName); - if ( !hResIcon) { //Icon not found in hInstance lets try to load it from core + if (!hResIcon) { //Icon not found in hInstance lets try to load it from core HINSTANCE hCoreInstance = hInst; if (hCoreInstance != hInstance) hResIcon = bShared ? LoadSmallIcon(hCoreInstance, lpIconName) : LoadSmallIconShared(hCoreInstance, lpIconName); @@ -243,7 +243,7 @@ HICON LoadSkinProtoIcon(const char *szProto, int status, bool big) if (statusIndx == -1) return NULL; - if ( !szProto) { + if (!szProto) { // Only return a protocol specific icon if there is only one protocol // Otherwise return the global icon. This affects the global status menu mainly. if (accounts.getCount() == 1) { @@ -385,7 +385,7 @@ static void convertOneProtocol(char *moduleName, char *iconName) _itoa(statusIcons[i].id, pm, 10); DBVARIANT dbv; - if ( !db_get_ts(NULL, "Icons", moduleName, &dbv)) { + if (!db_get_ts(NULL, "Icons", moduleName, &dbv)) { _itoa(i, pi, 10); db_set_ts(NULL, "SkinIcons", iconName, dbv.ptszVal); diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index e6aa790610..6cd4266c0f 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -191,7 +191,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TreeView_SetItem(hwndTree, &tvis.item); } tvis.item.stateMask = TVIS_STATEIMAGEMASK; - tvis.item.state = INDEXTOSTATEIMAGEMASK( !db_get_b(NULL, "SkinSoundsOff", arSounds[i].name, 0)?2:1); + tvis.item.state = INDEXTOSTATEIMAGEMASK(!db_get_b(NULL, "SkinSoundsOff", arSounds[i].name, 0)?2:1); tvis.item.lParam = i; tvis.item.pszText = arSounds[i].getDescr(); TreeView_InsertItem(hwndTree, &tvis); @@ -235,7 +235,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case DM_CHECKENABLED: EnableWindow( GetDlgItem(hwndDlg, IDC_SOUNDTREE), IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS)); - if ( !IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS)) + if (!IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS)) SendMessage(hwndDlg, DM_HIDEPANE, 0, 0); else if (TreeView_GetSelection(hwndTree) && TreeView_GetParent(hwndTree, TreeView_GetSelection(hwndTree))) SendMessage(hwndDlg, DM_SHOWPANE, 0, 0); @@ -262,7 +262,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NotifyEventHooks(hPlayEvent, 1, (LPARAM)arSounds[tvi.lParam].ptszTempFile); else { DBVARIANT dbv; - if ( !db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) { + if (!db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) { TCHAR szPathFull[MAX_PATH]; PathToAbsoluteT(dbv.ptszVal, szPathFull); NotifyEventHooks(hPlayEvent, 1, (LPARAM)szPathFull); @@ -324,7 +324,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.nMaxFile = SIZEOF(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = _T("wav"); - if ( !GetOpenFileName(&ofn)) + if (!GetOpenFileName(&ofn)) break; PathToRelativeT(str, strFull); @@ -392,7 +392,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_LOCATION, arSounds[tvi.lParam].ptszTempFile); else { DBVARIANT dbv; - if ( !db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) { + if (!db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) { SetDlgItemText(hwndDlg, IDC_LOCATION, dbv.ptszVal); db_free(&dbv); } diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index e7f479e668..1c9f86a48d 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -38,7 +38,7 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName) short picType; TCHAR szFilename[MAX_PATH]; - if ( !PathToAbsoluteT(ptszFileName, szFilename)) + if (!PathToAbsoluteT(ptszFileName, szFilename)) mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s"), ptszFileName); int filenameLen = lstrlen(szFilename); @@ -48,19 +48,19 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName) if (ServiceExists(MS_IMG_LOAD)) return CallService(MS_IMG_LOAD, (WPARAM)szFilename, IMGL_TCHAR); - if ( !lstrcmpi(pszExt, _T(".bmp")) || !lstrcmpi(pszExt, _T(".rle"))) { + if (!lstrcmpi(pszExt, _T(".bmp")) || !lstrcmpi(pszExt, _T(".rle"))) { //LoadImage can do this much faster return (INT_PTR)LoadImage(hInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); } - if ( !lstrcmpi(pszExt, _T(".png"))) { + if (!lstrcmpi(pszExt, _T(".png"))) { HANDLE hFile, hMap = NULL; BYTE* ppMap = NULL; INT_PTR cbFileSize = 0; BITMAPINFOHEADER* pDib; BYTE* pDibBits; - if ( !ServiceExists(MS_PNG2DIB)) { + if (!ServiceExists(MS_PNG2DIB)) { MessageBox(NULL, TranslateT("You need an image services plugin to process PNG images."), TranslateT("Error"), MB_OK); return 0; } diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index 86fa58689b..7eaba363de 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -49,12 +49,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); /* always succeeds */ /* fall thru */ case WM_SYSCOLORCHANGE: - if ( !(dat->flags&HLKF_HASENABLECOLOR)) { + if (!(dat->flags&HLKF_HASENABLECOLOR)) { if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor = RGB(0, 0, 255); else dat->enableColor = GetSysColor(COLOR_HOTLIGHT); dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2); } - if ( !(dat->flags&HLKF_HASDISABLECOLOR)) + if (!(dat->flags&HLKF_HASDISABLECOLOR)) dat->disableColor = GetSysColor(COLOR_GRAYTEXT); break; @@ -103,7 +103,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_LBUTTONDOWN: { POINT pt; POINTSTOPOINT(pt, MAKEPOINTS(lParam)); - if ( !PtInRect(&dat->rcText, pt)) break; + if (!PtInRect(&dat->rcText, pt)) break; SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), STN_CLICKED), (LPARAM)hwnd); return 0; } @@ -133,12 +133,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA { RECT rcWnd; POINT pt; HWND hwndParent; - if ( !GetWindowRect(hwnd, &rcWnd)) break; + if (!GetWindowRect(hwnd, &rcWnd)) break; pt.x = rcWnd.left; pt.y = rcWnd.top; hwndParent = GetParent(hwnd); if (hwndParent == NULL) hwndParent = hwnd; - if ( !ScreenToClient(hwndParent, &pt)) break; + if (!ScreenToClient(hwndParent, &pt)) break; rcWnd.right = pt.x+(rcWnd.right-rcWnd.left); rcWnd.bottom = pt.y+(rcWnd.bottom-rcWnd.top); rcWnd.left = pt.x; @@ -151,7 +151,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_CREATE: case HLK_MEASURETEXT: { TCHAR szText[256]; - if ( !GetWindowText(hwnd, szText, SIZEOF(szText))) return 0; + if (!GetWindowText(hwnd, szText, SIZEOF(szText))) return 0; lParam = (LPARAM)szText; /* fall thru */ case WM_SETTEXT: @@ -178,15 +178,15 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA } if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc, hPrevFont); ReleaseDC(hwnd, hdc); - if ( !fMeasured) return 0; /* text change failed */ + if (!fMeasured) return 0; /* text change failed */ SendMessage(hwnd, HLK_INVALIDATE, 0, 0); break; }} case WM_SETCURSOR: { POINT pt; HCURSOR hCursor; - if ( !GetCursorPos(&pt)) return FALSE; - if ( !ScreenToClient(hwnd, &pt)) return FALSE; + if (!GetCursorPos(&pt)) return FALSE; + if (!ScreenToClient(hwnd, &pt)) return FALSE; if (PtInRect(&dat->rcText, pt)) { hCursor = (HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR); if (hCursor == NULL) hCursor = LoadCursor(NULL, IDC_HAND); /* Win2000+ */ diff --git a/src/modules/utils/imgconv.cpp b/src/modules/utils/imgconv.cpp index 03c585cc03..20550b12c7 100644 --- a/src/modules/utils/imgconv.cpp +++ b/src/modules/utils/imgconv.cpp @@ -87,7 +87,7 @@ void ConvertBufferToPARGB32(HANDLE hPaintBuffer, HDC hdc, HICON hIcon, SIZE& siz HRESULT hr = getBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow); if (SUCCEEDED(hr)) { ARGB *pargb = (ARGB *)prgbQuad; - if ( !HasAlpha(pargb, sizIcon, cxRow)) { + if (!HasAlpha(pargb, sizIcon, cxRow)) { ICONINFO info; if (GetIconInfo(hIcon, &info)) { if (info.hbmMask) diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index f9b6f4caff..a4722f804f 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -34,7 +34,7 @@ typedef struct { static void OpenURLThread(void *arg) { TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)arg; - if ( !hUrlInfo->szUrl) + if (!hUrlInfo->szUrl) return; //wack a protocol on it @@ -49,7 +49,7 @@ static void OpenURLThread(void *arg) if (hUrlInfo->szUrl[i] == ':') szResult = mir_tstrdup(hUrlInfo->szUrl); else { - if ( !_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4)) + if (!_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4)) mir_sntprintf(szResult, size, _T("ftp://%s"), hUrlInfo->szUrl); else mir_sntprintf(szResult, size, _T("http://%s"), hUrlInfo->szUrl); diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 136c15c1bb..b60d5c68ac 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -74,7 +74,7 @@ TCHAR *GetContactID(HANDLE hContact) char *szProto = GetContactProto(hContact); if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1) { DBVARIANT dbv; - if ( !db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) { + if (!db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) { theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal); db_free(&dbv); return theValue; @@ -86,7 +86,7 @@ TCHAR *GetContactID(HANDLE hContact) ci.hContact = hContact; ci.szProto = szProto; ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR; - if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { switch (ci.type) { case CNFT_ASCIIZ: return (TCHAR *)ci.pszVal; @@ -285,38 +285,38 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) theKey[keyLength] = 0; if (hContact) { - if ( !_xcscmp(theKey, XSTR(key, "nick"))) + if (!_xcscmp(theKey, XSTR(key, "nick"))) theValue = GetContactNickX(key, hContact); - else if ( !_xcscmp(theKey, XSTR(key, "proto"))) + else if (!_xcscmp(theKey, XSTR(key, "proto"))) theValue = mir_a2x(key, GetContactProto(hContact)); - else if ( !_xcscmp(theKey, XSTR(key, "userid"))) + else if (!_xcscmp(theKey, XSTR(key, "userid"))) theValue = GetContactIDX(key, hContact); } - if ( !theValue) { - if ( !_xcscmp(theKey, XSTR(key, "miranda_path"))) + if (!theValue) { + if (!_xcscmp(theKey, XSTR(key, "miranda_path"))) theValue = GetModulePathX(key, NULL); - else if ( !_xcscmp(theKey, XSTR(key, "appdata"))) + else if (!_xcscmp(theKey, XSTR(key, "appdata"))) theValue = SHGetSpecialFolderPathX(CSIDL_APPDATA, theKey); - else if ( !_xcscmp(theKey, XSTR(key, "mydocuments"))) + else if (!_xcscmp(theKey, XSTR(key, "mydocuments"))) theValue = SHGetSpecialFolderPathX(CSIDL_PERSONAL, theKey); - else if ( !_xcscmp(theKey, XSTR(key, "desktop"))) + else if (!_xcscmp(theKey, XSTR(key, "desktop"))) theValue = SHGetSpecialFolderPathX(CSIDL_DESKTOPDIRECTORY, theKey); - else if ( !_xcscmp(theKey, XSTR(key, "miranda_profile"))) + else if (!_xcscmp(theKey, XSTR(key, "miranda_profile"))) theValue = GetProfileDirX(key); - else if ( !_xcscmp(theKey, XSTR(key, "miranda_profilename"))) + else if (!_xcscmp(theKey, XSTR(key, "miranda_profilename"))) theValue = GetProfileNameX(key); - else if ( !_xcscmp(theKey, XSTR(key, "username"))) + else if (!_xcscmp(theKey, XSTR(key, "username"))) theValue = GetUserNameX(key); - else if ( !_xcscmp(theKey, XSTR(key, "miranda_avatarcache"))) + else if (!_xcscmp(theKey, XSTR(key, "miranda_avatarcache"))) theValue = GetPathVarX(key, 1); - else if ( !_xcscmp(theKey, XSTR(key, "miranda_logpath"))) + else if (!_xcscmp(theKey, XSTR(key, "miranda_logpath"))) theValue = GetPathVarX(key, 2); - else if ( !_xcscmp(theKey, XSTR(key, "miranda_userdata"))) + else if (!_xcscmp(theKey, XSTR(key, "miranda_userdata"))) theValue = GetPathVarX(key, 3); } - if ( !theValue) + if (!theValue) theValue = GetEnvironmentVariableX(theKey); return theValue; @@ -337,7 +337,7 @@ XCHAR *GetVariableFromArray(REPLACEVARSARRAY *vars, XCHAR *key, size_t keyLength template XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) { - if ( !str) + if (!str) return NULL; XCHAR *p; @@ -361,7 +361,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) } else varStart = p+1; } - else if ( !varStart) + else if (!varStart) length++; } @@ -388,7 +388,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) } else varStart = p+1; } - else if ( !varStart) + else if (!varStart) *q++=*p; } @@ -428,7 +428,7 @@ static int OnFoldersChanged(WPARAM, LPARAM) mir_sntprintf(tszAvatarRoot, SIZEOF(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); TCHAR tmpVar[MAX_PATH]; - if ( !FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot)) + if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot)) _tcsncpy_s(tszAvatarRoot, SIZEOF(tszAvatarRoot), tmpVar, SIZEOF(tmpVar)); return 0; } @@ -438,7 +438,7 @@ void InitPathVar() mir_sntprintf(tszAvatarRoot, SIZEOF(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) { TCHAR tmpVar[MAX_PATH]; - if ( !FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot)) + if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot)) _tcsncpy_s(tszAvatarRoot, SIZEOF(tszAvatarRoot), tmpVar, SIZEOF(tmpVar)); HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged); } diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index 6f27af74f3..174d9ea1fc 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -125,7 +125,7 @@ static void CalcTsOffset(MIM_TIMEZONE *tz) SystemTimeToFileTime(&st, &ft); mir_time ts1 = FileTimeToUnixTime(&ft); - if ( !fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl)) + if (!fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl)) return; SystemTimeToFileTime(&stl, &ft); @@ -174,7 +174,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ; DBVARIANT dbv; - if ( !db_get_ts(hContact, "UserInfo", "TzName", &dbv)) + if (!db_get_ts(hContact, "UserInfo", "TzName", &dbv)) { HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags); db_free(&dbv); @@ -185,7 +185,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) if (timezone == -1) { char *szProto = GetContactProto(hContact); - if ( !db_get_ts(hContact, szProto, "TzName", &dbv)) + if (!db_get_ts(hContact, szProto, "TzName", &dbv)) { HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags); db_free(&dbv); @@ -336,13 +336,13 @@ static const ListMessages cbMessages = static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags) { - if ( !(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) + if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) { TCHAR tszClassName[128]; GetClassName(hWnd, tszClassName, SIZEOF(tszClassName)); - if ( !_tcsicmp(tszClassName, _T("COMBOBOX"))) + if (!_tcsicmp(tszClassName, _T("COMBOBOX"))) dwFlags |= TZF_PLF_CB; - else if ( !_tcsicmp(tszClassName, _T("LISTBOX"))) + else if (!_tcsicmp(tszClassName, _T("LISTBOX"))) dwFlags |= TZF_PLF_LB; } if (dwFlags & TZF_PLF_CB) @@ -366,7 +366,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) if (hContact) { DBVARIANT dbv; - if ( !db_get_ts(hContact, "UserInfo", "TzName", &dbv)) + if (!db_get_ts(hContact, "UserInfo", "TzName", &dbv)) { unsigned hash = mir_hashstrT(dbv.ptszVal); for (int i=0; i < g_timezonesBias.getCount(); i++) @@ -508,9 +508,9 @@ extern "C" __declspec(dllexport) void RecalculateTime(void) MIM_TIMEZONE &tz = g_timezones[i]; if (tz.offset != INT_MIN) tz.offset = INT_MIN; - if ( !found) + if (!found) { - if ( !wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) || + if (!wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) || !wcscmp(tz.tzi.DaylightName, myInfo.myTZ.tzi.DaylightName)) { _tcscpy(myInfo.myTZ.tszName, tz.tszName); diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 8bcb4a1fa7..36815e0a26 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -410,7 +410,7 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam) if (wParam & RWPF_NOACTIVATE) wp.showCmd = SW_SHOWNOACTIVATE; - if ( !(wParam & RWPF_NOMOVE)) + if (!(wParam & RWPF_NOMOVE)) AssertInsideScreen((WPARAM) &wp.rcNormalPosition, 0); SetWindowPlacement(swp->hwnd, &wp); @@ -451,7 +451,7 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) pfnRtlGenRandom = (PGENRANDOM)GetProcAddress(hModule, "SystemFunction036"); if (pfnRtlGenRandom) { - if ( !pfnRtlGenRandom((PVOID)lParam, wParam)) + if (!pfnRtlGenRandom((PVOID)lParam, wParam)) pfnRtlGenRandom = NULL; } } @@ -489,7 +489,7 @@ int LoadUtilsModule(void) void UnloadUtilsModule(void) { - if ( !bModuleInitialized) + if (!bModuleInitialized) return; UninitCrypt(); diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index be0a51998f..cdc7647534 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -201,7 +201,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP break; // It was not a visbility icon - if ( !(hitFlags & CLCHT_ONITEMEXTRA)) + if (!(hitFlags & CLCHT_ONITEMEXTRA)) break; // Get image in clicked column (0 = none, 1 = visible, 2 = invisible) @@ -258,7 +258,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP break; } } - if ( !set) + if (!set) CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0); } return TRUE; diff --git a/src/modules/xml/xmlApi.cpp b/src/modules/xml/xmlApi.cpp index 08b050218a..1c8d522ce2 100644 --- a/src/modules/xml/xmlApi.cpp +++ b/src/modules/xml/xmlApi.cpp @@ -257,7 +257,7 @@ static int xmlapiGetElement(HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *type if (closeTag) *closeTag = NULL; - if ( !type || pos >= XMLNode(_n).nElement()) + if (!type || pos >= XMLNode(_n).nElement()) return false; XMLNodeContents c(XMLNode(_n).enumContents((XMLElementPosition)pos)); switch (c.etype) { diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 7407fa908c..c067317eda 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -177,7 +177,7 @@ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIs if (stats>len/2) return TRUE; // Check for UNICODE NULL chars - for (i=0; ilpszName) || ( !getChildNode().isDeclaration()))) + if ((!isDeclaration())&&((d->lpszName) || (!getChildNode().isDeclaration()))) { if ( fputws(L"\n", f) == EOF) { @@ -603,13 +603,13 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm } } #else - if (( !isDeclaration())&&((d->lpszName) || ( !getChildNode().isDeclaration()))) + if ((!isDeclaration())&&((d->lpszName) || (!getChildNode().isDeclaration()))) { if (characterEncoding == char_encoding_UTF8) { // header so that windows recognize the file as UTF-8: unsigned char h[3] = {0xEF, 0xBB, 0xBF}; - if ( !fwrite(h, 3, 1, f)) + if (!fwrite(h, 3, 1, f)) { fclose(f); return eXMLErrorCannotWriteFile; @@ -617,7 +617,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm encoding = "utf-8"; } else if (characterEncoding == char_encoding_ShiftJIS) encoding = "SHIFT-JIS"; - if ( !encoding) encoding = "ISO-8859-1"; + if (!encoding) encoding = "ISO-8859-1"; if (fprintf(f, "\n", encoding)<0) { fclose(f); @@ -628,7 +628,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm if (characterEncoding == char_encoding_UTF8) { unsigned char h[3] = {0xEF, 0xBB, 0xBF}; - if ( !fwrite(h, 3, 1, f)) + if (!fwrite(h, 3, 1, f)) { fclose(f); return eXMLErrorCannotWriteFile; @@ -638,7 +638,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm #endif int i; XMLSTR t = createXMLString(nFormat, &i); - if ( !fwrite(t, sizeof(XMLCHAR)*i, 1, f)) + if (!fwrite(t, sizeof(XMLCHAR)*i, 1, f)) { free(t); fclose(f); @@ -729,7 +729,7 @@ ToXMLStringTool::~ToXMLStringTool() { freeBuffer(); } void ToXMLStringTool::freeBuffer() { if (buf) free(buf); buf = NULL; buflen = 0; } XMLSTR ToXMLStringTool::toXML(XMLCSTR source) { - if ( !source) + if (!source) { if (buflen<1) { buflen = 1; buf = (XMLSTR)malloc(sizeof(XMLCHAR)); } *buf = 0; @@ -750,7 +750,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) // // in: string (s) and length (lo) of string // out: new allocated string converted from xml - if ( !s) return NULL; + if (!s) return NULL; int ll = 0, j; XMLSTR d; @@ -779,7 +779,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if ((lo>=entity->l)&&(xstrnicmp(s, entity->s, entity->l) == 0)) { s+=entity->l; lo-=entity->l; break; } entity++; } while (entity->s); - if ( !entity->s) + if (!entity->s) { pXML->error = eXMLErrorUnknownCharacterEntity; return NULL; @@ -871,7 +871,7 @@ char myTagCompare(XMLCSTR cclose, XMLCSTR copen) // return 0 if equals // return 1 if different { - if ( !cclose) return 1; + if (!cclose) return 1; int l = (int)xstrlen(cclose); if (xstrnicmp(cclose, copen, l) != 0) return 1; const XMLCHAR c = copen[l]; @@ -965,7 +965,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT ALLXMLClearTag *ctag = XMLClearTags; do { - if ( !xstrncmp(ctag->lpszOpen, result.pStr, ctag->openTagLen)) + if (!xstrncmp(ctag->lpszOpen, result.pStr, ctag->openTagLen)) { result.pClr = ctag; pXML->nIndex+=ctag->openTagLen-1; @@ -1066,7 +1066,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT XMLCSTR XMLNode::updateName_WOSD(XMLSTR lpszName) { - if ( !d) { free(lpszName); return NULL; } + if (!d) { free(lpszName); return NULL; } if (d->lpszName&&(lpszName != d->lpszName)) free((void*)d->lpszName); d->lpszName = lpszName; return lpszName; @@ -1119,7 +1119,7 @@ static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem) { if (p == NULL) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); } if ((memInc == 0) || ((newsize%memInc) == 0)) p = realloc(p, (newsize+memInc)*sizeofElem); - // if ( !p) + // if (!p) // { // printf("XMLParser Error: Not enough memory! Aborting...\n"); exit(220); // } @@ -1177,7 +1177,7 @@ void *XMLNode::addToOrder(int memoryIncrease, int *_pos, int nc, void *p, int si // Add a child node to the given element. XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDeclaration, int pos) { - if ( !lpszName) return emptyXMLNode; + if (!lpszName) return emptyXMLNode; d->pChild = (XMLNode*)addToOrder(memoryIncrease, &pos, d->nChild, d->pChild, sizeof(XMLNode), eNodeChild); d->pChild[pos].d = NULL; d->pChild[pos] = XMLNode(d, lpszName, isDeclaration); @@ -1188,8 +1188,8 @@ XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDecla // Add an attribute to an element. XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XMLSTR lpszValuev) { - if ( !lpszName) return &emptyXMLAttribute; - if ( !d) { myFree(lpszName); myFree(lpszValuev); return &emptyXMLAttribute; } + if (!lpszName) return &emptyXMLAttribute; + if (!d) { myFree(lpszName); myFree(lpszValuev); return &emptyXMLAttribute; } int nc = d->nAttribute; d->pAttribute = (XMLAttribute*)myRealloc(d->pAttribute, (nc+1), memoryIncrease, sizeof(XMLAttribute)); XMLAttribute *pAttr = d->pAttribute+nc; @@ -1199,7 +1199,7 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM TCHAR* p = _tcschr(lpszName, ':'); if (p) - if ( !lstrcmp(p+1, d->lpszNS) || (d->pParent && !lstrcmp(p+1, d->pParent->lpszNS))) + if (!lstrcmp(p+1, d->lpszNS) || (d->pParent && !lstrcmp(p+1, d->pParent->lpszNS))) *p = 0; return pAttr; @@ -1208,8 +1208,8 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM // Add text to the element. XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos) { - if ( !lpszValue) return NULL; - if ( !d) { myFree(lpszValue); return NULL; } + if (!lpszValue) return NULL; + if (!d) { myFree(lpszValue); return NULL; } invalidateInnerText(); d->pText = (XMLCSTR*)addToOrder(memoryIncrease, &pos, d->nText, d->pText, sizeof(XMLSTR), eNodeText); d->pText[pos] = lpszValue; @@ -1220,14 +1220,14 @@ XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos) // Add clear (unformatted) text to the element. XMLClear *XMLNode::addClear_priv(int memoryIncrease, XMLSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, int pos) { - if ( !lpszValue) return &emptyXMLClear; - if ( !d) { myFree(lpszValue); return &emptyXMLClear; } + if (!lpszValue) return &emptyXMLClear; + if (!d) { myFree(lpszValue); return &emptyXMLClear; } invalidateInnerText(); d->pClear = (XMLClear *)addToOrder(memoryIncrease, &pos, d->nClear, d->pClear, sizeof(XMLClear), eNodeClear); XMLClear *pNewClear = d->pClear+pos; pNewClear->lpszValue = lpszValue; - if ( !lpszOpen) lpszOpen = XMLClearTags->lpszOpen; - if ( !lpszClose) lpszClose = XMLClearTags->lpszClose; + if (!lpszOpen) lpszOpen = XMLClearTags->lpszOpen; + if (!lpszClose) lpszClose = XMLClearTags->lpszClose; pNewClear->lpszOpenTag = lpszOpen; pNewClear->lpszCloseTag = lpszClose; d->nClear++; @@ -1292,14 +1292,14 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) { XML *pXML = (XML *)pa; XMLCSTR lpszText = pXML->lpszText; - if ( !lpszText) return 0; + if (!lpszText) return 0; if (dropWhiteSpace) while (XML_isSPACECHAR(*lpszText)&&(lpszText != tokenPStr)) lpszText++; int cbText = (int)(tokenPStr - lpszText); - if ( !cbText) { pXML->lpszText = NULL; return 0; } + if (!cbText) { pXML->lpszText = NULL; return 0; } if (dropWhiteSpace) { cbText--; while ((cbText)&&XML_isSPACECHAR(lpszText[cbText])) cbText--; cbText++; } - if ( !cbText) { pXML->lpszText = NULL; return 0; } + if (!cbText) { pXML->lpszText = NULL; return 0; } XMLSTR lpt = fromXMLString(lpszText, cbText, pXML); - if ( !lpt) return 1; + if (!lpt) return 1; pXML->lpszText = NULL; if (removeCommentsInMiddleOfText && d->nText && d->nClear) { @@ -1316,7 +1316,7 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) n = xstrlen(d->pText[i]); int n2 = xstrlen(lpt)+1; d->pText[i] = (XMLSTR)realloc((void*)d->pText[i], (n+n2)*sizeof(XMLCHAR)); - if ( !d->pText[i]) return 1; + if (!d->pText[i]) return 1; memcpy((void*)(d->pText[i]+n), lpt, n2*sizeof(XMLCHAR)); free(lpt); return 0; @@ -1422,13 +1422,13 @@ int XMLNode::ParseXMLElement(void *pa) // the current one and recurse pNew = addChild_priv(MEMORYINCREASE, stringDup(token.pStr, cbToken), nDeclaration, -1); - while ( !pNew.isEmpty()) + while (!pNew.isEmpty()) { // Callself to process the new node. If we return // FALSE this means we dont have any more // processing to do... - if ( !pNew.ParseXMLElement(pXML)) return FALSE; + if (!pNew.ParseXMLElement(pXML)) return FALSE; else { // If the call to recurse this function @@ -1441,7 +1441,7 @@ int XMLNode::ParseXMLElement(void *pa) { // If we are back at the root node then we // have an unmatched end tag - if ( !d->lpszName) + if (!d->lpszName) { pXML->error = eXMLErrorUnmatchedEndTag; return FALSE; @@ -1517,7 +1517,7 @@ int XMLNode::ParseXMLElement(void *pa) // We need to return to the previous caller. If the name // of the tag cannot be found we need to keep returning to // caller until we find a match - if ( !d->lpszNS) { + if (!d->lpszNS) { if (myTagCompare(d->lpszName, lpszTemp) != 0) #ifdef STRICT_PARSING { @@ -1538,7 +1538,7 @@ LBL_Error: } else { const TCHAR* p = _tcschr(lpszTemp, ':'); - if ( !p) + if (!p) goto LBL_Error; if (myTagCompare(d->lpszName, p+1) != 0) @@ -1707,7 +1707,7 @@ LBL_Error: if (attrVal) { attrVal = fromXMLString(attrVal, cbToken, pXML); - if ( !attrVal) return FALSE; + if (!attrVal) return FALSE; } addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), attrVal); } @@ -1735,7 +1735,7 @@ LBL_Error: // If we failed to obtain the next token else { - if (( !d->isDeclaration)&&(d->pParent)) + if ((!d->isDeclaration)&&(d->pParent)) { #ifdef STRICT_PARSING pXML->error = eXMLErrorUnmatchedEndTag; @@ -1776,7 +1776,7 @@ static void CountLinesAndColumns(XMLCSTR lpXML, int nUpto, XMLResults *pResults) // Parse XML and return the root element. XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) { - if ( !lpszXML) + if (!lpszXML) { if (pResults) { @@ -1793,14 +1793,14 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) // Create header element xnode.ParseXMLElement(&xml); enum XMLError error = xml.error; - if ( !xnode.nChildNode()) error = eXMLErrorNoXMLTagFound; + if (!xnode.nChildNode()) error = eXMLErrorNoXMLTagFound; if ((xnode.nChildNode() == 1)&&(xnode.nElement() == 1)) xnode = xnode.getChildNode(); // skip the empty node // If no error occurred if ((error == eXMLErrorNone) || (error == eXMLErrorMissingEndTag) || (error == eXMLErrorNoXMLTagFound)) { XMLCSTR name = xnode.getName(); - if (tag&&(*tag)&&(( !name) || (xstricmp(name, tag)))) + if (tag&&(*tag)&&((!name) || (xstricmp(name, tag)))) { xnode = xnode.getChildNode(tag); if (xnode.isEmpty()) @@ -1847,7 +1847,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) if (f == NULL) { if (pResults) pResults->error = eXMLErrorFileNotFound; return emptyXMLNode; } fseek(f, 0, SEEK_END); int l = (int)ftell(f), headerSz = 0; - if ( !l) { if (pResults) pResults->error = eXMLErrorEmpty; fclose(f); return emptyXMLNode; } + if (!l) { if (pResults) pResults->error = eXMLErrorEmpty; fclose(f); return emptyXMLNode; } fseek(f, 0, SEEK_SET); unsigned char *buf = (unsigned char*)malloc(l+4); l = (int)fread(buf, 1, l, f); @@ -1856,12 +1856,12 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) #ifdef _XMLWIDECHAR if (guessWideCharChars) { - if ( !myIsTextWideChar(buf, l)) + if (!myIsTextWideChar(buf, l)) { XMLNode::XMLCharEncoding ce = XMLNode::char_encoding_legacy; if ((buf[0] == 0xef)&&(buf[1] == 0xbb)&&(buf[2] == 0xbf)) { headerSz = 3; ce = XMLNode::char_encoding_UTF8; } XMLSTR b2 = myMultiByteToWideChar((const char*)(buf+headerSz), ce); - if ( !b2) + if (!b2) { // todo: unable to convert } @@ -1898,7 +1898,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) } #endif - if ( !buf) { if (pResults) pResults->error = eXMLErrorCharConversionError; return emptyXMLNode; } + if (!buf) { if (pResults) pResults->error = eXMLErrorCharConversionError; return emptyXMLNode; } XMLNode x = parseString((XMLSTR)(buf+headerSz), tag, pResults); free(buf); return x; @@ -1919,7 +1919,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma int nChildFormat = -1; int nElementI = pEntry->nChild+pEntry->nText+pEntry->nClear; int i, j; - if ((nFormat>=0)&&(nElementI == 1)&&(pEntry->nText == 1)&&( !pEntry->isDeclaration)) nFormat = -2; + if ((nFormat>=0)&&(nElementI == 1)&&(pEntry->nText == 1)&&(!pEntry->isDeclaration)) nFormat = -2; assert(pEntry); @@ -2006,7 +2006,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma // determine the number of spaces used for prefixes. if (nFormat != -1) { - if (cbElement&&( !pEntry->isDeclaration)) nChildFormat = nFormat+1; + if (cbElement&&(!pEntry->isDeclaration)) nChildFormat = nFormat+1; else nChildFormat = nFormat; } @@ -2101,7 +2101,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma } } - if ((cbElement)&&( !pEntry->isDeclaration)) + if ((cbElement)&&(!pEntry->isDeclaration)) { // If we have child entries we need to use long XML notation for // closing the element - "blah blah blah" @@ -2164,13 +2164,13 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma // this with free(). XMLSTR XMLNode::createXMLString(int nFormat, int *pnSize) const { - if ( !d) { if (pnSize) *pnSize = 0; return NULL; } + if (!d) { if (pnSize) *pnSize = 0; return NULL; } XMLSTR lpszResult = NULL; int cbStr; // Recursively Calculate the size of the XML string - if ( !dropWhiteSpace) nFormat = 0; + if (!dropWhiteSpace) nFormat = 0; nFormat = nFormat ? 0 : -1; cbStr = CreateXMLStringR(d, 0, nFormat); // Alllocate memory for the XML string + the NULL terminator and @@ -2195,13 +2195,13 @@ int XMLNode::detachFromParent(XMLNodeData *d) XMLNode::~XMLNode() { - if ( !d) return; + if (!d) return; d->ref_count--; emptyTheNode(0); } void XMLNode::deleteNodeContent() { - if ( !d) return; + if (!d) return; if (d->pParent) { detachFromParent(d); d->pParent = NULL; d->ref_count--; } emptyTheNode(1); } @@ -2249,7 +2249,7 @@ void XMLNode::emptyTheNode(char force) } void XMLNode::invalidateInnerText() { - if ( !d) return; + if (!d) return; myFree(d->pInnerText); d->pInnerText = NULL; } @@ -2275,7 +2275,7 @@ XMLNode::XMLNode(const XMLNode &A) XMLNode XMLNode::deepCopy() const { - if ( !d) return XMLNode::emptyXMLNode; + if (!d) return XMLNode::emptyXMLNode; XMLNode x(NULL, stringDup(d->lpszName), d->isDeclaration); XMLNodeData *p = x.d; int n = d->nAttribute; @@ -2326,8 +2326,8 @@ XMLNode XMLNode::deepCopy() const XMLNode XMLNode::addChild(XMLNode childNode, int pos) { XMLNodeData *dc = childNode.d; - if (( !dc) || ( !d)) return childNode; - if ( !dc->lpszName) + if ((!dc) || (!d)) return childNode; + if (!dc->lpszName) { // this is a root node: todo: correct fix int j = pos; @@ -2350,7 +2350,7 @@ XMLNode XMLNode::addChild(XMLNode childNode, int pos) void XMLNode::deleteAttribute(int i) { - if (( !d) || (i<0) || (i>=d->nAttribute)) return; + if ((!d) || (i<0) || (i>=d->nAttribute)) return; d->nAttribute--; XMLAttribute *p = d->pAttribute+i; free((void*)p->lpszName); @@ -2368,7 +2368,7 @@ void XMLNode::deleteAttribute(XMLCSTR lpszName) XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, int i) { - if ( !d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; } + if (!d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; } if (i>=d->nAttribute) { if (lpszNewName) return addAttribute_WOSD(lpszNewName, lpszNewValue); @@ -2401,9 +2401,9 @@ XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewN int XMLNode::indexText(XMLCSTR lpszValue) const { - if ( !d) return -1; + if (!d) return -1; int i, l = d->nText; - if ( !lpszValue) { if (l) return 0; return -1; } + if (!lpszValue) { if (l) return 0; return -1; } XMLCSTR *p = d->pText; for (i=0; i=d->nText)) return; + if ((!d) || (i<0) || (i>=d->nText)) return; invalidateInnerText(); d->nText--; XMLCSTR *p = d->pText+i; @@ -2424,7 +2424,7 @@ void XMLNode::deleteText(XMLCSTR lpszValue) { deleteText(indexText(lpszValue)); XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i) { - if ( !d) { if (lpszNewValue) free(lpszNewValue); return NULL; } + if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; } if (i>=d->nText) return addText_WOSD(lpszNewValue); invalidateInnerText(); XMLCSTR *p = d->pText+i; @@ -2434,7 +2434,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i) XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue) { - if ( !d) { if (lpszNewValue) free(lpszNewValue); return NULL; } + if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; } int i = indexText(lpszOldValue); if (i>=0) return updateText_WOSD(lpszNewValue, i); return addText_WOSD(lpszNewValue); @@ -2442,7 +2442,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue) void XMLNode::deleteClear(int i) { - if (( !d) || (i<0) || (i>=d->nClear)) return; + if ((!d) || (i<0) || (i>=d->nClear)) return; invalidateInnerText(); d->nClear--; XMLClear *p = d->pClear+i; @@ -2453,9 +2453,9 @@ void XMLNode::deleteClear(int i) int XMLNode::indexClear(XMLCSTR lpszValue) const { - if ( !d) return -1; + if (!d) return -1; int i, l = d->nClear; - if ( !lpszValue) { if (l) return 0; return -1; } + if (!lpszValue) { if (l) return 0; return -1; } XMLClear *p = d->pClear; for (i=0; ilpszValue); } XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i) { - if ( !d) { if (lpszNewContent) free(lpszNewContent); return NULL; } + if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; } if (i>=d->nClear) return addClear_WOSD(lpszNewContent); invalidateInnerText(); XMLClear *p = d->pClear+i; @@ -2476,7 +2476,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i) XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, XMLCSTR lpszOldValue) { - if ( !d) { if (lpszNewContent) free(lpszNewContent); return NULL; } + if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; } int i = indexClear(lpszOldValue); if (i>=0) return updateClear_WOSD(lpszNewContent, i); return addClear_WOSD(lpszNewContent); @@ -2490,7 +2490,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLClear *newP, XMLClear *oldP) int XMLNode::nChildNode(XMLCSTR name) const { - if ( !d) return 0; + if (!d) return 0; int i, j = 0, n = d->nChild; XMLNode *pc = d->pChild; for (i=0; inChild; if (j) i = *j; XMLNode *pc = d->pChild+i; for (; id->lpszName, name)) + if (!xstricmp(pc->d->lpszName, name)) { if (j) *j = i+1; return *pc; @@ -2521,7 +2521,7 @@ XMLNode XMLNode::getChildNode(XMLCSTR name, int *j) const XMLNode XMLNode::getChildNode(XMLCSTR name, int j) const { - if ( !d) return emptyXMLNode; + if (!d) return emptyXMLNode; if (j>=0) { int i=0; @@ -2529,16 +2529,16 @@ XMLNode XMLNode::getChildNode(XMLCSTR name, int j) const return getChildNode(name, &i); } int i = d->nChild; - while (i--) if ( !xstricmp(name, d->pChild[i].d->lpszName)) break; + while (i--) if (!xstricmp(name, d->pChild[i].d->lpszName)) break; if (i<0) return emptyXMLNode; return getChildNode(i); } XMLNode XMLNode::getNextNode() const { - if ( !d) return emptyXMLNode; + if (!d) return emptyXMLNode; XMLNodeDataTag *par = d->pParent; - if ( !par) return emptyXMLNode; + if (!par) return emptyXMLNode; int i, n = par->nChild; for (i=0; ipChild[i].d == d) @@ -2557,7 +2557,7 @@ XMLNode XMLNode::getChildNodeByPath(XMLCSTR _path, char createMissing, XMLCHAR s XMLNode XMLNode::getChildNodeByPathNonConst(XMLSTR path, char createIfMissing, XMLCHAR sep) { - if (( !path) || ( !(*path))) return *this; + if ((!path) || (!(*path))) return *this; XMLNode xn, xbase = *this; XMLCHAR *tend1, sepString[2]; sepString[0] = sep; sepString[1] = 0; tend1 = xstrstr(path, sepString); @@ -2588,7 +2588,7 @@ XMLElementPosition XMLNode::positionOfClear(XMLCSTR lpszValue) const { return po XMLElementPosition XMLNode::positionOfClear(XMLClear *a) const { if (a) return positionOfClear(a->lpszValue); return positionOfClear(); } XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const { - if (( !d) || ( !x.d)) return -1; + if ((!d) || (!x.d)) return -1; XMLNodeData *dd = x.d; XMLNode *pc = d->pChild; int i = d->nChild; @@ -2597,7 +2597,7 @@ XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const } XMLElementPosition XMLNode::positionOfChildNode(XMLCSTR name, int count) const { - if ( !name) return positionOfChildNode(count); + if (!name) return positionOfChildNode(count); int j = 0; do { getChildNode(name, &j); if (j<0) return -1; } while (count--); return findPosition(d, j-1, eNodeChild); @@ -2612,7 +2612,7 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name, XMLCSTR attributeName, do { x = getChildNode(name, &i); - if ( !x.isEmpty()) + if (!x.isEmpty()) { if (attributeValue) { @@ -2627,14 +2627,14 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name, XMLCSTR attributeName, if (x.isAttributeSet(attributeName)) { if (k) *k = i; return x; } } } - } while ( !x.isEmpty()); + } while (!x.isEmpty()); return emptyXMLNode; } // Find an attribute on an node. XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const { - if ( !d) return NULL; + if (!d) return NULL; int i=0, n = d->nAttribute; if (j) i = *j; XMLAttribute *pAttr = d->pAttribute+i; @@ -2652,7 +2652,7 @@ XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const { - if ( !d) return FALSE; + if (!d) return FALSE; int i, n = d->nAttribute; XMLAttribute *pAttr = d->pAttribute; for (i=0; i0) getAttribute(name, &i); return getAttribute(name, &i); @@ -2677,7 +2677,7 @@ XMLCSTR XMLNode::getAttribute(XMLCSTR name, int j) const XMLNodeContents XMLNode::enumContents(int i) const { XMLNodeContents c; - if ( !d) { c.etype = eNodeNULL; return c; } + if (!d) { c.etype = eNodeNULL; return c; } if (inAttribute) { c.etype = eNodeAttribute; @@ -2699,7 +2699,7 @@ XMLNodeContents XMLNode::enumContents(int i) const XMLCSTR XMLNode::getInnerText() const { - if ( !d) return NULL; + if (!d) return NULL; if (nText() <= 1 && nClear() == 0) return getText(); if (d->pInnerText) return d->pInnerText; @@ -2738,20 +2738,20 @@ XMLCSTR XMLNode::getInnerText() const return d->pInnerText = buf; } -XMLCSTR XMLNode::getName() const { if ( !d) return NULL; return d->lpszName; } -int XMLNode::nText() const { if ( !d) return 0; return d->nText; } -int XMLNode::nChildNode() const { if ( !d) return 0; return d->nChild; } -int XMLNode::nAttribute() const { if ( !d) return 0; return d->nAttribute; } -int XMLNode::nClear() const { if ( !d) return 0; return d->nClear; } -int XMLNode::nElement() const { if ( !d) return 0; return d->nAttribute+d->nChild+d->nText+d->nClear; } -XMLClear XMLNode::getClear (int i) const { if (( !d) || (i>=d->nClear)) return emptyXMLClear; return d->pClear[i]; } -XMLAttribute XMLNode::getAttribute (int i) const { if (( !d) || (i>=d->nAttribute)) return emptyXMLAttribute; return d->pAttribute[i]; } -XMLCSTR XMLNode::getAttributeName (int i) const { if (( !d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszName; } -XMLCSTR XMLNode::getAttributeValue(int i) const { if (( !d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszValue; } -XMLCSTR XMLNode::getText (int i) const { if (( !d) || (i>=d->nText)) return NULL; return d->pText[i]; } -XMLNode XMLNode::getChildNode (int i) const { if (( !d) || (i>=d->nChild)) return emptyXMLNode; return d->pChild[i]; } -XMLNode XMLNode::getParentNode () const { if (( !d) || ( !d->pParent)) return emptyXMLNode; return XMLNode(d->pParent); } -char XMLNode::isDeclaration () const { if ( !d) return 0; return d->isDeclaration; } +XMLCSTR XMLNode::getName() const { if (!d) return NULL; return d->lpszName; } +int XMLNode::nText() const { if (!d) return 0; return d->nText; } +int XMLNode::nChildNode() const { if (!d) return 0; return d->nChild; } +int XMLNode::nAttribute() const { if (!d) return 0; return d->nAttribute; } +int XMLNode::nClear() const { if (!d) return 0; return d->nClear; } +int XMLNode::nElement() const { if (!d) return 0; return d->nAttribute+d->nChild+d->nText+d->nClear; } +XMLClear XMLNode::getClear (int i) const { if ((!d) || (i>=d->nClear)) return emptyXMLClear; return d->pClear[i]; } +XMLAttribute XMLNode::getAttribute (int i) const { if ((!d) || (i>=d->nAttribute)) return emptyXMLAttribute; return d->pAttribute[i]; } +XMLCSTR XMLNode::getAttributeName (int i) const { if ((!d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszName; } +XMLCSTR XMLNode::getAttributeValue(int i) const { if ((!d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszValue; } +XMLCSTR XMLNode::getText (int i) const { if ((!d) || (i>=d->nText)) return NULL; return d->pText[i]; } +XMLNode XMLNode::getChildNode (int i) const { if ((!d) || (i>=d->nChild)) return emptyXMLNode; return d->pChild[i]; } +XMLNode XMLNode::getParentNode () const { if ((!d) || (!d->pParent)) return emptyXMLNode; return XMLNode(d->pParent); } +char XMLNode::isDeclaration () const { if (!d) return 0; return d->isDeclaration; } char XMLNode::isEmpty () const { return (d == NULL); } XMLNode XMLNode::emptyNode () { return XMLNode::emptyXMLNode; } @@ -2833,7 +2833,7 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf, int l, char useXM case 1: i++; break; case 0: i = l; } - if ( !useXMLEncodingAttribute) return bestGuess; + if (!useXMLEncodingAttribute) return bestGuess; // if encoding is specified and different from utf-8 than it's non-utf8 // otherwise it's utf-8 char bb[201]; @@ -2841,7 +2841,7 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf, int l, char useXM memcpy(bb, buf, l); // copy buf into bb to be able to do "bb[l] = 0" bb[l] = 0; b = (unsigned char*)strstr(bb, "encoding"); - if ( !b) return bestGuess; + if (!b) return bestGuess; b+=8; while XML_isSPACECHAR(*b) b++; if (*b != '=') return bestGuess; b++; while XML_isSPACECHAR(*b) b++; if ((*b != '\'')&&(*b != '"')) return bestGuess; b++; while XML_isSPACECHAR(*b) b++; @@ -2914,7 +2914,7 @@ XMLSTR XMLParserBase64Tool::encode(unsigned char *inbuf, unsigned int inlen, cha *(curr++) = base64EncodeTable[(j>>12)&0x3f]; *(curr++) = base64EncodeTable[(j>> 6)&0x3f]; *(curr++) = base64EncodeTable[(j)&0x3f]; - if (formatted) { if ( !k) { *(curr++) = _CXML('\n'); k = 18; } k--; } + if (formatted) { if (!k) { *(curr++) = _CXML('\n'); k = 18; } k--; } } eLen = inlen-eLen*3; // 0 - 2. if (eLen == 1) @@ -2937,7 +2937,7 @@ XMLSTR XMLParserBase64Tool::encode(unsigned char *inbuf, unsigned int inlen, cha unsigned int XMLParserBase64Tool::decodeSize(XMLCSTR data, XMLError *xe) { - if ( !data) return 0; + if (!data) return 0; if (xe) *xe = eXMLErrorNone; int size = 0; unsigned char c; @@ -2960,7 +2960,7 @@ unsigned int XMLParserBase64Tool::decodeSize(XMLCSTR data, XMLError *xe) unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int len, XMLError *xe) { - if ( !data) return 0; + if (!data) return 0; if (xe) *xe = eXMLErrorNone; int i=0, p = 0; unsigned char d, c; @@ -3021,19 +3021,19 @@ unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int void XMLParserBase64Tool::alloc(int newsize) { - if (( !buf)&&(newsize)) { buf = malloc(newsize); buflen = newsize; return; } + if ((!buf)&&(newsize)) { buf = malloc(newsize); buflen = newsize; return; } if (newsize>buflen) { buf = realloc(buf, newsize); buflen = newsize; } } unsigned char *XMLParserBase64Tool::decode(XMLCSTR data, int *outlen, XMLError *xe) { if (xe) *xe = eXMLErrorNone; - if ( !data) { *outlen = 0; return (unsigned char*)""; } + if (!data) { *outlen = 0; return (unsigned char*)""; } unsigned int len = decodeSize(data, xe); if (outlen) *outlen = len; - if ( !len) return NULL; + if (!len) return NULL; alloc(len+1); - if( !decode(data, (unsigned char*)buf, len, xe)) { return NULL; } + if(!decode(data, (unsigned char*)buf, len, xe)) { return NULL; } return (unsigned char*)buf; } -- cgit v1.2.3