From 46a53191c1ad11a41c948594e972568e62d155b4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jun 2012 13:58:20 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@332 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/utils/colourpicker.cpp | 4 +-- src/modules/utils/hyperlink.cpp | 64 +++++++++++++++++++------------------- src/modules/utils/openurl.cpp | 46 +++++++++++++-------------- src/modules/utils/path.cpp | 4 +-- src/modules/utils/resizer.cpp | 44 +++++++++++++------------- src/modules/utils/timezones.cpp | 4 +-- src/modules/utils/utils.cpp | 24 +++++++------- src/modules/utils/windowlist.cpp | 16 +++++----- 8 files changed, 103 insertions(+), 103 deletions(-) (limited to 'src/modules/utils') diff --git a/src/modules/utils/colourpicker.cpp b/src/modules/utils/colourpicker.cpp index 0f2f9bf8f8..29d25a175f 100644 --- a/src/modules/utils/colourpicker.cpp +++ b/src/modules/utils/colourpicker.cpp @@ -51,7 +51,7 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd,UINT message,WPARAM wParam cc.rgbResult=GetWindowLongPtr(hwnd,0); cc.lpCustColors=custColours; cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT; - if(ChooseColor(&cc)) { + if (ChooseColor(&cc)) { SetWindowLongPtr(hwnd,0,cc.rgbResult); SendMessage(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(hwnd),CPN_COLOURCHANGED),(LPARAM)hwnd); InvalidateRect(hwnd,NULL,FALSE); @@ -72,7 +72,7 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd,UINT message,WPARAM wParam GetClientRect(hwnd,&rc); DrawEdge(hdc1,&rc,EDGE_ETCHED,BF_RECT); InflateRect(&rc,-2,-2); - if(IsWindowEnabled(hwnd)) + if (IsWindowEnabled(hwnd)) hBrush=CreateSolidBrush(GetWindowLongPtr(hwnd,0)); else hBrush=CreateHatchBrush(HS_BDIAGONAL,GetSysColor(COLOR_GRAYTEXT)); diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index 7ed16f6857..cb7a117845 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -43,16 +43,16 @@ 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 (!(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; @@ -101,24 +101,24 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM 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; } 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)) { + 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); + if (LOWORD(lParam)) SendMessage(hwnd,HLK_INVALIDATE,0,0); SendMessage(hwnd,HLK_MEASURETEXT,0,0); } } @@ -131,12 +131,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM { 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 (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); rcWnd.left=pt.x; @@ -149,7 +149,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM 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: @@ -160,34 +160,34 @@ 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(GetTextExtentPoint32(hdc,(TCHAR*)lParam,lstrlen((TCHAR*)lParam),&textSize)) - if(GetClientRect(hwnd,&rc)) { + 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; dat->rcText.bottom=dat->rcText.top+textSize.cy; style=GetWindowLongPtr(hwnd,GWL_STYLE); - if(style&SS_CENTER) dat->rcText.left=(rc.right-textSize.cx)/2; - else if(style&SS_RIGHT) dat->rcText.left=rc.right-textSize.cx; + if (style&SS_CENTER) dat->rcText.left=(rc.right-textSize.cx)/2; + else if (style&SS_RIGHT) dat->rcText.left=rc.right-textSize.cx; else dat->rcText.left=0; 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 */ + 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(PtInRect(&dat->rcText,pt)) { + 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+ */ + if (hCursor==NULL) hCursor=LoadCursor(NULL,IDC_HAND); /* Win2000+ */ } else hCursor=LoadCursor(NULL,IDC_ARROW); SetCursor(hCursor); @@ -218,15 +218,15 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM HDC hdc; hdc=BeginPaint(hwnd,&ps); - if(hdc!=NULL) { - if(IsWindowEnabled(hwnd)) { + if (hdc!=NULL) { + if (IsWindowEnabled(hwnd)) { hPrevFont=(HFONT)SelectObject(hdc,dat->hEnableFont); textColor = (GetFocus() == hwnd) ? dat->focusColor : dat->enableColor; } else { hPrevFont=(HFONT)SelectObject(hdc,dat->hDisableFont); textColor=dat->disableColor; } - if(GetClientRect(hwnd,&rc) && GetWindowText(hwnd,szText,SIZEOF(szText))) { + if (GetClientRect(hwnd,&rc) && GetWindowText(hwnd,szText,SIZEOF(szText))) { if (drawThemeParentBackground && IsWinVerXPPlus()) { BOOL fSmoothing; @@ -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; } @@ -262,7 +262,7 @@ int InitHyperlink(void) wcl.cbClsExtra=0; wcl.cbWndExtra=sizeof(struct HyperlinkWndData*); wcl.hInstance=hMirandaInst; - if(IsWinVer2000Plus()) wcl.hCursor=NULL; + if (IsWinVer2000Plus()) wcl.hCursor=NULL; else wcl.hCursor=LoadCursor(wcl.hInstance,MAKEINTRESOURCE(IDC_HYPERLINKHAND)); wcl.lpszClassName=WNDCLASS_HYPERLINK; wcl.hbrBackground=NULL; diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 02ea139090..d6a4a937f4 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -46,18 +46,18 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM case WM_DDE_DATA: UnpackDDElParam(msg,lParam,(PUINT_PTR)&hDdeData,(PUINT_PTR)&hSzItem); dat->fData=1; - if(hDdeData) { + if (hDdeData) { DDEDATA *data; int release; data=(DDEDATA*)GlobalLock(hDdeData); - if(data->fAckReq) { + if (data->fAckReq) { DDEACK ack={0}; PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,PackDDElParam(WM_DDE_ACK,*(PUINT)&ack,(UINT)hSzItem)); } else GlobalDeleteAtom(hSzItem); release=data->fRelease; GlobalUnlock(hDdeData); - if(release) GlobalFree(hDdeData); + if (release) GlobalFree(hDdeData); } else GlobalDeleteAtom(hSzItem); return 0; @@ -73,23 +73,23 @@ static int DoDdeRequest(const char *szItemName,HWND hwndDdeMsg) struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg,0); hSzItemName=GlobalAddAtomA(szItemName); - if(!PostMessage(dat->hwndDde,WM_DDE_REQUEST,(WPARAM)hwndDdeMsg,MAKELPARAM(CF_TEXT,hSzItemName))) { + if (!PostMessage(dat->hwndDde,WM_DDE_REQUEST,(WPARAM)hwndDdeMsg,MAKELPARAM(CF_TEXT,hSzItemName))) { GlobalDeleteAtom(hSzItemName); return 1; } timeoutTick=GetTickCount()+5000; dat->fData=0; dat->fAcked=0; do { - if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { + if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } - if(dat->fData || dat->fAcked) break; + if (dat->fData || dat->fAcked) break; thisTick=GetTickCount(); - if(thisTick>timeoutTick) break; + if (thisTick>timeoutTick) break; } while(MsgWaitForMultipleObjects(0,NULL,FALSE,timeoutTick-thisTick,QS_ALLINPUT)==WAIT_OBJECT_0); - if(!dat->fData) { + if (!dat->fData) { GlobalDeleteAtom(hSzItemName); return 1; } @@ -107,7 +107,7 @@ static int DdeOpenUrl(const char *szBrowser,char *szUrl,int newWindow,HWND hwndD hSzBrowser=GlobalAddAtomA(szBrowser); hSzTopic=GlobalAddAtomA("WWW_OpenURL"); dat->fAcked=0; - if(!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDdeMsg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,&dwResult) + if (!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDdeMsg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,&dwResult) || !dat->fAcked) { GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); @@ -115,7 +115,7 @@ static int DdeOpenUrl(const char *szBrowser,char *szUrl,int newWindow,HWND hwndD } szItemName=(char*)mir_alloc(lstrlenA(szUrl)+7); wsprintfA(szItemName,"\"%s\",,%d",szUrl,newWindow?0:-1); - if(DoDdeRequest(szItemName,hwndDdeMsg)) { + if (DoDdeRequest(szItemName,hwndDdeMsg)) { mir_free(szItemName); GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); @@ -150,21 +150,21 @@ static void OpenURLThread(void *arg) hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW,_T(""),0,0,0,0,0,NULL,NULL,hMirandaInst,NULL); SetWindowLongPtr(hwndDdeMsg,0,(LONG_PTR)&msgWndData); - if(!_strnicmp(hUrlInfo->szUrl,"ftp:",4) || !_strnicmp(hUrlInfo->szUrl,"ftp.",4)) pszProtocol="ftp"; - if(!_strnicmp(hUrlInfo->szUrl,"mailto:",7)) pszProtocol="mailto"; - if(!_strnicmp(hUrlInfo->szUrl,"news:",5)) pszProtocol="news"; + if (!_strnicmp(hUrlInfo->szUrl,"ftp:",4) || !_strnicmp(hUrlInfo->szUrl,"ftp.",4)) pszProtocol="ftp"; + if (!_strnicmp(hUrlInfo->szUrl,"mailto:",7)) pszProtocol="mailto"; + 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 + 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")) + if (strstr(szCommandName,"mozilla") || strstr(szCommandName,"netscape")) 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")) + else if (strstr(szCommandName,"iexplore") || strstr(szCommandName,"msimn")) success=0==DdeOpenUrl("iexplore",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg); - else if(strstr(szCommandName,"opera")) + else if (strstr(szCommandName,"opera")) success=0==DdeOpenUrl("opera",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg); //opera's the default anyway } @@ -172,19 +172,19 @@ static void OpenURLThread(void *arg) } DestroyWindow(hwndDdeMsg); - if(success) return; + if (success) return; //wack a protocol on it - if((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1]==':') || hUrlInfo->szUrl[0]=='\\') { + if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\') { szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+9); wsprintfA(szResult,"file:///%s",hUrlInfo->szUrl); } else { int i; - for(i=0;isalpha(hUrlInfo->szUrl[i]);i++); - if(hUrlInfo->szUrl[i]==':') szResult=mir_strdup(hUrlInfo->szUrl); + for (i=0;isalpha(hUrlInfo->szUrl[i]);i++); + if (hUrlInfo->szUrl[i] == ':') szResult=mir_strdup(hUrlInfo->szUrl); else { - if(!_strnicmp(hUrlInfo->szUrl,"ftp.",4)) { + if (!_strnicmp(hUrlInfo->szUrl,"ftp.",4)) { szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+7); wsprintfA(szResult,"ftp://%s",hUrlInfo->szUrl); } diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index ff6a5550bb..ed29b7fa24 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -35,7 +35,7 @@ static int pathIsAbsolute(const char *path) { if ( strlen(path) <= 2 ) return 0; - if ((path[1]==':'&&path[2]=='\\')||(path[0]=='\\'&&path[1]=='\\')) + if ((path[1] == ':'&&path[2] == '\\')||(path[0] == '\\'&&path[1] == '\\')) return 1; return 0; } @@ -137,7 +137,7 @@ static int pathIsAbsoluteW(const TCHAR *path) { if ( lstrlen(path) <= 2 ) return 0; - if ((path[1]==':'&&path[2]=='\\')||(path[0]=='\\'&&path[1]=='\\')) + if ((path[1] == ':'&&path[2] == '\\')||(path[0] == '\\'&&path[1] == '\\')) return 1; return 0; } diff --git a/src/modules/utils/resizer.cpp b/src/modules/utils/resizer.cpp index 31806f644e..17358aadfb 100644 --- a/src/modules/utils/resizer.cpp +++ b/src/modules/utils/resizer.cpp @@ -61,26 +61,26 @@ 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) + if (extendedDlg && pTemplateEx->dlgVer!=1) return 1; - if(extendedDlg) pWord=(PWORD)(pTemplateEx+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 + 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) { + if (extendedDlg) { + if (pTemplateEx->style&DS_SETFONT) { pWord+=3; //font size,weight,italic while(*pWord++); //font name } } else { - if(pTemplate->style&DS_SETFONT) { + if (pTemplate->style&DS_SETFONT) { pWord++; //font size while(*pWord++); //font name } @@ -88,20 +88,20 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) urc.cbSize=sizeof(UTILRESIZECONTROL); rc.left=0; rc.top=0; - if(extendedDlg) {rc.right=pTemplateEx->cx; rc.bottom=pTemplateEx->cy;} + if (extendedDlg) {rc.right=pTemplateEx->cx; rc.bottom=pTemplateEx->cy;} else {rc.right=pTemplate->cx; rc.bottom=pTemplate->cy;} MapDialogRect(urd->hwndDlg,&rc); urc.dlgOriginalSize.cx=rc.right; urc.dlgOriginalSize.cy=rc.bottom; GetClientRect(urd->hwndDlg,&rc); urc.dlgNewSize.cx=rc.right; urc.dlgNewSize.cy=rc.bottom; - if(extendedDlg) itemCount=pTemplateEx->cDlgItems; + if (extendedDlg) itemCount=pTemplateEx->cDlgItems; else itemCount=pTemplate->cdit; hDwp=BeginDeferWindowPos(itemCount); - for(i=0;ix; 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); - if(procResult&RD_ANCHORX_RIGHT) { + if (procResult&RD_ANCHORX_RIGHT) { urc.rcItem.left+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx; urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx; } - else if(procResult&RD_ANCHORX_WIDTH) + else if (procResult&RD_ANCHORX_WIDTH) urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx; - else if(procResult&RD_ANCHORX_CENTRE) { + else if (procResult&RD_ANCHORX_CENTRE) { urc.rcItem.left+=(urc.dlgNewSize.cx-urc.dlgOriginalSize.cx)/2; urc.rcItem.right+=(urc.dlgNewSize.cx-urc.dlgOriginalSize.cx)/2; } - if(procResult&RD_ANCHORY_BOTTOM) { + if (procResult&RD_ANCHORY_BOTTOM) { urc.rcItem.top+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy; urc.rcItem.bottom+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy; } - else if(procResult&RD_ANCHORY_HEIGHT) + else if (procResult&RD_ANCHORY_HEIGHT) urc.rcItem.bottom+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy; - else if(procResult&RD_ANCHORY_CENTRE) { + else if (procResult&RD_ANCHORY_CENTRE) { urc.rcItem.top+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2; urc.rcItem.bottom+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2; } diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index 06e66bfbd3..b7947d6e98 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -361,12 +361,12 @@ static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags) GetClassName(hWnd, tszClassName, SIZEOF(tszClassName)); 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) return & cbMessages; - else if(dwFlags & TZF_PLF_LB) + else if (dwFlags & TZF_PLF_LB) return & lbMessages; else return NULL; diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index bbd6deb19f..04a7da1b5b 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -301,8 +301,8 @@ 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; + for (i=0; i < SIZEOF(countries); i++ ) + if ((int)wParam==countries[i].id) return (INT_PTR)countries[i].szName; return (INT_PTR)NULL; } @@ -388,8 +388,8 @@ 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(wParam&RWPF_NOSIZE) { + if (x==-1) return 1; + if (wParam&RWPF_NOSIZE) { OffsetRect(&wp.rcNormalPosition,x-wp.rcNormalPosition.left,y-wp.rcNormalPosition.top); } else { @@ -534,21 +534,21 @@ char* __fastcall ltrimp(char* str) bool __fastcall wildcmp(char * name, char * mask) { char * last='\0'; - for(;; mask++, name++) + for (;; mask++, name++) { - if(*mask != '?' && *mask != *name) break; - if(*name == '\0') return ((BOOL)!*mask); + if (*mask != '?' && *mask != *name) break; + if (*name == '\0') return ((BOOL)!*mask); } - if(*mask != '*') return FALSE; - for(;; mask++, name++) + if (*mask != '*') return FALSE; + for (;; mask++, name++) { while(*mask == '*') { last = mask++; - if(*mask == '\0') return ((BOOL)!*mask); /* true */ + if (*mask == '\0') return ((BOOL)!*mask); /* true */ } - if(*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */ - if(*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last; + if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */ + if (*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last; } } diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index ac1e34f569..fea07ac5fb 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.cpp @@ -41,8 +41,8 @@ static INT_PTR AddToWindowList(WPARAM, LPARAM lParam) static INT_PTR RemoveFromWindowList(WPARAM wParam,LPARAM lParam) { int i; - for(i=0;imessage,msg->wParam,msg->lParam); return 0; } @@ -73,8 +73,8 @@ static INT_PTR BroadcastToWindowListAsync(WPARAM wParam,LPARAM lParam) { int i; MSG *msg=(MSG*)lParam; - for(i=0;imessage,msg->wParam,msg->lParam); return 0; } -- cgit v1.2.3