summaryrefslogtreecommitdiff
path: root/src/modules/utils
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-13 17:26:45 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-13 17:26:45 +0000
commit5e686292c537275c8ea1399f311c082d905e8a63 (patch)
tree88a4f3921ff70323775f3329c8820a0fe947d74f /src/modules/utils
parent90c154b4be566ec4a804217d0f1e50fb1e259b72 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@398 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/utils')
-rw-r--r--src/modules/utils/bmpfilter.cpp2
-rw-r--r--src/modules/utils/hyperlink.cpp26
-rw-r--r--src/modules/utils/openurl.cpp14
-rw-r--r--src/modules/utils/resizer.cpp22
-rw-r--r--src/modules/utils/utils.cpp6
-rw-r--r--src/modules/utils/windowlist.cpp8
6 files changed, 39 insertions, 39 deletions
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp
index 2496c2dcc2..1ea930baf9 100644
--- a/src/modules/utils/bmpfilter.cpp
+++ b/src/modules/utils/bmpfilter.cpp
@@ -96,7 +96,7 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName )
return 0;
pic->get_Type(&picType);
- if (picType!=PICTYPE_BITMAP) {
+ if (picType != PICTYPE_BITMAP) {
pic->Release();
return 0;
}
diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp
index cb7a117845..8100fe1f48 100644
--- a/src/modules/utils/hyperlink.cpp
+++ b/src/modules/utils/hyperlink.cpp
@@ -43,12 +43,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
switch(msg) {
case WM_NCCREATE:
dat=(struct HyperlinkWndData*)mir_calloc(sizeof(struct HyperlinkWndData));
- if (dat==NULL) return FALSE; /* fail creation */
+ if (dat == NULL) return FALSE; /* fail creation */
SetWindowLongPtr(hwnd,0,(LONG_PTR)dat); /* always succeeds */
/* fall thru */
case WM_SYSCOLORCHANGE:
if (!(dat->flags&HLKF_HASENABLECOLOR)) {
- if (GetSysColorBrush(COLOR_HOTLIGHT)==NULL) dat->enableColor=RGB(0,0,255);
+ 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);
}
@@ -108,14 +108,14 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
case WM_SETFONT:
{ LOGFONT lf;
HFONT hFont;
- if ((HFONT)wParam==NULL) { /* use default system color */
+ if ((HFONT)wParam == NULL) { /* use default system color */
dat->hEnableFont=dat->hDisableFont=NULL;
return 0;
}
if (GetObject((HFONT)wParam,sizeof(lf),&lf)) {
lf.lfUnderline=1;
hFont=CreateFontIndirect(&lf);
- if (hFont!=NULL) {
+ if (hFont != NULL) {
dat->hEnableFont=hFont;
dat->hDisableFont=(HFONT)wParam;
if (LOWORD(lParam)) SendMessage(hwnd,HLK_INVALIDATE,0,0);
@@ -135,7 +135,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
pt.x=rcWnd.left;
pt.y=rcWnd.top;
hwndParent=GetParent(hwnd);
- if (hwndParent==NULL) hwndParent=hwnd;
+ if (hwndParent == NULL) hwndParent=hwnd;
if (!ScreenToClient(hwndParent,&pt)) break;
rcWnd.right=pt.x+(rcWnd.right-rcWnd.left);
rcWnd.bottom=pt.y+(rcWnd.bottom-rcWnd.top);
@@ -160,9 +160,9 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
LONG style;
BOOL fMeasured=FALSE;
hdc=GetDC(hwnd);
- if (hdc==NULL) return 0; /* text change failed */
- if (dat->hEnableFont!=NULL) hPrevFont=(HFONT)SelectObject(hdc,dat->hEnableFont);
- if (dat->hEnableFont==NULL || hPrevFont!=NULL) /* select failed? */
+ if (hdc == NULL) return 0; /* text change failed */
+ if (dat->hEnableFont != NULL) hPrevFont=(HFONT)SelectObject(hdc,dat->hEnableFont);
+ if (dat->hEnableFont == NULL || hPrevFont != NULL) /* select failed? */
if (GetTextExtentPoint32(hdc,(TCHAR*)lParam,lstrlen((TCHAR*)lParam),&textSize))
if (GetClientRect(hwnd,&rc)) {
dat->rcText.top=0;
@@ -174,7 +174,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
dat->rcText.right=dat->rcText.left+textSize.cx;
fMeasured=TRUE;
}
- if (dat->hEnableFont!=NULL && hPrevFont!=NULL) SelectObject(hdc,hPrevFont);
+ if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc,hPrevFont);
ReleaseDC(hwnd,hdc);
if (!fMeasured) return 0; /* text change failed */
SendMessage(hwnd,HLK_INVALIDATE,0,0);
@@ -187,7 +187,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
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+ */
+ if (hCursor == NULL) hCursor=LoadCursor(NULL,IDC_HAND); /* Win2000+ */
}
else hCursor=LoadCursor(NULL,IDC_ARROW);
SetCursor(hCursor);
@@ -218,7 +218,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
HDC hdc;
hdc=BeginPaint(hwnd,&ps);
- if (hdc!=NULL) {
+ if (hdc != NULL) {
if (IsWindowEnabled(hwnd)) {
hPrevFont=(HFONT)SelectObject(hdc,dat->hEnableFont);
textColor = (GetFocus() == hwnd) ? dat->focusColor : dat->enableColor;
@@ -241,13 +241,13 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
alignFlag=(GetWindowLongPtr(hwnd,GWL_STYLE)&(SS_CENTER|SS_RIGHT|SS_LEFT));
DrawText(hdc,szText,-1,&rc,alignFlag|DT_NOPREFIX|DT_SINGLELINE|DT_TOP);
}
- if (hPrevFont!=NULL) SelectObject(hdc,hPrevFont);
+ if (hPrevFont != NULL) SelectObject(hdc,hPrevFont);
EndPaint(hwnd,&ps);
}
return 0;
}
case WM_NCDESTROY:
- if (dat->hEnableFont!=NULL) DeleteObject(dat->hEnableFont);
+ if (dat->hEnableFont != NULL) DeleteObject(dat->hEnableFont);
mir_free(dat);
break;
}
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp
index d6a4a937f4..fb10c5f43c 100644
--- a/src/modules/utils/openurl.cpp
+++ b/src/modules/utils/openurl.cpp
@@ -87,7 +87,7 @@ static int DoDdeRequest(const char *szItemName,HWND hwndDdeMsg)
if (dat->fData || dat->fAcked) break;
thisTick=GetTickCount();
if (thisTick>timeoutTick) break;
- } while(MsgWaitForMultipleObjects(0,NULL,FALSE,timeoutTick-thisTick,QS_ALLINPUT)==WAIT_OBJECT_0);
+ } while (MsgWaitForMultipleObjects(0,NULL,FALSE,timeoutTick-thisTick,QS_ALLINPUT) == WAIT_OBJECT_0);
if (!dat->fData) {
GlobalDeleteAtom(hSzItemName);
@@ -155,17 +155,17 @@ static void OpenURLThread(void *arg)
if (!_strnicmp(hUrlInfo->szUrl,"news:",5)) pszProtocol="news";
else pszProtocol="http";
wsprintfA(szSubkey,"%s\\shell\\open\\command",pszProtocol);
- if (RegOpenKeyExA(HKEY_CURRENT_USER,szSubkey,0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS
- || RegOpenKeyExA(HKEY_CLASSES_ROOT,szSubkey,0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS) {
+ if (RegOpenKeyExA(HKEY_CURRENT_USER,szSubkey,0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS
+ || RegOpenKeyExA(HKEY_CLASSES_ROOT,szSubkey,0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS) {
dataLength=SIZEOF(szCommandName);
- if (RegQueryValueEx(hKey,NULL,NULL,NULL,(PBYTE)szCommandName,&dataLength)==ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey,NULL,NULL,NULL,(PBYTE)szCommandName,&dataLength) == ERROR_SUCCESS) {
_strlwr(szCommandName);
if (strstr(szCommandName,"mozilla") || strstr(szCommandName,"netscape"))
- success=(DdeOpenUrl("mozilla",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg)==0 || DdeOpenUrl("netscape",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg)==0);
+ success=(DdeOpenUrl("mozilla",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg) == 0 || DdeOpenUrl("netscape",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg) == 0);
else if (strstr(szCommandName,"iexplore") || strstr(szCommandName,"msimn"))
- success=0==DdeOpenUrl("iexplore",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg);
+ success=0 == DdeOpenUrl("iexplore",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg);
else if (strstr(szCommandName,"opera"))
- success=0==DdeOpenUrl("opera",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg);
+ success=0 == DdeOpenUrl("opera",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg);
//opera's the default anyway
}
RegCloseKey(hKey);
diff --git a/src/modules/utils/resizer.cpp b/src/modules/utils/resizer.cpp
index 17358aadfb..b68e874753 100644
--- a/src/modules/utils/resizer.cpp
+++ b/src/modules/utils/resizer.cpp
@@ -61,28 +61,28 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam)
int procResult;
int extendedDlg,itemCount;
- if (urd==NULL||urd->cbSize!=sizeof(UTILRESIZEDIALOG)) return 1;
+ if (urd == NULL||urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance,FindResourceA(urd->hInstance,urd->lpTemplate,MAKEINTRESOURCEA(5))));
pTemplateEx=(START_OF_DLGTEMPLATEEX*)pTemplate;
- extendedDlg=pTemplateEx->signature==0xFFFF;
- if (extendedDlg && pTemplateEx->dlgVer!=1)
+ extendedDlg=pTemplateEx->signature == 0xFFFF;
+ if (extendedDlg && pTemplateEx->dlgVer != 1)
return 1;
if (extendedDlg) pWord=(PWORD)(pTemplateEx+1);
else pWord=(PWORD)(pTemplate+1);
- if (*pWord==0xFFFF) pWord+=2; else while(*pWord++); //menu
- if (*pWord==0xFFFF) pWord+=2; else while(*pWord++); //class
- while(*pWord++); //title
+ if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //menu
+ if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //class
+ while (*pWord++); //title
if (extendedDlg) {
if (pTemplateEx->style&DS_SETFONT) {
pWord+=3; //font size,weight,italic
- while(*pWord++); //font name
+ while (*pWord++); //font name
}
}
else {
if (pTemplate->style&DS_SETFONT) {
pWord++; //font size
- while(*pWord++); //font name
+ while (*pWord++); //font name
}
}
@@ -117,11 +117,11 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam)
urc.rcItem.left=pItem->x; urc.rcItem.top=pItem->y;
urc.rcItem.right=urc.rcItem.left+pItem->cx; urc.rcItem.bottom=urc.rcItem.top+pItem->cy;
}
- if (*pWord==0xFFFF) pWord+=2; else while(*pWord++); //menu
- if (*pWord==0xFFFF) pWord+=2; else while(*pWord++); //class
+ if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //menu
+ if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //class
pWord+=1+(1+*pWord)/2; //creation data
- if (urc.wId==65535) continue; //using this breaks the dwp, so just ignore it
+ if (urc.wId == 65535) continue; //using this breaks the dwp, so just ignore it
MapDialogRect(urd->hwndDlg,&urc.rcItem);
procResult=(urd->pfnResizer)(urd->hwndDlg,urd->lParam,&urc);
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp
index 04a7da1b5b..2e113f877a 100644
--- a/src/modules/utils/utils.cpp
+++ b/src/modules/utils/utils.cpp
@@ -302,7 +302,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM)
int i;
for (i=0; i < SIZEOF(countries); i++ )
- if ((int)wParam==countries[i].id) return (INT_PTR)countries[i].szName;
+ if ((int)wParam == countries[i].id) return (INT_PTR)countries[i].szName;
return (INT_PTR)NULL;
}
@@ -388,7 +388,7 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam,LPARAM lParam)
x=DBGetContactSettingDword(swp->hContact,swp->szModule,szSettingName,-1);
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", swp->szNamePrefix);
y=(int)DBGetContactSettingDword(swp->hContact,swp->szModule,szSettingName,-1);
- if (x==-1) return 1;
+ if (x == -1) return 1;
if (wParam&RWPF_NOSIZE) {
OffsetRect(&wp.rcNormalPosition,x-wp.rcNormalPosition.left,y-wp.rcNormalPosition.top);
}
@@ -542,7 +542,7 @@ bool __fastcall wildcmp(char * name, char * mask)
if (*mask != '*') return FALSE;
for (;; mask++, name++)
{
- while(*mask == '*')
+ while (*mask == '*')
{
last = mask++;
if (*mask == '\0') return ((BOOL)!*mask); /* true */
diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp
index fea07ac5fb..e67f13c5e8 100644
--- a/src/modules/utils/windowlist.cpp
+++ b/src/modules/utils/windowlist.cpp
@@ -42,7 +42,7 @@ static INT_PTR RemoveFromWindowList(WPARAM wParam,LPARAM lParam)
{
int i;
for (i=0;i<windowListCount;i++)
- if (windowList[i].hwnd==(HWND)lParam && windowList[i].hList==(HANDLE)wParam) {
+ if (windowList[i].hwnd == (HWND)lParam && windowList[i].hList == (HANDLE)wParam) {
MoveMemory(&windowList[i],&windowList[i+1],sizeof(WINDOWLISTENTRY)*(windowListCount-i-1));
windowListCount--;
return 0;
@@ -54,7 +54,7 @@ static INT_PTR FindInWindowList(WPARAM wParam,LPARAM lParam)
{
int i;
for (i=0;i<windowListCount;i++)
- if (windowList[i].hContact==(HANDLE)lParam && windowList[i].hList==(HANDLE)wParam)
+ if (windowList[i].hContact == (HANDLE)lParam && windowList[i].hList == (HANDLE)wParam)
return (INT_PTR)windowList[i].hwnd;
return (INT_PTR)(HWND)NULL;
}
@@ -64,7 +64,7 @@ static INT_PTR BroadcastToWindowList(WPARAM wParam,LPARAM lParam)
int i;
MSG *msg=(MSG*)lParam;
for (i=0;i<windowListCount;i++)
- if (windowList[i].hList==(HANDLE)wParam)
+ if (windowList[i].hList == (HANDLE)wParam)
SendMessage(windowList[i].hwnd,msg->message,msg->wParam,msg->lParam);
return 0;
}
@@ -74,7 +74,7 @@ static INT_PTR BroadcastToWindowListAsync(WPARAM wParam,LPARAM lParam)
int i;
MSG *msg=(MSG*)lParam;
for (i=0;i<windowListCount;i++)
- if (windowList[i].hList==(HANDLE)wParam)
+ if (windowList[i].hList == (HANDLE)wParam)
PostMessage(windowList[i].hwnd,msg->message,msg->wParam,msg->lParam);
return 0;
}