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/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 +++--- 7 files changed, 50 insertions(+), 50 deletions(-) (limited to 'src/modules/utils') 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(); -- cgit v1.2.3