diff options
Diffstat (limited to 'src/modules')
64 files changed, 1292 insertions, 1291 deletions
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index b21e6aa77f..5a72b7b6e9 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -63,7 +63,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara CallService(MS_DB_EVENT_GET,(WPARAM)acs->handle,(LPARAM)&dbei);
hcontact=*((PHANDLE)(dbei.pBlob+sizeof(DWORD)));
mir_free(dbei.pBlob);
- if (hcontact!=INVALID_HANDLE_VALUE) {
+ if (hcontact != INVALID_HANDLE_VALUE) {
szName = cli.pfnGetContactDisplayName( hcontact, 0 );
isSet = 1;
}
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 66aafc243c..1c6bd79980 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -24,77 +24,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <initguid.h>
#include <oleacc.h>
-// TODO:
-// - Support for bitmap buttons (simple call to DrawIconEx())
-
-static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-typedef struct {
- HWND hwnd;
- int stateId; // button state
- int focus; // has focus (1 or 0)
- HFONT hFont; // font
- HICON arrow; // uses down arrow
- int defbutton; // default button
- HICON hIcon;
- HBITMAP hBitmap;
- int pushBtn;
- int pbState;
- HTHEME hThemeButton;
- HTHEME hThemeToolbar;
- char cHot;
- int flatBtn;
- HWND hwndToolTips;
+struct MButtonCtrl
+{
+ HWND hwnd;
+ int stateId; // button state
+ int focus; // has focus (1 or 0)
+ HFONT hFont; // font
+ HICON arrow; // uses down arrow
+ int defbutton; // default button
+ HICON hIcon;
+ HBITMAP hBitmap;
+ int pushBtn;
+ int pbState;
+ HTHEME hThemeButton;
+ HTHEME hThemeToolbar;
+ TCHAR cHot;
+ int flatBtn;
+ HWND hwndToolTips;
IAccPropServices* pAccPropServices;
-} MButtonCtrl;
-
+};
-static CRITICAL_SECTION csTips;
-static SortedList lToolTips;
-static BOOL bModuleInitialized = FALSE;
-
-typedef struct
+struct TTooltips
{
DWORD ThreadId;
HWND hwnd;
-} TTooltips;
-
-int LoadButtonModule(void)
-{
- WNDCLASSEX wc = {0};
+};
- if ( bModuleInitialized ) return 0;
- bModuleInitialized = TRUE;
-
- wc.cbSize = sizeof(wc);
- wc.lpszClassName = MIRANDABUTTONCLASS;
- wc.lpfnWndProc = MButtonWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.cbWndExtra = sizeof(MButtonCtrl*);
- wc.hbrBackground = 0;
- wc.style = CS_GLOBALCLASS;
- RegisterClassEx(&wc);
-
- InitializeCriticalSection(&csTips);
- lToolTips.increment = 1;
- lToolTips.sortFunc = NumericKeySort;
- return 0;
-}
-
-void UnloadButtonModule()
-{
- if ( !bModuleInitialized ) return;
- EnterCriticalSection(&csTips);
- List_Destroy(&lToolTips);
- LeaveCriticalSection(&csTips);
- DeleteCriticalSection(&csTips);
-}
+static LIST<TTooltips> lToolTips(1, (LIST<TTooltips>::FTSortFunc)NumericKeySort);
+static CRITICAL_SECTION csTips;
+static BOOL bModuleInitialized = FALSE;
// Used for our own cheap TrackMouseEvent
#define BUTTON_POLLID 100
#define BUTTON_POLLDELAY 50
-static void DestroyTheme(MButtonCtrl *ctl) {
+static void DestroyTheme(MButtonCtrl *ctl)
+{
if (closeThemeData) {
if (ctl->hThemeButton) {
closeThemeData(ctl->hThemeButton);
@@ -124,6 +89,7 @@ static void SetHwndPropInt(MButtonCtrl* bct, DWORD idObject, DWORD idChild, MSAA var.lVal = val;
bct->pAccPropServices->SetHwndProp(bct->hwnd, idObject, idChild, idProp, var);
}
+
static int TBStateConvert2Flat(int state)
{
switch(state) {
@@ -140,149 +106,155 @@ static int TBStateConvert2Flat(int state) #define DFCS_HOT 0x1000
#endif
+///////////////////////////////////////////////////////////////////////////////
+// Button painter
+
static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
{
- if (hdcPaint) {
- HDC hdcMem;
- HBITMAP hbmMem;
- HDC hOld;
- RECT rcClient;
-
- GetClientRect(ctl->hwnd, &rcClient);
- hdcMem = CreateCompatibleDC(hdcPaint);
- hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top);
- hOld = ( HDC )SelectObject(hdcMem, hbmMem);
-
- // If its a push button, check to see if it should stay pressed
- if (ctl->pushBtn && ctl->pbState) ctl->stateId = PBS_PRESSED;
-
- // Draw the flat button
- if (ctl->flatBtn) {
- if (ctl->hThemeToolbar) {
- int state = IsWindowEnabled(ctl->hwnd)?(ctl->stateId==PBS_NORMAL&&ctl->defbutton?PBS_DEFAULTED:ctl->stateId):PBS_DISABLED;
- if (isThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) {
- drawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient);
- }
- drawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rcClient, &rcClient);
- }
- else {
- HBRUSH hbr;
+ if (!hdcPaint)
+ return;
- if (ctl->stateId==PBS_PRESSED||ctl->stateId==PBS_HOT)
- hbr = GetSysColorBrush(COLOR_3DLIGHT);
- else {
- HWND hwndParent = GetParent(ctl->hwnd);
- HDC dc = GetDC(hwndParent);
- HBRUSH oldBrush = (HBRUSH)GetCurrentObject( dc, OBJ_BRUSH );
- hbr = (HBRUSH)SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM)dc, (LPARAM)hwndParent);
- SelectObject(dc,oldBrush);
- ReleaseDC(hwndParent,dc);
- }
- if (hbr) {
- FillRect(hdcMem, &rcClient, hbr);
- DeleteObject(hbr);
- }
- if (ctl->stateId==PBS_HOT||ctl->focus) {
- if (ctl->pbState)
- DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT);
- else DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT);
- }
- else if (ctl->stateId==PBS_PRESSED)
- DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER,BF_RECT|BF_SOFT);
+ HDC hdcMem;
+ HBITMAP hbmMem;
+ HDC hOld;
+ RECT rcClient;
+
+ GetClientRect(ctl->hwnd, &rcClient);
+ hdcMem = CreateCompatibleDC(hdcPaint);
+ hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top);
+ hOld = ( HDC )SelectObject(hdcMem, hbmMem);
+
+ // If its a push button, check to see if it should stay pressed
+ if (ctl->pushBtn && ctl->pbState) ctl->stateId = PBS_PRESSED;
+
+ // Draw the flat button
+ if (ctl->flatBtn) {
+ if (ctl->hThemeToolbar) {
+ int state = IsWindowEnabled(ctl->hwnd)?(ctl->stateId == PBS_NORMAL&&ctl->defbutton?PBS_DEFAULTED:ctl->stateId):PBS_DISABLED;
+ if (isThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) {
+ drawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient);
}
+ drawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rcClient, &rcClient);
}
else {
- // Draw background/border
- if (ctl->hThemeButton) {
- int state = IsWindowEnabled(ctl->hwnd)?(ctl->stateId==PBS_NORMAL&&ctl->defbutton?PBS_DEFAULTED:ctl->stateId):PBS_DISABLED;
- if (isThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) {
- drawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient);
- }
- drawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient);
- }
- else {
- UINT uState = DFCS_BUTTONPUSH|((ctl->stateId==PBS_HOT)?DFCS_HOT:0)|((ctl->stateId == PBS_PRESSED)?DFCS_PUSHED:0);
- if (ctl->defbutton&&ctl->stateId==PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON;
- DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState);
- }
+ HBRUSH hbr;
- // Draw focus rectangle if button has focus
- if (ctl->focus) {
- RECT focusRect = rcClient;
- InflateRect(&focusRect, -3, -3);
- DrawFocusRect(hdcMem, &focusRect);
+ if (ctl->stateId == PBS_PRESSED||ctl->stateId == PBS_HOT)
+ hbr = GetSysColorBrush(COLOR_3DLIGHT);
+ else {
+ HWND hwndParent = GetParent(ctl->hwnd);
+ HDC dc = GetDC(hwndParent);
+ HBRUSH oldBrush = (HBRUSH)GetCurrentObject( dc, OBJ_BRUSH );
+ hbr = (HBRUSH)SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM)dc, (LPARAM)hwndParent);
+ SelectObject(dc,oldBrush);
+ ReleaseDC(hwndParent,dc);
}
- }
-
- // If we have an icon or a bitmap, ignore text and only draw the image on the button
- if (ctl->hIcon) {
- int ix = (rcClient.right-rcClient.left)/2 - (GetSystemMetrics(SM_CXSMICON)/2);
- int iy = (rcClient.bottom-rcClient.top)/2 - (GetSystemMetrics(SM_CYSMICON)/2);
- if (ctl->stateId == PBS_PRESSED) {
- ix++;
- iy++;
+ if (hbr) {
+ FillRect(hdcMem, &rcClient, hbr);
+ DeleteObject(hbr);
}
- {
- HIMAGELIST hImageList;
- HICON hIconNew;
-
- hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);
- ImageList_AddIcon(hImageList, ctl->hIcon);
- hIconNew = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);
- DrawState(hdcMem,NULL,NULL,(LPARAM)hIconNew,0,ix,iy,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWindowEnabled(ctl->hwnd)?DST_ICON|DSS_NORMAL:DST_ICON|DSS_DISABLED);
- ImageList_RemoveAll(hImageList);
- ImageList_Destroy(hImageList);
- DestroyIcon(hIconNew);
+ if (ctl->stateId == PBS_HOT||ctl->focus) {
+ if (ctl->pbState)
+ DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT);
+ else DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT);
}
+ else if (ctl->stateId == PBS_PRESSED)
+ DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER,BF_RECT|BF_SOFT);
}
- else if (ctl->hBitmap) {
- BITMAP bminfo;
- int ix,iy;
-
- GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo);
- ix = (rcClient.right-rcClient.left)/2 - (bminfo.bmWidth/2);
- iy = (rcClient.bottom-rcClient.top)/2 - (bminfo.bmHeight/2);
- if (ctl->stateId == PBS_PRESSED) {
- ix++;
- iy++;
+ }
+ else {
+ // Draw background/border
+ if (ctl->hThemeButton) {
+ int state = IsWindowEnabled(ctl->hwnd)?(ctl->stateId == PBS_NORMAL&&ctl->defbutton?PBS_DEFAULTED:ctl->stateId):PBS_DISABLED;
+ if (isThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) {
+ drawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient);
}
- DrawState(hdcMem,NULL,NULL,(LPARAM)ctl->hBitmap,0,ix,iy,bminfo.bmWidth,bminfo.bmHeight,IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED);
+ drawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient);
}
- else if (GetWindowTextLength(ctl->hwnd)) {
- // Draw the text and optinally the arrow
- TCHAR szText[MAX_PATH];
- SIZE sz;
- RECT rcText;
- HFONT hOldFont;
-
- CopyRect(&rcText, &rcClient);
- GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
- SetBkMode(hdcMem, TRANSPARENT);
- hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
- // XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so.
- SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd)||!ctl->hThemeButton?GetSysColor(COLOR_BTNTEXT):GetSysColor(COLOR_GRAYTEXT));
- GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
- if (ctl->cHot) {
- SIZE szHot;
-
- GetTextExtentPoint32 (hdcMem, _T("&"), 1, &szHot);
- 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);
- }
- SelectObject(hdcMem, ctl->hFont);
- DrawState(hdcMem,NULL,NULL,(LPARAM)szText,0,(rcText.right-rcText.left-sz.cx)/2+(!ctl->hThemeButton&&ctl->stateId==PBS_PRESSED?1:0),ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId==PBS_PRESSED?0:1),sz.cx,sz.cy,IsWindowEnabled(ctl->hwnd)||ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED);
- SelectObject(hdcMem, hOldFont);
+ else {
+ UINT uState = DFCS_BUTTONPUSH|((ctl->stateId == PBS_HOT)?DFCS_HOT:0)|((ctl->stateId == PBS_PRESSED)?DFCS_PUSHED:0);
+ if (ctl->defbutton&&ctl->stateId == PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON;
+ DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState);
}
- BitBlt(hdcPaint, 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, hdcMem, 0, 0, SRCCOPY);
- SelectObject(hdcMem, hOld);
- DeleteObject(hbmMem);
- DeleteDC(hdcMem);
+ // Draw focus rectangle if button has focus
+ if (ctl->focus) {
+ RECT focusRect = rcClient;
+ InflateRect(&focusRect, -3, -3);
+ DrawFocusRect(hdcMem, &focusRect);
+ }
+ }
+
+ // If we have an icon or a bitmap, ignore text and only draw the image on the button
+ if (ctl->hIcon) {
+ int ix = (rcClient.right-rcClient.left)/2 - (GetSystemMetrics(SM_CXSMICON)/2);
+ int iy = (rcClient.bottom-rcClient.top)/2 - (GetSystemMetrics(SM_CYSMICON)/2);
+ if (ctl->stateId == PBS_PRESSED) {
+ ix++;
+ iy++;
+ }
+ {
+ HIMAGELIST hImageList;
+ HICON hIconNew;
+
+ hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);
+ ImageList_AddIcon(hImageList, ctl->hIcon);
+ hIconNew = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);
+ DrawState(hdcMem,NULL,NULL,(LPARAM)hIconNew,0,ix,iy,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWindowEnabled(ctl->hwnd)?DST_ICON|DSS_NORMAL:DST_ICON|DSS_DISABLED);
+ ImageList_RemoveAll(hImageList);
+ ImageList_Destroy(hImageList);
+ DestroyIcon(hIconNew);
+ }
+ }
+ else if (ctl->hBitmap) {
+ BITMAP bminfo;
+ int ix,iy;
+
+ GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo);
+ ix = (rcClient.right-rcClient.left)/2 - (bminfo.bmWidth/2);
+ iy = (rcClient.bottom-rcClient.top)/2 - (bminfo.bmHeight/2);
+ if (ctl->stateId == PBS_PRESSED) {
+ ix++;
+ iy++;
+ }
+ DrawState(hdcMem,NULL,NULL,(LPARAM)ctl->hBitmap,0,ix,iy,bminfo.bmWidth,bminfo.bmHeight,IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED);
}
+ else if (GetWindowTextLength(ctl->hwnd)) {
+ // Draw the text and optinally the arrow
+ TCHAR szText[MAX_PATH];
+ SIZE sz;
+ RECT rcText;
+ HFONT hOldFont;
+
+ CopyRect(&rcText, &rcClient);
+ GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
+ SetBkMode(hdcMem, TRANSPARENT);
+ hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
+ // XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so.
+ SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd)||!ctl->hThemeButton?GetSysColor(COLOR_BTNTEXT):GetSysColor(COLOR_GRAYTEXT));
+ GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
+ if (ctl->cHot) {
+ SIZE szHot;
+
+ GetTextExtentPoint32 (hdcMem, _T("&"), 1, &szHot);
+ 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);
+ }
+ SelectObject(hdcMem, ctl->hFont);
+ DrawState(hdcMem,NULL,NULL,(LPARAM)szText,0,(rcText.right-rcText.left-sz.cx)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0),ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId == PBS_PRESSED?0:1),sz.cx,sz.cy,IsWindowEnabled(ctl->hwnd)||ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED);
+ SelectObject(hdcMem, hOldFont);
+ }
+ BitBlt(hdcPaint, 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, hdcMem, 0, 0, SRCCOPY);
+ SelectObject(hdcMem, hOld);
+ DeleteObject(hbmMem);
+ DeleteDC(hdcMem);
}
+///////////////////////////////////////////////////////////////////////////////
+// Button's window procedure
+
static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MButtonCtrl* bct = (MButtonCtrl *)GetWindowLongPtr(hwndDlg, 0);
@@ -290,14 +262,12 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NCCREATE:
SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW);
bct = ( MButtonCtrl* )mir_calloc(sizeof(MButtonCtrl));
- if (bct==NULL) return FALSE;
+ if (bct == NULL) return FALSE;
bct->hwnd = hwndDlg;
bct->stateId = PBS_NORMAL;
bct->hFont = ( HFONT )GetStockObject(DEFAULT_GUI_FONT);
LoadTheme(bct);
- if (SUCCEEDED(CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
- IID_IAccPropServices, (void**)&bct->pAccPropServices)))
- {
+ if (SUCCEEDED(CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, IID_IAccPropServices, (void**)&bct->pAccPropServices))) {
// Annotating the Role of this object to be PushButton
SetHwndPropInt(bct, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, ROLE_SYSTEM_PUSHBUTTON);
}
@@ -326,16 +296,16 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L int idx;
TTooltips tt;
tt.ThreadId = GetCurrentThreadId();
-
- EnterCriticalSection(&csTips);
- if ( List_GetIndex( &lToolTips, &tt, &idx ) ) {
- mir_free( lToolTips.items[idx] );
- List_Remove( &lToolTips, idx );
- DestroyWindow( bct->hwndToolTips );
+
+ EnterCriticalSection(&csTips);
+ if (( idx = lToolTips.getIndex(&tt)) != -1) {
+ mir_free( lToolTips[idx] );
+ lToolTips.remove(idx);
+ DestroyWindow(bct->hwndToolTips);
}
- LeaveCriticalSection(&csTips);
-
- bct->hwndToolTips = NULL;
+ LeaveCriticalSection(&csTips);
+
+ bct->hwndToolTips = NULL;
}
}
if (bct->arrow) IconLib_ReleaseIcon(bct->arrow, 0);
@@ -352,7 +322,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if ( lParam != 0 ) {
TCHAR *tmp = ( TCHAR* )lParam;
while (*tmp) {
- if (*tmp=='&' && *(tmp+1)) {
+ if (*tmp == '&' && *(tmp+1)) {
bct->cHot = _tolower(*(tmp+1));
break;
}
@@ -363,7 +333,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_KEYUP:
- if (bct->stateId!=PBS_DISABLED && wParam == VK_SPACE) {
+ if (bct->stateId != PBS_DISABLED && wParam == VK_SPACE) {
if (bct->pushBtn) {
if (bct->pbState) {
bct->pbState = 0;
@@ -381,7 +351,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_SYSKEYUP:
- if (bct->stateId!=PBS_DISABLED && bct->cHot && bct->cHot == tolower((int)wParam)) {
+ if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int)wParam)) {
if (bct->pushBtn) {
if (bct->pbState) {
bct->pbState = 0;
@@ -412,9 +382,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_PAINT:
{
PAINTSTRUCT ps;
- HDC hdcPaint;
-
- hdcPaint = BeginPaint(hwndDlg, &ps);
+ HDC hdcPaint = BeginPaint(hwndDlg, &ps);
if (hdcPaint) {
PaintWorker(bct, hdcPaint);
EndPaint(hwndDlg, &ps);
@@ -443,15 +411,16 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (bct->hIcon) return (LRESULT)bct->hIcon;
else if (bct->hBitmap) return (LRESULT)bct->hBitmap;
else return 0;
+
case BM_SETCHECK:
if (!bct->pushBtn) break;
if (wParam == BST_CHECKED) {
bct->pbState = 1;
- bct->stateId = PBS_PRESSED;
+ bct->stateId = PBS_PRESSED;
}
else if (wParam == BST_UNCHECKED) {
bct->pbState = 0;
- bct->stateId = PBS_NORMAL;
+ bct->stateId = PBS_NORMAL;
}
InvalidateRect(bct->hwnd, NULL, TRUE);
break;
@@ -476,18 +445,22 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
InvalidateRect(bct->hwnd, NULL, TRUE);
break;
+
case BUTTONSETDEFAULT:
bct->defbutton = wParam?1:0;
InvalidateRect(bct->hwnd, NULL, TRUE);
break;
+
case BUTTONSETASPUSHBTN:
bct->pushBtn = 1;
InvalidateRect(bct->hwnd, NULL, TRUE);
break;
+
case BUTTONSETASFLATBTN:
bct->flatBtn = 1;
InvalidateRect(bct->hwnd, NULL, TRUE);
break;
+
case BUTTONADDTOOLTIP:
if ( wParam ) {
TOOLINFO ti = {0};
@@ -495,18 +468,18 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L int idx;
TTooltips tt;
tt.ThreadId = GetCurrentThreadId();
-
- EnterCriticalSection(&csTips);
- if ( List_GetIndex( &lToolTips, &tt, &idx )) {
- bct->hwndToolTips = ((TTooltips*)lToolTips.items[idx])->hwnd;
- } else {
+
+ EnterCriticalSection(&csTips);
+ if (( idx = lToolTips.getIndex(&tt)) != -1)
+ bct->hwndToolTips = lToolTips[idx]->hwnd;
+ else {
TTooltips *ptt = ( TTooltips* )mir_alloc( sizeof(TTooltips) );
ptt->ThreadId = tt.ThreadId;
ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), TTS_ALWAYSTIP, 0, 0, 0, 0, NULL, NULL, hMirandaInst, NULL);
- List_Insert( &lToolTips, ptt, idx );
+ lToolTips.insert(ptt, idx);
bct->hwndToolTips = ptt->hwnd;
}
- LeaveCriticalSection(&csTips);
+ LeaveCriticalSection(&csTips);
}
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND;
@@ -556,14 +529,14 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_MOUSELEAVE: // faked by the WM_TIMER
- if (bct->stateId!=PBS_DISABLED) { // don't change states if disabled
+ if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_NORMAL;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
break;
case WM_LBUTTONDOWN:
- if (bct->stateId!=PBS_DISABLED) { // don't change states if disabled
+ if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_PRESSED;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
@@ -576,10 +549,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (bct->pbState) bct->pbState = 0;
else bct->pbState = 1;
}
- if (bct->stateId!=PBS_DISABLED) { // don't change states if disabled
- if (bct->stateId==PBS_PRESSED)
+ if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
+ if (bct->stateId == PBS_PRESSED)
showClick = 1;
- if (msg==WM_LBUTTONUP) bct->stateId = PBS_HOT;
+ if (msg == WM_LBUTTONUP) bct->stateId = PBS_HOT;
else bct->stateId = PBS_NORMAL;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
@@ -612,3 +585,39 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
return DefWindowProc(hwndDlg, msg, wParam, lParam);
}
+
+///////////////////////////////////////////////////////////////////////////////
+// Module load
+
+int LoadButtonModule(void)
+{
+ WNDCLASSEX wc = {0};
+
+ if ( bModuleInitialized ) return 0;
+ bModuleInitialized = TRUE;
+
+ wc.cbSize = sizeof(wc);
+ wc.lpszClassName = MIRANDABUTTONCLASS;
+ wc.lpfnWndProc = MButtonWndProc;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.cbWndExtra = sizeof(MButtonCtrl*);
+ wc.hbrBackground = 0;
+ wc.style = CS_GLOBALCLASS;
+ RegisterClassEx(&wc);
+
+ InitializeCriticalSection(&csTips);
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Module unload
+
+void UnloadButtonModule()
+{
+ if ( bModuleInitialized ) {
+ EnterCriticalSection(&csTips);
+ lToolTips.destroy();
+ LeaveCriticalSection(&csTips);
+ DeleteCriticalSection(&csTips);
+ }
+}
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index d81b6335c5..17bf8834e7 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -52,7 +52,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *groupContact;
ClcGroup *group;
CLCINFOITEM *cii = (CLCINFOITEM *) lParam;
- if (cii==NULL || cii->cbSize != sizeof(CLCINFOITEM))
+ if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM))
return (LRESULT) (HANDLE) NULL;
if (cii->hParentGroup == NULL)
group = &dat->list;
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 6b95a648bb..6f8b0c4049 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -91,7 +91,7 @@ static void ShowEventsInTray() char nTrayProtoCnt;
int nTrayCnt=cli.trayIconCount;
if (!cli.events.count || !nTrayCnt) return;
- if (cli.events.count ==1 || nTrayCnt == 1)
+ if (cli.events.count == 1 || nTrayCnt == 1)
{
ShowOneEventInTray(0); //for only one icon in tray show topmost event
return;
@@ -153,7 +153,7 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) int i;
struct CListEvent* p;
- if (cle==NULL || cle->cbSize != sizeof(CLISTEVENT))
+ if (cle == NULL || cle->cbSize != sizeof(CLISTEVENT))
return NULL;
if (cle->flags & CLEF_URGENT) {
@@ -297,9 +297,9 @@ int fnEventsProcessTrayDoubleClick(int index) int i;
char * szProto=NULL;
for (i=0; i<cli.trayIconCount; i++)
- if (cli.trayIcon[i].id==index) {
+ if (cli.trayIcon[i].id == index) {
szProto=cli.trayIcon[i].szProto;
- if (i==0) click_in_first_icon=TRUE;
+ if (i == 0) click_in_first_icon=TRUE;
break;
}
if (szProto) {
@@ -315,7 +315,7 @@ int fnEventsProcessTrayDoubleClick(int index) break;
} }
- if (i==cli.events.count) { //EventNotFound
+ if (i == cli.events.count) { //EventNotFound
//lets process backward try to find first event without desired proto in tray
int j;
if (click_in_first_icon)
@@ -330,11 +330,11 @@ int fnEventsProcessTrayDoubleClick(int index) if (cli.trayIcon[j].szProto && !_strcmpi(eventProto, cli.trayIcon[j].szProto))
break;
- if (j==cli.trayIconCount) {
+ if (j == cli.trayIconCount) {
eventIndex=i;
break;
} } }
- if (i==cli.events.count) { //not found
+ if (i == cli.events.count) { //not found
cli.pfnUnlockTray();
return 1; //continue processing to show contact list
} } } }
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 1d9f8275d7..051cc4cee6 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -375,7 +375,7 @@ static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) //lparam - lparam from winproc
INT_PTR ContactMenuExecService(WPARAM wParam,LPARAM lParam)
{
- if (wParam!=0) {
+ if (wParam != 0) {
lpContactMenuExecParam cmep=(lpContactMenuExecParam)wParam;
//call with wParam=(WPARAM)(HANDLE)hContact,lparam=popupposition
CallService(cmep->szServiceName,lParam,cmep->param);
@@ -603,7 +603,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) CallService(smep->svc, 0, (LPARAM)smep->hMenuItem);
}
else {
- if ( smep->status == 0 && smep->protoindex !=0 && smep->proto != NULL ) {
+ if ( smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL ) {
PMO_IntMenuItem pimi;
char *prot = smep->proto;
char szHumanName[64]={0};
@@ -1118,7 +1118,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) tmi.cbSize=sizeof(tmi);
if (overallStatus >= ID_STATUS_OFFLINE) {
int pos = statustopos(cli.currentStatusMenuItem);
- if (pos==-1) pos=0;
+ if (pos == -1) pos=0;
{ // reset all current possible checked statuses
int pos2;
for (pos2=0; pos2<hStatusMainMenuHandlesCnt; pos2++)
@@ -1258,7 +1258,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam,LPARAM lParam) {
char *buf=mir_strdup(mi->pszService);
int i=0;
- while(buf[i]!='\0' && buf[i]!='/') i++;
+ while (buf[i] != '\0' && buf[i] != '/') i++;
buf[i]='\0';
smep->proto=mir_strdup(buf);
mir_free(buf);
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 717d5beae1..00d4074b33 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -455,7 +455,7 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) }
if ((cli.pfnGetProtocolVisibility(szPreferredProto))
&& (GetAverageMode() == -1)
- && (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_MULTI)
+ && (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI)
&& !(DBGetContactSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT)))
goto LBL_Error;
}
@@ -970,7 +970,7 @@ void fnUnlockTray( void ) // return; //stub to be removed
initcheck;
#ifdef _DEBUG
- if (trayLockCS.RecursionCount==0) DebugBreak(); //try to unlock already
+ if (trayLockCS.RecursionCount == 0) DebugBreak(); //try to unlock already
#endif
LeaveCriticalSection( &trayLockCS );
}
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index ad35aeb3bf..a9619b6302 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -636,7 +636,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_SETCURSOR:
if (cluiopt.transparent) {
- if (!transparentFocus && GetForegroundWindow()!=hwnd && setLayeredWindowAttributes) {
+ if (!transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) {
setLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)cluiopt.alpha, LWA_ALPHA);
transparentFocus=1;
SetTimer(hwnd, TM_AUTOALPHA,250,NULL);
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 56a86bab43..73b3e972d5 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -1121,7 +1121,7 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) break;
memmove(start,start+1,strlen(start+1)+1);
- if (*start!='\0') start++;
+ if (*start != '\0') start++;
else break;
}
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 0d8a883702..84fbaa9e6a 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -382,7 +382,7 @@ WNDPROC MyOldWindowProc=NULL; LRESULT CALLBACK LBTNDOWNProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (uMsg==WM_LBUTTONDOWN && !(GetKeyState(VK_CONTROL)&0x8000)) {
+ if (uMsg == WM_LBUTTONDOWN && !(GetKeyState(VK_CONTROL)&0x8000)) {
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lParam);
@@ -409,7 +409,7 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam) tvi.hItem=hit;
TreeView_GetItem(tvw, &tvi);
- if (hti.hItem!=hit)
+ if (hti.hItem != hit)
((MenuItemOptData *)tvi.lParam)->isSelected=0;
else
((MenuItemOptData *)tvi.lParam)->isSelected=1;
@@ -477,7 +477,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA MenuItemOptData *iod;
hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_MENUITEMS));
- if (hti==NULL)
+ if (hti == NULL)
break;
tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
@@ -619,7 +619,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.hItem=hit;
TreeView_GetItem(tvw,&tvi);
- if (hti.hItem!=hit)
+ if (hti.hItem != hit)
((MenuItemOptData *)tvi.lParam)->isSelected=0;
else
((MenuItemOptData *)tvi.lParam)->isSelected=1;
@@ -634,7 +634,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA LPNMTREEVIEW pn;
pn = (LPNMTREEVIEW) lParam;
//((MenuItemOptData *)(pn->itemNew.lParam))->isSelected=1;
- /*if (pn->action==NotKeyPressed)
+ /*if (pn->action == NotKeyPressed)
{
remove all selection
}
@@ -654,7 +654,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_SET),FALSE);
hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_MENUITEMS));
- if (hti==NULL)
+ if (hti == NULL)
break;
tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
@@ -725,9 +725,9 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2;
TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti);
if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST;
- if (dat->hDragItem==hti.hItem) break;
+ if (dat->hDragItem == hti.hItem) break;
dat->hDragItem=NULL;
- if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem==TVI_FIRST)) {
+ if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem == TVI_FIRST)) {
HWND tvw;
HTREEITEM * pSIT;
HTREEITEM FirstItem=NULL;
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index 287f16b83a..ddf7c287b4 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -168,7 +168,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) {
TCHAR szQuestion[256+100];
mir_sntprintf( szQuestion, SIZEOF(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation can not be undone."), name );
- if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete Group"), MB_YESNO|MB_ICONQUESTION)==IDNO)
+ if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete Group"), MB_YESNO|MB_ICONQUESTION) == IDNO)
return 1;
}
SetCursor(LoadCursor(NULL, IDC_WAIT));
diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 75c2630a33..e02abed203 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -42,7 +42,7 @@ INT_PTR hkSearch(WPARAM wParam,LPARAM lParam) */
static INT_PTR hkRead(WPARAM, LPARAM)
{
- if (cli.pfnEventsProcessTrayDoubleClick(0)==0) return TRUE;
+ if (cli.pfnEventsProcessTrayDoubleClick(0) == 0) return TRUE;
SetForegroundWindow(cli.hwndContactList);
SetFocus(cli.hwndContactList);
return 0;
diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index 471c8530f5..c40792a095 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -211,7 +211,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM while ( tvi.hItem != NULL ) {
TreeView_GetItem(hwndProtoOrder, &tvi);
- if (tvi.lParam!=0) {
+ if (tvi.lParam != 0) {
ProtocolData* ppd = ( ProtocolData* )tvi.lParam;
PROTOACCOUNT* pa = Proto_GetAccount( ppd->RealName );
if ( pa != NULL ) {
diff --git a/src/modules/contacts/contacts.cpp b/src/modules/contacts/contacts.cpp index 043e316512..562965ad17 100644 --- a/src/modules/contacts/contacts.cpp +++ b/src/modules/contacts/contacts.cpp @@ -91,9 +91,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { DBVARIANT dbv;
CONTACTINFO *ci = (CONTACTINFO*)lParam;
- if (ci==NULL) return 1;
- if (ci->szProto==NULL) ci->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT,(WPARAM)ci->hContact,0);
- if (ci->szProto==NULL) return 1;
+ if (ci == NULL) return 1;
+ if (ci->szProto == NULL) ci->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT,(WPARAM)ci->hContact,0);
+ if (ci->szProto == NULL) return 1;
ci->type = 0;
switch(ci->dwFlag & 0x7F) {
case CNF_FIRSTNAME: return ProcessDatabaseValueDefault( ci, "FirstName" );
@@ -141,13 +141,13 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { if ( !GetDatabaseString( ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv ))
return 0;
- if ( !DBGetContactSetting( ci->hContact, ci->szProto, (ci->dwFlag & 0x7F)==CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv )) {
+ if ( !DBGetContactSetting( ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv )) {
if ( dbv.type == DBVT_WORD ) {
int i,countryCount;
struct CountryListEntry *countries;
CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&countryCount,(LPARAM)&countries);
for (i=0;i<countryCount;i++) {
- if (countries[i].id!=dbv.wVal) continue;
+ if (countries[i].id != dbv.wVal) continue;
if ( ci->dwFlag & CNF_UNICODE ) {
int cbLen = MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )countries[i].szName, -1, NULL, 0 );
@@ -163,7 +163,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { return 0;
}
}
- else return ProcessDatabaseValueDefault( ci, (ci->dwFlag & 0x7F)==CNF_COUNTRY ? "Country" : "CompanyCountry" );
+ else return ProcessDatabaseValueDefault( ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry" );
DBFreeVariant(&dbv);
}
break;
@@ -198,7 +198,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { case CNF_UNIQUEID:
{
char *uid = (char*)CallProtoService(ci->szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
- if ((INT_PTR)uid!=CALLSERVICE_NOTFOUND&&uid)
+ if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid)
if (!ProcessDatabaseValueDefault(ci,uid))
return 0;
@@ -209,7 +209,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { 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 ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid)
if (!ProcessDatabaseValueDefault(ci,uid))
return 0;
@@ -226,7 +226,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { // make sure we aren't in CNF_DISPLAYNC mode
// don't get custom name for NULL contact
char* saveProto = ci->szProto; ci->szProto = "CList";
- if (ci->hContact!=NULL && (ci->dwFlag&0x7F)==CNF_DISPLAY && !ProcessDatabaseValueDefault(ci,"MyHandle")) {
+ if (ci->hContact != NULL && (ci->dwFlag&0x7F) == CNF_DISPLAY && !ProcessDatabaseValueDefault(ci,"MyHandle")) {
ci->szProto = saveProto;
return 0;
}
@@ -253,10 +253,10 @@ 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 ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid) {
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);
+ long value = (dbv.type == DBVT_BYTE) ? dbv.bVal:(dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal);
if ( ci->dwFlag & CNF_UNICODE ) {
WCHAR buf[ 40 ];
_ltow( value, buf, 10 );
@@ -392,7 +392,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara cws.value.pbVal = nameOrder;
tvi.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg,IDC_NAMEORDER));
i=0;
- while( tvi.hItem != NULL ) {
+ while ( tvi.hItem != NULL ) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
TreeView_GetItem( GetDlgItem(hwndDlg,IDC_NAMEORDER), &tvi );
nameOrder[i++] = (BYTE)tvi.lParam;
@@ -405,7 +405,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara case IDC_NAMEORDER:
if (((LPNMHDR)lParam)->code == TVN_BEGINDRAGA) {
LPNMTREEVIEWA notify = (LPNMTREEVIEWA)lParam;
- if ( notify->itemNew.lParam==0 || notify->itemNew.lParam == SIZEOF(nameOrderDescr)-1 )
+ if ( notify->itemNew.lParam == 0 || notify->itemNew.lParam == SIZEOF(nameOrderDescr)-1 )
break;
SetCapture(hwndDlg);
dat->dragging=1;
@@ -448,7 +448,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara ScreenToClient(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti.pt);
hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_NAMEORDER))/2;
TreeView_HitTest(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti);
- if (dat->hDragItem==hti.hItem) break;
+ if (dat->hDragItem == hti.hItem) break;
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=hti.hItem;
TreeView_GetItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),&tvi);
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index a2cae1e64b..0ed1001308 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -140,7 +140,7 @@ static int getProfileCmdLineArgs(TCHAR * szProfile, size_t cch) TCHAR szThisParam[1024];
int firstParam=1;
- while(szCmdLine[0])
+ while (szCmdLine[0])
{
if (szCmdLine[0] == '"')
{
@@ -155,7 +155,7 @@ static int getProfileCmdLineArgs(TCHAR * szProfile, size_t cch) lstrcpyn(szThisParam, szCmdLine, min(SIZEOF(szThisParam), szEndOfParam - szCmdLine+1));
szCmdLine = szEndOfParam;
}
- while(*szCmdLine && *szCmdLine<=' ') szCmdLine++;
+ while (*szCmdLine && *szCmdLine<=' ') szCmdLine++;
if (firstParam) { firstParam=0; continue; } //first param is executable name
if (szThisParam[0] == '/' || szThisParam[0] == '-') continue; //no switches supported
@@ -254,7 +254,7 @@ static void moveProfileDirProfiles(TCHAR * profiledir, BOOL isRootDir = TRUE) }
mir_free(profile);
}
- while(FindNextFile(hFind, &ffd));
+ while (FindNextFile(hFind, &ffd));
}
FindClose(hFind);
}
@@ -488,7 +488,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) TCHAR classname[256];
ENUMMIRANDAWINDOW * x = (ENUMMIRANDAWINDOW *)lParam;
DWORD_PTR res=0;
- if ( GetClassName(hwnd,classname,SIZEOF(classname)) && lstrcmp( _T("Miranda"),classname)==0 ) {
+ if ( GetClassName(hwnd,classname,SIZEOF(classname)) && lstrcmp( _T("Miranda"),classname) == 0 ) {
if ( SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res ) {
x->found++;
return FALSE;
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 60a72b71c6..cecbef4dd8 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -203,7 +203,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf bool warnThisSection = false;
char szSection[128]; szSection[0] = 0;
- while(!feof(fp)) {
+ while (!feof(fp)) {
char szLine[2048];
if (fgets(szLine,sizeof(szLine),fp) == NULL)
break;
@@ -286,7 +286,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf warnInfo.szValue=szValue;
warnInfo.warnNoMore=0;
warnInfo.cancel=0;
- if (warnThisSection && IDNO==DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_WARNINICHANGE),NULL,WarnIniChangeDlgProc,(LPARAM)&warnInfo))
+ if (warnThisSection && IDNO == DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_WARNINICHANGE),NULL,WarnIniChangeDlgProc,(LPARAM)&warnInfo))
continue;
if (warnInfo.cancel)
break;
@@ -322,7 +322,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf case 'G':
{ char *pstr;
for (pstr=szValue+1;*pstr;pstr++) {
- if (*pstr=='\\') {
+ if (*pstr == '\\') {
switch(pstr[1]) {
case 'n': *pstr='\n'; break;
case 't': *pstr='\t'; break;
@@ -347,7 +347,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf buf=(PBYTE)mir_alloc(lstrlenA(szValue+1));
for (len=0,pszValue=szValue+1;;len++) {
buf[len]=(BYTE)strtol(pszValue,&pszEnd,0x10);
- if (pszValue==pszEnd) break;
+ if (pszValue == pszEnd) break;
pszValue=pszEnd;
}
cws.szModule=szSection;
@@ -420,8 +420,8 @@ static void DoAutoExec(void) mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
if (!lstrcmpi(szUse,_T("prompt")) && !secFN) {
int result=DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_INSTALLINI),NULL,InstallIniDlgProc,(LPARAM)szIniPath);
- if (result==IDC_NOTOALL) break;
- if (result==IDCANCEL) continue;
+ if (result == IDC_NOTOALL) break;
+ if (result == IDCANCEL) continue;
}
ProcessIniFile(szIniPath, szSafeSections, szUnsafeSections, secur, secFN);
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index fcb7d246f5..b764a43ff3 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -446,7 +446,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, if ( wParam )
{
SetWindowText(dat->hwndOK, TranslateT("&Run"));
- EnableWindow(dat->hwndOK, ListView_GetSelectedCount(hwndList)==1);
+ EnableWindow(dat->hwndOK, ListView_GetSelectedCount(hwndList) == 1);
}
break;
@@ -705,7 +705,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, pshn.lParam=0;
pshn.hdr.code=PSN_RESET;
for (i=0;i<dat->pageCount;i++) {
- if (dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue;
+ if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
pshn.hdr.hwndFrom=dat->opd[i].hwnd;
SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn);
}
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 18d4c28670..380e644228 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -191,8 +191,8 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) {
char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
- if (szProto==NULL) return;
- if (dat->hwndAdvSearch==NULL) {
+ if (szProto == NULL) return;
+ if (dat->hwndAdvSearch == NULL) {
RECT rc;
dat->hwndAdvSearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)hwndDlg);
GetWindowRect(GetDlgItem(hwndDlg,IDC_RESULTS),&rc);
@@ -223,8 +223,8 @@ static void ReposTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) static void ShowTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat)
{
char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
- if (szProto==NULL) return;
- if (dat->hwndTinySearch==NULL) {
+ if (szProto == NULL) return;
+ if (dat->hwndTinySearch == NULL) {
dat->hwndTinySearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)/*GetDlgItem(*/hwndDlg/*,IDC_TINYEXTENDEDGROUP)*/);
if (dat->hwndTinySearch)
ReposTinySearchDlg(hwndDlg, dat);
@@ -236,7 +236,7 @@ static void ShowTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) static void HideAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat)
{
- if (dat->hwndAdvSearch==NULL) return;
+ if (dat->hwndAdvSearch == NULL) return;
if (animateWindow && IsWinVerXPPlus()) //blending is quite slow on win2k
animateWindow(dat->hwndAdvSearch,150,AW_HIDE|AW_BLEND);
else ShowWindow(dat->hwndAdvSearch,SW_HIDE);
@@ -254,7 +254,7 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg,int idControl) int i;
static const int controls[]={IDC_BYPROTOID,IDC_BYEMAIL,IDC_BYNAME,IDC_BYADVANCED,IDC_BYCUSTOM};
for ( i=0; i < SIZEOF(controls); i++ )
- CheckDlgButton(hwndDlg,controls[i],idControl==controls[i]?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,controls[i],idControl == controls[i]?BST_CHECKED:BST_UNCHECKED);
}
#define sttErrMsg TranslateT("You haven't filled in the search field. Please enter a search term and try again.")
@@ -522,7 +522,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
}
case WM_TIMER:
- if (wParam==TIMERID_THROBBER) {
+ if (wParam == TIMERID_THROBBER) {
RECT rc;
HDC hdc;
int borders[3];
@@ -536,7 +536,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case WM_DRAWITEM:
{ DRAWITEMSTRUCT *dis=(DRAWITEMSTRUCT*)lParam;
- if (dis->CtlID==IDC_STATUSBAR && dis->itemID==1) {
+ if (dis->CtlID == IDC_STATUSBAR && dis->itemID == 1) {
RenderThrobber(dis->hDC,&dis->rcItem,&dat->throbbing,&dat->pivot);
return TRUE;
}
@@ -560,7 +560,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP hdi.fmt=HDF_LEFT|HDF_STRING;
Header_SetItem(ListView_GetHeader(hwndList),dat->iLastColumnSortIndex,&hdi);
- if (nmlv->iSubItem!=dat->iLastColumnSortIndex)
+ if (nmlv->iSubItem != dat->iLastColumnSortIndex)
{
dat->bSortAscending=TRUE;
dat->iLastColumnSortIndex=nmlv->iSubItem;
@@ -580,7 +580,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_PROTOLIST:
- if (HIWORD(wParam)==CBN_SELCHANGE) {
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
HideAdvancedSearchDlg(hwndDlg,dat);
if (dat->hwndAdvSearch) {
DestroyWindow(dat->hwndAdvSearch);
@@ -603,14 +603,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP HideAdvancedSearchDlg(hwndDlg,dat);
break;
case IDC_PROTOID:
- if (HIWORD(wParam)==EN_CHANGE) {
+ if (HIWORD(wParam) == EN_CHANGE) {
HideAdvancedSearchDlg(hwndDlg,dat);
CheckSearchTypeRadioButton(hwndDlg,IDC_BYPROTOID);
EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),TRUE);
}
break;
case IDC_EMAIL:
- if (HIWORD(wParam)==EN_CHANGE) {
+ if (HIWORD(wParam) == EN_CHANGE) {
HideAdvancedSearchDlg(hwndDlg,dat);
CheckSearchTypeRadioButton(hwndDlg,IDC_BYEMAIL);
}
@@ -618,7 +618,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_NAMENICK:
case IDC_NAMEFIRST:
case IDC_NAMELAST:
- if (HIWORD(wParam)==EN_CHANGE) {
+ if (HIWORD(wParam) == EN_CHANGE) {
HideAdvancedSearchDlg(hwndDlg,dat);
CheckSearchTypeRadioButton(hwndDlg,IDC_BYNAME);
}
@@ -658,7 +658,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR str[256];
GetDlgItemText(hwndDlg,IDC_PROTOID,str,SIZEOF(str));
rtrim(str);
- if (str[0]==0)
+ if (str[0] == 0)
MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
else
BeginSearch(hwndDlg,dat,szProto,PS_BASICSEARCHT,PF1_BASICSEARCH,str);
@@ -667,7 +667,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR str[256];
GetDlgItemText(hwndDlg,IDC_EMAIL,str,SIZEOF(str));
rtrim(str);
- if (str[0]==0)
+ if (str[0] == 0)
MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
else
BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYEMAILT,PF1_SEARCHBYEMAIL,str);
@@ -681,19 +681,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP psbn.pszFirstName = first;
psbn.pszLastName = last;
psbn.pszNick = nick;
- if (nick[0]==0 && first[0]==0 && last[0]==0)
+ if (nick[0] == 0 && first[0] == 0 && last[0] == 0)
MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
else
BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYNAMET,PF1_SEARCHBYNAME,&psbn);
}
else if (IsDlgButtonChecked(hwndDlg,IDC_BYADVANCED)) {
- if (dat->hwndAdvSearch==NULL)
+ if (dat->hwndAdvSearch == NULL)
MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
else
BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYADVANCED,PF1_EXTSEARCHUI,dat->hwndAdvSearch);
}
- if (dat->searchCount==0) {
+ if (dat->searchCount == 0) {
if (dat->hResultHook) {UnhookEvent(dat->hResultHook); dat->hResultHook=NULL;}
break;
}
@@ -749,8 +749,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
}
}
- if (lParam && dat->hwndTinySearch==(HWND)lParam
- && HIWORD(wParam)==EN_SETFOCUS && LOWORD(wParam)==0
+ if (lParam && dat->hwndTinySearch == (HWND)lParam
+ && HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) == 0
&& !IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) {
CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM);
}
@@ -776,14 +776,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP { ACKDATA *ack=(ACKDATA*)lParam;
int i;
- if (ack->type!=ACKTYPE_SEARCH) break;
+ if (ack->type != ACKTYPE_SEARCH) break;
for (i=0;i<dat->searchCount;i++)
- if (dat->search[i].hProcess==ack->hProcess && dat->search[i].hProcess != NULL && !lstrcmpA(dat->search[i].szProto,ack->szModule)) break;
- if (i==dat->searchCount) break;
- if (ack->result==ACKRESULT_SUCCESS || ack->result==ACKRESULT_FAILED) {
+ if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != NULL && !lstrcmpA(dat->search[i].szProto,ack->szModule)) break;
+ if (i == dat->searchCount) break;
+ if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) {
dat->searchCount--;
memmove(dat->search+i,dat->search+i+1,sizeof(struct ProtoSearchInfo)*(dat->searchCount-i));
- if (dat->searchCount==0) {
+ if (dat->searchCount == 0) {
mir_free(dat->search);
dat->search=NULL;
UnhookEvent(dat->hResultHook);
@@ -794,14 +794,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg);
SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat);
}
- else if (ack->result==ACKRESULT_SEARCHRESULT && ack->lParam) {
+ else if (ack->result == ACKRESULT_SEARCHRESULT && ack->lParam) {
PROTOSEARCHRESULT *psr;
CUSTOMSEARCHRESULTS * csr=(CUSTOMSEARCHRESULTS*)ack->lParam;
dat->bFlexSearchResult=TRUE;
psr=&(csr->psr);
- // check if this is column names data (psr->cbSize==0)
- if ( psr->cbSize==0 ) { // blob contain info about columns
+ // check if this is column names data (psr->cbSize == 0)
+ if ( psr->cbSize == 0 ) { // blob contain info about columns
int iColumn;
LVCOLUMN lvc={0};
@@ -856,7 +856,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--; )
{
szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
- if (szComboProto==NULL) continue;
+ if (szComboProto == NULL) continue;
if (!lstrcmpA(szComboProto,ack->szModule))
{
cbei.mask = CBEIF_IMAGE;
@@ -876,7 +876,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
break;
}
- else if (ack->result==ACKRESULT_DATA) {
+ else if (ack->result == ACKRESULT_DATA) {
LVITEM lvi={0};
int i,col;
PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)ack->lParam;
@@ -900,7 +900,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCOUNT,0,0); i--; )
{
szComboProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,i,0);
- if (szComboProto==NULL) continue;
+ if (szComboProto == NULL) continue;
if (!lstrcmpA(szComboProto,ack->szModule)) {
cbei.mask=CBEIF_IMAGE;
cbei.iItem=i;
@@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP DBWriteContactSettingTString(NULL, "FindAdd", "LastSearched", szProto?szProto:_T(""));
}
SaveColumnSizes(hwndList);
- if (dat->hResultHook!=NULL) UnhookEvent(dat->hResultHook);
+ if (dat->hResultHook != NULL) UnhookEvent(dat->hResultHook);
FreeSearchResults(hwndList);
ImageList_Destroy(dat->himlComboIcons);
mir_free(dat->search);
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 868cd1f126..cc3622609f 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -183,7 +183,7 @@ void FreeSearchResults(HWND hwndResults) lvi.mask=LVIF_PARAM;
ListView_GetItem(hwndResults,&lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
- if (lsr==NULL) continue;
+ if (lsr == NULL) continue;
mir_free(lsr->psr.id);
mir_free(lsr->psr.email);
mir_free(lsr->psr.nick);
@@ -229,7 +229,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * }
if (failures) {
//infuriatingly vague error message. fixme.
- if (dat->searchCount==0) {
+ if (dat->searchCount == 0) {
forkthread(BeginSearchFailed,0,NULL);
mir_free(dat->search);
dat->search=NULL;
@@ -241,7 +241,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * dat->searchCount=1;
dat->search[0].hProcess=(HANDLE)CallProtoService(szProto,szSearchService,0,(LPARAM)pvSearchParams);
dat->search[0].szProto=szProto;
- if (dat->search[0].hProcess==NULL) {
+ if (dat->search[0].hProcess == NULL) {
//infuriatingly vague error message. fixme.
PROTOACCOUNT* pa = Proto_GetAccount(szProto);
forkthread(BeginSearchFailed, 0, mir_tstrdup(pa->tszAccountName));
@@ -296,14 +296,14 @@ void SetStatusBarResultInfo(HWND hwndDlg) lvi.mask=LVIF_PARAM;
ListView_GetItem(hwndResults,&lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
- if (lsr==NULL) continue;
+ if (lsr == NULL) continue;
for (i=0;i<subtotalCount;i++) {
- if (subtotal[i].szProto==lsr->szProto) {
+ if (subtotal[i].szProto == lsr->szProto) {
subtotal[i].count++;
break;
}
}
- if (i==subtotalCount) {
+ if (i == subtotalCount) {
subtotal=(struct ProtoResultsSummary*)mir_realloc(subtotal,sizeof(struct ProtoResultsSummary)*(subtotalCount+1));
subtotal[subtotalCount].szProto=lsr->szProto;
subtotal[subtotalCount++].count=1;
@@ -316,7 +316,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) return;
if ( subtotalCount == 1 ) {
- if (total==1) mir_sntprintf( str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName );
+ if (total == 1) mir_sntprintf( str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName );
else mir_sntprintf( str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName );
}
else {
@@ -341,7 +341,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto)
{
SaveColumnSizes(hwndResults);
- while(ListView_DeleteColumn(hwndResults,0));
+ while (ListView_DeleteColumn(hwndResults,0));
ListView_SetImageList(hwndResults,dat->himlComboIcons,LVSIL_SMALL);
LoadColumnSizes(hwndResults,szProto);
}
@@ -356,7 +356,7 @@ void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y) dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
{ LVITEM lvi;
- if (ListView_GetSelectedCount(GetDlgItem(hwndDlg,IDC_RESULTS))!=1) return;
+ if (ListView_GetSelectedCount(GetDlgItem(hwndDlg,IDC_RESULTS)) != 1) return;
lvi.mask=LVIF_PARAM;
lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_RESULTS),-1,LVNI_ALL|LVNI_SELECTED);
ListView_GetItem(GetDlgItem(hwndDlg,IDC_RESULTS),&lvi);
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index b38936f8c6..961c598c3b 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -419,7 +419,7 @@ static void sttSaveCollapseState( HWND hwndTree ) TVITEM tvi;
hti = TreeView_GetRoot( hwndTree );
- while( hti != NULL ) {
+ while ( hti != NULL ) {
HTREEITEM ht;
TreeItem *treeItem;
@@ -439,7 +439,7 @@ static void sttSaveCollapseState( HWND hwndTree ) ht = TreeView_GetChild( hwndTree, hti );
if ( ht == NULL ) {
ht = TreeView_GetNextSibling( hwndTree, hti );
- while( ht == NULL ) {
+ while ( ht == NULL ) {
hti = TreeView_GetParent( hwndTree, hti );
if ( hti == NULL ) break;
ht = TreeView_GetNextSibling( hwndTree, hti );
@@ -505,7 +505,7 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa int cnt=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0 );
for ( i = 0; i < cnt; i++ ) {
- if (SendDlgItemMessage(hwndDlg,IDC_EFFECT_COMBO,CB_GETITEMDATA,i,0)==pEffect->effectIndex ) {
+ if (SendDlgItemMessage(hwndDlg,IDC_EFFECT_COMBO,CB_GETITEMDATA,i,0) == pEffect->effectIndex ) {
SendDlgItemMessage(hwndDlg,IDC_EFFECT_COMBO,CB_SETCURSEL, i, 0 );
break;
} } }
diff --git a/src/modules/history/history.cpp b/src/modules/history/history.cpp index dda1617443..6e502790b9 100644 --- a/src/modules/history/history.cpp +++ b/src/modules/history/history.cpp @@ -323,7 +323,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP if ( index == LB_ERR )
break;
- if ( MessageBox(hwndDlg,TranslateT("Are you sure you want to delete this history item?"),TranslateT("Delete History"),MB_YESNO|MB_ICONQUESTION)==IDYES) {
+ if ( MessageBox(hwndDlg,TranslateT("Are you sure you want to delete this history item?"),TranslateT("Delete History"),MB_YESNO|MB_ICONQUESTION) == IDYES) {
hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,index,0);
CallService(MS_DB_EVENT_DELETE,(WPARAM)hContact,(LPARAM)hDbevent);
SendMessage(hwndDlg,DM_HREBUILD,0,0);
@@ -337,7 +337,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP DBEVENTINFO dbei;
int sel;
sel=SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0);
- if (sel==LB_ERR) { EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),FALSE); break; }
+ if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),FALSE); break; }
EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),TRUE);
contactName = cli.pfnGetContactDisplayName( hContact, 0 );
hDbEvent=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,sel,0);
@@ -381,7 +381,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP index = -1;
continue;
}
- if (hDbEvent==hDbEventStart) break;
+ if (hDbEvent == hDbEventStart) break;
newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0);
if (newBlobSize>oldBlobSize) {
dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob,newBlobSize);
@@ -392,7 +392,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetObjectDescription(&dbei,str,SIZEOF(str));
if (str[0]) {
CharUpperBuff(str,lstrlen(str));
- if ( _tcsstr(str,(const TCHAR*)lParam)!=NULL) {
+ if ( _tcsstr(str,(const TCHAR*)lParam) != NULL) {
SendDlgItemMessage(hwndDlg,IDC_LIST,LB_SETCURSEL,index,0);
SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_LIST,LBN_SELCHANGE),0);
break;
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index ab7975399f..5000607aaa 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -1437,7 +1437,7 @@ static void SaveCollapseState( HWND hwndTree ) TVITEM tvi;
hti = TreeView_GetRoot( hwndTree );
- while( hti != NULL ) {
+ while ( hti != NULL ) {
HTREEITEM ht;
TreeItem *treeItem;
@@ -1457,7 +1457,7 @@ static void SaveCollapseState( HWND hwndTree ) ht = TreeView_GetChild( hwndTree, hti );
if ( ht == NULL ) {
ht = TreeView_GetNextSibling( hwndTree, hti );
- while( ht == NULL ) {
+ while ( ht == NULL ) {
hti = TreeView_GetParent( hwndTree, hti );
if ( hti == NULL ) break;
ht = TreeView_GetNextSibling( hwndTree, hti );
diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp index c44875c473..8ac510b29a 100644 --- a/src/modules/idle/idle.cpp +++ b/src/modules/idle/idle.cpp @@ -383,8 +383,8 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg, IDC_IDLEONWINDOWS), checked);
EnableWindow(GetDlgItem(hwndDlg, IDC_IDLEONMIRANDA), checked);
EnableWindow(GetDlgItem(hwndDlg, IDC_IDLE1STTIME), checked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AASTATUS), IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE)==BST_CHECKED?1:0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_IDLESTATUSLOCK), IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE)==BST_CHECKED?1:0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AASTATUS), IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE) == BST_CHECKED?1:0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IDLESTATUSLOCK), IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE) == BST_CHECKED?1:0);
break;
}
case WM_NOTIFY:
@@ -401,8 +401,8 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEONLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED));
DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEONTSDC, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLETERMINAL) == BST_CHECKED));
DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEPRIVATE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLEPRIVATE) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_AAENABLE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE)==BST_CHECKED?1:0));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESTATUSLOCK)==BST_CHECKED?1:0));
+ DBWriteContactSettingByte(NULL, IDLEMOD, IDL_AAENABLE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE) == BST_CHECKED?1:0));
+ DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESTATUSLOCK) == BST_CHECKED?1:0));
{
int curSel = SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_GETCURSEL, 0, 0);
if ( curSel != CB_ERR ) {
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index d25576af61..17c62f00cd 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -30,8 +30,8 @@ static const DWORD ignoreIdToPf4[IGNOREEVENT_MAX]={0xFFFFFFFF,0xFFFFFFFF,0xFFFFF static DWORD GetMask(HANDLE hContact)
{
DWORD mask=DBGetContactSettingDword(hContact,"Ignore","Mask1",(DWORD)(-1));
- if (mask==(DWORD)(-1)) {
- if (hContact==NULL) mask=0;
+ if (mask == (DWORD)(-1)) {
+ if (hContact == NULL) mask=0;
else {
if (DBGetContactSettingByte(hContact,"CList","Hidden",0) || DBGetContactSettingByte(hContact,"CList","NotOnList",0))
mask=DBGetContactSettingDword(NULL,"Ignore","Mask1",0);
@@ -52,23 +52,23 @@ static void SetListGroupIcons(HWND hwndList,HANDLE hFirstItem,HANDLE hParentItem typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0);
//check groups
- if (typeOfFirst==CLCIT_GROUP) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList,hChildItem,hItem,childCount);
for (i=0; i < SIZEOF(iconOn); i++)
- if (iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i)==0) iconOn[i]=0;
+ if (iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i) == 0) iconOn[i]=0;
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
}
//check contacts
- if (typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
for ( i=0; i < SIZEOF(iconOn); i++ ) {
iImage=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i);
- if (iconOn[i] && iImage==0) iconOn[i]=0;
- if (iImage!=0xFF) childCount[i]++;
+ if (iconOn[i] && iImage == 0) iconOn[i]=0;
+ if (iImage != 0xFF) childCount[i]++;
}
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem);
}
@@ -88,19 +88,19 @@ static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iIm typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0);
//check groups
- if (typeOfFirst==CLCIT_GROUP) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hChildItem) SetAllChildIcons(hwndList,hChildItem,iColumn,iImage);
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
}
//check contacts
- if (typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
iOldIcon=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
- if (iOldIcon!=0xFF && iOldIcon!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
+ if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem);
}
}
@@ -124,16 +124,16 @@ static void SetIconsForColumn(HWND hwndList,HANDLE hItem,HANDLE hItemAll,int iCo int itemType;
itemType=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hItem,0);
- if (itemType==CLCIT_CONTACT) {
+ if (itemType == CLCIT_CONTACT) {
int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
- if (oldiImage!=0xFF&&oldiImage!=iImage)
+ if (oldiImage != 0xFF&&oldiImage != iImage)
SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
}
- else if (itemType==CLCIT_INFO) {
- if (hItem==hItemAll) SetAllChildIcons(hwndList,hItem,iColumn,iImage);
+ else if (itemType == CLCIT_INFO) {
+ if (hItem == hItemAll) SetAllChildIcons(hwndList,hItem,iColumn,iImage);
else SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); //hItemUnknown
}
- else if (itemType==CLCIT_GROUP) {
+ else if (itemType == CLCIT_GROUP) {
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hItem) SetAllChildIcons(hwndList,hItem,iColumn,iImage);
}
@@ -146,7 +146,7 @@ static void InitialiseItem(HWND hwndList,HANDLE hContact,HANDLE hItem,DWORD prot mask=GetMask(hContact);
for (i=0;i<IGNOREEVENT_MAX;i++)
- if ((ignoreIdToPf1[i]==0xFFFFFFFF&&ignoreIdToPf4[i]==0xFFFFFFFF) || (proto1Caps&ignoreIdToPf1[i]||proto4Caps&ignoreIdToPf4[i]))
+ if ((ignoreIdToPf1[i] == 0xFFFFFFFF&&ignoreIdToPf4[i] == 0xFFFFFFFF) || (proto1Caps&ignoreIdToPf1[i]||proto4Caps&ignoreIdToPf4[i]))
SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,mask&(1<<i)?i+3:0));
SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(IGNOREEVENT_MAX,1));
SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(IGNOREEVENT_MAX+1,2));
@@ -160,7 +160,7 @@ static void SaveItemMask(HWND hwndList,HANDLE hContact,HANDLE hItem,const char * mask=0;
for (i=0;i<IGNOREEVENT_MAX;i++) {
iImage=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0));
- if (iImage && iImage!=0xFF) mask|=1<<i;
+ if (iImage && iImage != 0xFF) mask|=1<<i;
}
DBWriteContactSettingDword(hContact,"Ignore",pszSetting,mask);
}
@@ -174,9 +174,9 @@ static void SetAllContactIcons(HWND hwndList) hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
do {
hItem=(HANDLE)SendMessage(hwndList,CLM_FINDCONTACT,(WPARAM)hContact,0);
- if (hItem && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(IGNOREEVENT_MAX,0))==0xFF) {
+ if (hItem && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(IGNOREEVENT_MAX,0)) == 0xFF) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) proto1Caps=proto4Caps=0;
+ if (szProto == NULL) proto1Caps=proto4Caps=0;
else {
proto1Caps=CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0);
proto4Caps=CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_4,0);
@@ -185,7 +185,7 @@ static void SetAllContactIcons(HWND hwndList) if (!DBGetContactSettingByte(hContact,"CList","Hidden",0))
SendMessage(hwndList,CLM_SETCHECKMARK,(WPARAM)hItem,1);
}
- } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
}
static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
@@ -275,22 +275,22 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM DWORD hitFlags;
int iImage;
- if (nm->iColumn==-1) break;
+ if (nm->iColumn == -1) break;
hItem=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y));
- if (hItem==NULL) break;
+ if (hItem == NULL) break;
if (!(hitFlags&CLCHT_ONITEMEXTRA)) break;
- if (nm->iColumn==IGNOREEVENT_MAX) { //ignore all
+ if (nm->iColumn == IGNOREEVENT_MAX) { //ignore all
for (iImage=0;iImage<IGNOREEVENT_MAX;iImage++)
SetIconsForColumn(GetDlgItem(hwndDlg,IDC_LIST),hItem,hItemAll,iImage,iImage+3);
}
- else if (nm->iColumn==IGNOREEVENT_MAX+1) { //ignore none
+ else if (nm->iColumn == IGNOREEVENT_MAX+1) { //ignore none
for (iImage=0;iImage<IGNOREEVENT_MAX;iImage++)
SetIconsForColumn(GetDlgItem(hwndDlg,IDC_LIST),hItem,hItemAll,iImage,0);
}
else {
iImage=SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn,0));
- if (iImage==0) iImage=nm->iColumn+3;
- else if (iImage!=0xFF) iImage=0;
+ if (iImage == 0) iImage=nm->iColumn+3;
+ else if (iImage != 0xFF) iImage=0;
SetIconsForColumn(GetDlgItem(hwndDlg,IDC_LIST),hItem,hItemAll,nm->iColumn,iImage);
}
SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL);
@@ -313,7 +313,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM DBDeleteContactSetting(hContact,"CList","Hidden");
else
DBWriteContactSettingByte(hContact,"CList","Hidden",1);
- } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
SaveItemMask(GetDlgItem(hwndDlg,IDC_LIST),NULL,hItemAll,"Default1");
SaveItemMask(GetDlgItem(hwndDlg,IDC_LIST),NULL,hItemUnknown,"Mask1");
return TRUE;
@@ -367,8 +367,8 @@ static INT_PTR IsIgnored(WPARAM wParam,LPARAM lParam) static INT_PTR Ignore(WPARAM wParam,LPARAM lParam)
{
DWORD mask=GetMask((HANDLE)wParam);
- if ((lParam<1 || lParam>IGNOREEVENT_MAX) && lParam!=IGNOREEVENT_ALL) return 1;
- if (lParam==IGNOREEVENT_ALL) mask=(1<<IGNOREEVENT_MAX)-1;
+ if ((lParam<1 || lParam>IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL) return 1;
+ if (lParam == IGNOREEVENT_ALL) mask=(1<<IGNOREEVENT_MAX)-1;
else mask|=1<<(lParam-1);
DBWriteContactSettingDword((HANDLE)wParam,"Ignore","Mask1",mask);
return 0;
@@ -377,8 +377,8 @@ static INT_PTR Ignore(WPARAM wParam,LPARAM lParam) static INT_PTR Unignore(WPARAM wParam,LPARAM lParam)
{
DWORD mask=GetMask((HANDLE)wParam);
- if ((lParam<1 || lParam>IGNOREEVENT_MAX) && lParam!=IGNOREEVENT_ALL) return 1;
- if (lParam==IGNOREEVENT_ALL) mask=0;
+ if ((lParam<1 || lParam>IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL) return 1;
+ if (lParam == IGNOREEVENT_ALL) mask=0;
else mask&=~(1<<(lParam-1));
DBWriteContactSettingDword((HANDLE)wParam,"Ignore","Mask1",mask);
return 0;
@@ -417,7 +417,7 @@ static INT_PTR IgnoreRecvAuth(WPARAM wParam,LPARAM lParam) static int IgnoreAddedNotify(WPARAM, LPARAM lParam)
{
DBEVENTINFO *dbei=(DBEVENTINFO*)lParam;
- if (dbei && dbei->eventType==EVENTTYPE_ADDED && dbei->pBlob!=NULL) {
+ if (dbei && dbei->eventType == EVENTTYPE_ADDED && dbei->pBlob != NULL) {
HANDLE hContact;
hContact=*((PHANDLE)(dbei->pBlob+sizeof(DWORD)));
diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp index bffe6898f7..5013361393 100644 --- a/src/modules/langpack/langpack.cpp +++ b/src/modules/langpack/langpack.cpp @@ -71,7 +71,7 @@ static int IsEmpty(char *str) while (str[i])
{
- if (str[i]!=' '&&str[i]!='\r'&&str[i]!='\n')
+ if (str[i] != ' '&&str[i] != '\r'&&str[i] != '\n')
return 0;
i++;
}
@@ -110,7 +110,7 @@ unsigned int __fastcall hash(const void * key, unsigned int len) // Mix 4 bytes at a time into the hash
const unsigned char * data = (const unsigned char *)key;
- while(len >= 4)
+ while (len >= 4)
{
unsigned int k = *(unsigned int *)data;
@@ -361,7 +361,7 @@ static int LoadLangPack(const TCHAR *szLangPack) break;
lrtrim( line );
- if ( IsEmpty( line ) || line[0] == ';' || line[0]==0)
+ if ( IsEmpty( line ) || line[0] == ';' || line[0] == 0)
continue;
if ( line[0] == '[' || line[0] == '#' )
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index ed084b523d..80e005ad7a 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -69,13 +69,13 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which) DWORD dwCurrentThreadId=GetCurrentThreadId();
WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
- if (nlc==NULL || nlc->handleType!=NLH_CONNECTION) {
+ if (nlc == NULL || nlc->handleType != NLH_CONNECTION) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
nlncs = (which == NLNCS_SEND) ? &nlc->ncsSend : &nlc->ncsRecv;
- if (nlncs->lockCount && nlncs->dwOwningThreadId==dwCurrentThreadId) {
+ if (nlncs->lockCount && nlncs->dwOwningThreadId == dwCurrentThreadId) {
nlncs->lockCount++;
ReleaseMutex(hConnectionHeaderMutex);
return 1;
@@ -86,14 +86,14 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which) WaitForSingleObject(nlncs->hMutex,INFINITE);
nlncs->dwOwningThreadId=dwCurrentThreadId;
nlncs->lockCount=1;
- if (InterlockedDecrement(&nlc->dontCloseNow)==0)
+ if (InterlockedDecrement(&nlc->dontCloseNow) == 0)
SetEvent(nlc->hOkToCloseEvent);
return 1;
}
void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs)
{
- if (--nlncs->lockCount==0) {
+ if (--nlncs->lockCount == 0) {
nlncs->dwOwningThreadId=0;
ReleaseMutex(nlncs->hMutex);
}
@@ -105,8 +105,8 @@ static INT_PTR GetNetlibUserSettingInt(const char *szUserModule,const char *szSe if (DBGetContactSetting(NULL,szUserModule,szSetting,&dbv)
&& DBGetContactSetting(NULL,"Netlib",szSetting,&dbv))
return defValue;
- if (dbv.type==DBVT_BYTE) return dbv.bVal;
- if (dbv.type==DBVT_WORD) return dbv.wVal;
+ if (dbv.type == DBVT_BYTE) return dbv.bVal;
+ if (dbv.type == DBVT_WORD) return dbv.wVal;
return dbv.dVal;
}
@@ -122,7 +122,7 @@ static char *GetNetlibUserSettingString(const char *szUserModule,const char *szS if (decode) CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
szRet=mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
- if (szRet==NULL) SetLastError(ERROR_OUTOFMEMORY);
+ if (szRet == NULL) SetLastError(ERROR_OUTOFMEMORY);
return szRet;
}
}
@@ -132,9 +132,9 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam) NETLIBUSER *nlu=(NETLIBUSER*)lParam;
struct NetlibUser *thisUser;
- if (nlu==NULL || nlu->cbSize!=sizeof(NETLIBUSER) || nlu->szSettingsModule==NULL
- || (!(nlu->flags&NUF_NOOPTIONS) && nlu->szDescriptiveName==NULL)
- || (nlu->flags&NUF_HTTPGATEWAY && (nlu->pfnHttpGatewayInit==NULL))) {
+ if (nlu == NULL || nlu->cbSize != sizeof(NETLIBUSER) || nlu->szSettingsModule == NULL
+ || (!(nlu->flags&NUF_NOOPTIONS) && nlu->szDescriptiveName == NULL)
+ || (nlu->flags&NUF_HTTPGATEWAY && (nlu->pfnHttpGatewayInit == NULL))) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -156,9 +156,9 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam) if (nlu->szDescriptiveName) {
thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_u2t((WCHAR*)nlu->ptszDescriptiveName) : mir_a2t(nlu->szDescriptiveName));
}
- if ((thisUser->user.szSettingsModule=mir_strdup(nlu->szSettingsModule))==NULL
- || (nlu->szDescriptiveName && thisUser->user.ptszDescriptiveName ==NULL)
- || (nlu->szHttpGatewayUserAgent && (thisUser->user.szHttpGatewayUserAgent=mir_strdup(nlu->szHttpGatewayUserAgent))==NULL))
+ if ((thisUser->user.szSettingsModule=mir_strdup(nlu->szSettingsModule)) == NULL
+ || (nlu->szDescriptiveName && thisUser->user.ptszDescriptiveName == NULL)
+ || (nlu->szHttpGatewayUserAgent && (thisUser->user.szHttpGatewayUserAgent=mir_strdup(nlu->szHttpGatewayUserAgent)) == NULL))
{
mir_free(thisUser);
SetLastError(ERROR_OUTOFMEMORY);
@@ -172,9 +172,9 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam) thisUser->settings.cbSize=sizeof(NETLIBUSERSETTINGS);
thisUser->settings.useProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLUseProxy",0);
thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLProxyType",PROXYTYPE_SOCKS5);
- if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType==PROXYTYPE_HTTPS)
+ 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;
}
@@ -204,7 +204,7 @@ static INT_PTR NetlibGetUserSettings(WPARAM wParam,LPARAM lParam) NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam;
struct NetlibUser *nlu=(struct NetlibUser*)wParam;
- if (GetNetlibHandleType(nlu)!=NLH_USER || nlus==NULL || nlus->cbSize!=sizeof(NETLIBUSERSETTINGS)) {
+ if (GetNetlibHandleType(nlu) != NLH_USER || nlus == NULL || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -217,7 +217,7 @@ static INT_PTR NetlibSetUserSettings(WPARAM wParam,LPARAM lParam) NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam;
struct NetlibUser *nlu=(struct NetlibUser*)wParam;
- if (GetNetlibHandleType(nlu)!=NLH_USER || nlus==NULL || nlus->cbSize!=sizeof(NETLIBUSERSETTINGS)) {
+ if (GetNetlibHandleType(nlu) != NLH_USER || nlus == NULL || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -415,7 +415,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam) unsigned char *pszIn,*pszOut;
int outputLen;
- if (szInput==NULL) {
+ if (szInput == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return (INT_PTR)(char*)NULL;
}
@@ -427,7 +427,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam) else outputLen+=3;
}
szOutput=(unsigned char*)HeapAlloc(GetProcessHeap(),0,outputLen+1);
- if (szOutput==NULL) {
+ if (szOutput == NULL) {
SetLastError(ERROR_OUTOFMEMORY);
return (INT_PTR)(unsigned char*)NULL;
}
@@ -436,7 +436,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam) (65 <= *pszIn && *pszIn <= 90) ||
(97 <= *pszIn && *pszIn <= 122) ||
*pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
- else if (*pszIn==' ') *pszOut++='+';
+ else if (*pszIn == ' ') *pszOut++='+';
else {
*pszOut++='%';
*pszOut++=szHexDigits[*pszIn>>4];
@@ -455,7 +455,7 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam) char *pszOut;
PBYTE pbIn;
- if (nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
+ if (nlb64 == NULL || nlb64->pszEncoded == NULL || nlb64->pbDecoded == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -466,7 +466,7 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam) nlb64->cchEncoded=Netlib_GetBase64EncodedBufferSize(nlb64->cbDecoded);
for (iIn=0,pbIn=nlb64->pbDecoded,pszOut=nlb64->pszEncoded;iIn<nlb64->cbDecoded;iIn+=3,pbIn+=3,pszOut+=4) {
pszOut[0]=base64chars[pbIn[0]>>2];
- if (nlb64->cbDecoded-iIn==1) {
+ if (nlb64->cbDecoded-iIn == 1) {
pszOut[1]=base64chars[(pbIn[0]&3)<<4];
pszOut[2]='=';
pszOut[3]='=';
@@ -474,7 +474,7 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam) break;
}
pszOut[1]=base64chars[((pbIn[0]&3)<<4)|(pbIn[1]>>4)];
- if (nlb64->cbDecoded-iIn==2) {
+ if (nlb64->cbDecoded-iIn == 2) {
pszOut[2]=base64chars[(pbIn[1]&0xF)<<2];
pszOut[3]='=';
pszOut+=4;
@@ -492,9 +492,9 @@ static BYTE Base64CharToInt(char c) if (c>='A' && c<='Z') return c-'A';
if (c>='a' && c<='z') return c-'a'+26;
if (c>='0' && c<='9') return c-'0'+52;
- if (c=='+') return 62;
- if (c=='/') return 63;
- if (c=='=') return 64;
+ if (c == '+') return 62;
+ if (c == '/') return 63;
+ if (c == '=') return 64;
return 255;
}
@@ -506,7 +506,7 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam) BYTE b1,b2,b3,b4;
int iIn;
- if (nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
+ if (nlb64 == NULL || nlb64->pszEncoded == NULL || nlb64->pbDecoded == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -524,14 +524,14 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam) b2=Base64CharToInt(pszIn[1]);
b3=Base64CharToInt(pszIn[2]);
b4=Base64CharToInt(pszIn[3]);
- if (b1==255 || b1==64 || b2==255 || b2==64 || b3==255 || b4==255) {
+ if (b1 == 255 || b1 == 64 || b2 == 255 || b2 == 64 || b3 == 255 || b4 == 255) {
SetLastError(ERROR_INVALID_DATA);
return 0;
}
pbOut[0]=(b1<<2)|(b2>>4);
- if (b3==64) {nlb64->cbDecoded-=2; break;}
+ if (b3 == 64) {nlb64->cbDecoded-=2; break;}
pbOut[1]=(b2<<4)|(b3>>2);
- if (b4==64) {nlb64->cbDecoded--; break;}
+ if (b4 == 64) {nlb64->cbDecoded--; break;}
pbOut[2]=b4|(b3<<6);
}
return 1;
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index 3f28551434..5e8d76d464 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -221,7 +221,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) sin6.sin6_family = AF_INET6;
/* if the netlib user wanted a free port given in the range, then
- they better have given wPort==0, let's hope so */
+ 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))
@@ -234,7 +234,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) }
else
{
- /* if ->wPort==0 then they'll get any free port, otherwise they'll
+ /* if ->wPort == 0 then they'll get any free port, otherwise they'll
be asking for whatever was in nlb->wPort*/
if (nlb->wPort != 0)
{
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index d0be2f35b2..fb027366bc 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -400,7 +400,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime, static int SendHttpRequestAndData(struct NetlibConnection *nlc,struct ResizableCharBuffer *httpRequest,NETLIBHTTPREQUEST *nlhr,int sendContentLengthHeader)
{
- bool sendData = (nlhr->requestType==REQUEST_POST || nlhr->requestType==REQUEST_PUT);
+ bool sendData = (nlhr->requestType == REQUEST_POST || nlhr->requestType == REQUEST_PUT);
if (sendContentLengthHeader && sendData)
AppendToCharBuffer(httpRequest,"Content-Length: %d\r\n\r\n", nlhr->dataLength);
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp index fa6c2368b5..a760aee43d 100644 --- a/src/modules/netlib/netlibhttpproxy.cpp +++ b/src/modules/netlib/netlibhttpproxy.cpp @@ -505,7 +505,7 @@ INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam,LPARAM lParam) INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam)
{
struct NetlibUser * nu = (struct NetlibUser*)wParam;
- if (GetNetlibHandleType(nu)!=NLH_USER) return ERROR_INVALID_PARAMETER;
+ if (GetNetlibHandleType(nu) != NLH_USER) return ERROR_INVALID_PARAMETER;
mir_free(nu->szStickyHeaders);
nu->szStickyHeaders = mir_strdup((char*)lParam); // pointer is ours
return 0;
@@ -515,7 +515,7 @@ INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam, LPARAM lParam) {
int oldTimeout;
struct NetlibConnection *nlc=(struct NetlibConnection*)wParam;
- if (GetNetlibHandleType(nlc)!=NLH_CONNECTION) return -1;
+ if (GetNetlibHandleType(nlc) != NLH_CONNECTION) return -1;
oldTimeout = nlc->pollingTimeout;
nlc->pollingTimeout = lParam;
return oldTimeout;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index d974406047..92496eaa5c 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -137,8 +137,8 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara break;
*/
case IDC_FILENAME:
- if (HIWORD(wParam)!=EN_CHANGE) break;
- if ((HWND)lParam==GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE) break;
+ if ((HWND)lParam == GetFocus())
CheckDlgButton(hwndDlg,IDC_TOFILE,BST_CHECKED);
{
@@ -161,7 +161,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara ofn.lStructSize=OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner=hwndDlg;
ofn.Flags=OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- if (LOWORD(wParam)==IDC_FILENAMEBROWSE) {
+ if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
ofn.lpstrTitle=TranslateT("Select where log file will be created");
} else {
ofn.Flags|=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST;
@@ -177,12 +177,12 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara ofn.lpstrFile=str;
ofn.nMaxFile=SIZEOF(str)-2;
ofn.nMaxFileTitle=MAX_PATH;
- if (LOWORD(wParam)==IDC_FILENAMEBROWSE) {
+ if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
if (!GetSaveFileName(&ofn)) return 1;
} else {
if (!GetOpenFileName(&ofn)) return 1;
}
- if (LOWORD(wParam)==IDC_RUNATSTARTBROWSE && _tcschr(str,' ')!=NULL) {
+ if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str,' ') != NULL) {
MoveMemory(str+1,str,SIZEOF(str)-2);
str[0]='"';
lstrcat(str,_T("\""));
@@ -241,10 +241,10 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_STATE|TVIF_TEXT;
tvi.hItem=TreeView_GetRoot(hwndFilter);
- while(tvi.hItem)
+ while (tvi.hItem)
{
TreeView_GetItem(hwndFilter,&tvi);
- checked = ((tvi.state&TVIS_STATEIMAGEMASK)>>12==2);
+ checked = ((tvi.state&TVIS_STATEIMAGEMASK)>>12 == 2);
if (tvi.lParam == -1) {
logOptions.toLog = checked;
@@ -298,7 +298,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara void NetlibLogShowOptions(void)
{
- if (logOptions.hwndOpts==NULL)
+ if (logOptions.hwndOpts == NULL)
logOptions.hwndOpts=CreateDialog(hMirandaInst,MAKEINTRESOURCE(IDD_NETLIBLOGOPTS),NULL,LogOptionsDlgProc);
SetForegroundWindow(logOptions.hwndOpts);
}
@@ -490,7 +490,7 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int int i;
for (i = 0; i<len; i++)
{
- if ((buf[i]<' ' && buf[i]!='\t' && buf[i]!='\r' && buf[i]!='\n') || buf[i]>=0x80)
+ if ((buf[i]<' ' && buf[i] != '\t' && buf[i] != '\r' && buf[i] != '\n') || buf[i]>=0x80)
{
isText = 0;
break;
@@ -533,7 +533,7 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int pszBuf += wsprintfA(pszBuf, "%08X: ", line);
// Dump data as hex
for (col = 0; col < colsInLine; col++)
- pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col&3)==3 && col != 15)?'-':' ');
+ pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col&3) == 3 && col != 15)?'-':' ');
// Fill out last line with blanks
for ( ; col<16; col++)
{
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 086269c021..0be23f2da1 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -168,7 +168,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib buf[0]=5; //yep, socks5
buf[1]=1; //one auth method
buf[2]=nlu->settings.useProxyAuth?2:0;
- if (NLSend(nlc,(char*)buf,3,MSG_DUMPPROXY)==SOCKET_ERROR) {
+ if (NLSend(nlc,(char*)buf,3,MSG_DUMPPROXY) == SOCKET_ERROR) {
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
return 0;
}
@@ -178,13 +178,13 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
return 0;
}
- if ((buf[1]!=0 && buf[1]!=2)) {
+ if ((buf[1] != 0 && buf[1] != 2)) {
SetLastError(ERROR_INVALID_ID_AUTHORITY);
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
return 0;
}
- if (buf[1]==2) { //rfc1929
+ if (buf[1] == 2) { //rfc1929
int nUserLen,nPassLen;
PBYTE pAuthBuf;
@@ -196,7 +196,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib memcpy(pAuthBuf+2,nlu->settings.szProxyAuthUser,nUserLen);
pAuthBuf[2+nUserLen]=nPassLen;
memcpy(pAuthBuf+3+nUserLen,nlu->settings.szProxyAuthPassword,nPassLen);
- if (NLSend(nlc,(char*)pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
+ if (NLSend(nlc,(char*)pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY) == SOCKET_ERROR) {
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
mir_free(pAuthBuf);
return 0;
@@ -237,7 +237,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib pInit[0]=5; //SOCKS5
pInit[1]= nloc->flags & NLOCF_UDP ? 3 : 1; //connect or UDP
pInit[2]=0; //reserved
- if (hostIP==INADDR_NONE) { //DNS lookup through proxy
+ if (hostIP == INADDR_NONE) { //DNS lookup through proxy
pInit[3]=3;
pInit[4]=nHostLen-1;
memcpy(pInit+5,nloc->szHost,nHostLen-1);
@@ -247,7 +247,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib *(PDWORD)(pInit+4)=hostIP;
}
*(PWORD)(pInit+4+nHostLen)=htons(nloc->wPort);
- if (NLSend(nlc,(char*)pInit,6+nHostLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
+ if (NLSend(nlc,(char*)pInit,6+nHostLen,MSG_DUMPPROXY) == SOCKET_ERROR) {
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
mir_free(pInit);
return 0;
@@ -260,7 +260,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib return 0;
}
- if ( buf[0]!=5 || buf[1] ) {
+ if ( buf[0] != 5 || buf[1] ) {
const char* err = "Unknown response";
if ( buf[0] != 5 )
SetLastError(ERROR_BAD_FORMAT);
@@ -348,7 +348,7 @@ static bool NetlibInitHttpsConnection(struct NetlibConnection *nlc, struct Netli }
NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
- NetlibLogf(nlu,"%s %d: %s request failed (%u %s)",__FILE__,__LINE__,nlu->settings.proxyType==PROXYTYPE_HTTP?"HTTP":"HTTPS",nlhrReply->resultCode,nlhrReply->szResultDescr);
+ NetlibLogf(nlu,"%s %d: %s request failed (%u %s)",__FILE__,__LINE__,nlu->settings.proxyType == PROXYTYPE_HTTP?"HTTP":"HTTPS",nlhrReply->resultCode,nlhrReply->szResultDescr);
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return 0;
}
@@ -361,7 +361,7 @@ static void FreePartiallyInitedConnection(struct NetlibConnection *nlc) {
DWORD dwOriginalLastError=GetLastError();
- if (nlc->s!=INVALID_SOCKET) closesocket(nlc->s);
+ if (nlc->s != INVALID_SOCKET) closesocket(nlc->s);
mir_free(nlc->nlhpi.szHttpPostUrl);
mir_free(nlc->nlhpi.szHttpGetUrl);
mir_free((char*)nlc->nloc.szHost);
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 0988f5d552..48d4f4c291 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -86,7 +86,7 @@ static void EnableMultipleControls(HWND hwndDlg,const UINT *controls,int cContro static void AddProxyTypeItem(HWND hwndDlg,int type,int selectType)
{
int i;
- i = SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_ADDSTRING,0,(LPARAM)(type==0?TranslateTS(szProxyTypes[type]):szProxyTypes[type]));
+ i = SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_ADDSTRING,0,(LPARAM)(type == 0?TranslateTS(szProxyTypes[type]):szProxyTypes[type]));
SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_SETITEMDATA, i, type);
if (type == selectType) SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_SETCURSEL, i, 0);
}
@@ -103,23 +103,23 @@ static void CopySettingsStruct(NETLIBUSERSETTINGS *dest,NETLIBUSERSETTINGS *sour static void CombineSettingsStrings(char **dest,char **source)
{
- if (*dest!=NULL && (*source==NULL || lstrcmpiA(*dest,*source))) {mir_free(*dest); *dest=NULL;}
+ if (*dest != NULL && (*source == NULL || lstrcmpiA(*dest,*source))) {mir_free(*dest); *dest=NULL;}
}
static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NETLIBUSERSETTINGS *source,DWORD sourceFlags)
{
if (sourceFlags&NUF_OUTGOING) {
if (*destFlags&NUF_OUTGOING) {
- if (dest->validateSSL!=source->validateSSL) dest->validateSSL=2;
- if (dest->useProxy!=source->useProxy) dest->useProxy=2;
- if (dest->proxyType!=source->proxyType) dest->proxyType=0;
+ if (dest->validateSSL != source->validateSSL) dest->validateSSL=2;
+ if (dest->useProxy != source->useProxy) dest->useProxy=2;
+ if (dest->proxyType != source->proxyType) dest->proxyType=0;
CombineSettingsStrings(&dest->szProxyServer,&source->szProxyServer);
- if (dest->wProxyPort!=source->wProxyPort) dest->wProxyPort=0;
- if (dest->useProxyAuth!=source->useProxyAuth) dest->useProxyAuth=2;
+ if (dest->wProxyPort != source->wProxyPort) dest->wProxyPort=0;
+ if (dest->useProxyAuth != source->useProxyAuth) dest->useProxyAuth=2;
CombineSettingsStrings(&dest->szProxyAuthUser,&source->szProxyAuthUser);
CombineSettingsStrings(&dest->szProxyAuthPassword,&source->szProxyAuthPassword);
- if (dest->dnsThroughProxy!=source->dnsThroughProxy) dest->dnsThroughProxy=2;
- if (dest->specifyOutgoingPorts!=source->specifyOutgoingPorts) dest->specifyOutgoingPorts=2;
+ if (dest->dnsThroughProxy != source->dnsThroughProxy) dest->dnsThroughProxy=2;
+ if (dest->specifyOutgoingPorts != source->specifyOutgoingPorts) dest->specifyOutgoingPorts=2;
CombineSettingsStrings(&dest->szOutgoingPorts,&source->szOutgoingPorts);
}
else {
@@ -142,8 +142,8 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET }
if (sourceFlags&NUF_INCOMING) {
if (*destFlags&NUF_INCOMING) {
- if (dest->enableUPnP!=source->enableUPnP) dest->enableUPnP=2;
- if (dest->specifyIncomingPorts!=source->specifyIncomingPorts) dest->specifyIncomingPorts=2;
+ if (dest->enableUPnP != source->enableUPnP) dest->enableUPnP=2;
+ if (dest->specifyIncomingPorts != source->specifyIncomingPorts) dest->specifyIncomingPorts=2;
CombineSettingsStrings(&dest->szIncomingPorts,&source->szIncomingPorts);
}
else {
@@ -153,7 +153,7 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET if (dest->szIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts);
}
}
- if ((*destFlags&NUF_NOHTTPSOPTION)!=(sourceFlags&NUF_NOHTTPSOPTION))
+ if ((*destFlags&NUF_NOHTTPSOPTION) != (sourceFlags&NUF_NOHTTPSOPTION))
*destFlags=(*destFlags|sourceFlags)&~NUF_NOHTTPSOPTION;
else *destFlags|=sourceFlags;
}
@@ -162,7 +162,7 @@ static void ChangeSettingIntByCheckbox(HWND hwndDlg,UINT ctrlId,int iUser,int me {
int newValue,i;
- newValue=IsDlgButtonChecked(hwndDlg,ctrlId)!=BST_CHECKED;
+ newValue=IsDlgButtonChecked(hwndDlg,ctrlId) != BST_CHECKED;
CheckDlgButton(hwndDlg,ctrlId,newValue?BST_CHECKED:BST_UNCHECKED);
if (iUser == -1)
{
@@ -252,13 +252,13 @@ void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTING if (thisUser->user.flags & NUF_NOOPTIONS) continue;
CombineSettingsStructs(&combinedSettings, &flags, &thisUser->settings, thisUser->user.flags);
}
- if (combinedSettings.validateSSL==2) combinedSettings.validateSSL=0;
- if (combinedSettings.useProxy==2) combinedSettings.useProxy=0;
- if (combinedSettings.proxyType==0) combinedSettings.proxyType=PROXYTYPE_SOCKS5;
- if (combinedSettings.useProxyAuth==2) combinedSettings.useProxyAuth=0;
- if (combinedSettings.dnsThroughProxy==2) combinedSettings.dnsThroughProxy=1;
- if (combinedSettings.enableUPnP==2) combinedSettings.enableUPnP=1;
- if (combinedSettings.specifyIncomingPorts==2) combinedSettings.specifyIncomingPorts=0;
+ if (combinedSettings.validateSSL == 2) combinedSettings.validateSSL=0;
+ if (combinedSettings.useProxy == 2) combinedSettings.useProxy=0;
+ if (combinedSettings.proxyType == 0) combinedSettings.proxyType=PROXYTYPE_SOCKS5;
+ if (combinedSettings.useProxyAuth == 2) combinedSettings.useProxyAuth=0;
+ if (combinedSettings.dnsThroughProxy == 2) combinedSettings.dnsThroughProxy=1;
+ if (combinedSettings.enableUPnP == 2) combinedSettings.enableUPnP=1;
+ if (combinedSettings.specifyIncomingPorts == 2) combinedSettings.specifyIncomingPorts=0;
WriteSettingsStructToDb("Netlib",&combinedSettings,flags);
NetlibFreeUserSettingsStruct(&combinedSettings);
LeaveCriticalSection(&csNetlibUser);
@@ -368,7 +368,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, tempSettings[i]->flags & NUF_NOOPTIONS || !(tempSettings[i]->flags & NUF_OUTGOING))
continue;
- if (tempSettings[i]->settings.proxyType==PROXYTYPE_SOCKS4) enableUser=1;
+ if (tempSettings[i]->settings.proxyType == PROXYTYPE_SOCKS4) enableUser=1;
else
{
enableAuth=1;
@@ -399,8 +399,8 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYPORT), enableServer);
}
else EnableMultipleControls(hwndDlg,useProxyControls,SIZEOF(useProxyControls),FALSE);
- EnableMultipleControls(hwndDlg,specifyPortsControls,SIZEOF(specifyPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTS)!=BST_UNCHECKED);
- EnableMultipleControls(hwndDlg,specifyOPortsControls,SIZEOF(specifyOPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTSO)!=BST_UNCHECKED);
+ EnableMultipleControls(hwndDlg,specifyPortsControls,SIZEOF(specifyPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTS) != BST_UNCHECKED);
+ EnableMultipleControls(hwndDlg,specifyOPortsControls,SIZEOF(specifyOPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTSO) != BST_UNCHECKED);
break;
}
case WM_COMMAND:
@@ -408,7 +408,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch(LOWORD(wParam))
{
case IDC_NETLIBUSERS:
- if (HIWORD(wParam)==CBN_SELCHANGE) SendMessage(hwndDlg,M_REFRESHALL,0,0);
+ if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(hwndDlg,M_REFRESHALL,0,0);
return 0;
case IDC_LOGOPTIONS:
@@ -462,11 +462,11 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,validateSSL));
break;
case IDC_PROXYHOST:
- if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyServer));
break;
case IDC_PROXYPORT:
- if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
{ int newValue,i;
newValue=GetDlgItemInt(hwndDlg,LOWORD(wParam),NULL,FALSE);
if (iUser == -1)
@@ -479,19 +479,19 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, }
break;
case IDC_PROXYUSER:
- if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthUser));
break;
case IDC_PROXYPASS:
- if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthPassword));
break;
case IDC_PORTSRANGE:
- if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szIncomingPorts));
break;
case IDC_PORTSRANGEO:
- if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szOutgoingPorts));
break;
}
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp index 91fc4ddbe9..401e545792 100644 --- a/src/modules/netlib/netlibpktrecver.cpp +++ b/src/modules/netlib/netlibpktrecver.cpp @@ -28,12 +28,12 @@ INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam) struct NetlibConnection *nlc=(struct NetlibConnection*)wParam;
struct NetlibPacketRecver *nlpr;
- if (GetNetlibHandleType(nlc)!=NLH_CONNECTION || lParam==0) {
+ if (GetNetlibHandleType(nlc) != NLH_CONNECTION || lParam == 0) {
SetLastError(ERROR_INVALID_PARAMETER);
return (INT_PTR)(struct NetlibPacketRecver*)NULL;
}
nlpr=(struct NetlibPacketRecver*)mir_calloc(sizeof(struct NetlibPacketRecver));
- if (nlpr==NULL) {
+ if (nlpr == NULL) {
SetLastError(ERROR_OUTOFMEMORY);
return (INT_PTR)(struct NetlibPacketRecver*)NULL;
}
@@ -53,7 +53,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam) NETLIBPACKETRECVER *nlprParam=(NETLIBPACKETRECVER*)lParam;
INT_PTR recvResult;
- if (GetNetlibHandleType(nlpr)!=NLH_PACKETRECVER || nlprParam==NULL || nlprParam->cbSize!=sizeof(NETLIBPACKETRECVER) || nlprParam->bytesUsed>nlpr->packetRecver.bytesAvailable) {
+ if (GetNetlibHandleType(nlpr) != NLH_PACKETRECVER || nlprParam == NULL || nlprParam->cbSize != sizeof(NETLIBPACKETRECVER) || nlprParam->bytesUsed>nlpr->packetRecver.bytesAvailable) {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
@@ -62,8 +62,8 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam) return SOCKET_ERROR;
}
nlpr->packetRecver.dwTimeout=nlprParam->dwTimeout;
- if (nlprParam->bytesUsed==0) {
- if (nlpr->packetRecver.bytesAvailable==nlpr->packetRecver.bufferSize) {
+ if (nlprParam->bytesUsed == 0) {
+ if (nlpr->packetRecver.bytesAvailable == nlpr->packetRecver.bufferSize) {
nlpr->packetRecver.bytesAvailable=0;
NetlibLogf(nlpr->nlc->nlu,"Packet recver: packet overflowed buffer, ditching");
}
@@ -72,7 +72,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam) MoveMemory(nlpr->packetRecver.buffer,nlpr->packetRecver.buffer+nlprParam->bytesUsed,nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed);
nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed;
}
- if (nlprParam->dwTimeout!=INFINITE) {
+ if (nlprParam->dwTimeout != INFINITE) {
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/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 639cade4de..655bb781eb 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -622,7 +622,7 @@ static void discoverUPnP(void) if (he)
{
- while(he->h_addr_list[nip]) ++nip;
+ while (he->h_addr_list[nip]) ++nip;
ips = ( unsigned* )mir_alloc(nip * sizeof(unsigned));
@@ -795,7 +795,7 @@ void NetlibUPnPDeletePortMapping(WORD extport, char* proto) void NetlibUPnPCleanup(void*)
{
- if (DBGetContactSettingByte(NULL,"Netlib","NLEnableUPnP",1)==0)
+ if (DBGetContactSettingByte(NULL,"Netlib","NLEnableUPnP",1) == 0)
// upnp is disabled globally, no need for a cleanup
return;
diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp index 773d3893b3..2b5a270271 100644 --- a/src/modules/options/descbutton.cpp +++ b/src/modules/options/descbutton.cpp @@ -227,7 +227,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara switch(msg) {
case WM_NCCREATE:
dat = (MDescButtonCtrl*)mir_alloc(sizeof(MDescButtonCtrl));
- if (dat==NULL)
+ if (dat == NULL)
return FALSE;
memset(dat, 0, sizeof(MDescButtonCtrl));
diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp index b4acd701d6..4a6f11cba5 100644 --- a/src/modules/options/headerbar.cpp +++ b/src/modules/options/headerbar.cpp @@ -298,7 +298,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam switch(msg) {
case WM_NCCREATE:
itc = new MHeaderbarCtrl; //(MHeaderbarCtrl*)mir_alloc(sizeof(MHeaderbarCtrl));
- if (itc==NULL)
+ if (itc == NULL)
return FALSE;
SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)itc);
diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index 669fd2345a..b31ba45bba 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -333,7 +333,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L switch(msg) {
case WM_NCCREATE:
itc = new MIcoTabCtrl; //(MIcoTabCtrl*)mir_alloc(sizeof(MIcoTabCtrl));
- if (itc==NULL) return FALSE;
+ if (itc == NULL) return FALSE;
itc->nSelectedIdx=-1;
itc->nHotIdx=-1;
itc->bMouseInside = FALSE;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 699a9d5f91..0b6c2d583d 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2010 Miranda ICQ/IM project,
+Copyright 2000-2010 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CORE_MODULES_FILTER _T("<core modules>")
static HANDLE hOptionsInitEvent;
-static HWND hwndOptions=NULL;
+static HWND hwndOptions = NULL;
static HWND hFilterSearchWnd = NULL;
// Thread for search keywords in dialogs
@@ -50,16 +50,16 @@ struct OptionsPageInit struct DlgTemplateExBegin
{
- WORD dlgVer;
- WORD signature;
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- WORD cDlgItems;
- short x;
- short y;
- short cx;
- short cy;
+ WORD dlgVer;
+ WORD signature;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ WORD cDlgItems;
+ short x;
+ short y;
+ short cx;
+ short cy;
};
struct OptionsPageData
@@ -70,9 +70,9 @@ struct OptionsPageData HTREEITEM hTreeItem;
HWND hwnd;
int changed;
- int simpleHeight,expertHeight;
- int simpleWidth,expertWidth;
- int simpleBottomControlId,simpleRightControlId;
+ int simpleHeight, expertHeight;
+ int simpleWidth, expertWidth;
+ int simpleBottomControlId, simpleRightControlId;
int nExpertOnlyControls;
UINT *expertOnlyControls;
DWORD flags;
@@ -105,9 +105,9 @@ static HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name) tvi.pszText = str;
tvi.cchTextMax = SIZEOF( str );
tvi.hItem = TreeView_GetRoot( hwndTree );
- while( tvi.hItem != NULL ) {
+ while ( tvi.hItem != NULL ) {
SendMessage( hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi );
- if ( !_tcsicmp( str,name ))
+ if ( !_tcsicmp( str, name ))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
@@ -124,9 +124,9 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con tvi.pszText = str;
tvi.cchTextMax = SIZEOF( str );
tvi.hItem = TreeView_GetChild( hwndTree, hItem );
- while( tvi.hItem != NULL ) {
+ while ( tvi.hItem != NULL ) {
SendMessage( hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi );
- if ( !_tcsicmp( str,name ))
+ if ( !_tcsicmp( str, name ))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
@@ -134,13 +134,13 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con return NULL;
}
-static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd,LPARAM lParam)
+static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd, LPARAM lParam)
{
TCHAR szClass[64];
- GetClassName(hwnd,szClass,SIZEOF(szClass));
- if (!lstrcmp(szClass,_T("Button")) && (GetWindowLongPtr(hwnd,GWL_STYLE)&0x0F)==BS_GROUPBOX)
- SendMessage(hwnd,WM_SETFONT,lParam,0);
+ GetClassName(hwnd, szClass, SIZEOF(szClass));
+ if (!lstrcmp(szClass, _T("Button")) && (GetWindowLongPtr(hwnd, GWL_STYLE)&0x0F) == BS_GROUPBOX)
+ SendMessage(hwnd, WM_SETFONT, lParam, 0);
return TRUE;
}
@@ -149,7 +149,7 @@ struct MoveChildParam HWND hDlg;
POINT offset;
};
-static BOOL CALLBACK MoveEnumChildren(HWND hwnd,LPARAM lParam)
+static BOOL CALLBACK MoveEnumChildren(HWND hwnd, LPARAM lParam)
{
struct MoveChildParam * param = ( struct MoveChildParam *) lParam;
@@ -175,15 +175,15 @@ static BOOL CALLBACK MoveEnumChildren(HWND hwnd,LPARAM lParam) static void SaveOptionsTreeState(HWND hdlg)
{
TVITEMA tvi;
- char buf[130],str[128];
+ char buf[130], str[128];
tvi.mask = TVIF_TEXT | TVIF_STATE;
tvi.pszText = str;
tvi.cchTextMax = SIZEOF(str);
tvi.hItem = TreeView_GetRoot( GetDlgItem( hdlg, IDC_PAGETREE ));
while ( tvi.hItem != NULL ) {
- if ( SendMessageA( GetDlgItem(hdlg,IDC_PAGETREE), TVM_GETITEMA, 0, (LPARAM)&tvi )) {
- mir_snprintf(buf, SIZEOF(buf), "%s%s",OPTSTATE_PREFIX,str);
- DBWriteContactSettingByte(NULL,"Options",buf,(BYTE)((tvi.state&TVIS_EXPANDED)?1:0));
+ if ( SendMessageA( GetDlgItem(hdlg, IDC_PAGETREE), TVM_GETITEMA, 0, (LPARAM)&tvi )) {
+ mir_snprintf(buf, SIZEOF(buf), "%s%s", OPTSTATE_PREFIX, str);
+ DBWriteContactSettingByte(NULL, "Options", buf, (BYTE)((tvi.state&TVIS_EXPANDED)?1:0));
}
tvi.hItem = TreeView_GetNextSibling( GetDlgItem( hdlg, IDC_PAGETREE ), tvi.hItem );
} }
@@ -206,14 +206,14 @@ static int lstrcmpnull(TCHAR *str1, TCHAR *str2) if ( str1 == NULL && str2 != NULL )
return -1;
- return lstrcmp(str1, str2);
+ return lstrcmp(str1, str2);
}
static TCHAR *GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size)
{
TCHAR tszModuleName[MAX_PATH];
GetModuleFileName(hInstance, tszModuleName, SIZEOF(tszModuleName));
- TCHAR *dllName = _tcsrchr(tszModuleName,'\\');
+ TCHAR *dllName = _tcsrchr(tszModuleName, '\\');
if (!dllName)
{
dllName = tszModuleName;
@@ -285,43 +285,43 @@ static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARA hdc = (HDC)wParam;
TCHAR buf[255];
- if ( bSearchState==1 && FilterLoadProgress < 100 && FilterLoadProgress > 0 )
+ if ( bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0 )
mir_sntprintf( buf, SIZEOF(buf), TranslateT("Loading... %d%%"), FilterLoadProgress );
else
mir_sntprintf( buf, SIZEOF(buf), TranslateT( "Search" ) );
BOOL bDrawnByTheme = FALSE;
- int oldMode = SetBkMode( hdc, TRANSPARENT );
+ int oldMode = SetBkMode( hdc, TRANSPARENT );
- if ( openThemeData ) {
+ if ( openThemeData ) {
HTHEME hTheme = openThemeData( hWnd, L"EDIT");
if ( hTheme ) {
if ( isThemeBackgroundPartiallyTransparent( hTheme, EP_EDITTEXT, ETS_NORMAL ))
drawThemeParentBackground( hWnd, hdc, &rc );
- RECT rc2;
- getThemeBackgroundContentRect( hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc, &rc2 );
- rc2.top = 2 * rc.top - rc2.top;
- rc2.left = 2 * rc.left - rc2.left;
- rc2.bottom = 2 * rc.bottom - rc2.bottom;
- rc2.right = 2 * rc.right - rc2.right;
+ RECT rc2;
+ getThemeBackgroundContentRect( hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc, &rc2 );
+ rc2.top = 2 * rc.top - rc2.top;
+ rc2.left = 2 * rc.left - rc2.left;
+ rc2.bottom = 2 * rc.bottom - rc2.bottom;
+ rc2.right = 2 * rc.right - rc2.right;
- drawThemeBackground( hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc2, &rc );
- HFONT hFont = (HFONT) SendMessage(hWnd, WM_GETFONT, 0, 0);
+ drawThemeBackground( hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc2, &rc );
+ HFONT hFont = (HFONT) SendMessage(hWnd, WM_GETFONT, 0, 0);
HFONT oldFont = (HFONT) SelectObject( hdc, hFont );
- wchar_t *bufW = mir_t2u(buf);
+ wchar_t *bufW = mir_t2u(buf);
drawThemeText( hTheme, hdc, EP_EDITTEXT, ETS_DISABLED, bufW, -1, 0, 0, &rc );
mir_free(bufW);
- SelectObject( hdc, oldFont );
- closeThemeData( hTheme );
+ SelectObject( hdc, oldFont );
+ closeThemeData( hTheme );
bDrawnByTheme = TRUE;
}
}
- SetBkMode( hdc, oldMode );
+ SetBkMode( hdc, oldMode );
if ( !bDrawnByTheme ) {
HFONT hFont = (HFONT) SendMessage(hWnd, WM_GETFONT, 0, 0);
@@ -330,7 +330,7 @@ static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARA FillRect( hdc, &rc, GetSysColorBrush( COLOR_WINDOW ) );
int oldMode = SetBkMode( hdc, TRANSPARENT );
DrawText( hdc, buf, -1, &rc, 0 );
- SetBkMode( hdc, oldMode );
+ SetBkMode( hdc, oldMode );
SelectObject( hdc, oldFont );
}
@@ -371,7 +371,7 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = bmi.bmiHeader.biCompression = BI_RGB;
hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, NULL, 0);
- hOldBmp = (HBITMAP)SelectObject(tempDC,hBmp);
+ hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
//paint
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
@@ -384,8 +384,8 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = if (!pBits[3]) pBits[3] = 255;
//Copy to output
- BitBlt(hdc,0,0,rc.right,rc.bottom,tempDC,0,0,SRCCOPY);
- SelectObject(tempDC,hOldBmp);
+ BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
+ SelectObject(tempDC, hOldBmp);
DeleteObject(hBmp);
DeleteDC(tempDC);
}
@@ -418,8 +418,8 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam }
case WM_DESTROY:
- RemovePropA(hwnd, "Miranda.AeroRender.Active");
- break;
+ RemovePropA(hwnd, "Miranda.AeroRender.Active");
+ break;
}
return CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam);
}
@@ -431,7 +431,7 @@ static void CALLBACK FilterSearchTimerFunc( HWND hwnd, UINT, UINT_PTR, DWORD ) return;
if ( hFilterSearchWnd == NULL)
- hFilterSearchWnd = CreateWindowA( "STATIC", "Test", WS_OVERLAPPED|WS_DISABLED, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), 0 ); // Fake window to keep option page focused
+ hFilterSearchWnd = CreateWindowA( "STATIC", "Test", WS_OVERLAPPED|WS_DISABLED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), 0 ); // Fake window to keep option page focused
if ( FilterPage < dat->pageCount )
FindFilterStrings( TRUE, dat->currentPage == FilterPage, hFilterSearchWnd, &( dat->opd[FilterPage]) );
@@ -460,29 +460,27 @@ static void ExecuteFindFilterStringsTimer( HWND hdlg ) static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, struct OptionsPageData * opd, int PageCount)
{
- int i;
- int index;
HINSTANCE* KnownInstances = ( HINSTANCE* )alloca(sizeof(HINSTANCE)*PageCount);
int countKnownInst = 0;
- SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_RESETCONTENT, 0,0);
- index=SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_ADDSTRING,(WPARAM)0, (LPARAM)TranslateTS(ALL_MODULES_FILTER));
- SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_SETITEMDATA,(WPARAM)index, (LPARAM)NULL);
- index=SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_ADDSTRING,(WPARAM)0, (LPARAM)TranslateTS(CORE_MODULES_FILTER));
- SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_SETITEMDATA,(WPARAM)index, (LPARAM)hMirandaInst);
+ SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_RESETCONTENT, 0, 0);
+ int index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)TranslateTS(ALL_MODULES_FILTER));
+ SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)NULL);
+ index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)TranslateTS(CORE_MODULES_FILTER));
+ SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)hMirandaInst);
TCHAR* tszModuleName = ( TCHAR* )alloca(MAX_PATH*sizeof(TCHAR));
- for (i=0; i<PageCount; i++) {
+ for (int i = 0; i<PageCount; i++) {
TCHAR * dllName = NULL;
int j;
- HINSTANCE inst=opd[i].hInst;
+ HINSTANCE inst = opd[i].hInst;
if ( !enableKeywordFiltering )
FindFilterStrings( enableKeywordFiltering, FALSE, hDlg, &opd[i]); // only modules name ( fast enougth )
- if (inst==hMirandaInst) continue;
- for (j=0; j<countKnownInst; j++)
- if (KnownInstances[j]==inst) break;
- if (j!=countKnownInst) continue;
- KnownInstances[countKnownInst]=inst;
+ if (inst == hMirandaInst) continue;
+ for (j = 0; j<countKnownInst; j++)
+ if (KnownInstances[j] == inst) break;
+ if (j != countKnownInst) continue;
+ KnownInstances[countKnownInst] = inst;
countKnownInst++;
GetModuleFileName(inst, tszModuleName, MAX_PATH);
{
@@ -491,12 +489,12 @@ static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, struct Option dllName = mir_a2t( name );
}
- if (!dllName) dllName = mir_tstrdup( _tcsrchr(tszModuleName,_T('\\')) );
+ if (!dllName) dllName = mir_tstrdup( _tcsrchr(tszModuleName, _T('\\')) );
if (!dllName) dllName = mir_tstrdup( tszModuleName );
if (dllName) {
- index=SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_ADDSTRING,(WPARAM)0, (LPARAM)dllName);
- SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER,(UINT) CB_SETITEMDATA,(WPARAM)index, (LPARAM)inst);
+ index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)dllName);
+ SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)inst);
mir_free( dllName );
}
}
@@ -509,14 +507,10 @@ static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, struct Option static BOOL IsInsideTab( HWND hdlg, OptionsDlgData * dat, int i )
{
int pages = 0;
- if (dat->opd[i].pszTab != NULL)
- {
+ if (dat->opd[i].pszTab != NULL) {
// Count tabs to calc position
- for (int j=0; j < dat->pageCount && pages < 2; j++ )
- {
+ for (int j = 0; j < dat->pageCount && pages < 2; j++ ) {
if (!CheckPageShow( hdlg, dat, j ) ) continue;
- //if (( dat->opd[j].flags & ODPF_SIMPLEONLY ) && IsDlgButtonChecked( hdlg, IDC_EXPERT )) continue;
- //if (( dat->opd[j].flags & ODPF_EXPERTONLY ) && !IsDlgButtonChecked( hdlg, IDC_EXPERT )) continue;
if ( lstrcmp(dat->opd[j].pszTitle, dat->opd[i].pszTitle) || lstrcmpnull(dat->opd[j].pszGroup, dat->opd[i].pszGroup) ) continue;
pages++;
}
@@ -524,7 +518,7 @@ static BOOL IsInsideTab( HWND hdlg, OptionsDlgData * dat, int i ) return (pages > 1);
}
-static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
struct OptionsDlgData* dat = (struct OptionsDlgData* )GetWindowLongPtr( hdlg, GWLP_USERDATA );
HWND hwndTree = GetDlgItem(hdlg, IDC_PAGETREE);
@@ -532,25 +526,24 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR switch ( message ) {
case WM_CTLCOLORSTATIC:
switch ( GetDlgCtrlID(( HWND )lParam ))
- {
- case IDC_WHITERECT:
- case IDC_KEYWORD_FILTER:
- SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW ));
- return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW );
- }
+ case IDC_WHITERECT:
+ case IDC_KEYWORD_FILTER:
+ SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW ));
+ return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW );
+
break;
case WM_INITDIALOG:
{
- PROPSHEETHEADER *psh=(PROPSHEETHEADER*)lParam;
- OPENOPTIONSDIALOG *ood=(OPENOPTIONSDIALOG*)psh->pStartPage;
+ PROPSHEETHEADER *psh = (PROPSHEETHEADER*)lParam;
+ OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)psh->pStartPage;
OPTIONSDIALOGPAGE *odp;
int i;
struct DlgTemplateExBegin *dte;
TCHAR *lastPage = NULL, *lastGroup = NULL, *lastTab = NULL;
DBVARIANT dbv;
TCITEM tie;
- LOGFONT lf;
+ LOGFONT lf;
typedef BOOL (STDAPICALLTYPE *pfnGetComboBoxInfo)(HWND, PCOMBOBOXINFO);
pfnGetComboBoxInfo getComboBoxInfo = (pfnGetComboBoxInfo)GetProcAddress(GetModuleHandleA("user32"), "GetComboBoxInfo");
@@ -570,16 +563,16 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR Utils_RestoreWindowPositionNoSize(hdlg, NULL, "Options", "");
TranslateDialogDefault(hdlg);
Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS);
- CheckDlgButton(hdlg,IDC_EXPERT,DBGetContactSettingByte(NULL,"Options","Expert",SETTING_SHOWEXPERT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
- EnableWindow(GetDlgItem(hdlg,IDC_APPLY),FALSE);
- dat=(struct OptionsDlgData*)mir_alloc(sizeof(struct OptionsDlgData));
- SetWindowLongPtr(hdlg,GWLP_USERDATA,(LONG_PTR)dat);
- SetWindowText(hdlg,psh->pszCaption);
+ CheckDlgButton(hdlg, IDC_EXPERT, DBGetContactSettingByte(NULL, "Options", "Expert", SETTING_SHOWEXPERT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hdlg, IDC_APPLY), FALSE);
+ dat = (struct OptionsDlgData*)mir_alloc(sizeof(struct OptionsDlgData));
+ SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)dat);
+ SetWindowText(hdlg, psh->pszCaption);
- dat->hBoldFont=(HFONT)SendDlgItemMessage(hdlg,IDC_EXPERT,WM_GETFONT,0,0);
- GetObject(dat->hBoldFont,sizeof(lf),&lf);
- lf.lfWeight=FW_BOLD;
- dat->hBoldFont=CreateFontIndirect(&lf);
+ dat->hBoldFont = (HFONT)SendDlgItemMessage(hdlg, IDC_EXPERT, WM_GETFONT, 0, 0);
+ GetObject(dat->hBoldFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ dat->hBoldFont = CreateFontIndirect(&lf);
dat->pageCount = psh->nPages;
dat->opd = ( struct OptionsPageData* )mir_alloc( sizeof(struct OptionsPageData) * dat->pageCount );
@@ -614,37 +607,37 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR }
else lastTab = LangPackPcharToTchar( ood->pszTab );
- for ( i=0; i < dat->pageCount; i++, odp++ ) {
+ for ( i = 0; i < dat->pageCount; i++, odp++ ) {
struct OptionsPageData* opd = &dat->opd[i];
- HRSRC hrsrc=FindResourceA(odp->hInstance,odp->pszTemplate,MAKEINTRESOURCEA(5));
- HGLOBAL hglb=LoadResource(odp->hInstance,hrsrc);
- DWORD resSize=SizeofResource(odp->hInstance,hrsrc);
+ HRSRC hrsrc = FindResourceA(odp->hInstance, odp->pszTemplate, MAKEINTRESOURCEA(5));
+ HGLOBAL hglb = LoadResource(odp->hInstance, hrsrc);
+ DWORD resSize = SizeofResource(odp->hInstance, hrsrc);
opd->pTemplate = ( DLGTEMPLATE* )mir_alloc(resSize);
- memcpy(opd->pTemplate,LockResource(hglb),resSize);
- dte=(struct DlgTemplateExBegin*)opd->pTemplate;
+ memcpy(opd->pTemplate, LockResource(hglb), resSize);
+ dte = (struct DlgTemplateExBegin*)opd->pTemplate;
if ( dte->signature == 0xFFFF ) {
//this feels like an access violation, and is according to boundschecker
//...but it works - for now
//may well have to remove and sort out the original dialogs
- dte->style&=~(WS_VISIBLE|WS_CHILD|WS_POPUP|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|DS_MODALFRAME|DS_CENTER);
- dte->style|=WS_CHILD;
+ dte->style &= ~(WS_VISIBLE|WS_CHILD|WS_POPUP|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|DS_MODALFRAME|DS_CENTER);
+ dte->style |= WS_CHILD;
}
else {
- opd->pTemplate->style&=~(WS_VISIBLE|WS_CHILD|WS_POPUP|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|DS_MODALFRAME|DS_CENTER);
- opd->pTemplate->style|=WS_CHILD;
+ opd->pTemplate->style &= ~(WS_VISIBLE|WS_CHILD|WS_POPUP|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|DS_MODALFRAME|DS_CENTER);
+ opd->pTemplate->style |= WS_CHILD;
}
- opd->dlgProc=odp->pfnDlgProc;
- opd->hInst=odp->hInstance;
- opd->hwnd=NULL;
- opd->changed=0;
- opd->simpleHeight=opd->expertHeight=0;
- opd->simpleBottomControlId=odp->nIDBottomSimpleControl;
- opd->simpleWidth=opd->expertWidth=0;
- opd->simpleRightControlId=odp->nIDRightSimpleControl;
- opd->nExpertOnlyControls=odp->nExpertOnlyControls;
- opd->expertOnlyControls=odp->expertOnlyControls;
- opd->flags=odp->flags;
- opd->dwInitParam=odp->dwInitParam;
+ opd->dlgProc = odp->pfnDlgProc;
+ opd->hInst = odp->hInstance;
+ opd->hwnd = NULL;
+ opd->changed = 0;
+ opd->simpleHeight = opd->expertHeight = 0;
+ opd->simpleBottomControlId = odp->nIDBottomSimpleControl;
+ opd->simpleWidth = opd->expertWidth = 0;
+ opd->simpleRightControlId = odp->nIDRightSimpleControl;
+ opd->nExpertOnlyControls = odp->nExpertOnlyControls;
+ opd->expertOnlyControls = odp->expertOnlyControls;
+ opd->flags = odp->flags;
+ opd->dwInitParam = odp->dwInitParam;
if ( odp->pszTitle == NULL )
opd->pszTitle = NULL;
else if ( odp->flags & ODPF_UNICODE ) {
@@ -687,23 +680,23 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR mir_free( lastPage );
mir_free( lastTab );
- GetWindowRect(GetDlgItem(hdlg,IDC_STNOPAGE),&dat->rcDisplay);
+ GetWindowRect(GetDlgItem(hdlg, IDC_STNOPAGE), &dat->rcDisplay);
MapWindowPoints(NULL, hdlg, (LPPOINT)&dat->rcDisplay, 2);
// Add an item to count in height
tie.mask = TCIF_TEXT | TCIF_IMAGE;
tie.iImage = -1;
tie.pszText = _T("X");
- TabCtrl_InsertItem(GetDlgItem(hdlg,IDC_TAB), 0, &tie);
+ TabCtrl_InsertItem(GetDlgItem(hdlg, IDC_TAB), 0, &tie);
- GetWindowRect(GetDlgItem(hdlg,IDC_TAB), &dat->rcTab);
+ GetWindowRect(GetDlgItem(hdlg, IDC_TAB), &dat->rcTab);
MapWindowPoints(NULL, hdlg, (LPPOINT)&dat->rcTab, 2);
- TabCtrl_AdjustRect(GetDlgItem(hdlg,IDC_TAB), FALSE, &dat->rcTab);
+ TabCtrl_AdjustRect(GetDlgItem(hdlg, IDC_TAB), FALSE, &dat->rcTab);
//!!!!!!!!!! int enableKeywordFiltering = DBGetContactSettingWord(NULL, "Options", "EnableKeywordFiltering", TRUE);
- FillFilterCombo( 0, //!!!!!!!!!! enableKeywordFiltering,
+ FillFilterCombo( 0, //!!!!!!!!!! enableKeywordFiltering,
hdlg, dat->opd, dat->pageCount);
- SendMessage(hdlg,DM_REBUILDPAGETREE,0,0);
+ SendMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
return TRUE;
}
@@ -713,9 +706,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR TVINSERTSTRUCT tvis;
TVITEMA tvi;
BOOL bRemoveFocusFromFilter = FALSE;
- char str[128],buf[130];
+ char str[128], buf[130];
- HINSTANCE FilterInst=NULL;
+ HINSTANCE FilterInst = NULL;
LPARAM oldSel = SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, CB_GETEDITSEL, 0, 0);
@@ -740,9 +733,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR _tcsncpy(dat->szFilterString, pos, SIZEOF(dat->szFilterString));
}
else {
- int sel = SendMessage( GetDlgItem(hdlg, IDC_KEYWORD_FILTER ), (UINT) CB_GETCURSEL, 0,0 );
+ int sel = SendMessage( GetDlgItem(hdlg, IDC_KEYWORD_FILTER ), (UINT) CB_GETCURSEL, 0, 0 );
if (sel != -1) {
- HINSTANCE hinst = (HINSTANCE)SendMessage( GetDlgItem(hdlg, IDC_KEYWORD_FILTER ), (UINT) CB_GETITEMDATA, sel ,0 );
+ HINSTANCE hinst = (HINSTANCE)SendMessage( GetDlgItem(hdlg, IDC_KEYWORD_FILTER ), (UINT) CB_GETITEMDATA, sel , 0 );
TCHAR szFileName[300];
GetModuleFileName(hinst, szFileName, SIZEOF(szFileName));
TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
@@ -760,7 +753,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR if ( dat->currentPage != (-1)) {
oldWnd = dat->opd[dat->currentPage].hwnd;
if ( dat->opd[dat->currentPage].insideTab )
- oldTab = GetDlgItem( hdlg,IDC_TAB );
+ oldTab = GetDlgItem( hdlg, IDC_TAB );
}
dat->hCurrentPage = NULL;
@@ -773,22 +766,22 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- for ( i=0; i < dat->pageCount; i++ ) {
- static TCHAR *fullTitle=NULL;
+ for ( i = 0; i < dat->pageCount; i++ ) {
+ static TCHAR *fullTitle = NULL;
TCHAR * useTitle;
if (fullTitle) mir_free(fullTitle);
- fullTitle=NULL;
+ fullTitle = NULL;
if (! CheckPageShow( hdlg, dat, i ) ) continue;
tvis.hParent = NULL;
- if ( FilterInst!=NULL ) {
- size_t sz=dat->opd[i].pszGroup?_tcslen(dat->opd[i].pszGroup)+1:0;
+ if ( FilterInst != NULL ) {
+ size_t sz = dat->opd[i].pszGroup?_tcslen(dat->opd[i].pszGroup)+1:0;
if (sz) sz+=3;
sz+=dat->opd[i].pszTitle?_tcslen(dat->opd[i].pszTitle)+1:0;
fullTitle = ( TCHAR* )mir_alloc(sz*sizeof(TCHAR));
- mir_sntprintf(fullTitle,sz,(dat->opd[i].pszGroup && dat->opd[i].pszTitle)?_T("%s - %s"):_T("%s%s"),dat->opd[i].pszGroup?dat->opd[i].pszGroup:_T(""),dat->opd[i].pszTitle?dat->opd[i].pszTitle:_T("") );
+ mir_sntprintf(fullTitle, sz, (dat->opd[i].pszGroup && dat->opd[i].pszTitle)?_T("%s - %s"):_T("%s%s"), dat->opd[i].pszGroup?dat->opd[i].pszGroup:_T(""), dat->opd[i].pszTitle?dat->opd[i].pszTitle:_T("") );
}
- useTitle=fullTitle?fullTitle:dat->opd[i].pszTitle;
- if (dat->opd[i].pszGroup != NULL && FilterInst==NULL) {
+ useTitle = fullTitle?fullTitle:dat->opd[i].pszTitle;
+ if (dat->opd[i].pszGroup != NULL && FilterInst == NULL) {
tvis.hParent = FindNamedTreeItemAtRoot(hwndTree, dat->opd[i].pszGroup);
if (tvis.hParent == NULL) {
tvis.item.lParam = -1;
@@ -798,31 +791,31 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR }
else {
TVITEM tvi;
- tvi.hItem = FindNamedTreeItemAtRoot(hwndTree,useTitle);
+ tvi.hItem = FindNamedTreeItemAtRoot(hwndTree, useTitle);
if ( tvi.hItem != NULL ) {
- if ( i == dat->currentPage ) dat->hCurrentPage=tvi.hItem;
+ if ( i == dat->currentPage ) dat->hCurrentPage = tvi.hItem;
tvi.mask = TVIF_PARAM;
- TreeView_GetItem(hwndTree,&tvi);
+ TreeView_GetItem(hwndTree, &tvi);
if ( tvi.lParam == -1 ) {
tvi.lParam = i;
- TreeView_SetItem(hwndTree,&tvi);
+ TreeView_SetItem(hwndTree, &tvi);
continue;
} } }
if ( dat->opd[i].pszTab != NULL ) {
HTREEITEM hItem;
if (tvis.hParent == NULL)
- hItem = FindNamedTreeItemAtRoot(hwndTree,useTitle);
+ hItem = FindNamedTreeItemAtRoot(hwndTree, useTitle);
else
- hItem = FindNamedTreeItemAtChildren(hwndTree,tvis.hParent,useTitle);
+ hItem = FindNamedTreeItemAtChildren(hwndTree, tvis.hParent, useTitle);
if ( hItem != NULL ) {
if ( i == dat->currentPage ) {
TVITEM tvi;
- tvi.hItem=hItem;
- tvi.mask=TVIF_PARAM;
- tvi.lParam=dat->currentPage;
- TreeView_SetItem(hwndTree,&tvi);
- dat->hCurrentPage=hItem;
+ tvi.hItem = hItem;
+ tvi.mask = TVIF_PARAM;
+ tvi.lParam = dat->currentPage;
+ TreeView_SetItem(hwndTree, &tvi);
+ dat->hCurrentPage = hItem;
}
continue;
}
@@ -835,7 +828,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR dat->hCurrentPage = dat->opd[i].hTreeItem;
if (fullTitle) mir_free(fullTitle);
- fullTitle=NULL;
+ fullTitle = NULL;
}
tvi.mask = TVIF_TEXT | TVIF_STATE;
tvi.pszText = str;
@@ -843,17 +836,17 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR tvi.hItem = TreeView_GetRoot(hwndTree);
while ( tvi.hItem != NULL ) {
if ( SendMessageA( hwndTree, TVM_GETITEMA, 0, (LPARAM)&tvi )) {
- mir_snprintf(buf, SIZEOF(buf), "%s%s",OPTSTATE_PREFIX,str);
+ mir_snprintf(buf, SIZEOF(buf), "%s%s", OPTSTATE_PREFIX, str);
if ( !DBGetContactSettingByte( NULL, "Options", buf, 1 ))
TreeView_Expand( hwndTree, tvi.hItem, TVE_COLLAPSE );
}
tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
}
- if (dat->hCurrentPage==NULL) {
- dat->hCurrentPage=TreeView_GetRoot(hwndTree);
- dat->currentPage=-1;
+ if (dat->hCurrentPage == NULL) {
+ dat->hCurrentPage = TreeView_GetRoot(hwndTree);
+ dat->currentPage = -1;
}
- TreeView_SelectItem(hwndTree,dat->hCurrentPage);
+ TreeView_SelectItem(hwndTree, dat->hCurrentPage);
if ( oldWnd ) {
if ( dat->currentPage == (-1) || oldWnd != dat->opd[dat->currentPage].hwnd ) {
@@ -870,21 +863,21 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, CB_SETEDITSEL, 0, oldSel ); //but don't select any of the text
- ShowWindow(hwndTree,SW_SHOW);
+ ShowWindow(hwndTree, SW_SHOW);
}
break;
case PSM_CHANGED:
- EnableWindow(GetDlgItem(hdlg,IDC_APPLY),TRUE);
- if (dat->currentPage != (-1)) dat->opd[dat->currentPage].changed=1;
+ EnableWindow(GetDlgItem(hdlg, IDC_APPLY), TRUE);
+ if (dat->currentPage != (-1)) dat->opd[dat->currentPage].changed = 1;
return TRUE;
case PSM_ISEXPERT:
- SetWindowLongPtr(hdlg,DWLP_MSGRESULT,IsDlgButtonChecked(hdlg,IDC_EXPERT));
+ SetWindowLongPtr(hdlg, DWLP_MSGRESULT, IsDlgButtonChecked(hdlg, IDC_EXPERT));
return TRUE;
case PSM_GETBOLDFONT:
- SetWindowLongPtr(hdlg,DWLP_MSGRESULT,(LONG_PTR)dat->hBoldFont);
+ SetWindowLongPtr(hdlg, DWLP_MSGRESULT, (LONG_PTR)dat->hBoldFont);
return TRUE;
case WM_NOTIFY:
@@ -892,188 +885,187 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR case IDC_TAB:
case IDC_PAGETREE:
switch(((LPNMHDR)lParam)->code) {
- case TVN_ITEMEXPANDING:
- SetWindowLongPtr(hdlg,DWLP_MSGRESULT,FALSE);
- return TRUE;
- case TCN_SELCHANGING:
- case TVN_SELCHANGING:
- { PSHNOTIFY pshn;
- if (dat->currentPage==-1 || dat->opd[dat->currentPage].hwnd==NULL) break;
- pshn.hdr.code=PSN_KILLACTIVE;
- pshn.hdr.hwndFrom=dat->opd[dat->currentPage].hwnd;
- pshn.hdr.idFrom=0;
- pshn.lParam=0;
- if (SendMessage(dat->opd[dat->currentPage].hwnd,WM_NOTIFY,0,(LPARAM)&pshn)) {
- SetWindowLongPtr(hdlg,DWLP_MSGRESULT,TRUE);
+ case TVN_ITEMEXPANDING:
+ SetWindowLongPtr(hdlg, DWLP_MSGRESULT, FALSE);
+ return TRUE;
+
+ case TCN_SELCHANGING:
+ case TVN_SELCHANGING:
+ if (dat->currentPage != -1 && dat->opd[dat->currentPage].hwnd != NULL) {
+ PSHNOTIFY pshn;
+ pshn.hdr.code = PSN_KILLACTIVE;
+ pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = 0;
+ if (SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn)) {
+ SetWindowLongPtr(hdlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
- break;
}
- case TCN_SELCHANGE:
- case TVN_SELCHANGED:
- { BOOL tabChange = (wParam == IDC_TAB);
- ShowWindow(GetDlgItem(hdlg,IDC_STNOPAGE),SW_HIDE);
- if (dat->currentPage!=-1 && dat->opd[dat->currentPage].hwnd!=NULL) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_HIDE);
- if (!tabChange) {
- TVITEM tvi;
- tvi.hItem=dat->hCurrentPage=TreeView_GetSelection(hwndTree);
- if (tvi.hItem==NULL) break;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- TreeView_GetItem(hwndTree,&tvi);
- dat->currentPage=tvi.lParam;
- ShowWindow(GetDlgItem(hdlg,IDC_TAB),SW_HIDE);
- }
- else {
- TCITEM tie;
- TVITEM tvi;
-
- tie.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hdlg,IDC_TAB),TabCtrl_GetCurSel(GetDlgItem(hdlg,IDC_TAB)),&tie);
- dat->currentPage=tie.lParam;
-
- tvi.hItem=dat->hCurrentPage;
- tvi.mask=TVIF_PARAM;
- tvi.lParam=dat->currentPage;
- TreeView_SetItem(hwndTree,&tvi);
- }
- if ( dat->currentPage != -1 ) {
- if ( dat->opd[dat->currentPage].hwnd == NULL ) {
- RECT rcPage;
- RECT rcControl,rc;
- int w,h;
-
- dat->opd[dat->currentPage].hwnd=CreateDialogIndirectParamA(dat->opd[dat->currentPage].hInst,dat->opd[dat->currentPage].pTemplate,hdlg,dat->opd[dat->currentPage].dlgProc,dat->opd[dat->currentPage].dwInitParam);
- if (dat->opd[dat->currentPage].flags&ODPF_BOLDGROUPS)
- EnumChildWindows(dat->opd[dat->currentPage].hwnd,BoldGroupTitlesEnumChildren,(LPARAM)dat->hBoldFont);
- GetClientRect(dat->opd[dat->currentPage].hwnd,&rcPage);
- dat->opd[dat->currentPage].expertWidth=rcPage.right;
- dat->opd[dat->currentPage].expertHeight=rcPage.bottom;
- GetWindowRect(dat->opd[dat->currentPage].hwnd,&rc);
-
- if (dat->opd[dat->currentPage].simpleBottomControlId) {
- GetWindowRect(GetDlgItem(dat->opd[dat->currentPage].hwnd,dat->opd[dat->currentPage].simpleBottomControlId),&rcControl);
- dat->opd[dat->currentPage].simpleHeight=rcControl.bottom-rc.top;
- }
- else dat->opd[dat->currentPage].simpleHeight=dat->opd[dat->currentPage].expertHeight;
+ break;
- if (dat->opd[dat->currentPage].simpleRightControlId) {
- GetWindowRect(GetDlgItem(dat->opd[dat->currentPage].hwnd,dat->opd[dat->currentPage].simpleRightControlId),&rcControl);
- dat->opd[dat->currentPage].simpleWidth=rcControl.right-rc.left;
- }
- else dat->opd[dat->currentPage].simpleWidth=dat->opd[dat->currentPage].expertWidth;
+ case TCN_SELCHANGE:
+ case TVN_SELCHANGED:
+ ShowWindow(GetDlgItem(hdlg, IDC_STNOPAGE), SW_HIDE);
+ if (dat->currentPage != -1 && dat->opd[dat->currentPage].hwnd != NULL)
+ ShowWindow(dat->opd[dat->currentPage].hwnd, SW_HIDE);
- if (IsDlgButtonChecked(hdlg,IDC_EXPERT)) {
- w=dat->opd[dat->currentPage].expertWidth;
- h=dat->opd[dat->currentPage].expertHeight;
- }
- else {
- int i;
- for (i=0;i<dat->opd[dat->currentPage].nExpertOnlyControls;i++)
- ShowWindow(GetDlgItem(dat->opd[dat->currentPage].hwnd,dat->opd[dat->currentPage].expertOnlyControls[i]),SW_HIDE);
- w=dat->opd[dat->currentPage].simpleWidth;
- h=dat->opd[dat->currentPage].simpleHeight;
- }
+ if ((wParam != IDC_TAB)) {
+ TVITEM tvi;
+ tvi.hItem = dat->hCurrentPage = TreeView_GetSelection(hwndTree);
+ if (tvi.hItem == NULL) break;
+ tvi.mask = TVIF_HANDLE|TVIF_PARAM;
+ TreeView_GetItem(hwndTree, &tvi);
+ dat->currentPage = tvi.lParam;
+ ShowWindow(GetDlgItem(hdlg, IDC_TAB), SW_HIDE);
+ }
+ else {
+ TCITEM tie;
+ TVITEM tvi;
- dat->opd[dat->currentPage].offsetX = 0;
- dat->opd[dat->currentPage].offsetY = 0;
+ tie.mask = TCIF_PARAM;
+ TabCtrl_GetItem(GetDlgItem(hdlg, IDC_TAB), TabCtrl_GetCurSel(GetDlgItem(hdlg, IDC_TAB)), &tie);
+ dat->currentPage = tie.lParam;
- dat->opd[dat->currentPage].insideTab = IsInsideTab( hdlg, dat, dat->currentPage );
- if (dat->opd[dat->currentPage].insideTab) {
- SetWindowPos(dat->opd[dat->currentPage].hwnd,HWND_TOP,(dat->rcTab.left+dat->rcTab.right-w)>>1,dat->rcTab.top,w,h,0);
- ThemeDialogBackground(dat->opd[dat->currentPage].hwnd,TRUE);
- } else {
- SetWindowPos(dat->opd[dat->currentPage].hwnd,HWND_TOP,(dat->rcDisplay.left+dat->rcDisplay.right-w)>>1,(dat->rcDisplay.top+dat->rcDisplay.bottom-h)>>1,w,h,0);
- ThemeDialogBackground(dat->opd[dat->currentPage].hwnd,FALSE);
- }
+ tvi.hItem = dat->hCurrentPage;
+ tvi.mask = TVIF_PARAM;
+ tvi.lParam = dat->currentPage;
+ TreeView_SetItem(hwndTree, &tvi);
+ }
+ if ( dat->currentPage != -1 ) {
+ OptionsPageData& p = dat->opd[dat->currentPage];
+ if ( p.hwnd == NULL ) {
+ RECT rcPage;
+ RECT rcControl, rc;
+ int w, h;
+
+ p.hwnd = CreateDialogIndirectParamA(p.hInst, p.pTemplate, hdlg, p.dlgProc, p.dwInitParam);
+ if (p.flags & ODPF_BOLDGROUPS)
+ EnumChildWindows(p.hwnd, BoldGroupTitlesEnumChildren, (LPARAM)dat->hBoldFont);
+ GetClientRect(p.hwnd, &rcPage);
+ p.expertWidth = rcPage.right;
+ p.expertHeight = rcPage.bottom;
+ GetWindowRect(p.hwnd, &rc);
+
+ if (p.simpleBottomControlId) {
+ GetWindowRect(GetDlgItem(p.hwnd, p.simpleBottomControlId), &rcControl);
+ p.simpleHeight = rcControl.bottom-rc.top;
}
- if ( !tabChange )
- {
- dat->opd[ dat->currentPage].insideTab = IsInsideTab( hdlg, dat, dat->currentPage );
- if ( dat->opd[dat->currentPage].insideTab ) {
- // Make tabbed pane
- int i,pages=0,sel=0;
- TCITEM tie;
- HWND hwndTab = GetDlgItem(hdlg,IDC_TAB);
-
- TabCtrl_DeleteAllItems(hwndTab);
- tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
- tie.iImage = -1;
- for ( i=0; i < dat->pageCount; i++ ) {
- if (!CheckPageShow( hdlg, dat, i ) ) continue;
- //if (( dat->opd[i].flags & ODPF_SIMPLEONLY ) && IsDlgButtonChecked( hdlg, IDC_EXPERT )) continue;
- //if (( dat->opd[i].flags & ODPF_EXPERTONLY ) && !IsDlgButtonChecked( hdlg, IDC_EXPERT )) continue;
- if ( lstrcmp(dat->opd[i].pszTitle, dat->opd[dat->currentPage].pszTitle) || lstrcmpnull(dat->opd[i].pszGroup, dat->opd[dat->currentPage].pszGroup) ) continue;
-
- tie.pszText = dat->opd[i].pszTab;
- tie.lParam = i;
- TabCtrl_InsertItem(hwndTab, pages, &tie);
- if ( !lstrcmp(dat->opd[i].pszTab,dat->opd[dat->currentPage].pszTab) )
- sel = pages;
- pages++;
- }
- TabCtrl_SetCurSel(hwndTab,sel);
- ShowWindow(hwndTab, dat->opd[dat->currentPage].insideTab ? SW_SHOW : SW_HIDE );
- }
+ else p.simpleHeight = p.expertHeight;
- if (dat->opd[dat->currentPage].insideTab)
- ThemeDialogBackground(dat->opd[dat->currentPage].hwnd,TRUE);
- else
- ThemeDialogBackground(dat->opd[dat->currentPage].hwnd,FALSE);
+ if (p.simpleRightControlId) {
+ GetWindowRect(GetDlgItem(p.hwnd, p.simpleRightControlId), &rcControl);
+ p.simpleWidth = rcControl.right-rc.left;
}
+ else p.simpleWidth = p.expertWidth;
- // Resizing
- if (!dat->opd[dat->currentPage].simpleBottomControlId)
- {
- int pageWidth, pageHeight;
-
- if (IsDlgButtonChecked(hdlg,IDC_EXPERT)) {
- pageWidth=dat->opd[dat->currentPage].expertWidth;
- pageHeight=dat->opd[dat->currentPage].expertHeight;
- }
- else {
- pageWidth=dat->opd[dat->currentPage].simpleWidth;
- pageHeight=dat->opd[dat->currentPage].simpleHeight;
- }
+ if (IsDlgButtonChecked(hdlg, IDC_EXPERT)) {
+ w = p.expertWidth;
+ h = p.expertHeight;
+ }
+ else {
+ for (int i = 0; i < p.nExpertOnlyControls; i++)
+ ShowWindow(GetDlgItem(p.hwnd, p.expertOnlyControls[i]), SW_HIDE);
+ w = p.simpleWidth;
+ h = p.simpleHeight;
+ }
- RECT * parentPageRect = &dat->rcDisplay;
+ p.offsetX = 0;
+ p.offsetY = 0;
- if ( dat->opd[dat->currentPage].insideTab )
- parentPageRect = &dat->rcTab;
+ p.insideTab = IsInsideTab( hdlg, dat, dat->currentPage );
+ if (p.insideTab) {
+ SetWindowPos(p.hwnd, HWND_TOP, (dat->rcTab.left+dat->rcTab.right-w)>>1, dat->rcTab.top, w, h, 0);
+ ThemeDialogBackground(p.hwnd, TRUE);
+ }
+ else {
+ SetWindowPos(p.hwnd, HWND_TOP, (dat->rcDisplay.left+dat->rcDisplay.right-w)>>1, (dat->rcDisplay.top+dat->rcDisplay.bottom-h)>>1, w, h, 0);
+ ThemeDialogBackground(p.hwnd, FALSE);
+ }
+ }
+ if (wParam != IDC_TAB) {
+ p.insideTab = IsInsideTab( hdlg, dat, dat->currentPage );
+ if (p.insideTab) {
+ // Make tabbed pane
+ int i, pages = 0, sel = 0;
+ TCITEM tie;
+ HWND hwndTab = GetDlgItem(hdlg, IDC_TAB);
+
+ TabCtrl_DeleteAllItems(hwndTab);
+ tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
+ tie.iImage = -1;
+ for ( i = 0; i < dat->pageCount; i++ ) {
+ if (!CheckPageShow( hdlg, dat, i ) ) continue;
+ //if (( dat->opd[i].flags & ODPF_SIMPLEONLY ) && IsDlgButtonChecked( hdlg, IDC_EXPERT )) continue;
+ //if (( dat->opd[i].flags & ODPF_EXPERTONLY ) && !IsDlgButtonChecked( hdlg, IDC_EXPERT )) continue;
+ if ( lstrcmp(dat->opd[i].pszTitle, p.pszTitle) || lstrcmpnull(dat->opd[i].pszGroup, p.pszGroup) ) continue;
+
+ tie.pszText = dat->opd[i].pszTab;
+ tie.lParam = i;
+ TabCtrl_InsertItem(hwndTab, pages, &tie);
+ if ( !lstrcmp(dat->opd[i].pszTab, p.pszTab) )
+ sel = pages;
+ pages++;
+ }
+ TabCtrl_SetCurSel(hwndTab, sel);
+ ShowWindow(hwndTab, p.insideTab ? SW_SHOW : SW_HIDE );
+ }
- pageHeight = min( pageHeight, parentPageRect->bottom - parentPageRect->top );
- pageWidth = min( pageWidth, parentPageRect->right - parentPageRect->left );
+ if (p.insideTab)
+ ThemeDialogBackground(p.hwnd, TRUE);
+ else
+ ThemeDialogBackground(p.hwnd, FALSE);
+ }
- int newOffsetX = ( parentPageRect->right - parentPageRect->left - pageWidth ) >> 1;
- int newOffsetY = dat->opd[dat->currentPage].insideTab ? 0 : ( parentPageRect->bottom - parentPageRect->top - pageHeight ) >> 1;
+ // Resizing
+ if (!p.simpleBottomControlId) {
+ int pageWidth, pageHeight;
- struct MoveChildParam mcp;
- mcp.hDlg = dat->opd[dat->currentPage].hwnd;
- mcp.offset.x = newOffsetX - dat->opd[dat->currentPage].offsetX;
- mcp.offset.y = newOffsetY - dat->opd[dat->currentPage].offsetY;
+ if (IsDlgButtonChecked(hdlg, IDC_EXPERT)) {
+ pageWidth = p.expertWidth;
+ pageHeight = p.expertHeight;
+ }
+ else {
+ pageWidth = p.simpleWidth;
+ pageHeight = p.simpleHeight;
+ }
+ RECT* parentPageRect = &dat->rcDisplay;
+ if ( p.insideTab )
+ parentPageRect = &dat->rcTab;
+
+ pageHeight = min( pageHeight, parentPageRect->bottom - parentPageRect->top );
+ pageWidth = min( pageWidth, parentPageRect->right - parentPageRect->left );
+
+ int newOffsetX = ( parentPageRect->right - parentPageRect->left - pageWidth ) >> 1;
+ int newOffsetY = p.insideTab ? 0 : ( parentPageRect->bottom - parentPageRect->top - pageHeight ) >> 1;
+
+ struct MoveChildParam mcp;
+ mcp.hDlg = p.hwnd;
+ mcp.offset.x = newOffsetX - p.offsetX;
+ mcp.offset.y = newOffsetY - p.offsetY;
+
+ if ( mcp.offset.x || mcp.offset.y ) {
+ EnumChildWindows(p.hwnd, MoveEnumChildren, (LPARAM)(&mcp));
+
+ SetWindowPos( p.hwnd, NULL,
+ parentPageRect->left, parentPageRect->top,
+ parentPageRect->right - parentPageRect->left,
+ parentPageRect->bottom - parentPageRect->top,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ p.offsetX = newOffsetX;
+ p.offsetY = newOffsetY;
+ }
- if ( mcp.offset.x || mcp.offset.y )
- {
- EnumChildWindows(dat->opd[dat->currentPage].hwnd,MoveEnumChildren,(LPARAM)(&mcp));
-
- SetWindowPos( dat->opd[dat->currentPage].hwnd, NULL,
- parentPageRect->left, parentPageRect->top,
- parentPageRect->right - parentPageRect->left,
- parentPageRect->bottom - parentPageRect->top,
- SWP_NOZORDER | SWP_NOACTIVATE );
- dat->opd[dat->currentPage].offsetX = newOffsetX;
- dat->opd[dat->currentPage].offsetY = newOffsetY;
- }
-
- }
+ }
- ShowWindow(dat->opd[dat->currentPage].hwnd,SW_SHOW);
- if (((LPNMTREEVIEW)lParam)->action==TVC_BYMOUSE) PostMessage(hdlg,DM_FOCUSPAGE,0,0);
- else SetFocus(hwndTree);
- }
- else ShowWindow(GetDlgItem(hdlg,IDC_STNOPAGE),SW_SHOW);
- break;
- } } }
+ ShowWindow(p.hwnd, SW_SHOW);
+ if (((LPNMTREEVIEW)lParam)->action == TVC_BYMOUSE) PostMessage(hdlg, DM_FOCUSPAGE, 0, 0);
+ else SetFocus(hwndTree);
+ }
+ else ShowWindow(GetDlgItem(hdlg, IDC_STNOPAGE), SW_SHOW);
+ break;
+ } }
break;
case DM_FOCUSPAGE:
@@ -1084,7 +1076,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR case WM_TIMER:
if (wParam == FILTER_TIMEOUT_TIMER) {
SaveOptionsTreeState(hdlg);
- SendMessage(hdlg,DM_REBUILDPAGETREE,0,0);
+ SendMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
KillTimer(hdlg, FILTER_TIMEOUT_TIMER);
}
@@ -1094,7 +1086,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR switch(LOWORD(wParam)) {
case IDC_KEYWORD_FILTER:
//add a timer - when the timer elapses filter the option pages
- if ( (HIWORD(wParam)==CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
+ if ( (HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
if (!SetTimer(hdlg, FILTER_TIMEOUT_TIMER, 400, NULL))
MessageBeep(MB_ICONSTOP);
@@ -1102,91 +1094,91 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR case IDC_EXPERT:
{
- int expert=IsDlgButtonChecked(hdlg,IDC_EXPERT);
- int i,j;
+ int expert = IsDlgButtonChecked(hdlg, IDC_EXPERT);
+ int i, j;
PSHNOTIFY pshn;
RECT rcPage;
- int neww,newh;
-
- DBWriteContactSettingByte(NULL,"Options","Expert",(BYTE)expert);
- pshn.hdr.idFrom=0;
- pshn.lParam=expert;
- pshn.hdr.code=PSN_EXPERTCHANGED;
- for (i=0;i<dat->pageCount;i++) {
- if (dat->opd[i].hwnd==NULL) continue;
+ int neww, newh;
+
+ DBWriteContactSettingByte(NULL, "Options", "Expert", (BYTE)expert);
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = expert;
+ pshn.hdr.code = PSN_EXPERTCHANGED;
+ for (i = 0;i<dat->pageCount;i++) {
+ if (dat->opd[i].hwnd == NULL) continue;
if (!CheckPageShow( hdlg, dat, i ) ) continue;
//if (( dat->opd[i].flags & ODPF_SIMPLEONLY ) && expert) continue;
//if (( dat->opd[i].flags & ODPF_EXPERTONLY ) && !expert) continue;
- pshn.hdr.hwndFrom=dat->opd[i].hwnd;
- SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn);
+ pshn.hdr.hwndFrom = dat->opd[i].hwnd;
+ SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
- for (j=0;j<dat->opd[i].nExpertOnlyControls;j++)
- ShowWindow(GetDlgItem(dat->opd[i].hwnd,dat->opd[i].expertOnlyControls[j]),expert?SW_SHOW:SW_HIDE);
+ for (j = 0;j<dat->opd[i].nExpertOnlyControls;j++)
+ ShowWindow(GetDlgItem(dat->opd[i].hwnd, dat->opd[i].expertOnlyControls[j]), expert?SW_SHOW:SW_HIDE);
dat->opd[i].insideTab = IsInsideTab( hdlg, dat, i );
- GetWindowRect(dat->opd[i].hwnd,&rcPage);
- if (dat->opd[i].simpleBottomControlId) newh=expert?dat->opd[i].expertHeight:dat->opd[i].simpleHeight;
- else newh=rcPage.bottom-rcPage.top;
- if (dat->opd[i].simpleRightControlId) neww=expert?dat->opd[i].expertWidth:dat->opd[i].simpleWidth;
- else neww=rcPage.right-rcPage.left;
- if (i==dat->currentPage) {
- POINT ptStart,ptEnd,ptNow;
- DWORD thisTick,startTick;
+ GetWindowRect(dat->opd[i].hwnd, &rcPage);
+ if (dat->opd[i].simpleBottomControlId) newh = expert?dat->opd[i].expertHeight:dat->opd[i].simpleHeight;
+ else newh = rcPage.bottom-rcPage.top;
+ if (dat->opd[i].simpleRightControlId) neww = expert?dat->opd[i].expertWidth:dat->opd[i].simpleWidth;
+ else neww = rcPage.right-rcPage.left;
+ if (i == dat->currentPage) {
+ POINT ptStart, ptEnd, ptNow;
+ DWORD thisTick, startTick;
RECT rc;
- ptNow.x=ptNow.y=0;
- ClientToScreen(hdlg,&ptNow);
- GetWindowRect(dat->opd[i].hwnd,&rc);
- ptStart.x=rc.left-ptNow.x;
- ptStart.y=rc.top-ptNow.y;
+ ptNow.x = ptNow.y = 0;
+ ClientToScreen(hdlg, &ptNow);
+ GetWindowRect(dat->opd[i].hwnd, &rc);
+ ptStart.x = rc.left-ptNow.x;
+ ptStart.y = rc.top-ptNow.y;
if (dat->opd[i].insideTab) {
- ptEnd.x=(dat->rcTab.left+dat->rcTab.right-neww)>>1;
- ptEnd.y=dat->rcTab.top;
+ ptEnd.x = (dat->rcTab.left+dat->rcTab.right-neww)>>1;
+ ptEnd.y = dat->rcTab.top;
} else {
- ptEnd.x=(dat->rcDisplay.left+dat->rcDisplay.right-neww)>>1;
- ptEnd.y=(dat->rcDisplay.top+dat->rcDisplay.bottom-newh)>>1;
+ ptEnd.x = (dat->rcDisplay.left+dat->rcDisplay.right-neww)>>1;
+ ptEnd.y = (dat->rcDisplay.top+dat->rcDisplay.bottom-newh)>>1;
}
if (abs(ptEnd.x-ptStart.x)>5 || abs(ptEnd.y-ptStart.y)>5) {
- startTick=GetTickCount();
- SetWindowPos(dat->opd[i].hwnd,HWND_TOP,0,0,min(neww,rcPage.right),min(newh,rcPage.bottom),SWP_NOMOVE);
+ startTick = GetTickCount();
+ SetWindowPos(dat->opd[i].hwnd, HWND_TOP, 0, 0, min(neww, rcPage.right), min(newh, rcPage.bottom), SWP_NOMOVE);
UpdateWindow(dat->opd[i].hwnd);
for (;;) {
- thisTick=GetTickCount();
+ thisTick = GetTickCount();
if (thisTick>startTick+100) break;
- ptNow.x=ptStart.x+(ptEnd.x-ptStart.x)*(int)(thisTick-startTick)/100;
- ptNow.y=ptStart.y+(ptEnd.y-ptStart.y)*(int)(thisTick-startTick)/100;
- SetWindowPos(dat->opd[i].hwnd,0,ptNow.x,ptNow.y,0,0,SWP_NOZORDER|SWP_NOSIZE);
+ ptNow.x = ptStart.x+(ptEnd.x-ptStart.x)*(int)(thisTick-startTick)/100;
+ ptNow.y = ptStart.y+(ptEnd.y-ptStart.y)*(int)(thisTick-startTick)/100;
+ SetWindowPos(dat->opd[i].hwnd, 0, ptNow.x, ptNow.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
}
}
if (dat->opd[i].insideTab)
- ShowWindow(GetDlgItem(hdlg,IDC_TAB),SW_SHOW);
+ ShowWindow(GetDlgItem(hdlg, IDC_TAB), SW_SHOW);
else
- ShowWindow(GetDlgItem(hdlg,IDC_TAB),SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, IDC_TAB), SW_HIDE);
}
if (dat->opd[i].insideTab) {
- SetWindowPos(dat->opd[i].hwnd,HWND_TOP,(dat->rcTab.left+dat->rcTab.right-neww)>>1,dat->rcTab.top,neww,newh,0);
- ThemeDialogBackground(dat->opd[i].hwnd,TRUE);
+ SetWindowPos(dat->opd[i].hwnd, HWND_TOP, (dat->rcTab.left+dat->rcTab.right-neww)>>1, dat->rcTab.top, neww, newh, 0);
+ ThemeDialogBackground(dat->opd[i].hwnd, TRUE);
} else {
- SetWindowPos(dat->opd[i].hwnd,HWND_TOP,(dat->rcDisplay.left+dat->rcDisplay.right-neww)>>1,(dat->rcDisplay.top+dat->rcDisplay.bottom-newh)>>1,neww,newh,0);
- ThemeDialogBackground(dat->opd[i].hwnd,FALSE);
+ SetWindowPos(dat->opd[i].hwnd, HWND_TOP, (dat->rcDisplay.left+dat->rcDisplay.right-neww)>>1, (dat->rcDisplay.top+dat->rcDisplay.bottom-newh)>>1, neww, newh, 0);
+ ThemeDialogBackground(dat->opd[i].hwnd, FALSE);
}
}
SaveOptionsTreeState(hdlg);
- SendMessage(hdlg,DM_REBUILDPAGETREE,0,0);
+ SendMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
break;
}
case IDCANCEL:
{ int i;
PSHNOTIFY pshn;
- pshn.hdr.idFrom=0;
- pshn.lParam=0;
- pshn.hdr.code=PSN_RESET;
- for (i=0;i<dat->pageCount;i++) {
- if (dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue;
- pshn.hdr.hwndFrom=dat->opd[i].hwnd;
- SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn);
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = 0;
+ pshn.hdr.code = PSN_RESET;
+ for (i = 0;i<dat->pageCount;i++) {
+ if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
+ pshn.hdr.hwndFrom = dat->opd[i].hwnd;
+ SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
DestroyWindow(hdlg);
break;
@@ -1197,31 +1189,31 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR int i;
PSHNOTIFY pshn;
- if (LOWORD(wParam) == IDOK && GetParent(GetFocus()) == GetDlgItem(hdlg, IDC_KEYWORD_FILTER))
+ if (LOWORD(wParam) == IDOK && GetParent(GetFocus()) == GetDlgItem(hdlg, IDC_KEYWORD_FILTER))
return TRUE;
- EnableWindow(GetDlgItem(hdlg,IDC_APPLY),FALSE);
+ EnableWindow(GetDlgItem(hdlg, IDC_APPLY), FALSE);
SetFocus(hwndTree);
- if (dat->currentPage!=(-1)) {
- pshn.hdr.idFrom=0;
- pshn.lParam=0;
- pshn.hdr.code=PSN_KILLACTIVE;
- pshn.hdr.hwndFrom=dat->opd[dat->currentPage].hwnd;
- if (SendMessage(dat->opd[dat->currentPage].hwnd,WM_NOTIFY,0,(LPARAM)&pshn))
+ if (dat->currentPage != (-1)) {
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = 0;
+ pshn.hdr.code = PSN_KILLACTIVE;
+ pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
+ if (SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn))
break;
}
- pshn.hdr.code=PSN_APPLY;
- for (i=0;i<dat->pageCount;i++) {
- if (dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue;
- dat->opd[i].changed=0;
- pshn.hdr.hwndFrom=dat->opd[i].hwnd;
- if (SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn)==PSNRET_INVALID_NOCHANGEPAGE) {
- dat->hCurrentPage=dat->opd[i].hTreeItem;
- TreeView_SelectItem(hwndTree,dat->hCurrentPage);
- if (dat->currentPage!=(-1)) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_HIDE);
- dat->currentPage=i;
- if (dat->currentPage != (-1)) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_SHOW);
+ pshn.hdr.code = PSN_APPLY;
+ for (i = 0;i<dat->pageCount;i++) {
+ if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
+ dat->opd[i].changed = 0;
+ pshn.hdr.hwndFrom = dat->opd[i].hwnd;
+ if (SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
+ dat->hCurrentPage = dat->opd[i].hTreeItem;
+ TreeView_SelectItem(hwndTree, dat->hCurrentPage);
+ if (dat->currentPage != (-1)) ShowWindow(dat->opd[dat->currentPage].hwnd, SW_HIDE);
+ dat->currentPage = i;
+ if (dat->currentPage != (-1)) ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW);
return 0;
} }
@@ -1235,7 +1227,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR if ( FilterTimerId ) KillTimer ( hdlg, FilterTimerId );
DestroyWindow ( hFilterSearchWnd );
ClearFilterStrings();
- dat->szFilterString[0]=0;
+ dat->szFilterString[0] = 0;
SaveOptionsTreeState( hdlg );
Window_FreeIcon_IcoLib( hdlg );
@@ -1250,14 +1242,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR DBWriteContactSettingTString( NULL, "Options", "LastPage", dat->opd[dat->currentPage].pszTitle );
}
else {
- DBDeleteContactSetting(NULL,"Options","LastTab");
- DBDeleteContactSetting(NULL,"Options","LastGroup");
- DBDeleteContactSetting(NULL,"Options","LastPage");
+ DBDeleteContactSetting(NULL, "Options", "LastTab");
+ DBDeleteContactSetting(NULL, "Options", "LastGroup");
+ DBDeleteContactSetting(NULL, "Options", "LastPage");
}
Utils_SaveWindowPosition(hdlg, NULL, "Options", "");
{
int i;
- for ( i=0; i < dat->pageCount; i++ ) {
+ for ( i = 0; i < dat->pageCount; i++ ) {
if ( dat->opd[i].hwnd != NULL )
DestroyWindow(dat->opd[i].hwnd);
mir_free(dat->opd[i].pszGroup);
@@ -1279,7 +1271,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPAR static void FreeOptionsData( struct OptionsPageInit* popi )
{
int i;
- for ( i=0; i < popi->pageCount; i++ ) {
+ for ( i = 0; i < popi->pageCount; i++ ) {
mir_free(( char* )popi->odp[i].pszTitle );
mir_free( popi->odp[i].pszGroup );
mir_free( popi->odp[i].pszTab );
@@ -1314,12 +1306,12 @@ void OpenAccountOptions( PROTOACCOUNT* pa ) psh.pStartPage = (LPCTSTR)&ood;
psh.pszCaption = tszTitle;
psh.ppsp = (PROPSHEETPAGE*)opi.odp;
- hwndOptions = CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_OPTIONSPAGE),NULL,OptionsDlgProc,(LPARAM)&psh);
+ hwndOptions = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_OPTIONSPAGE), NULL, OptionsDlgProc, (LPARAM)&psh);
mir_free(( void* )ood.pszPage );
FreeOptionsData( &opi );
} }
-static void OpenOptionsNow(const char *pszGroup,const char *pszPage,const char *pszTab, bool bSinglePage=false)
+static void OpenOptionsNow(const char *pszGroup, const char *pszPage, const char *pszTab, bool bSinglePage = false)
{
if ( IsWindow( hwndOptions )) {
ShowWindow( hwndOptions, SW_RESTORE );
@@ -1329,16 +1321,16 @@ static void OpenOptionsNow(const char *pszGroup,const char *pszPage,const char * HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
TCHAR *ptszGroup = LangPackPcharToTchar(pszGroup);
- hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions,IDC_PAGETREE),ptszGroup);
+ hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), ptszGroup);
if (hItem != NULL) {
- hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions,IDC_PAGETREE),hItem,ptszPage);
+ hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, ptszPage);
}
mir_free(ptszGroup);
} else {
- hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions,IDC_PAGETREE),ptszPage);
+ hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), ptszPage);
}
if (hItem != NULL) {
- TreeView_SelectItem(GetDlgItem(hwndOptions,IDC_PAGETREE),hItem);
+ TreeView_SelectItem(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem);
}
mir_free(ptszPage);
}
@@ -1359,7 +1351,7 @@ static void OpenOptionsNow(const char *pszGroup,const char *pszPage,const char * psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell
hwndOptions = CreateDialogParam(hMirandaInst,
- MAKEINTRESOURCE(bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
+ MAKEINTRESOURCE(bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
NULL, OptionsDlgProc, (LPARAM)&psh);
FreeOptionsData( &opi );
@@ -1367,7 +1359,7 @@ static void OpenOptionsNow(const char *pszGroup,const char *pszPage,const char * static INT_PTR OpenOptions(WPARAM, LPARAM lParam)
{
- OPENOPTIONSDIALOG *ood=(OPENOPTIONSDIALOG*)lParam;
+ OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)lParam;
if ( ood == NULL )
return 1;
@@ -1383,7 +1375,7 @@ static INT_PTR OpenOptions(WPARAM, LPARAM lParam) static INT_PTR OpenOptionsPage(WPARAM, LPARAM lParam)
{
- OPENOPTIONSDIALOG *ood=(OPENOPTIONSDIALOG*)lParam;
+ OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)lParam;
if ( ood == NULL )
return 1;
@@ -1400,24 +1392,24 @@ static INT_PTR OpenOptionsPage(WPARAM, LPARAM lParam) static INT_PTR OpenOptionsDialog(WPARAM, LPARAM)
{
if (hwndOptions || GetAsyncKeyState(VK_CONTROL) || !ServiceExists(MS_MODERNOPT_SHOW))
- OpenOptionsNow(NULL,NULL,NULL);
+ OpenOptionsNow(NULL, NULL, NULL);
else
CallService(MS_MODERNOPT_SHOW, 0, 0);
return 0;
}
-static INT_PTR AddOptionsPage(WPARAM wParam,LPARAM lParam)
-{ OPTIONSDIALOGPAGE *odp=(OPTIONSDIALOGPAGE*)lParam, *dst;
- struct OptionsPageInit *opi=(struct OptionsPageInit*)wParam;
+static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam)
+{ OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)lParam, *dst;
+ struct OptionsPageInit *opi = (struct OptionsPageInit*)wParam;
- if (odp==NULL||opi==NULL) return 1;
- if (odp->cbSize!=sizeof(OPTIONSDIALOGPAGE)
+ if (odp == NULL||opi == NULL) return 1;
+ if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE)
&& odp->cbSize != OPTIONPAGE_OLD_SIZE
&& odp->cbSize != OPTIONPAGE_OLD_SIZE2
&& odp->cbSize != OPTIONPAGE_OLD_SIZE3)
return 1;
- opi->odp=(OPTIONSDIALOGPAGE*)mir_realloc(opi->odp,sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1));
+ opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1));
dst = opi->odp + opi->pageCount;
memset( dst, 0, sizeof( OPTIONSDIALOGPAGE ));
memcpy( dst, odp, odp->cbSize );
@@ -1498,7 +1490,7 @@ static int OptModulesLoaded(WPARAM, LPARAM) int ShutdownOptionsModule(WPARAM, LPARAM)
{
if (IsWindow(hwndOptions)) DestroyWindow(hwndOptions);
- hwndOptions=NULL;
+ hwndOptions = NULL;
//!!!!!!!!!! UnhookFilterEvents();
@@ -1507,14 +1499,14 @@ int ShutdownOptionsModule(WPARAM, LPARAM) int LoadOptionsModule(void)
{
- hwndOptions=NULL;
- hOptionsInitEvent=CreateHookableEvent(ME_OPT_INITIALISE);
- CreateServiceFunction(MS_OPT_ADDPAGE,AddOptionsPage);
- CreateServiceFunction(MS_OPT_OPENOPTIONS,OpenOptions);
- CreateServiceFunction(MS_OPT_OPENOPTIONSPAGE,OpenOptionsPage);
- CreateServiceFunction("Options/OptionsCommand",OpenOptionsDialog);
- HookEvent(ME_SYSTEM_MODULESLOADED,OptModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN,ShutdownOptionsModule);
+ hwndOptions = NULL;
+ hOptionsInitEvent = CreateHookableEvent(ME_OPT_INITIALISE);
+ CreateServiceFunction(MS_OPT_ADDPAGE, AddOptionsPage);
+ CreateServiceFunction(MS_OPT_OPENOPTIONS, OpenOptions);
+ CreateServiceFunction(MS_OPT_OPENOPTIONSPAGE, OpenOptionsPage);
+ CreateServiceFunction("Options/OptionsCommand", OpenOptionsDialog);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OptModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownOptionsModule);
//!!!!!!!!!! HookFilterEvents();
return 0;
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 6c84809932..f047793af5 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -46,7 +46,7 @@ typedef struct { // can all be NULL Miranda_Plugin_Interfaces Interfaces;
Database_Plugin_Info DbInfo;
CList_Initialise clistlink;
- PLUGININFOEX * pluginInfo; // must be freed if hInst==NULL then its a copy
+ PLUGININFOEX * pluginInfo; // must be freed if hInst == NULL then its a copy
DATABASELINK * dblink; // only valid during module being in memory
} BASIC_PLUGIN_INFO;
@@ -307,7 +307,7 @@ static int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, // fetch internal database function pointers
bpi->dblink = bpi->DbInfo(NULL);
// validate returned link structure
- if ( bpi->dblink && bpi->dblink->cbSize==sizeof(DATABASELINK) ) {
+ if ( bpi->dblink && bpi->dblink->cbSize == sizeof(DATABASELINK) ) {
bpi->hInst=h;
return 1;
}
@@ -957,7 +957,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar 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) );
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM) (LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p) );
break;
}
case IDC_GETMOREPLUGINS:
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index c8c1b3d5c6..f5ebd92fb1 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -213,7 +213,7 @@ static INT_PTR Proto_AddToContact(WPARAM wParam,LPARAM lParam) if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break;
pdCompare = Proto_IsProtocolLoaded(( char* )dbv.pszVal );
mir_free(dbv.pszVal);
- if (pdCompare==NULL) continue;
+ if (pdCompare == NULL) continue;
if (pd->type > pdCompare->type) break;
}
//put the new module at position i
@@ -241,12 +241,12 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam,LPARAM lParam) i = Proto_IsProtoOnContact(wParam,lParam);
if (!i) return 1;
- if (i==-1)
+ if (i == -1)
DBDeleteContactSetting((HANDLE)wParam,"Protocol","p");
else {
for (i--;;i++) { //we have to decrease i, as Proto_IsOnContact returns +1 more number than read from database
_itoa(i+1,str,10);
- if (0!=DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) {
+ if (0 != DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) {
_itoa(i,str,10);
DBDeleteContactSetting((HANDLE)wParam,"_Filter",str);
break;
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 8916ff1512..ed1e7c14f2 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -326,7 +326,7 @@ char** __fastcall Proto_FilesMatrixA( wchar_t **files ) if ( files == NULL ) return NULL;
int count = 0;
- while( files[ count++ ] );
+ while ( files[ count++ ] );
char** filesA = ( char** )mir_alloc( count * sizeof( char* ));
for ( int i = 0; i < count; ++i )
@@ -340,7 +340,7 @@ static wchar_t** __fastcall Proto_FilesMatrixU( char **files ) if ( files == NULL ) return NULL;
int count = 0;
- while( files[ count++ ] );
+ while ( files[ count++ ] );
wchar_t** filesU = ( wchar_t** )mir_alloc( count * sizeof( wchar_t* ));
for ( int i = 0; i < count; ++i )
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index 6e0906782e..b629958a0d 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -93,7 +93,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
char * pszFile = (char *) lParam;
- if ( pszFile && (DBGetContactSettingByte(NULL,"Skin","UseSound",0) || (int)wParam==1))
+ if ( pszFile && (DBGetContactSettingByte(NULL,"Skin","UseSound",0) || (int)wParam == 1))
PlaySoundA(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
return 0;
@@ -106,10 +106,10 @@ static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam) for (j=0; j<soundCount; j++) {
if ( pszSoundName && strcmp( soundList[j].name, pszSoundName ) == 0) {
- if (DBGetContactSettingByte(NULL, "SkinSoundsOff", pszSoundName, 0)==0) {
+ if (DBGetContactSettingByte(NULL, "SkinSoundsOff", pszSoundName, 0) == 0) {
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, "SkinSounds", pszSoundName, &dbv)==0) {
+ if (DBGetContactSettingString(NULL, "SkinSounds", pszSoundName, &dbv) == 0) {
char szFull[MAX_PATH];
pathToAbsolute(dbv.pszVal, szFull, NULL);
@@ -132,7 +132,7 @@ static HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name) tvi.pszText = str;
tvi.cchTextMax = SIZEOF(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
- while( tvi.hItem != NULL ) {
+ while ( tvi.hItem != NULL ) {
TreeView_GetItem( hwndTree, &tvi );
if ( !_tcsicmp( str, name ))
return tvi.hItem;
@@ -248,11 +248,11 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ZeroMemory(&tvi,sizeof(tvi));
ZeroMemory(&hti,sizeof(hti));
hti=TreeView_GetSelection(hwndTree);
- if (hti==NULL) break;
+ if (hti == NULL) break;
tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT;
tvi.hItem = hti;
- if (TreeView_GetItem(hwndTree, &tvi)==FALSE) break;
- if (tvi.lParam==-1) break;
+ if (TreeView_GetItem(hwndTree, &tvi) == FALSE) break;
+ if (tvi.lParam == -1) break;
if (soundList[tvi.lParam].tempFile)
NotifyEventHooks(hPlayEvent, 1, (LPARAM)soundList[tvi.lParam].tempFile);
else {
@@ -275,18 +275,18 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ZeroMemory(&tvi,sizeof(tvi));
ZeroMemory(&hti,sizeof(hti));
hti=TreeView_GetSelection(hwndTree);
- if (hti==NULL) break;
+ if (hti == NULL) break;
tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT;
tvi.hItem = hti;
- if (TreeView_GetItem(hwndTree, &tvi)==FALSE) break;
- if (tvi.lParam==-1) break;
+ if (TreeView_GetItem(hwndTree, &tvi) == FALSE) break;
+ if (tvi.lParam == -1) break;
if (soundList[tvi.lParam].tempFile)
mir_snprintf(strFull, SIZEOF(strFull), "%s", soundList[tvi.lParam].tempFile);
else {
- if (DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[tvi.lParam].name, 0)==0) {
+ if (DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[tvi.lParam].name, 0) == 0) {
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)==0) {
+ if (DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv) == 0) {
pathToAbsolute(dbv.pszVal, strdir, NULL);
DBFreeVariant(&dbv);
} } }
@@ -315,11 +315,11 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM soundList[tvi.lParam].tempFile = mir_strdup(strFull);
SetDlgItemTextA(hwndDlg, IDC_LOCATION, strFull);
}
- if (LOWORD(wParam)==IDC_GETMORE) {
+ if (LOWORD(wParam) == IDC_GETMORE) {
CallService(MS_UTILS_OPENURL,1,(LPARAM)"http://addons.miranda-im.org/index.php?action=display&id=5");
break;
}
- if (LOWORD(wParam)==IDC_LOCATION) {
+ if (LOWORD(wParam) == IDC_LOCATION) {
break;
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -368,7 +368,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NMTREEVIEW *pnmtv = (NMTREEVIEW*)lParam;
TVITEM tvi = pnmtv->itemNew;
- if (tvi.lParam==-1) {
+ if (tvi.lParam == -1) {
SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
}
else {
@@ -392,7 +392,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
NMTVKEYDOWN* ptkd = (NMTVKEYDOWN*)lParam;
- if (ptkd&&ptkd->wVKey==VK_SPACE&&TreeView_GetSelection(ptkd->hdr.hwndFrom))
+ if (ptkd&&ptkd->wVKey == VK_SPACE&&TreeView_GetSelection(ptkd->hdr.hwndFrom))
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -405,7 +405,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti))
if (hti.flags&TVHT_ONITEM)
if (hti.flags&TVHT_ONITEMSTATEICON)
- if (TreeView_GetParent(hwndTree, hti.hItem)!=NULL)
+ if (TreeView_GetParent(hwndTree, hti.hItem) != NULL)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
} }
diff --git a/src/modules/sremail/email.cpp b/src/modules/sremail/email.cpp index 149b984db3..38a1e0eb11 100644 --- a/src/modules/sremail/email.cpp +++ b/src/modules/sremail/email.cpp @@ -38,7 +38,7 @@ static INT_PTR SendEMailCommand(WPARAM wParam,LPARAM lParam) char *szProto;
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
- if (szProto==NULL || DBGetContactSettingString((HANDLE)wParam,szProto,"e-mail",&dbv)) {
+ if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam,szProto,"e-mail",&dbv)) {
if (DBGetContactSettingString((HANDLE)wParam,"UserInfo","Mye-mail0",&dbv)) {
MessageBox((HWND)lParam,TranslateT("User has not registered an e-mail address"),TranslateT("Send e-mail"),MB_OK);
return 1;
diff --git a/src/modules/srfile/file.cpp b/src/modules/srfile/file.cpp index b5172ae9c4..6073dd7a8a 100644 --- a/src/modules/srfile/file.cpp +++ b/src/modules/srfile/file.cpp @@ -267,12 +267,12 @@ static void RemoveUnreadFileEvents(void) dbei.cbSize=sizeof(dbei);
hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hContact) {
+ while (hContact) {
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);
- while(hDbEvent) {
+ while (hDbEvent) {
dbei.cbBlob=0;
CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_FILE)
+ if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)hDbEvent);
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
}
diff --git a/src/modules/srfile/fileexistsdlg.cpp b/src/modules/srfile/fileexistsdlg.cpp index 1ba90b11c0..23bc8b0877 100644 --- a/src/modules/srfile/fileexistsdlg.cpp +++ b/src/modules/srfile/fileexistsdlg.cpp @@ -52,7 +52,7 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime) static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POINT *ptCursor)
{
IShellFolder *pDesktopFolder;
- if (SHGetDesktopFolder(&pDesktopFolder)==NOERROR) {
+ if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) {
ITEMIDLIST *pCurrentIdl;
#if defined( _UNICODE )
WCHAR* wszFilename = ( LPWSTR )szFilename;
@@ -60,14 +60,14 @@ static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POI WCHAR wszFilename[MAX_PATH];
MultiByteToWideChar(CP_ACP,0,szFilename,-1,wszFilename,SIZEOF(wszFilename));
#endif
- if (pDesktopFolder->ParseDisplayName(NULL,NULL,wszFilename,NULL,&pCurrentIdl,NULL)==NOERROR) {
+ if (pDesktopFolder->ParseDisplayName(NULL,NULL,wszFilename,NULL,&pCurrentIdl,NULL) == NOERROR) {
if (pCurrentIdl->mkid.cb) {
ITEMIDLIST *pidl,*pidlNext,*pidlFilename;
IShellFolder *pFileFolder;
for (pidl=pCurrentIdl;;) {
pidlNext=(ITEMIDLIST*)((PBYTE)pidl+pidl->mkid.cb);
- if (pidlNext->mkid.cb==0) {
+ if (pidlNext->mkid.cb == 0) {
pidlFilename = (ITEMIDLIST*)CoTaskMemAlloc(pidl->mkid.cb+sizeof(pidl->mkid.cb));
CopyMemory(pidlFilename,pidl,pidl->mkid.cb+sizeof(pidl->mkid.cb));
pidl->mkid.cb=0;
@@ -75,9 +75,9 @@ static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POI }
pidl=pidlNext;
}
- if (pDesktopFolder->BindToObject(pCurrentIdl,NULL,IID_IShellFolder,(void**)&pFileFolder)==NOERROR) {
+ if (pDesktopFolder->BindToObject(pCurrentIdl,NULL,IID_IShellFolder,(void**)&pFileFolder) == NOERROR) {
IContextMenu *pContextMenu;
- if (pFileFolder->GetUIObjectOf(NULL,1,(LPCITEMIDLIST*)&pidlFilename,IID_IContextMenu,NULL,(void**)&pContextMenu)==NOERROR) {
+ if (pFileFolder->GetUIObjectOf(NULL,1,(LPCITEMIDLIST*)&pidlFilename,IID_IContextMenu,NULL,(void**)&pContextMenu) == NOERROR) {
switch(cmd) {
case C_PROPERTIES:
{ CMINVOKECOMMANDINFO ici={0};
@@ -231,7 +231,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM pfnIconWindowProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_EXISTINGICON),GWLP_WNDPROC,(LONG_PTR)IconCtrlSubclassProc);
hwndFocus=GetDlgItem(hwndDlg,IDC_RESUME);
- if ( _tstati64(fts->tszCurrentFile,&statbuf)==0) {
+ if ( _tstati64(fts->tszCurrentFile,&statbuf) == 0) {
SetControlToUnixTime(hwndDlg,IDC_EXISTINGDATE,statbuf.st_mtime);
GetSensiblyFormattedSize(statbuf.st_size,szSize,SIZEOF(szSize),0,1,NULL);
SetDlgItemText(hwndDlg,IDC_EXISTINGSIZE,szSize);
diff --git a/src/modules/srfile/fileopts.cpp b/src/modules/srfile/fileopts.cpp index c1c0b23870..ca22961ece 100644 --- a/src/modules/srfile/fileopts.cpp +++ b/src/modules/srfile/fileopts.cpp @@ -98,7 +98,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL,"SRFile","ScanCmdLine",&dbv)==0) {
+ if (DBGetContactSettingTString(NULL,"SRFile","ScanCmdLine",&dbv) == 0) {
SetDlgItemText(hwndDlg,IDC_SCANCMDLINE,dbv.ptszVal);
DBFreeVariant(&dbv);
}
@@ -140,7 +140,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_FILEDIR:
- if ((HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus())) return 0;
+ if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
break;
case IDC_FILEDIRBROWSE:
{ TCHAR str[MAX_PATH];
@@ -156,8 +156,8 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(hwndDlg,M_UPDATEENABLING,0,0);
break;
case IDC_SCANCMDLINE:
- if (HIWORD(wParam)==CBN_SELCHANGE) PostMessage(hwndDlg,M_SCANCMDLINESELCHANGE,0,0);
- else if (HIWORD(wParam)!=CBN_EDITCHANGE) return 0;
+ if (HIWORD(wParam) == CBN_SELCHANGE) PostMessage(hwndDlg,M_SCANCMDLINESELCHANGE,0,0);
+ else if (HIWORD(wParam) != CBN_EDITCHANGE) return 0;
break;
case IDC_SCANCMDLINEBROWSE:
{ TCHAR str[MAX_PATH+2];
diff --git a/src/modules/srfile/filerecvdlg.cpp b/src/modules/srfile/filerecvdlg.cpp index 1e399a83d7..4de076e0fe 100644 --- a/src/modules/srfile/filerecvdlg.cpp +++ b/src/modules/srfile/filerecvdlg.cpp @@ -37,9 +37,9 @@ static void GetLowestExistingDirName(const TCHAR *szTestDir,TCHAR *szExistingDir TCHAR *pszLastBackslash;
lstrcpyn(szExistingDir,szTestDir,cchExistingDir);
- while((dwAttributes=GetFileAttributes(szExistingDir))!=INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
+ while ((dwAttributes=GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
pszLastBackslash=_tcsrchr(szExistingDir,'\\');
- if (pszLastBackslash==NULL) {*szExistingDir='\0'; break;}
+ if (pszLastBackslash == NULL) {*szExistingDir='\0'; break;}
*pszLastBackslash='\0';
}
if (szExistingDir[0] == '\0') GetCurrentDirectory(cchExistingDir,szExistingDir);
@@ -327,7 +327,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_DRAWITEM:
{ LPDRAWITEMSTRUCT dis=(LPDRAWITEMSTRUCT)lParam;
- if (dis->hwndItem==GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
+ if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto;
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0);
diff --git a/src/modules/srfile/filesenddlg.cpp b/src/modules/srfile/filesenddlg.cpp index de07d65689..8567003f91 100644 --- a/src/modules/srfile/filesenddlg.cpp +++ b/src/modules/srfile/filesenddlg.cpp @@ -45,7 +45,7 @@ static void SetFileListAndSizeControls(HWND hwndDlg,struct FileDlgData *dat) if (i>1) {
TCHAR szFormat[32];
if (fileCount && dirCount) {
- mir_sntprintf(szFormat,SIZEOF(szFormat),_T("%s, %s"),TranslateTS(fileCount==1?_T("%d file"):_T("%d files")),TranslateTS(dirCount==1?_T("%d directory"):_T("%d directories")));
+ mir_sntprintf(szFormat,SIZEOF(szFormat),_T("%s, %s"),TranslateTS(fileCount == 1?_T("%d file"):_T("%d files")),TranslateTS(dirCount == 1?_T("%d directory"):_T("%d directories")));
mir_sntprintf(str,SIZEOF(str),szFormat,fileCount,dirCount);
}
else if (fileCount) {
@@ -102,7 +102,7 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA // Fill the array
pBuf = buf + fileOffset;
nTemp = 0;
- while(*pBuf)
+ while (*pBuf)
{
// Allocate space for path+filename
int cbFileNameLen = lstrlen( pBuf );
@@ -179,13 +179,13 @@ static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP {
switch(msg) {
case WM_CHAR:
- if (wParam=='\n' && GetKeyState(VK_CONTROL)&0x8000) {
+ if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) {
PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0);
return 0;
}
break;
case WM_SYSCHAR:
- if ((wParam=='s' || wParam=='S') && GetKeyState(VK_MENU)&0x8000) {
+ if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) {
PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0);
return 0;
}
@@ -223,7 +223,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- if (fsd->ppFiles!=NULL && fsd->ppFiles[0]!=NULL) {
+ if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
int totalCount,i;
for (totalCount=0;fsd->ppFiles[totalCount];totalCount++);
dat->files = ( TCHAR** )mir_alloc( sizeof(TCHAR*)*(totalCount+1)); // Leaks
@@ -281,7 +281,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis=(LPDRAWITEMSTRUCT)lParam;
- if (dis->hwndItem==GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
+ if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto;
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0);
diff --git a/src/modules/srfile/filexferdlg.cpp b/src/modules/srfile/filexferdlg.cpp index cedc49638f..7c7adf8281 100644 --- a/src/modules/srfile/filexferdlg.cpp +++ b/src/modules/srfile/filexferdlg.cpp @@ -31,8 +31,8 @@ static int CheckVirusScanned(HWND hwnd,struct FileDlgData *dat,int i) if (dat->send) return 1;
if (dat->fileVirusScanned == NULL) return 0;
if (dat->fileVirusScanned[i]) return 1;
- if (DBGetContactSettingByte(NULL,"SRFile","WarnBeforeOpening",1)==0) return 1;
- return IDYES==MessageBox(hwnd,TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"),TranslateT("File Received"),MB_YESNO|MB_DEFBUTTON2);
+ if (DBGetContactSettingByte(NULL,"SRFile","WarnBeforeOpening",1) == 0) return 1;
+ return IDYES == MessageBox(hwnd,TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"),TranslateT("File Received"),MB_YESNO|MB_DEFBUTTON2);
}
#define M_VIRUSSCANDONE (WM_USER+100)
@@ -141,7 +141,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) }
else lstrcpyn(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine));
if (CreateProcess(NULL,szCmdLine,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) {
- if (WaitForSingleObject(pi.hProcess,3600*1000)==WAIT_OBJECT_0)
+ if (WaitForSingleObject(pi.hProcess,3600*1000) == WAIT_OBJECT_0)
PostMessage(info->hwndReply,M_VIRUSSCANDONE,info->returnCode,0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR FILETIME ft;
GetSensiblyFormattedSize((dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])/dat->bytesRecvedHistorySize,szSpeed,SIZEOF(szSpeed),0,1,NULL);
- if (dat->bytesRecvedHistory[0]==dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])
+ if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])
lstrcpy(szTime,_T("??:??:??"));
else {
li.QuadPart=BIGI(10000000)*(dat->transferStatus.currentFileSize-dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
@@ -342,7 +342,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR FileTimeToSystemTime(&ft,&st);
GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER,&st,NULL,szTime,SIZEOF(szTime));
}
- if (dat->bytesRecvedHistory[0]!=dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) {
+ if (dat->bytesRecvedHistory[0] != dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) {
li.QuadPart=BIGI(10000000)*(dat->transferStatus.totalBytes-dat->transferStatus.totalProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
ft.dwHighDateTime=li.HighPart; ft.dwLowDateTime=li.LowPart;
FileTimeToSystemTime(&ft,&st);
@@ -512,13 +512,13 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR pfr->action=FILERESUME_RENAME;
{ TCHAR *pszExtension,*pszFilename;
int i;
- if ((pszFilename = _tcsrchr(szOriginalFilename,'\\'))==NULL) pszFilename=szOriginalFilename;
- if ((pszExtension = _tcsrchr(pszFilename+1,'.'))==NULL) pszExtension=pszFilename+lstrlen(pszFilename);
+ if ((pszFilename = _tcsrchr(szOriginalFilename,'\\')) == NULL) pszFilename=szOriginalFilename;
+ if ((pszExtension = _tcsrchr(pszFilename+1,'.')) == NULL) pszExtension=pszFilename+lstrlen(pszFilename);
if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename);
pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*((pszExtension-szOriginalFilename)+21+lstrlen(pszExtension)));
for (i=1;;i++) {
_stprintf((TCHAR*)pfr->szFilename,_T("%.*s (%u)%s"),pszExtension-szOriginalFilename,szOriginalFilename,i,pszExtension);
- if (_taccess(pfr->szFilename,0)!=0)
+ if (_taccess(pfr->szFilename,0) != 0)
break;
}
}
@@ -532,9 +532,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
case HM_RECVEVENT:
{ ACKDATA *ack=(ACKDATA*)lParam;
- if (ack->hProcess!=dat->fs) break; /* icq abuses this sometimes */
- if (ack->hContact!=dat->hContact) break;
- if (ack->type!=ACKTYPE_FILE) break;
+ if (ack->hProcess != dat->fs) break; /* icq abuses this sometimes */
+ if (ack->hContact != dat->hContact) break;
+ if (ack->type != ACKTYPE_FILE) break;
if (dat->waitingForAcceptance) {
SetTimer(hwndDlg,1,1000,NULL);
@@ -550,9 +550,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case ACKRESULT_NEXTFILE:
SetFtStatus(hwndDlg, LPGENT("Moving to next file..."), FTS_TEXT);
SetDlgItemTextA(hwndDlg,IDC_FILENAME,"");
- if (dat->transferStatus.currentFileNumber==1 && dat->transferStatus.totalFiles>1 && !dat->send)
+ if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles>1 && !dat->send)
SetOpenFileButtonStyle(GetDlgItem(hwndDlg,IDC_OPENFILE),1);
- if (dat->transferStatus.currentFileNumber!=-1 && dat->files && !dat->send && DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE)==VIRUSSCAN_DURINGDL) {
+ if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
PostMessage(hwndDlg,M_VIRUSSCANDONE,dat->transferStatus.currentFileNumber,0);
else {
@@ -576,7 +576,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
SetFtStatus(hwndDlg, LPGENT("File already exists"), FTS_TEXT);
- if (dat->resumeBehaviour==FILERESUME_ASK) {
+ if (dat->resumeBehaviour == FILERESUME_ASK) {
TDlgProcFileExistsParam param = { hwndDlg, fts };
ShowWindow(hwndDlg,SW_SHOWNORMAL);
CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILEEXISTS),hwndDlg,DlgProcFileExists,(LPARAM)¶m);
@@ -689,11 +689,11 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR FTS_OPEN);
int useScanner=DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE);
- if (useScanner!=VIRUSSCAN_DISABLE) {
+ if (useScanner != VIRUSSCAN_DISABLE) {
struct virusscanthreadstartinfo *vstsi;
vstsi=(struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
vstsi->hwndReply=hwndDlg;
- if (useScanner==VIRUSSCAN_DURINGDL) {
+ if (useScanner == VIRUSSCAN_DURINGDL) {
vstsi->returnCode=dat->transferStatus.currentFileNumber;
if ( GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) {
PostMessage(hwndDlg,M_VIRUSSCANDONE,vstsi->returnCode,0);
@@ -724,7 +724,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } break; // case HM_RECVEVENT
case M_VIRUSSCANDONE:
{ int done=1,i;
- if ((int)wParam==-1) {
+ if ((int)wParam == -1) {
for (i=0;i<dat->transferStatus.totalFiles;i++) dat->fileVirusScanned[i]=1;
}
else {
diff --git a/src/modules/srurl/url.cpp b/src/modules/srurl/url.cpp index 04d9ec84f7..5db30d7fda 100644 --- a/src/modules/srurl/url.cpp +++ b/src/modules/srurl/url.cpp @@ -48,7 +48,7 @@ static int UrlEventAdded(WPARAM wParam,LPARAM lParam) dbei.cbSize=sizeof(dbei);
dbei.cbBlob=0;
CallService(MS_DB_EVENT_GET,lParam,(LPARAM)&dbei);
- if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType!=EVENTTYPE_URL) return 0;
+ if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_URL) return 0;
SkinPlaySound("RecvUrl");
ZeroMemory(&cle,sizeof(cle));
@@ -83,12 +83,12 @@ static void RestoreUnreadUrlAlerts(void) cle.pszService="SRUrl/ReadUrl";
hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hContact) {
+ while (hContact) {
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);
- while(hDbEvent) {
+ while (hDbEvent) {
dbei.cbBlob=0;
CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_URL) {
+ if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_URL) {
cle.hContact=hContact;
cle.hDbEvent=hDbEvent;
cle.flags = CLEF_TCHAR;
@@ -108,7 +108,7 @@ static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) char *szProto;
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
- if (lstrcmpA(cws->szModule,"CList") && (szProto==NULL || lstrcmpA(cws->szModule,szProto))) return 0;
+ if (lstrcmpA(cws->szModule,"CList") && (szProto == NULL || lstrcmpA(cws->szModule,szProto))) return 0;
WindowList_Broadcast(hUrlWindowList,DM_UPDATETITLE,0,0);
return 0;
}
diff --git a/src/modules/srurl/urldialogs.cpp b/src/modules/srurl/urldialogs.cpp index 72a491bf17..6fcef0b088 100644 --- a/src/modules/srurl/urldialogs.cpp +++ b/src/modules/srurl/urldialogs.cpp @@ -138,7 +138,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis=(LPDRAWITEMSTRUCT)lParam;
- if (dis->hwndItem==GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
+ if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto;
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0);
@@ -304,7 +304,7 @@ static HGLOBAL DoDdeRequest(const char *szItemName,HWND hwndDlg) 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 (!ddeData) {
GlobalDeleteAtom(hSzItemName);
@@ -329,26 +329,26 @@ static void AddBrowserPageToCombo(char *url,HWND hwndCombo) {
char *title,*frame,*end;
- if (url[0]!='"') return;
+ if (url[0] != '"') return;
url++;
title=strchr(url,'"');
- if (title==NULL) return;
+ if (title == NULL) return;
*title='\0'; title++;
if (*title) {
title+=2;
frame=strchr(title,'"');
- if (frame==NULL) return;
+ if (frame == NULL) return;
*frame='\0'; frame++;
if (*frame) {
frame+=2;
end=strchr(frame,'"');
- if (end==NULL) return;
+ if (end == NULL) return;
*end='\0';
}
else frame=NULL;
}
else title=frame=NULL;
- if (frame==NULL || *frame==0) {
+ if (frame == NULL || *frame == 0) {
char *szItemData;
int i;
char szExistingUrl[1024];
@@ -387,7 +387,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser,HWND hwndDlg,HWND return;
}
hData=DoDdeRequest("WWW_ListWindows",hwndDlg);
- if (hData==NULL) {
+ if (hData == NULL) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
return;
@@ -412,12 +412,12 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser,HWND hwndDlg,HWND return;
}
for (i=0;i<windowCount;i++) {
- if (windowId[i]==0) break;
+ if (windowId[i] == 0) break;
{ char str[16];
mir_snprintf(str, SIZEOF(str), "%d",windowId[i]);
hData=DoDdeRequest(str,hwndDlg);
}
- if (hData!=NULL) {
+ if (hData != NULL) {
dataLength=GlobalSize(hData)-offsetof(DDEDATA,Value);
data=(DDEDATA*)GlobalLock(hData);
AddBrowserPageToCombo((char*)data->Value,hwndCombo);
@@ -443,13 +443,13 @@ static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP {
switch(msg) {
case WM_CHAR:
- if (wParam=='\n' && GetKeyState(VK_CONTROL)&0x8000) {
+ if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) {
PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0);
return 0;
}
break;
case WM_SYSCHAR:
- if ((wParam=='s' || wParam=='S') && GetKeyState(VK_MENU)&0x8000) {
+ if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) {
PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0);
return 0;
}
@@ -577,7 +577,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DestroyWindow(hwndDlg);
return TRUE;
case IDC_URLS:
- if (HIWORD(wParam)==CBN_SELCHANGE) {
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
int i, urlSize;
char *title;
i=SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETCURSEL,0,0);
@@ -586,7 +586,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP urlSize=SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETLBTEXTLEN,(WPARAM)i,0);
EnableWindow(GetDlgItem(hwndDlg,IDOK), (urlSize>0));
}
- else if (HIWORD(wParam)==CBN_EDITCHANGE) {
+ else if (HIWORD(wParam) == CBN_EDITCHANGE) {
int urlSize = GetWindowTextLength(GetDlgItem(hwndDlg,IDC_URLS));
EnableWindow(GetDlgItem(hwndDlg,IDOK), (urlSize>0));
}
@@ -622,9 +622,9 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case HM_EVENTSENT:
{ ACKDATA *ack=(ACKDATA*)lParam;
DBEVENTINFO dbei;
- if (ack->hProcess!=dat->hSendId) break;
- if (ack->hContact!=dat->hContact) break;
- if (ack->type!=ACKTYPE_URL || ack->result!=ACKRESULT_SUCCESS) break;
+ if (ack->hProcess != dat->hSendId) break;
+ if (ack->hContact != dat->hContact) break;
+ if (ack->type != ACKTYPE_URL || ack->result != ACKRESULT_SUCCESS) break;
ZeroMemory(&dbei,sizeof(dbei));
dbei.cbSize=sizeof(dbei);
@@ -650,7 +650,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg,IDC_URLS),GW_CHILD),GWLP_WNDPROC,(LONG_PTR)OldSendEditProc);
SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MESSAGE),GWLP_WNDPROC,(LONG_PTR)OldSendEditProc);
if (dat->hAckEvent) UnhookEvent(dat->hAckEvent);
- if (dat->sendBuffer!=NULL) mir_free(dat->sendBuffer);
+ if (dat->sendBuffer != NULL) mir_free(dat->sendBuffer);
mir_free(dat);
Utils_SaveWindowPosition(hwndDlg,NULL,"SRUrl","send");
{ int i;
diff --git a/src/modules/updatenotify/updatenotify.cpp b/src/modules/updatenotify/updatenotify.cpp index 581e13c8e9..123903c937 100644 --- a/src/modules/updatenotify/updatenotify.cpp +++ b/src/modules/updatenotify/updatenotify.cpp @@ -173,7 +173,7 @@ static VOID CALLBACK UpdateNotifyTimerCheck(HWND, UINT, UINT_PTR, DWORD) KillTimer(NULL, updateTimerId);
if (!DBGetContactSettingByte(NULL, UN_MOD, UN_ENABLE, UN_ENABLE_DEF))
return;
- if (dwUpdateThreadID!=0) {
+ if (dwUpdateThreadID != 0) {
Netlib_Logf(hNetlibUser, "Update notification already running, ignoring attempt");
return;
}
@@ -271,8 +271,8 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { DBWriteContactSettingDword(NULL, UN_MOD, UN_LASTCHECK, und->reqTime);
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(szVersionText), (LPARAM)szVersionText);
isUnicode = strstr(szVersionText, "Unicode") != NULL ? 1 : 0;
- isBetaCheck = DBGetContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_DEF)==UN_NOTIFYTYPE_BETA?1:0;
- isAlphaCheck = DBGetContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_DEF)==UN_NOTIFYTYPE_ALPHA?1:0;
+ isBetaCheck = DBGetContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_DEF) == UN_NOTIFYTYPE_BETA?1:0;
+ isAlphaCheck = DBGetContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_DEF) == UN_NOTIFYTYPE_ALPHA?1:0;
dwVersion = CallService(MS_SYSTEM_GETVERSION, 0, 0);
mir_snprintf(szVersion, sizeof(szVersion), "%d.%d.%d.%d",
HIBYTE(HIWORD(dwVersion)), LOBYTE(HIWORD(dwVersion)),
@@ -658,7 +658,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lParam;
- if (hdr&&hdr->code==PSN_APPLY) {
+ if (hdr&&hdr->code == PSN_APPLY) {
DBWriteContactSettingByte(NULL, UN_MOD, UN_ENABLE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ENABLEUPDATES)));
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLESTABLE))
DBWriteContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_STABLE);
diff --git a/src/modules/userinfo/contactinfo.cpp b/src/modules/userinfo/contactinfo.cpp index b8dd841835..8b8c7ae66d 100644 --- a/src/modules/userinfo/contactinfo.cpp +++ b/src/modules/userinfo/contactinfo.cpp @@ -43,7 +43,7 @@ static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDCANCEL:
EndDialog(hwndDlg,wParam);
case IDC_EMAIL:
- if (HIWORD(wParam)==EN_CHANGE)
+ if (HIWORD(wParam) == EN_CHANGE)
EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_EMAIL)));
break;
}
@@ -73,7 +73,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar SendDlgItemMessage(hwndDlg,IDC_NUMBER,EM_LIMITTEXT,63,0);
CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&countryCount,(LPARAM)&countries);
for (i=0;i<countryCount;i++) {
- if (countries[i].id==0 || countries[i].id==0xFFFF) continue;
+ if (countries[i].id == 0 || countries[i].id == 0xFFFF) continue;
item=SendDlgItemMessageA(hwndDlg,IDC_COUNTRY,CB_ADDSTRING,0,(LPARAM)Translate(countries[i].szName));
SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_SETITEMDATA,item,countries[i].id);
}
@@ -86,7 +86,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar { char *szText=(char*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
int isValid=1;
GetDlgItemTextA(hwndDlg,IDC_PHONE,szText,252);
- if (lstrlenA(szText)<7 || szText[0]!='+') isValid=0;
+ if (lstrlenA(szText)<7 || szText[0] != '+') isValid=0;
if (isValid) isValid=(lstrlenA(szText+1) == (int)strspn(szText+1,"0123456789 ()-"));
if (!isValid) {
MessageBox(hwndDlg,TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK);
@@ -98,10 +98,10 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDCANCEL:
EndDialog(hwndDlg,wParam);
case IDC_COUNTRY:
- if (HIWORD(wParam)!=CBN_SELCHANGE) break;
+ if (HIWORD(wParam) != CBN_SELCHANGE) break;
case IDC_AREA:
case IDC_NUMBER:
- if (LOWORD(wParam)!=IDC_COUNTRY && HIWORD(wParam)!=EN_CHANGE) break;
+ if (LOWORD(wParam) != IDC_COUNTRY && HIWORD(wParam) != EN_CHANGE) break;
if (noRecursion) break;
EnableWindow(GetDlgItem(hwndDlg,IDOK),TRUE);
{ char szPhone[96],szArea[32],szNumber[64];
@@ -114,7 +114,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar }
break;
case IDC_PHONE:
- if (HIWORD(wParam)!=EN_UPDATE) break;
+ if (HIWORD(wParam) != EN_UPDATE) break;
if (noRecursion) break;
noRecursion=1;
{
@@ -178,7 +178,7 @@ static int IsOverEmail(HWND hwndDlg,TCHAR* szEmail,int cchEmail) GetClientRect(hwndEmails,&rc);
if (!PtInRect(&rc,hti.pt)) return 0;
if (ListView_SubItemHitTest(hwndEmails,&hti) == -1) return 0;
- if (hti.iSubItem!=1) return 0;
+ if (hti.iSubItem != 1) return 0;
if (!(hti.flags&LVHT_ONITEMLABEL)) return 0;
ListView_GetSubItemRect(hwndEmails,hti.iItem,1,LVIR_LABEL,&rc);
szText[0] = 0;
@@ -207,7 +207,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lf.lfUnderline=1;
hEmailFont=CreateFontIndirect(&lf);
}
- if (hHandCursor==NULL) {
+ if (hHandCursor == NULL) {
if (IsWinVer2000Plus()) hHandCursor=LoadCursor(NULL,IDC_HAND);
else hHandCursor=LoadCursor(hMirandaInst,MAKEINTRESOURCE(IDC_HYPERLINKHAND));
}
@@ -246,7 +246,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) break;
+ if (szProto == NULL) break;
//e-mails
ListView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_EMAILS));
lvi.mask=LVIF_TEXT|LVIF_PARAM;
@@ -254,7 +254,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iSubItem=0;
lvi.iItem=0;
for (i=-1;;i++) {
- if (i==-1) {
+ if (i == -1) {
if (DBGetContactSettingTString(hContact,szProto,"e-mail",&dbv))
continue;
lvi.pszText=TranslateT("Primary");
@@ -378,7 +378,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
RECT rc;
ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,LVIR_LABEL,&rc);
- if (nm->iSubItem==1 && nm->nmcd.hdr.idFrom==IDC_EMAILS) {
+ if (nm->iSubItem == 1 && nm->nmcd.hdr.idFrom == IDC_EMAILS) {
HFONT hoFont;
TCHAR szText[256] = {0};
ListView_GetItemText(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,szText,SIZEOF(szText));
@@ -391,16 +391,16 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
HICON hIcon = NULL;
- if (nm->nmcd.lItemlParam==(LPARAM)(-2) && nm->iSubItem-3==(nm->nmcd.hdr.idFrom==IDC_PHONES))
+ if (nm->nmcd.lItemlParam == (LPARAM)(-2) && nm->iSubItem-3 == (nm->nmcd.hdr.idFrom == IDC_PHONES))
hIcon = LoadSkinIcon( SKINICON_OTHER_ADDCONTACT );
- else if (nm->iSubItem>1 && nm->nmcd.lItemlParam!=(LPARAM)(-1) && nm->nmcd.lItemlParam!=(LPARAM)(-2)) {
+ else if (nm->iSubItem>1 && nm->nmcd.lItemlParam != (LPARAM)(-1) && nm->nmcd.lItemlParam != (LPARAM)(-2)) {
static int iconResources[3]={SKINICON_OTHER_RENAME,SKINICON_OTHER_DELETE};
- if (nm->iSubItem==2 && nm->nmcd.hdr.idFrom==IDC_PHONES) {
+ if (nm->iSubItem == 2 && nm->nmcd.hdr.idFrom == IDC_PHONES) {
TCHAR szText[2];
ListView_GetItemText(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,szText,SIZEOF(szText));
if (szText[0]) hIcon = LoadSkinIcon( SKINICON_OTHER_SMS );
}
- else hIcon = LoadSkinIcon( iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom==IDC_EMAILS)] );
+ else hIcon = LoadSkinIcon( iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom == IDC_EMAILS)] );
}
else break;
DrawIconEx(nm->nmcd.hdc,(rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2,(rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
@@ -416,7 +416,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP LVITEM lvi;
TCHAR szEmail[256];
HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- char *szIdTemplate=nm->hdr.idFrom==IDC_PHONES?"MyPhone%d":"Mye-mail%d";
+ char *szIdTemplate=nm->hdr.idFrom == IDC_PHONES?"MyPhone%d":"Mye-mail%d";
LVHITTESTINFO hti;
if (IsOverEmail(hwndDlg,szEmail,SIZEOF(szEmail))) {
@@ -434,14 +434,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iItem=hti.iItem;
lvi.iSubItem=0;
ListView_GetItem(nm->hdr.hwndFrom,&lvi);
- if (lvi.lParam==(LPARAM)(-1)) break;
- if (lvi.lParam==(LPARAM)(-2)) {
- if (hti.iSubItem-3==(nm->hdr.idFrom==IDC_PHONES)) {
+ if (lvi.lParam == (LPARAM)(-1)) break;
+ if (lvi.lParam == (LPARAM)(-2)) {
+ if (hti.iSubItem-3 == (nm->hdr.idFrom == IDC_PHONES)) {
//add
char szNewData[256]="",idstr[33];
int i;
DBVARIANT dbv;
- if (IDOK!=DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom==IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom==IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szNewData))
+ if (IDOK != DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szNewData))
break;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i);
@@ -453,7 +453,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
else {
- if (hti.iSubItem-3==(nm->hdr.idFrom==IDC_PHONES)) {
+ if (hti.iSubItem-3 == (nm->hdr.idFrom == IDC_PHONES)) {
//delete
int i;
char idstr[33];
@@ -469,7 +469,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBDeleteContactSetting(hContact,"UserInfo",idstr);
SendMessage(hwndDlg,M_REMAKELISTS,0,0);
}
- else if (hti.iSubItem-2==(nm->hdr.idFrom==IDC_PHONES)) {
+ else if (hti.iSubItem-2 == (nm->hdr.idFrom == IDC_PHONES)) {
//edit
char szText[256],idstr[33];
DBVARIANT dbv;
@@ -477,7 +477,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break;
lstrcpynA(szText,dbv.pszVal,SIZEOF(szText));
DBFreeVariant(&dbv);
- if (IDOK!=DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom==IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom==IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szText))
+ if (IDOK != DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szText))
break;
DBWriteContactSettingString(hContact,"UserInfo",idstr,szText);
SendMessage(hwndDlg,M_REMAKELISTS,0,0);
@@ -490,8 +490,8 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
break;
case WM_SETCURSOR:
- if (LOWORD(lParam)!=HTCLIENT) break;
- if (GetForegroundWindow()==GetParent(hwndDlg)) {
+ if (LOWORD(lParam) != HTCLIENT) break;
+ if (GetForegroundWindow() == GetParent(hwndDlg)) {
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hwndDlg,&pt);
diff --git a/src/modules/userinfo/stdinfo.cpp b/src/modules/userinfo/stdinfo.cpp index 976c590ac4..7af6334a9b 100644 --- a/src/modules/userinfo/stdinfo.cpp +++ b/src/modules/userinfo/stdinfo.cpp @@ -72,38 +72,38 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
dbv.type=DBVT_DELETED;
- if (szModule==NULL) unspecified=1;
+ if (szModule == NULL) unspecified=1;
else if (proto_service) unspecified=Proto_GetContactInfoSetting(hContact,szProto,szModule,szSetting,&dbv,0);
else unspecified=DBGetContactSettingW(hContact,szModule,szSetting,&dbv);
if (!unspecified) {
switch(dbv.type) {
case DBVT_BYTE:
- if (special==SVS_GENDER) {
- if (dbv.cVal=='M') ptstr=TranslateT("Male");
- else if (dbv.cVal=='F') ptstr=TranslateT("Female");
+ if (special == SVS_GENDER) {
+ if (dbv.cVal == 'M') ptstr=TranslateT("Male");
+ else if (dbv.cVal == 'F') ptstr=TranslateT("Female");
else unspecified=1;
}
- else if (special==SVS_MONTH) {
+ else if (special == SVS_MONTH) {
if (dbv.bVal>0 && dbv.bVal<=12) {
pstr=str;
GetLocaleInfoA(LOCALE_USER_DEFAULT,LOCALE_SABBREVMONTHNAME1-1+dbv.bVal,str,SIZEOF(str));
}
else unspecified=1;
}
- else if (special==SVS_TIMEZONE) {
- if (dbv.cVal==-100) unspecified=1;
+ else if (special == SVS_TIMEZONE) {
+ if (dbv.cVal == -100) unspecified=1;
else {
pstr=str;
mir_snprintf(str, SIZEOF(str), dbv.cVal?"UTC%+d:%02d":"UTC",-dbv.cVal/2,(dbv.cVal&1)*30);
}
}
else {
- unspecified=(special==SVS_ZEROISUNSPEC && dbv.bVal==0);
- pstr=_itoa(special==SVS_SIGNED?dbv.cVal:dbv.bVal,str,10);
+ unspecified=(special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
+ pstr=_itoa(special == SVS_SIGNED?dbv.cVal:dbv.bVal,str,10);
}
break;
case DBVT_WORD:
- if (special==SVS_COUNTRY) {
+ if (special == SVS_COUNTRY) {
WORD wSave = dbv.wVal;
if (wSave == ( WORD )-1) {
char szSettingName[100];
@@ -116,29 +116,29 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char }
pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,wSave,0));
- unspecified=pstr==NULL;
+ unspecified=pstr == NULL;
}
else {
- unspecified=(special==SVS_ZEROISUNSPEC && dbv.wVal==0);
- pstr=_itoa(special==SVS_SIGNED?dbv.sVal:dbv.wVal,str,10);
+ unspecified=(special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
+ pstr=_itoa(special == SVS_SIGNED?dbv.sVal:dbv.wVal,str,10);
}
break;
case DBVT_DWORD:
- unspecified=(special==SVS_ZEROISUNSPEC && dbv.dVal==0);
- if (special==SVS_IP) {
+ unspecified=(special == SVS_ZEROISUNSPEC && dbv.dVal == 0);
+ if (special == SVS_IP) {
struct in_addr ia;
ia.S_un.S_addr=htonl(dbv.dVal);
pstr=inet_ntoa(ia);
- if (dbv.dVal==0) unspecified=1;
+ if (dbv.dVal == 0) unspecified=1;
}
- else pstr=_itoa(special==SVS_SIGNED?dbv.lVal:dbv.dVal,str,10);
+ else pstr=_itoa(special == SVS_SIGNED?dbv.lVal:dbv.dVal,str,10);
break;
case DBVT_ASCIIZ:
- unspecified=(special==SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ unspecified=(special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
pstr=dbv.pszVal;
break;
case DBVT_UTF8:
- unspecified=(special==SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ unspecified=(special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
#if defined( _UNICODE )
if ( !unspecified )
{ WCHAR* wszStr;
@@ -186,7 +186,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) break;
+ if (szProto == NULL) break;
SetValue(hwndDlg,IDC_NICK,hContact,szProto,"Nick",0);
SetValue(hwndDlg,IDC_FIRSTNAME,hContact,szProto,"FirstName",0);
SetValue(hwndDlg,IDC_LASTNAME,hContact,szProto,"LastName",0);
@@ -262,7 +262,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) break;
+ if (szProto == NULL) break;
SetValue(hwndDlg,IDC_STREET,hContact,szProto,"Street",SVS_ZEROISUNSPEC);
SetValue(hwndDlg,IDC_CITY,hContact,szProto,"City",SVS_ZEROISUNSPEC);
SetValue(hwndDlg,IDC_STATE,hContact,szProto,"State",SVS_ZEROISUNSPEC);
@@ -310,7 +310,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) break;
+ if (szProto == NULL) break;
SetValue(hwndDlg,IDC_COMPANY,hContact,szProto,"Company",SVS_ZEROISUNSPEC);
SetValue(hwndDlg,IDC_DEPARTMENT,hContact,szProto,"CompanyDepartment",SVS_ZEROISUNSPEC);
SetValue(hwndDlg,IDC_POSITION,hContact,szProto,"CompanyPosition",SVS_ZEROISUNSPEC);
@@ -348,7 +348,7 @@ void ResizeColumns(HWND hwndLV) {
int nCol = 0; LVCOLUMN lvCol;
lvCol.mask = LVCF_WIDTH;
- while(ListView_GetColumn(hwndLV, nCol++, &lvCol))
+ while (ListView_GetColumn(hwndLV, nCol++, &lvCol))
ListView_SetColumnWidth(hwndLV, nCol-1, LVSCW_AUTOSIZE);
}
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (hContact != NULL) {
char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) break;
+ if (szProto == NULL) break;
bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
SetValue(hwndDlg,IDC_WEBPAGE,hContact,szProto,"Homepage",SVS_ZEROISUNSPEC);
@@ -524,7 +524,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) break;
+ if (szProto == NULL) break;
SetValue(hwndDlg,IDC_ABOUT,hContact,szProto,"About",0);
}
break;
@@ -544,9 +544,9 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
break;
case WM_COMMAND:
- if (wParam==MAKEWPARAM(IDC_MYNOTES,EN_CHANGE))
+ if (wParam == MAKEWPARAM(IDC_MYNOTES,EN_CHANGE))
SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
- else if (LOWORD(wParam)==IDCANCEL)
+ else if (LOWORD(wParam) == IDCANCEL)
SendMessage(GetParent(hwndDlg),msg,wParam,lParam);
break;
case WM_DESTROY:
diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp index 38947bec2b..7dd3a1a121 100644 --- a/src/modules/userinfo/userinfo.cpp +++ b/src/modules/userinfo/userinfo.cpp @@ -88,7 +88,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) opi.pageCount=0;
opi.odp=NULL;
NotifyEventHooks(hDetailsInitEvent,(WPARAM)&opi,wParam);
- if (opi.pageCount==0) return 0;
+ if (opi.pageCount == 0) return 0;
qsort(opi.odp,opi.pageCount,sizeof(OPTIONSDIALOGPAGE),(int (*)(const void*,const void*))PageSortProc);
ZeroMemory(&psh,sizeof(psh));
@@ -105,7 +105,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) //cleanup moved to WM_DESTROY
//mir_free((char*)opi.odp[i].pszTitle);
//mir_free((char*)opi.odp[i].pszTab);
- if (opi.odp[i].pszGroup!=NULL) mir_free(opi.odp[i].pszGroup);
+ if (opi.odp[i].pszGroup != NULL) mir_free(opi.odp[i].pszGroup);
if ((DWORD_PTR)opi.odp[i].pszTemplate&0xFFFF0000) mir_free((char*)opi.odp[i].pszTemplate);
}
mir_free(opi.odp);
@@ -117,8 +117,8 @@ static INT_PTR AddDetailsPage(WPARAM wParam,LPARAM lParam) OPTIONSDIALOGPAGE *odp=(OPTIONSDIALOGPAGE*)lParam, *dst;
struct DetailsPageInit *opi=(struct DetailsPageInit*)wParam;
- if (odp==NULL||opi==NULL) return 1;
- if (odp->cbSize!=sizeof(OPTIONSDIALOGPAGE)
+ if (odp == NULL||opi == NULL) return 1;
+ if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE)
&& odp->cbSize != OPTIONPAGE_OLD_SIZE2
&& odp->cbSize != OPTIONPAGE_OLD_SIZE3)
return 1;
@@ -135,16 +135,16 @@ static INT_PTR AddDetailsPage(WPARAM wParam,LPARAM lParam) #if defined(_UNICODE)
if ( odp->flags & ODPF_UNICODE )
{
- dst->ptszTitle = (odp->ptszTitle==0) ? NULL : mir_wstrdup(odp->ptszTitle);
+ dst->ptszTitle = (odp->ptszTitle == 0) ? NULL : mir_wstrdup(odp->ptszTitle);
dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->ptszTab) ? NULL : mir_wstrdup(odp->ptszTab);
}
else
#endif
{
if ( odp->flags & ODPF_DONTTRANSLATE )
- dst->ptszTitle = (odp->pszTitle==0) ? NULL : mir_a2t(odp->pszTitle);
+ dst->ptszTitle = (odp->pszTitle == 0) ? NULL : mir_a2t(odp->pszTitle);
else
- dst->ptszTitle = (odp->pszTitle==0) ? NULL : LangPackPcharToTchar(odp->pszTitle);
+ dst->ptszTitle = (odp->pszTitle == 0) ? NULL : LangPackPcharToTchar(odp->pszTitle);
dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : LangPackPcharToTchar(odp->pszTab);
}
@@ -215,7 +215,7 @@ static int UserInfoContactDelete(WPARAM wParam,LPARAM) {
HWND hwnd;
hwnd=WindowList_Find(hWindowList,(HANDLE)wParam);
- if (hwnd!=NULL) DestroyWindow(hwnd);
+ if (hwnd != NULL) DestroyWindow(hwnd);
return 0;
}
@@ -347,7 +347,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR str[128];
mir_sntprintf(str,SIZEOF(str), _T("%.*s%s%.*s"),dat->updateAnimFrame%10,_T("........."),dat->szUpdating,dat->updateAnimFrame%10,_T("........."));
SetDlgItemText(hwndDlg,IDC_UPDATING,str);
- if (++dat->updateAnimFrame==UPDATEANIMFRAMES) dat->updateAnimFrame=0;
+ if (++dat->updateAnimFrame == UPDATEANIMFRAMES) dat->updateAnimFrame=0;
break;
}
case WM_CTLCOLORSTATIC:
@@ -388,7 +388,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.lParam=(LPARAM)dat->hContact;
for (i=0;i<dat->pageCount;i++) {
pshn.hdr.hwndFrom=dat->opd[i].hwnd;
- if (dat->opd[i].hwnd!=NULL)
+ if (dat->opd[i].hwnd != NULL)
SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn);
}
break;
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP char *szProto;
if (dat->hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0);
- if (szProto==NULL) {EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE); break;}
+ if (szProto == NULL) {EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE); break;}
if (CallProtoService(szProto,PS_GETSTATUS,0,0)<ID_STATUS_ONLINE) EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE);
else EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),!IsWindowVisible(GetDlgItem(hwndDlg,IDC_UPDATING)));
}
@@ -409,12 +409,12 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP ACKDATA *ack=(ACKDATA*)lParam;
int i;
- if (ack->hContact==NULL && ack->type==ACKTYPE_STATUS) {
+ if (ack->hContact == NULL && ack->type == ACKTYPE_STATUS) {
SendMessage(hwndDlg,M_CHECKONLINE,0,0);
break;
}
- if (ack->hContact!=dat->hContact) break;
- if (ack->type!=ACKTYPE_GETINFO) break;
+ if (ack->hContact != dat->hContact) break;
+ if (ack->type != ACKTYPE_GETINFO) break;
SendMessage(hwndDlg,PSM_FORCECHANGED,0,0);
/* if they're not gonna send any more ACK's don't let that mean we should crash */
if (!ack->hProcess && !ack->lParam) {
@@ -423,11 +423,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hwndDlg,M_CHECKONLINE,0,0);
break;
} //if
- if (dat->infosUpdated==NULL) dat->infosUpdated=(int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess);
- if (ack->result==ACKRESULT_SUCCESS || ack->result==ACKRESULT_FAILED) dat->infosUpdated[ack->lParam]=1;
+ if (dat->infosUpdated == NULL) dat->infosUpdated=(int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess);
+ if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) dat->infosUpdated[ack->lParam]=1;
for (i=0;i<(int)ack->hProcess;i++)
- if (dat->infosUpdated[i]==0) break;
- if (i==(int)ack->hProcess) {
+ if (dat->infosUpdated[i] == 0) break;
+ if (i == (int)ack->hProcess) {
ShowWindow(GetDlgItem(hwndDlg,IDC_UPDATING),SW_HIDE);
KillTimer(hwndDlg,1);
SendMessage(hwndDlg,M_CHECKONLINE,0,0);
@@ -518,7 +518,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.lParam=(LPARAM)dat->hContact;
pshn.hdr.code=PSN_RESET;
for (i=0;i<dat->pageCount;i++) {
- if (dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue;
+ if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
pshn.hdr.hwndFrom=dat->opd[i].hwnd;
SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn);
}
@@ -531,7 +531,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP PSHNOTIFY pshn;
pshn.hdr.idFrom=0;
pshn.lParam=(LPARAM)dat->hContact;
- if (dat->currentPage!=-1) {
+ if (dat->currentPage != -1) {
pshn.hdr.code=PSN_KILLACTIVE;
pshn.hdr.hwndFrom=dat->opd[dat->currentPage].hwnd;
if (SendMessage(dat->opd[dat->currentPage].hwnd,WM_NOTIFY,0,(LPARAM)&pshn))
@@ -540,11 +540,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.hdr.code=PSN_APPLY;
for (i=0;i<dat->pageCount;i++) {
- if (dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue;
+ if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
pshn.hdr.hwndFrom=dat->opd[i].hwnd;
- if (SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn)==PSNRET_INVALID_NOCHANGEPAGE) {
+ if (SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
TreeView_Select(GetDlgItem(hwndDlg,IDC_PAGETREE), dat->opd[i].hItem, TVGN_CARET);
- if (dat->currentPage!=-1) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_HIDE);
+ if (dat->currentPage != -1) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_HIDE);
dat->currentPage=i;
ShowWindow(dat->opd[dat->currentPage].hwnd,SW_SHOW);
return 0;
@@ -554,7 +554,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
}
case IDC_UPDATE:
- if (dat->infosUpdated!=NULL) {mir_free(dat->infosUpdated); dat->infosUpdated=NULL;}
+ if (dat->infosUpdated != NULL) {mir_free(dat->infosUpdated); dat->infosUpdated=NULL;}
if (dat->hContact != NULL) {
if (!CallContactService(dat->hContact,PSS_GETINFO,0,0)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE);
@@ -589,7 +589,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP { int i;
for (i=0;i<dat->pageCount;i++)
{
- if (dat->opd[i].hwnd!=NULL) DestroyWindow(dat->opd[i].hwnd);
+ if (dat->opd[i].hwnd != NULL) DestroyWindow(dat->opd[i].hwnd);
mir_free(dat->opd[i].ptszTitle);
mir_free(dat->opd[i].ptszTab);
}
diff --git a/src/modules/useronline/useronline.cpp b/src/modules/useronline/useronline.cpp index 543b0c4e95..5fec748a17 100644 --- a/src/modules/useronline/useronline.cpp +++ b/src/modules/useronline/useronline.cpp @@ -29,13 +29,13 @@ static int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
int newStatus,oldStatus;
- if ((HANDLE)wParam==NULL || strcmp(cws->szSetting,"Status")) return 0;
+ if ((HANDLE)wParam == NULL || strcmp(cws->szSetting,"Status")) return 0;
newStatus=cws->value.wVal;
oldStatus=DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
DBWriteContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",(WORD)newStatus);
if (CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) return 0;
if (DBGetContactSettingByte((HANDLE)wParam,"CList","Hidden",0)) return 0;
- if (newStatus==ID_STATUS_OFFLINE&&oldStatus!=ID_STATUS_OFFLINE) {
+ if (newStatus == ID_STATUS_OFFLINE&&oldStatus != ID_STATUS_OFFLINE) {
// Remove the event from the queue if it exists since they are now offline
int lastEvent = (int)DBGetContactSettingDword((HANDLE)wParam,"UserOnline","LastEvent",0);
@@ -44,8 +44,8 @@ static int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) DBWriteContactSettingDword((HANDLE)wParam,"UserOnline", "LastEvent", 0);
}
}
- if ((newStatus==ID_STATUS_ONLINE || newStatus==ID_STATUS_FREECHAT) &&
- oldStatus!=ID_STATUS_ONLINE && oldStatus!=ID_STATUS_FREECHAT) {
+ if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) &&
+ oldStatus != ID_STATUS_ONLINE && oldStatus != ID_STATUS_FREECHAT) {
{
DWORD ticked = db_dword_get(NULL, "UserOnline", cws->szModule, GetTickCount());
// only play the sound (or show event) if this event happens at least 10 secs after the proto went from offline
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;
}
diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index 984d5e036a..5d5719bfd7 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -32,23 +32,23 @@ static void SetListGroupIcons(HWND hwndList,HANDLE hFirstItem,HANDLE hParentItem typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0);
//check groups
- if (typeOfFirst==CLCIT_GROUP) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList,hChildItem,hItem,childCount);
for ( i=0; i < SIZEOF(iconOn); i++)
- if (iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i)==0) iconOn[i]=0;
+ if (iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i) == 0) iconOn[i]=0;
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
}
//check contacts
- if (typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
for ( i=0; i < SIZEOF(iconOn); i++) {
iImage=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i);
- if (iconOn[i] && iImage==0) iconOn[i]=0;
- if (iImage!=0xFF) childCount[i]++;
+ if (iconOn[i] && iImage == 0) iconOn[i]=0;
+ if (iImage != 0xFF) childCount[i]++;
}
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem);
}
@@ -66,19 +66,19 @@ static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iIm typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0);
//check groups
- if (typeOfFirst==CLCIT_GROUP) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hChildItem) SetAllChildIcons(hwndList,hChildItem,iColumn,iImage);
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
}
//check contacts
- if (typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem;
+ if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem);
- while(hItem) {
+ while (hItem) {
iOldIcon=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
- if (iOldIcon!=0xFF && iOldIcon!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
+ if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem);
}
}
@@ -109,21 +109,21 @@ static void SetAllContactIcons(HWND hwndList) hItem=(HANDLE)SendMessage(hwndList,CLM_FINDCONTACT,(WPARAM)hContact,0);
if (hItem) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (szProto==NULL) {flags=0; status=0;}
+ if (szProto == NULL) {flags=0; status=0;}
else {
flags=CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0);
status=DBGetContactSettingWord(hContact,szProto,"ApparentMode",0);
}
if (flags&PF1_INVISLIST) {
- if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,0))==0xFF)
- SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,status==ID_STATUS_ONLINE?1:0));
+ if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,0)) == 0xFF)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,status == ID_STATUS_ONLINE?1:0));
}
if (flags&PF1_VISLIST) {
- if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,0))==0xFF)
- SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,status==ID_STATUS_OFFLINE?2:0));
+ if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,0)) == 0xFF)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,status == ID_STATUS_OFFLINE?2:0));
}
}
- } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
}
static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP // Update list, making sure that the options are mutually exclusive
if (itemType == CLCIT_CONTACT) { // A contact
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
- if (iImage && SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn?0:1,0))!=0xFF)
+ if (iImage && SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn?0:1,0)) != 0xFF)
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0));
}
else if (itemType == CLCIT_INFO) { // All Contacts
@@ -249,15 +249,15 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP set=0;
for (i=0;i<2;i++) {
iImage=SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0));
- if (iImage==i+1) {
- CallContactService(hContact,PSS_SETAPPARENTMODE,iImage==1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE,0);
+ if (iImage == i+1) {
+ CallContactService(hContact,PSS_SETAPPARENTMODE,iImage == 1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE,0);
set=1;
break;
}
}
if (!set) CallContactService(hContact,PSS_SETAPPARENTMODE,0,0);
}
- } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
return TRUE;
}
}
diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index a3e070496e..2ff53f005b 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -60,7 +60,7 @@ #include <stdlib.h>
XMLCSTR XMLNode::getVersion() { return _CXML("v2.43"); }
-void freeXMLString(XMLSTR t){if(t)free(t);}
+void freeXMLString(XMLSTR t) {if(t)free(t);}
static XMLNode::XMLCharEncoding characterEncoding=XMLNode::char_encoding_UTF8;
static char guessWideCharChars=1, dropWhiteSpace=1, removeCommentsInMiddleOfText=1;
@@ -154,7 +154,7 @@ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIs {
#ifdef sun
// for SPARC processors: wchar_t* buffers must always be alligned, otherwise it's a char* buffer.
- if ((((unsigned long)b)%sizeof(wchar_t))!=0) return FALSE;
+ if ((((unsigned long)b)%sizeof(wchar_t)) != 0) return FALSE;
#endif
const wchar_t *s=(const wchar_t*)b;
@@ -192,11 +192,11 @@ char myIsTextWideChar(const void *b,int l) { return (char)IsTextUnicode((CONST L wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce)
{
int i;
- if (ce==XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,NULL,0);
+ if (ce == XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,NULL,0);
else i=(int)MultiByteToWideChar(CP_ACP ,MB_PRECOMPOSED,s,-1,NULL,0);
if (i<0) return NULL;
wchar_t *d=(wchar_t *)malloc((i+1)*sizeof(XMLCHAR));
- if (ce==XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,d,i);
+ if (ce == XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,d,i);
else i=(int)MultiByteToWideChar(CP_ACP ,MB_PRECOMPOSED,s,-1,d,i);
d[i]=0;
return d;
@@ -211,7 +211,7 @@ static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1,c #else
char *myWideCharToMultiByte(const wchar_t *s)
{
- UINT codePage=CP_ACP; if (characterEncoding==XMLNode::char_encoding_UTF8) codePage=CP_UTF8;
+ UINT codePage=CP_ACP; if (characterEncoding == XMLNode::char_encoding_UTF8) codePage=CP_UTF8;
int i=(int)WideCharToMultiByte(codePage, // code page
0, // performance and mapping flags
s, // wide-character string
@@ -297,16 +297,16 @@ static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) do
{
left=towlower(*c1++); right=towlower(*c2++);
- } while (left&&(left==right));
+ } while (left&&(left == right));
return (int)left-(int)right;
}
static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l)
{
wchar_t left,right;
- while(l--)
+ while (l--)
{
left=towlower(*c1++); right=towlower(*c2++);
- if ((!left)||(left!=right)) return (int)left-(int)right;
+ if ((!left)||(left != right)) return (int)left-(int)right;
}
return 0;
}
@@ -318,7 +318,7 @@ static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) {
char *filenameAscii=myWideCharToMultiByte(filename);
FILE *f;
- if (mode[0]==_CXML('r')) f=fopen(filenameAscii,"rb");
+ if (mode[0] == _CXML('r')) f=fopen(filenameAscii,"rb");
else f=fopen(filenameAscii,"wb");
free(filenameAscii);
return f;
@@ -345,33 +345,33 @@ static inline int _strnicmp(const char *c1,const char *c2, int l) { return strnc #ifdef _XMLWIDECHAR
#ifdef _XMLWINDOWS
// for Microsoft Visual Studio 6.0 and Microsoft Visual Studio .NET and Borland C++ Builder 6.0
-char xmltob(XMLCSTR t,char v){ if (t&&(*t)) return (char)_wtoi(t); return v; }
-int xmltoi(XMLCSTR t,int v){ if (t&&(*t)) return _wtoi(t); return v; }
-long xmltol(XMLCSTR t,long v){ if (t&&(*t)) return _wtol(t); return v; }
-double xmltof(XMLCSTR t,double v){ if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; }
+char xmltob(XMLCSTR t,char v) { if (t&&(*t)) return (char)_wtoi(t); return v; }
+int xmltoi(XMLCSTR t,int v) { if (t&&(*t)) return _wtoi(t); return v; }
+long xmltol(XMLCSTR t,long v) { if (t&&(*t)) return _wtol(t); return v; }
+double xmltof(XMLCSTR t,double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; }
#else
#ifdef sun
// for CC
#include <widec.h>
-char xmltob(XMLCSTR t,char v){ if (t) return (char)wstol(t,NULL,10); return v; }
-int xmltoi(XMLCSTR t,int v){ if (t) return (int)wstol(t,NULL,10); return v; }
-long xmltol(XMLCSTR t,long v){ if (t) return wstol(t,NULL,10); return v; }
+char xmltob(XMLCSTR t,char v) { if (t) return (char)wstol(t,NULL,10); return v; }
+int xmltoi(XMLCSTR t,int v) { if (t) return (int)wstol(t,NULL,10); return v; }
+long xmltol(XMLCSTR t,long v) { if (t) return wstol(t,NULL,10); return v; }
#else
// for gcc
-char xmltob(XMLCSTR t,char v){ if (t) return (char)wcstol(t,NULL,10); return v; }
-int xmltoi(XMLCSTR t,int v){ if (t) return (int)wcstol(t,NULL,10); return v; }
-long xmltol(XMLCSTR t,long v){ if (t) return wcstol(t,NULL,10); return v; }
+char xmltob(XMLCSTR t,char v) { if (t) return (char)wcstol(t,NULL,10); return v; }
+int xmltoi(XMLCSTR t,int v) { if (t) return (int)wcstol(t,NULL,10); return v; }
+long xmltol(XMLCSTR t,long v) { if (t) return wcstol(t,NULL,10); return v; }
#endif
-double xmltof(XMLCSTR t,double v){ if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; }
+double xmltof(XMLCSTR t,double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; }
#endif
#else
-char xmltob(XMLCSTR t,char v){ if (t&&(*t)) return (char)atoi(t); return v; }
-int xmltoi(XMLCSTR t,int v){ if (t&&(*t)) return atoi(t); return v; }
-long xmltol(XMLCSTR t,long v){ if (t&&(*t)) return atol(t); return v; }
-double xmltof(XMLCSTR t,double v){ if (t&&(*t)) return atof(t); return v; }
+char xmltob(XMLCSTR t,char v) { if (t&&(*t)) return (char)atoi(t); return v; }
+int xmltoi(XMLCSTR t,int v) { if (t&&(*t)) return atoi(t); return v; }
+long xmltol(XMLCSTR t,long v) { if (t&&(*t)) return atol(t); return v; }
+double xmltof(XMLCSTR t,double v) { if (t&&(*t)) return atof(t); return v; }
#endif
-XMLCSTR xmltoa(XMLCSTR t,XMLCSTR v){ if (t) return t; return v; }
-XMLCHAR xmltoc(XMLCSTR t,const XMLCHAR v){ if (t&&(*t)) return *t; return v; }
+XMLCSTR xmltoa(XMLCSTR t,XMLCSTR v) { if (t) return t; return v; }
+XMLCHAR xmltoc(XMLCSTR t,const XMLCHAR v) { if (t&&(*t)) return *t; return v; }
/////////////////////////////////////////////////////////////////////////
// the "openFileHelper" function //
@@ -401,7 +401,7 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) {
// create message
char message[2000],*s1=(char*)"",*s3=(char*)""; XMLCSTR s2=_CXML("");
- if (pResults.error==eXMLErrorFirstTagNotFound) { s1=(char*)"First Tag should be '"; s2=tag; s3=(char*)"'.\n"; }
+ if (pResults.error == eXMLErrorFirstTagNotFound) { s1=(char*)"First Tag should be '"; s2=tag; s3=(char*)"'.\n"; }
sprintf(message,
#ifdef _XMLWIDECHAR
"XML Parsing error inside file '%S'.\n%S\nAt line %i, column %i.\n%s%S%s"
@@ -605,7 +605,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm #else
if ((!isDeclaration())&&((d->lpszName)||(!getChildNode().isDeclaration())))
{
- if (characterEncoding==char_encoding_UTF8)
+ if (characterEncoding == char_encoding_UTF8)
{
// header so that windows recognize the file as UTF-8:
unsigned char h[3]={0xEF,0xBB,0xBF};
@@ -615,7 +615,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm return eXMLErrorCannotWriteFile;
}
encoding="utf-8";
- } else if (characterEncoding==char_encoding_ShiftJIS) encoding="SHIFT-JIS";
+ } else if (characterEncoding == char_encoding_ShiftJIS) encoding="SHIFT-JIS";
if (!encoding) encoding="ISO-8859-1";
if (fprintf(f,"<?xml version=\"1.0\" encoding=\"%s\"?>\n",encoding)<0)
@@ -625,7 +625,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm }
} else
{
- if (characterEncoding==char_encoding_UTF8)
+ if (characterEncoding == char_encoding_UTF8)
{
unsigned char h[3]={0xEF,0xBB,0xBF};
if (!fwrite(h,3,1,f))
@@ -644,7 +644,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm fclose(f);
return eXMLErrorCannotWriteFile;
}
- if (fclose(f)!=0)
+ if (fclose(f) != 0)
{
free(t);
return eXMLErrorCannotWriteFile;
@@ -656,10 +656,10 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm // Duplicate a given string.
XMLSTR stringDup(XMLCSTR lpszData, int cbData)
{
- if (lpszData==NULL) return NULL;
+ if (lpszData == NULL) return NULL;
XMLSTR lpszNew;
- if (cbData==-1) cbData=(int)xstrlen(lpszData);
+ if (cbData == -1) cbData=(int)xstrlen(lpszData);
lpszNew = (XMLSTR)malloc((cbData+1) * sizeof(XMLCHAR));
if (lpszNew)
{
@@ -679,9 +679,9 @@ XMLSTR ToXMLStringTool::toXMLUnSafe(XMLSTR dest,XMLCSTR source) entity=XMLEntities;
do
{
- if (ch==entity->c) {xstrcpy(dest,entity->s); dest+=entity->l; source++; goto out_of_loop1; }
+ if (ch == entity->c) {xstrcpy(dest,entity->s); dest+=entity->l; source++; goto out_of_loop1; }
entity++;
- } while(entity->s);
+ } while (entity->s);
#ifdef _XMLWIDECHAR
*(dest++)=*(source++);
#else
@@ -711,9 +711,9 @@ int ToXMLStringTool::lengthXMLString(XMLCSTR source) entity=XMLEntities;
do
{
- if (ch==entity->c) { r+=entity->l; source++; goto out_of_loop1; }
+ if (ch == entity->c) { r+=entity->l; source++; goto out_of_loop1; }
entity++;
- } while(entity->s);
+ } while (entity->s);
#ifdef _XMLWIDECHAR
r++; source++;
#else
@@ -758,14 +758,14 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) XMLCharacterEntity *entity;
while ((lo>0)&&(*s))
{
- if (*s==_CXML('&'))
+ if (*s == _CXML('&'))
{
- if ((lo>2)&&(s[1]==_CXML('#')))
+ if ((lo>2)&&(s[1] == _CXML('#')))
{
s+=2; lo-=2;
- if ((*s==_CXML('X'))||(*s==_CXML('x'))) { s++; lo--; }
- while ((*s)&&(*s!=_CXML(';'))&&((lo--)>0)) s++;
- if (*s!=_CXML(';'))
+ if ((*s == _CXML('X'))||(*s == _CXML('x'))) { s++; lo--; }
+ while ((*s)&&(*s != _CXML(';'))&&((lo--)>0)) s++;
+ if (*s != _CXML(';'))
{
pXML->error=eXMLErrorUnknownCharacterEntity;
return NULL;
@@ -776,9 +776,9 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) entity=XMLEntities;
do
{
- if ((lo>=entity->l)&&(xstrnicmp(s,entity->s,entity->l)==0)) { s+=entity->l; lo-=entity->l; break; }
+ if ((lo>=entity->l)&&(xstrnicmp(s,entity->s,entity->l) == 0)) { s+=entity->l; lo-=entity->l; break; }
entity++;
- } while(entity->s);
+ } while (entity->s);
if (!entity->s)
{
pXML->error=eXMLErrorUnknownCharacterEntity;
@@ -800,15 +800,15 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) s=d;
while (ll-->0)
{
- if (*ss==_CXML('&'))
+ if (*ss == _CXML('&'))
{
- if (ss[1]==_CXML('#'))
+ if (ss[1] == _CXML('#'))
{
ss+=2; j=0;
- if ((*ss==_CXML('X'))||(*ss==_CXML('x')))
+ if ((*ss == _CXML('X'))||(*ss == _CXML('x')))
{
ss++;
- while (*ss!=_CXML(';'))
+ while (*ss != _CXML(';'))
{
if ((*ss>=_CXML('0'))&&(*ss<=_CXML('9'))) j=(j<<4)+*ss-_CXML('0');
else if ((*ss>=_CXML('A'))&&(*ss<=_CXML('F'))) j=(j<<4)+*ss-_CXML('A')+10;
@@ -818,7 +818,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) }
} else
{
- while (*ss!=_CXML(';'))
+ while (*ss != _CXML(';'))
{
if ((*ss>=_CXML('0'))&&(*ss<=_CXML('9'))) j=(j*10)+*ss-_CXML('0');
else { free((void*)s); pXML->error=eXMLErrorUnknownCharacterEntity;return NULL;}
@@ -834,9 +834,9 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) entity=XMLEntities;
do
{
- if (xstrnicmp(ss,entity->s,entity->l)==0) { *(d++)=entity->c; ss+=entity->l; break; }
+ if (xstrnicmp(ss,entity->s,entity->l) == 0) { *(d++)=entity->c; ss+=entity->l; break; }
entity++;
- } while(entity->s);
+ } while (entity->s);
}
} else
{
@@ -863,7 +863,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) return (XMLSTR)s;
}
-#define XML_isSPACECHAR(ch) ((ch==_CXML('\n'))||(ch==_CXML(' '))||(ch== _CXML('\t'))||(ch==_CXML('\r')))
+#define XML_isSPACECHAR(ch) ((ch == _CXML('\n'))||(ch == _CXML(' '))||(ch == _CXML('\t'))||(ch == _CXML('\r')))
// private:
char myTagCompare(XMLCSTR cclose, XMLCSTR copen)
@@ -873,13 +873,13 @@ char myTagCompare(XMLCSTR cclose, XMLCSTR copen) {
if (!cclose) return 1;
int l=(int)xstrlen(cclose);
- if (xstrnicmp(cclose, copen, l)!=0) return 1;
+ if (xstrnicmp(cclose, copen, l) != 0) return 1;
const XMLCHAR c=copen[l];
if (XML_isSPACECHAR(c)||
- (c==_CXML('/' ))||
- (c==_CXML('<' ))||
- (c==_CXML('>' ))||
- (c==_CXML('=' ))) return 0;
+ (c == _CXML('/' ))||
+ (c == _CXML('<' ))||
+ (c == _CXML('>' ))||
+ (c == _CXML('=' ))) return 0;
return 1;
}
@@ -888,7 +888,7 @@ static inline XMLCHAR getNextChar(XML *pXML) {
XMLCHAR ch = pXML->lpXML[pXML->nIndex];
#ifdef _XMLWIDECHAR
- if (ch!=0) pXML->nIndex++;
+ if (ch != 0) pXML->nIndex++;
#else
pXML->nIndex+=XML_ByteTable[(unsigned char)ch];
#endif
@@ -927,10 +927,10 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT nFoundMatch = FALSE;
// Search through the string to find a matching quote
- while((ch = getNextChar(pXML)))
+ while ((ch = getNextChar(pXML)))
{
- if (ch==chTemp) { nFoundMatch = TRUE; break; }
- if (ch==_CXML('<')) break;
+ if (ch == chTemp) { nFoundMatch = TRUE; break; }
+ if (ch == _CXML('<')) break;
}
// If we failed to find a matching quote
@@ -973,7 +973,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT return result;
}
ctag++;
- } while(ctag->lpszOpen);
+ } while (ctag->lpszOpen);
// Peek at the next character to see if we have an end tag '</',
// or an xml declaration '<?'
@@ -1032,21 +1032,21 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT {
// Indicate we are dealing with text
*pType = eTokenText;
- while((ch = getNextChar(pXML)))
+ while ((ch = getNextChar(pXML)))
{
if XML_isSPACECHAR(ch)
{
indexStart++; break;
- } else if (ch==_CXML('/'))
+ } else if (ch == _CXML('/'))
{
// If we find a slash then this maybe text or a short hand end tag
// Peek at the next character to see it we have short hand end tag
ch=pXML->lpXML[pXML->nIndex];
// If we found a short hand end tag then we need to exit the loop
- if (ch==_CXML('>')) { pXML->nIndex--; break; }
+ if (ch == _CXML('>')) { pXML->nIndex--; break; }
- } else if ((ch==_CXML('<'))||(ch==_CXML('>'))||(ch==_CXML('=')))
+ } else if ((ch == _CXML('<'))||(ch == _CXML('>'))||(ch == _CXML('=')))
{
pXML->nIndex--; break;
}
@@ -1067,13 +1067,13 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT XMLCSTR XMLNode::updateName_WOSD(XMLSTR lpszName)
{
if (!d) { free(lpszName); return NULL; }
- if (d->lpszName&&(lpszName!=d->lpszName)) free((void*)d->lpszName);
+ if (d->lpszName&&(lpszName != d->lpszName)) free((void*)d->lpszName);
d->lpszName=lpszName;
return lpszName;
}
// private:
-XMLNode::XMLNode(struct XMLNodeDataTag *p){ d=p; (p->ref_count)++; }
+XMLNode::XMLNode(struct XMLNodeDataTag *p) { d=p; (p->ref_count)++; }
XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration)
{
d=(XMLNodeData*)malloc(sizeof(XMLNodeData));
@@ -1117,8 +1117,8 @@ XMLNode XMLNode::createXMLTopNode(XMLCSTR lpszName, char isDeclaration) { return static inline void myFree(void *p) { if (p) free(p); }
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 == NULL) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); }
+ if ((memInc == 0)||((newsize%memInc) == 0)) p=realloc(p,(newsize+memInc)*sizeofElem);
// if (!p)
// {
// printf("XMLParser Error: Not enough memory! Aborting...\n"); exit(220);
@@ -1130,7 +1130,7 @@ static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem) XMLElementPosition XMLNode::findPosition(XMLNodeData *d, int index, XMLElementType xxtype)
{
if (index<0) return -1;
- int i=0,j=(int)((index<<2)+xxtype),*o=d->pOrder; while (o[i]!=j) i++; return i;
+ int i=0,j=(int)((index<<2)+xxtype),*o=d->pOrder; while (o[i] != j) i++; return i;
}
// private:
@@ -1162,8 +1162,8 @@ void *XMLNode::addToOrder(int memoryIncrease,int *_pos, int nc, void *p, int siz int i=pos;
memmove(o+i+1, o+i, (n-i)*sizeof(int));
- while ((pos<n)&&((o[pos]&3)!=(int)xtype)) pos++;
- if (pos==n) { *_pos=nc; o[n]=(int)((nc<<2)+xtype); return p; }
+ while ((pos<n)&&((o[pos]&3) != (int)xtype)) pos++;
+ if (pos == n) { *_pos=nc; o[n]=(int)((nc<<2)+xtype); return p; }
o[i]=o[pos];
for (i=pos+1;i<=n;i++) if ((o[i]&3) == (int)xtype) o[i]+=4;
@@ -1247,13 +1247,13 @@ char XMLNode::parseClearTag(void *px, void *_pClear) // Find the closing tag
// Seems the <!DOCTYPE need a better treatment so lets handle it
- if (pClear.lpszOpen==XMLClearTags[1].lpszOpen)
+ if (pClear.lpszOpen == XMLClearTags[1].lpszOpen)
{
XMLCSTR pCh=lpXML;
while (*pCh)
{
- if (*pCh==_CXML('<')) { pClear.lpszClose=docTypeEnd; lpszTemp=xstrstr(lpXML,docTypeEnd); break; }
- else if (*pCh==_CXML('>')) { lpszTemp=pCh; break; }
+ if (*pCh == _CXML('<')) { pClear.lpszClose=docTypeEnd; lpszTemp=xstrstr(lpXML,docTypeEnd); break; }
+ else if (*pCh == _CXML('>')) { lpszTemp=pCh; break; }
#ifdef _XMLWIDECHAR
pCh++;
#else
@@ -1293,7 +1293,7 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) XML *pXML=(XML *)pa;
XMLCSTR lpszText=pXML->lpszText;
if (!lpszText) return 0;
- if (dropWhiteSpace) while (XML_isSPACECHAR(*lpszText)&&(lpszText!=tokenPStr)) lpszText++;
+ if (dropWhiteSpace) while (XML_isSPACECHAR(*lpszText)&&(lpszText != tokenPStr)) lpszText++;
int cbText = (int)(tokenPStr - lpszText);
if (!cbText) { pXML->lpszText=NULL; return 0; }
if (dropWhiteSpace) { cbText--; while ((cbText)&&XML_isSPACECHAR(lpszText[cbText])) cbText--; cbText++; }
@@ -1306,10 +1306,10 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) // if the previous insertion was a comment (<!-- -->) AND
// if the previous previous insertion was a text then, delete the comment and append the text
int n=d->nChild+d->nText+d->nClear-1,*o=d->pOrder;
- if (((o[n]&3)==eNodeClear)&&((o[n-1]&3)==eNodeText))
+ if (((o[n]&3) == eNodeClear)&&((o[n-1]&3) == eNodeText))
{
int i=o[n]>>2;
- if (d->pClear[i].lpszOpenTag==XMLClearTags[2].lpszOpen)
+ if (d->pClear[i].lpszOpenTag == XMLClearTags[2].lpszOpen)
{
deleteClear(i);
i=o[n-1]>>2;
@@ -1451,7 +1451,7 @@ int XMLNode::ParseXMLElement(void *pa) // element then we only need to unwind
// once more...
- if (myTagCompare(d->lpszName, pXML->lpEndTag)==0)
+ if (myTagCompare(d->lpszName, pXML->lpEndTag) == 0)
{
pXML->cbEndTag = 0;
}
@@ -1468,7 +1468,7 @@ int XMLNode::ParseXMLElement(void *pa) // then we need to return to the caller
// and let it process the element.
- if (myTagCompare(d->lpszName, pXML->lpNewElement)==0)
+ if (myTagCompare(d->lpszName, pXML->lpNewElement) == 0)
{
return TRUE;
}
@@ -1702,7 +1702,7 @@ LBL_Error: if (cbTemp)
{
// Add the valued attribute to the list
- if (xtype==eTokenQuotedText) { token.pStr++; cbToken-=2; }
+ if (xtype == eTokenQuotedText) { token.pStr++; cbToken-=2; }
XMLSTR attrVal=(XMLSTR)token.pStr;
if (attrVal)
{
@@ -1794,10 +1794,10 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) xnode.ParseXMLElement(&xml);
enum XMLError error = xml.error;
if (!xnode.nChildNode()) error=eXMLErrorNoXMLTagFound;
- if ((xnode.nChildNode()==1)&&(xnode.nElement()==1)) xnode=xnode.getChildNode(); // skip the empty node
+ 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))
+ if ((error == eXMLErrorNone)||(error == eXMLErrorMissingEndTag)||(error == eXMLErrorNoXMLTagFound))
{
XMLCSTR name=xnode.getName();
if (tag&&(*tag)&&((!name)||(xstricmp(name,tag))))
@@ -1828,9 +1828,9 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) pResults->error = error;
// If we have an error
- if (error!=eXMLErrorNone)
+ if (error != eXMLErrorNone)
{
- if (error==eXMLErrorMissingEndTag) xml.nIndex=xml.nIndexMissigEndTag;
+ if (error == eXMLErrorMissingEndTag) xml.nIndex=xml.nIndexMissigEndTag;
// Find which line and column it starts on.
CountLinesAndColumns(xml.lpXML, xml.nIndex, pResults);
}
@@ -1844,7 +1844,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) {
if (pResults) { pResults->nLine=0; pResults->nColumn=0; }
FILE *f=xfopen(filename,_CXML("rb"));
- if (f==NULL) { if (pResults) pResults->error=eXMLErrorFileNotFound; return emptyXMLNode; }
+ 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; }
@@ -1859,7 +1859,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) 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; }
+ 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)
{
@@ -1868,33 +1868,33 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) free(buf); buf=(unsigned char*)b2; headerSz=0;
} else
{
- if ((buf[0]==0xef)&&(buf[1]==0xff)) headerSz=2;
- if ((buf[0]==0xff)&&(buf[1]==0xfe)) headerSz=2;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xff)) headerSz=2;
+ if ((buf[0] == 0xff)&&(buf[1] == 0xfe)) headerSz=2;
}
} else
{
- if ((buf[0]==0xef)&&(buf[1]==0xff)) headerSz=2;
- if ((buf[0]==0xff)&&(buf[1]==0xfe)) headerSz=2;
- if ((buf[0]==0xef)&&(buf[1]==0xbb)&&(buf[2]==0xbf)) headerSz=3;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xff)) headerSz=2;
+ if ((buf[0] == 0xff)&&(buf[1] == 0xfe)) headerSz=2;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xbb)&&(buf[2] == 0xbf)) headerSz=3;
}
#else
if (guessWideCharChars)
{
if (myIsTextWideChar(buf,l))
{
- if ((buf[0]==0xef)&&(buf[1]==0xff)) headerSz=2;
- if ((buf[0]==0xff)&&(buf[1]==0xfe)) headerSz=2;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xff)) headerSz=2;
+ if ((buf[0] == 0xff)&&(buf[1] == 0xfe)) headerSz=2;
char *b2=myWideCharToMultiByte((const wchar_t*)(buf+headerSz));
free(buf); buf=(unsigned char*)b2; headerSz=0;
} else
{
- if ((buf[0]==0xef)&&(buf[1]==0xbb)&&(buf[2]==0xbf)) headerSz=3;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xbb)&&(buf[2] == 0xbf)) headerSz=3;
}
} else
{
- if ((buf[0]==0xef)&&(buf[1]==0xff)) headerSz=2;
- if ((buf[0]==0xff)&&(buf[1]==0xfe)) headerSz=2;
- if ((buf[0]==0xef)&&(buf[1]==0xbb)&&(buf[2]==0xbf)) headerSz=3;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xff)) headerSz=2;
+ if ((buf[0] == 0xff)&&(buf[1] == 0xfe)) headerSz=2;
+ if ((buf[0] == 0xef)&&(buf[1] == 0xbb)&&(buf[2] == 0xbf)) headerSz=3;
}
#endif
@@ -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);
@@ -1984,7 +1984,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma lpszMarker[nResult]=_CXML('>');
}
nResult++;
- if (nFormat!=-1)
+ if (nFormat != -1)
{
if (lpszMarker) lpszMarker[nResult]=_CXML('\n');
nResult++;
@@ -2004,7 +2004,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma // Calculate the child format for when we recurse. This is used to
// determine the number of spaces used for prefixes.
- if (nFormat!=-1)
+ if (nFormat != -1)
{
if (cbElement&&(!pEntry->isDeclaration)) nChildFormat=nFormat+1;
else nChildFormat=nFormat;
@@ -2050,7 +2050,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma cb = (int)LENSTR(pChild->lpszOpenTag);
if (cb)
{
- if (nFormat!=-1)
+ if (nFormat != -1)
{
if (lpszMarker)
{
@@ -2082,7 +2082,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma nResult += cb;
}
- if (nFormat!=-1)
+ if (nFormat != -1)
{
if (lpszMarker) lpszMarker[nResult] = _CXML('\n');
nResult++;
@@ -2131,7 +2131,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma } else
{
if (nFormat>=0) nResult+=cbElement+4+nFormat;
- else if (nFormat==-1) nResult+=cbElement+3;
+ else if (nFormat == -1) nResult+=cbElement+3;
else nResult+=cbElement+4;
}
} else
@@ -2186,7 +2186,7 @@ int XMLNode::detachFromParent(XMLNodeData *d) {
XMLNode *pa=d->pParent->pChild;
int i=0;
- while (((void*)(pa[i].d))!=((void*)d)) i++;
+ while (((void*)(pa[i].d)) != ((void*)d)) i++;
d->pParent->nChild--;
if (d->pParent->nChild) memmove(pa+i,pa+i+1,(d->pParent->nChild-i)*sizeof(XMLNode));
else { free(pa); d->pParent->pChild=NULL; }
@@ -2208,7 +2208,7 @@ void XMLNode::deleteNodeContent() void XMLNode::emptyTheNode(char force)
{
XMLNodeData *dd=d; // warning: must stay this way!
- if ((dd->ref_count==0)||force)
+ if ((dd->ref_count == 0)||force)
{
if (d->pParent) detachFromParent(d);
int i;
@@ -2241,7 +2241,7 @@ void XMLNode::emptyTheNode(char force) dd->pChild=NULL; dd->pText=NULL; dd->pClear=NULL; dd->pAttribute=NULL;
dd->pOrder=NULL; dd->pInnerText=NULL; dd->lpszNS=dd->lpszName=NULL; dd->pParent=NULL;
}
- if (dd->ref_count==0)
+ if (dd->ref_count == 0)
{
free(dd);
d=NULL;
@@ -2296,7 +2296,7 @@ XMLNode XMLNode::deepCopy() const if (n)
{
p->nText=n; p->pText=(XMLCSTR*)malloc(n*sizeof(XMLCSTR));
- while(n--) p->pText[n]=stringDup(d->pText[n]);
+ while (n--) p->pText[n]=stringDup(d->pText[n]);
}
n=d->nClear;
if (n)
@@ -2338,7 +2338,7 @@ XMLNode XMLNode::addChild(XMLNode childNode, int pos) }
return childNode;
}
- if (dc->pParent) { if ((detachFromParent(dc)<=pos)&&(dc->pParent==d)) pos--; } else dc->ref_count++;
+ if (dc->pParent) { if ((detachFromParent(dc)<=pos)&&(dc->pParent == d)) pos--; } else dc->ref_count++;
dc->pParent=d;
// int nc=d->nChild;
// d->pChild=(XMLNode*)myRealloc(d->pChild,(nc+1),memoryIncrease,sizeof(XMLNode));
@@ -2358,7 +2358,7 @@ void XMLNode::deleteAttribute(int i) if (d->nAttribute) memmove(p,p+1,(d->nAttribute-i)*sizeof(XMLAttribute)); else { free(p); d->pAttribute=NULL; }
}
-void XMLNode::deleteAttribute(XMLAttribute *a){ if (a) deleteAttribute(a->lpszName); }
+void XMLNode::deleteAttribute(XMLAttribute *a) { if (a) deleteAttribute(a->lpszName); }
void XMLNode::deleteAttribute(XMLCSTR lpszName)
{
int j=0;
@@ -2375,9 +2375,9 @@ XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewN return NULL;
}
XMLAttribute *p=d->pAttribute+i;
- if (p->lpszValue&&p->lpszValue!=lpszNewValue) free((void*)p->lpszValue);
+ if (p->lpszValue&&p->lpszValue != lpszNewValue) free((void*)p->lpszValue);
p->lpszValue=lpszNewValue;
- if (lpszNewName&&p->lpszName!=lpszNewName) { free((void*)p->lpszName); p->lpszName=lpszNewName; };
+ if (lpszNewName&&p->lpszName != lpszNewName) { free((void*)p->lpszName); p->lpszName=lpszNewName; };
return p;
}
@@ -2405,7 +2405,7 @@ int XMLNode::indexText(XMLCSTR lpszValue) const int i,l=d->nText;
if (!lpszValue) { if (l) return 0; return -1; }
XMLCSTR *p=d->pText;
- for (i=0; i<l; i++) if (lpszValue==p[i]) return i;
+ for (i=0; i<l; i++) if (lpszValue == p[i]) return i;
return -1;
}
@@ -2428,7 +2428,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i) if (i>=d->nText) return addText_WOSD(lpszNewValue);
invalidateInnerText();
XMLCSTR *p=d->pText+i;
- if (*p!=lpszNewValue) { free((void*)*p); *p=lpszNewValue; }
+ if (*p != lpszNewValue) { free((void*)*p); *p=lpszNewValue; }
return lpszNewValue;
}
@@ -2457,7 +2457,7 @@ int XMLNode::indexClear(XMLCSTR lpszValue) const int i,l=d->nClear;
if (!lpszValue) { if (l) return 0; return -1; }
XMLClear *p=d->pClear;
- for (i=0; i<l; i++) if (lpszValue==p[i].lpszValue) return i;
+ for (i=0; i<l; i++) if (lpszValue == p[i].lpszValue) return i;
return -1;
}
@@ -2470,7 +2470,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i) if (i>=d->nClear) return addClear_WOSD(lpszNewContent);
invalidateInnerText();
XMLClear *p=d->pClear+i;
- if (lpszNewContent!=p->lpszValue) { free((void*)p->lpszValue); p->lpszValue=lpszNewContent; }
+ if (lpszNewContent != p->lpszValue) { free((void*)p->lpszValue); p->lpszValue=lpszNewContent; }
return p;
}
@@ -2495,7 +2495,7 @@ int XMLNode::nChildNode(XMLCSTR name) const XMLNode *pc=d->pChild;
for (i=0; i<n; i++)
{
- if (xstricmp(pc->d->lpszName, name)==0) j++;
+ if (xstricmp(pc->d->lpszName, name) == 0) j++;
pc++;
}
return j;
@@ -2561,7 +2561,7 @@ XMLNode XMLNode::getChildNodeByPathNonConst(XMLSTR path, char createIfMissing, X XMLNode xn,xbase=*this;
XMLCHAR *tend1,sepString[2]; sepString[0]=sep; sepString[1]=0;
tend1=xstrstr(path,sepString);
- while(tend1)
+ while (tend1)
{
*tend1=0;
xn=xbase.getChildNode(path);
@@ -2592,7 +2592,7 @@ XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const XMLNodeData *dd=x.d;
XMLNode *pc=d->pChild;
int i=d->nChild;
- while (i--) if (pc[i].d==dd) return findPosition(d,i,eNodeChild);
+ while (i--) if (pc[i].d == dd) return findPosition(d,i,eNodeChild);
return -1;
}
XMLElementPosition XMLNode::positionOfChildNode(XMLCSTR name, int count) const
@@ -2620,7 +2620,7 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name,XMLCSTR attributeName,XM do
{
t=x.getAttribute(attributeName,&j);
- if (t&&(xstricmp(attributeValue,t)==0)) { if (k) *k=i; return x; }
+ if (t&&(xstricmp(attributeValue,t) == 0)) { if (k) *k=i; return x; }
} while (t);
} else
{
@@ -2640,7 +2640,7 @@ XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const XMLAttribute *pAttr=d->pAttribute+i;
for (; i<n; i++)
{
- if (xstricmp(pAttr->lpszName, lpszAttrib)==0)
+ if (xstricmp(pAttr->lpszName, lpszAttrib) == 0)
{
if (j) *j=i+1;
return pAttr->lpszValue;
@@ -2657,7 +2657,7 @@ char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const XMLAttribute *pAttr=d->pAttribute;
for (i=0; i<n; i++)
{
- if (xstricmp(pAttr->lpszName, lpszAttrib)==0)
+ if (xstricmp(pAttr->lpszName, lpszAttrib) == 0)
{
return TRUE;
}
@@ -2752,7 +2752,7 @@ XMLCSTR XMLNode::getText (int i) const { if ((!d)||(i>=d->nText 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); }
+char XMLNode::isEmpty ( ) const { return (d == NULL); }
XMLNode XMLNode::emptyNode ( ) { return XMLNode::emptyXMLNode; }
XMLNode XMLNode::addChild(XMLCSTR lpszName, char isDeclaration, XMLElementPosition pos)
@@ -2819,7 +2819,7 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf,int l, char useXML if (l<25) return (XMLCharEncoding)0;
if (guessWideCharChars&&(myIsTextWideChar(buf,l))) return (XMLCharEncoding)0;
unsigned char *b=(unsigned char*)buf;
- if ((b[0]==0xef)&&(b[1]==0xbb)&&(b[2]==0xbf)) return char_encoding_UTF8;
+ if ((b[0] == 0xef)&&(b[1] == 0xbb)&&(b[2] == 0xbf)) return char_encoding_UTF8;
// Match utf-8 model ?
XMLCharEncoding bestGuess=char_encoding_UTF8;
@@ -2827,9 +2827,9 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf,int l, char useXML while (i<l)
switch (XML_utf8ByteTable[b[i]])
{
- case 4: i++; if ((i<l)&&(b[i]& 0xC0)!=0x80) { bestGuess=char_encoding_legacy; i=l; } // 10bbbbbb ?
- case 3: i++; if ((i<l)&&(b[i]& 0xC0)!=0x80) { bestGuess=char_encoding_legacy; i=l; } // 10bbbbbb ?
- case 2: i++; if ((i<l)&&(b[i]& 0xC0)!=0x80) { bestGuess=char_encoding_legacy; i=l; } // 10bbbbbb ?
+ case 4: i++; if ((i<l)&&(b[i]& 0xC0) != 0x80) { bestGuess=char_encoding_legacy; i=l; } // 10bbbbbb ?
+ case 3: i++; if ((i<l)&&(b[i]& 0xC0) != 0x80) { bestGuess=char_encoding_legacy; i=l; } // 10bbbbbb ?
+ case 2: i++; if ((i<l)&&(b[i]& 0xC0) != 0x80) { bestGuess=char_encoding_legacy; i=l; } // 10bbbbbb ?
case 1: i++; break;
case 0: i=l;
}
@@ -2842,24 +2842,24 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf,int l, char useXML bb[l]=0;
b=(unsigned char*)strstr(bb,"encoding");
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+=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++;
- if ((xstrnicmp((char*)b,"utf-8",5)==0)||
- (xstrnicmp((char*)b,"utf8",4)==0))
+ if ((xstrnicmp((char*)b,"utf-8",5) == 0)||
+ (xstrnicmp((char*)b,"utf8",4) == 0))
{
- if (bestGuess==char_encoding_legacy) return char_encoding_error;
+ if (bestGuess == char_encoding_legacy) return char_encoding_error;
return char_encoding_UTF8;
}
- if ((xstrnicmp((char*)b,"shiftjis",8)==0)||
- (xstrnicmp((char*)b,"shift-jis",9)==0)||
- (xstrnicmp((char*)b,"sjis",4)==0)) return char_encoding_ShiftJIS;
+ if ((xstrnicmp((char*)b,"shiftjis",8) == 0)||
+ (xstrnicmp((char*)b,"shift-jis",9) == 0)||
+ (xstrnicmp((char*)b,"sjis",4) == 0)) return char_encoding_ShiftJIS;
- if (xstrnicmp((char*)b,"GB2312",6)==0) return char_encoding_GB2312;
- if (xstrnicmp((char*)b,"Big5",4)==0) return char_encoding_Big5;
- if (xstrnicmp((char*)b,"GBK",3)==0) return char_encoding_GBK;
+ if (xstrnicmp((char*)b,"GB2312",6) == 0) return char_encoding_GB2312;
+ if (xstrnicmp((char*)b,"Big5",4) == 0) return char_encoding_Big5;
+ if (xstrnicmp((char*)b,"GBK",3) == 0) return char_encoding_GBK;
return char_encoding_legacy;
#endif
@@ -2917,13 +2917,13 @@ XMLSTR XMLParserBase64Tool::encode(unsigned char *inbuf, unsigned int inlen, cha if (formatted) { if (!k) { *(curr++)=_CXML('\n'); k=18; } k--; }
}
eLen=inlen-eLen*3; // 0 - 2.
- if (eLen==1)
+ if (eLen == 1)
{
*(curr++)=base64EncodeTable[ inbuf[0]>>2 ];
*(curr++)=base64EncodeTable[(inbuf[0]<<4)&0x3F];
*(curr++)=base64Fillchar;
*(curr++)=base64Fillchar;
- } else if (eLen==2)
+ } else if (eLen == 2)
{
j=(inbuf[0]<<8)|inbuf[1];
*(curr++)=base64EncodeTable[ j>>10 ];
@@ -2949,12 +2949,12 @@ unsigned int XMLParserBase64Tool::decodeSize(XMLCSTR data,XMLError *xe) #endif
c=base64DecodeTable[(unsigned char)(*data)];
if (c<97) size++;
- else if (c==98) { if (xe) *xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+ else if (c == 98) { if (xe) *xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
data++;
}
- if (xe&&(size%4!=0)) *xe=eXMLErrorBase64DataSizeIsNotMultipleOf4;
- if (size==0) return 0;
- do { data--; size--; } while(*data==base64Fillchar); size++;
+ if (xe&&(size%4 != 0)) *xe=eXMLErrorBase64DataSizeIsNotMultipleOf4;
+ if (size == 0) return 0;
+ do { data--; size--; } while (*data == base64Fillchar); size++;
return (unsigned int)((size*3)/4);
}
@@ -2970,50 +2970,50 @@ unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int #ifdef _XMLWIDECHAR
#define BASE64DECODE_READ_NEXT_CHAR(c) \
do { \
- if (data[i]>255){ c=98; break; } \
+ if (data[i]>255) { c=98; break; } \
c=base64DecodeTable[(unsigned char)data[i++]]; \
- }while (c==97); \
- if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+ }while (c == 97); \
+ if(c == 98) { if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
#else
#define BASE64DECODE_READ_NEXT_CHAR(c) \
- do { c=base64DecodeTable[(unsigned char)data[i++]]; }while (c==97); \
- if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+ do { c=base64DecodeTable[(unsigned char)data[i++]]; }while (c == 97); \
+ if(c == 98) { if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
#endif
BASE64DECODE_READ_NEXT_CHAR(c)
- if (c==99) { return 2; }
- if (c==96)
+ if (c == 99) { return 2; }
+ if (c == 96)
{
- if (p==(int)len) return 2;
+ if (p == (int)len) return 2;
if (xe) *xe=eXMLErrorBase64DecodeTruncatedData;
return 1;
}
BASE64DECODE_READ_NEXT_CHAR(d)
- if ((d==99)||(d==96)) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
- if (p==(int)len) { if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall; return 0; }
+ if ((d == 99)||(d == 96)) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (p == (int)len) { if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall; return 0; }
buf[p++]=(unsigned char)((c<<2)|((d>>4)&0x3));
BASE64DECODE_READ_NEXT_CHAR(c)
- if (c==99) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
- if (p==(int)len)
+ if (c == 99) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (p == (int)len)
{
- if (c==96) return 2;
+ if (c == 96) return 2;
if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall;
return 0;
}
- if (c==96) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (c == 96) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
buf[p++]=(unsigned char)(((d<<4)&0xf0)|((c>>2)&0xf));
BASE64DECODE_READ_NEXT_CHAR(d)
- if (d==99 ) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
- if (p==(int)len)
+ if (d == 99 ) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (p == (int)len)
{
- if (d==96) return 2;
+ if (d == 96) return 2;
if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall;
return 0;
}
- if (d==96) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (d == 96) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
buf[p++]=(unsigned char)(((c<<6)&0xc0)|d);
}
}
diff --git a/src/modules/xml/xmlParser.h b/src/modules/xml/xmlParser.h index 5a216ab0cb..55a3dca61a 100644 --- a/src/modules/xml/xmlParser.h +++ b/src/modules/xml/xmlParser.h @@ -294,16 +294,16 @@ public: XMLSTR createXMLString(int nFormat=1, int *pnSize=NULL) const;
/**< The returned string should be free'd using the "freeXMLString" function.
*
- * If nFormat==0, no formatting is required otherwise this returns an user friendly XML string from a given element
+ * If nFormat == 0, no formatting is required otherwise this returns an user friendly XML string from a given element
* with appropriate white spaces and carriage returns. if pnSize is given it returns the size in character of the string. */
/// Save the content of an xmlNode inside a file
XMLError writeToFile(XMLCSTR filename,
const char *encoding=NULL,
char nFormat=1) const;
- /**< If nFormat==0, no formatting is required otherwise this returns an user friendly XML string from a given element with appropriate white spaces and carriage returns.
- * If the global parameter "characterEncoding==encoding_UTF8", then the "encoding" parameter is ignored and always set to "utf-8".
- * If the global parameter "characterEncoding==encoding_ShiftJIS", then the "encoding" parameter is ignored and always set to "SHIFT-JIS".
+ /**< If nFormat == 0, no formatting is required otherwise this returns an user friendly XML string from a given element with appropriate white spaces and carriage returns.
+ * If the global parameter "characterEncoding == encoding_UTF8", then the "encoding" parameter is ignored and always set to "utf-8".
+ * If the global parameter "characterEncoding == encoding_ShiftJIS", then the "encoding" parameter is ignored and always set to "SHIFT-JIS".
* If "_XMLWIDECHAR=1", then the "encoding" parameter is ignored and always set to "utf-16".
* If no "encoding" parameter is given the "ISO-8859-1" encoding is used. */
/** @} */
@@ -317,7 +317,7 @@ public: int nText() const; ///< nbr of text field
XMLNode getParentNode() const; ///< return the parent node
XMLNode getChildNode(int i=0) const; ///< return ith child node
- XMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node with specific name (return an empty node if failing). If i==-1, this returns the last XMLNode with the given name.
+ XMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node with specific name (return an empty node if failing). If i == -1, this returns the last XMLNode with the given name.
XMLNode getChildNode(XMLCSTR name, int *i=NULL) const; ///< return next child node with specific name (return an empty node if failing)
XMLNode getChildNodeWithAttribute(XMLCSTR tagName,
XMLCSTR attributeName,
@@ -354,7 +354,7 @@ public: XMLNode(const XMLNode &A); ///< to allow shallow/fast copy:
XMLNode& operator=( const XMLNode& A ); ///< to allow shallow/fast copy:
- XMLNode(): d(NULL){};
+ XMLNode(): d(NULL) {};
static XMLNode emptyXMLNode;
static XMLClear emptyXMLClear;
static XMLAttribute emptyXMLAttribute;
@@ -483,7 +483,7 @@ public: XMLElementPosition positionOfClear(XMLClear *a) const;
XMLElementPosition positionOfChildNode(int i=0) const;
XMLElementPosition positionOfChildNode(XMLNode x) const;
- XMLElementPosition positionOfChildNode(XMLCSTR name, int i=0) const; ///< return the position of the ith childNode with the specified name if (name==NULL) return the position of the ith childNode
+ XMLElementPosition positionOfChildNode(XMLCSTR name, int i=0) const; ///< return the position of the ith childNode with the specified name if (name == NULL) return the position of the ith childNode
/** @} */
/// Enumeration for XML character encoding.
@@ -630,7 +630,7 @@ typedef struct XMLNodeContents XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData=-1);
/**< This is
* a very handy function when used with all the "XMLNode::*_WOSD" functions (\link xmlWOSD \endlink).
-* @param cbData If !=0 then cbData is the number of chars to duplicate. New strings allocated with
+* @param cbData If != 0 then cbData is the number of chars to duplicate. New strings allocated with
* this function should be free'd using the "freeXMLString" function. */
/// to free the string allocated inside the "stringDup" function or the "createXMLString" function.
@@ -670,7 +670,7 @@ XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString,const XMLCHAR defautValue=_CXML('\0 typedef struct XMLDLLENTRY ToXMLStringTool
{
public:
- ToXMLStringTool(): buf(NULL),buflen(0){}
+ ToXMLStringTool(): buf(NULL),buflen(0) {}
~ToXMLStringTool();
void freeBuffer();///<call this function when you have finished using this object to release memory used by the internal buffer.
@@ -703,7 +703,7 @@ private: typedef struct XMLDLLENTRY XMLParserBase64Tool
{
public:
- XMLParserBase64Tool(): buf(NULL),buflen(0){}
+ XMLParserBase64Tool(): buf(NULL),buflen(0) {}
~XMLParserBase64Tool();
void freeBuffer();///< Call this function when you have finished using this object to release memory used by the internal buffer.
|