From 6183362250af373372830fbd5d4d952b0038bbfc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 Oct 2013 17:38:06 +0000 Subject: more warning fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@6558 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clcitems.cpp | 7 ++- plugins/Clist_modern/src/modern_clcmsgs.cpp | 15 ++++--- plugins/Clist_modern/src/modern_clcpaint.cpp | 12 ++--- plugins/Clist_modern/src/modern_clcutils.cpp | 14 ++---- plugins/Clist_modern/src/modern_clistsettings.cpp | 2 - plugins/Clist_modern/src/modern_clui.cpp | 26 +++-------- plugins/Clist_modern/src/modern_cluiframes.cpp | 3 -- plugins/Clist_modern/src/modern_docking.cpp | 12 ----- plugins/Clist_modern/src/modern_row.cpp | 28 +----------- .../Clist_modern/src/modern_rowheight_funcs.cpp | 3 +- plugins/Clist_modern/src/modern_skineditor.cpp | 52 ++++++++-------------- plugins/Clist_modern/src/modern_skinengine.cpp | 29 +++--------- plugins/Clist_modern/src/modern_skinopt.cpp | 12 ++--- plugins/Clist_modern/src/modern_skinselector.cpp | 17 +++---- plugins/Clist_modern/src/modern_statusbar.cpp | 2 +- .../Clist_modern/src/modern_statusbar_options.cpp | 1 - plugins/Clist_modern/src/modern_viewmodebar.cpp | 10 ++--- plugins/Clist_modern/src/modern_xptheme.cpp | 5 ++- 18 files changed, 73 insertions(+), 177 deletions(-) (limited to 'plugins/Clist_modern/src') diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 35a4eed2fe..1bcac75ec1 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -57,7 +57,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) p.iImage = corecli.pfnGetContactIcon(cacheEntry->hContact); memset(p.iExtraImage, 0xFF, sizeof(p.iExtraImage)); - p.proto = cacheEntry->m_cache_cszProto; + p.proto = cacheEntry->m_cache_cszProto; p.type = CLCIT_CONTACT; p.flags = 0;//CONTACTF_ONLINE; p.isSubcontact = i+1; @@ -71,8 +71,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) char *szProto = cacheEntry->m_cache_cszProto; if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,wStatus)) p.flags |= CONTACTF_ONLINE; - int apparentMode = szProto != NULL?cacheEntry->ApparentMode:0; - apparentMode = szProto != NULL?cacheEntry->ApparentMode:0; + int apparentMode = szProto != NULL ? cacheEntry->ApparentMode : 0; if (apparentMode == ID_STATUS_OFFLINE) p.flags |= CONTACTF_INVISTO; else if (apparentMode == ID_STATUS_ONLINE) p.flags |= CONTACTF_VISTO; else if (apparentMode) p.flags |= CONTACTF_VISTO|CONTACTF_INVISTO; @@ -565,7 +564,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) group->expanded = savedGroup[i].expanded; break; } - continue; + continue; } else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { for (i=0; i < savedContact.getCount(); i++) diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 7875ba21ff..d31016b09f 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -49,7 +49,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara return 0; case CLM_SETFONT: - if (HIWORD(lParam) < 0 || HIWORD(lParam)>FONTID_MODERN_MAX) return 0; + if (HIWORD(lParam)>FONTID_MODERN_MAX) return 0; dat->fontModernInfo[HIWORD(lParam)].hFont = (HFONT)wParam; dat->fontModernInfo[HIWORD(lParam)].changed = 1; @@ -62,18 +62,19 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara case CLM_SETHIDEEMPTYGROUPS: { - BOOL old = ((GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_HIDEEMPTYGROUPS) != 0); - BOOL newval = old; - if (wParam) SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)|CLS_HIDEEMPTYGROUPS); - else SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)&~CLS_HIDEEMPTYGROUPS); - newval = ((GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_HIDEEMPTYGROUPS) != 0); + BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); + if (wParam) + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS); + else + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~ CLS_HIDEEMPTYGROUPS); + BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); if (newval != old) SendMessage(hwnd,CLM_AUTOREBUILD, 0, 0); } return 0; case CLM_SETTEXTCOLOR: - if (wParam < 0 || wParam>FONTID_MODERN_MAX) break; + if (wParam > FONTID_MODERN_MAX) break; dat->fontModernInfo[wParam].colour = lParam; dat->force_in_dialog = TRUE; diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 50392aba60..18b29d54df 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1006,11 +1006,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); if ( dat->text_rtl != 0 ) _RTLRect( &counts_rc, free_row_rc.right, dx ); - if ( InClistWindow && g_CluiData.fLayered ) - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, uTextFormat ); - else - //88 - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, uTextFormat ); + ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, uTextFormat ); if ( dat->text_rtl == 0 ) text_rect.right = counts_rc.right; else @@ -3186,8 +3182,6 @@ void CLCPaint::_DrawContactLine( HDC hdcMem, ClcData *dat, ClcContact *Drawing, void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint ) { - int i; - RECT text_rc = {0}; UINT uTextFormat = DT_NOPREFIX | /*DT_VCENTER |*/ DT_SINGLELINE | @@ -3196,12 +3190,12 @@ void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContac ( gl_TrimText?DT_END_ELLIPSIS:0 )| (( dat->force_in_dialog || dat->bkChanged ) ? DT_FORCENATIVERENDER:0 ); - text_rc = *row_rc; + RECT text_rc = *row_rc; text_rc.right = row_rc->left; text_rc.left = row_rc->right; - for ( i=0; i < Drawing->ext_nItemsNum; i++ ) + for (int i=0; i < Drawing->ext_nItemsNum; i++ ) { RECT *prcItem = &( Drawing->ext_mpItemsDesc[i].itemRect ); if ( __IsVisible( rcPaint, prcItem ) || ( Drawing->ext_mpItemsDesc[i].itemType == CIT_AVATAR && Drawing->avatar_pos == AVATAR_POS_ANIMATED )) diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 69eb2ddd9e..3fb5c65ab8 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -181,11 +181,8 @@ void cliScrollTo(HWND hwnd,ClcData *dat,int desty,int noSmooth) } } dat->yScroll = desty; - if ((dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL) && FALSE) - ScrollWindowEx(hwnd, 0, previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE); - else - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); - SetScrollPos(hwnd,SB_VERT,dat->yScroll,TRUE); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); } @@ -400,11 +397,8 @@ int GetDropTargetInformation(HWND hwnd,ClcData *dat,POINT pt) { if (bottomItem == -1 && contact->type != CLCIT_GROUP && contact->groupId == 0) { - if (contact->type != CLCIT_GROUP && contact->groupId == 0) - { - bottomItem = topItem; - cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup); - } + bottomItem = topItem; + cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup); } if (bottomItem != -1 && bottomcontact->type != CLCIT_GROUP) { diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 4dd9db47cb..77464992ef 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -228,8 +228,6 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) pdnce->m_cache_cszProto = GetProtoForContact(pdnce->hContact); if (pdnce->m_cache_cszProto == NULL) pdnce->m_cache_bProtoNotExists = FALSE; - else if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pdnce->m_cache_cszProto) == (int)NULL && 0) - pdnce->m_cache_bProtoNotExists = TRUE; else if (pdnce->m_cache_cszProto && pdnce->tszName) pdnce->freeName(); } diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index c86934b64c..da0679328b 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -447,9 +447,9 @@ HRESULT CLUI::CreateCLC() else CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0); if (bOldUseGroups != (BYTE)-1) - CallService(MS_CLIST_SETUSEGROUPS ,(WPARAM)bOldUseGroups, 0); + CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)bOldUseGroups, 0); else - CallService(MS_CLIST_SETUSEGROUPS ,(WPARAM)bOldUseGroups, 0); + CallService(MS_CLIST_SETUSEGROUPS, 0, 0); } nLastRequiredHeight = 0; mutex_bDisableAutoUpdate = 0; @@ -1537,15 +1537,6 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) } return 0; } - if (g_CluiData.bCurrentAlpha == GoalAlpha && 0) - { - if (mutex_bAnimationInProgress) - { - KillTimer(hwnd,TM_SMOTHALPHATRANSITION); - mutex_bAnimationInProgress = 0; - } - return 0; - } if (mutex_bShowHideCalledFromAnimation) return 0; @@ -2160,7 +2151,6 @@ LRESULT CLUI::OnAutoAlphaTimer(UINT msg, WPARAM wParam, LPARAM lParam) POINT pt = UNPACK_POINT(GetMessagePos()); HWND hwndPt = WindowFromPoint(pt); - inwnd = FALSE; inwnd = CLUI_CheckOwnedByClui(hwndPt); if ( ! inwnd ) inwnd = ( GetCapture() == pcli->hwndContactList ); @@ -2262,11 +2252,10 @@ LRESULT CLUI::OnTimer(UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CLUI::OnActivate(UINT msg, WPARAM wParam, LPARAM lParam) { - BOOL IsOption = FALSE; SetCursor(LoadCursor(NULL, IDC_ARROW)); SendMessage(pcli->hwndContactTree, WM_ACTIVATE, wParam, lParam); if ( db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT)) { - if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && GetParent((HWND)lParam) != m_hWnd && !IsOption) + if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && GetParent((HWND)lParam) != m_hWnd) { if ( !g_bCalledFromShowHide) CLUI_UpdateTimer(0); } @@ -2279,7 +2268,7 @@ LRESULT CLUI::OnActivate(UINT msg, WPARAM wParam, LPARAM lParam) return 0; } - if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && !CLUI_CheckOwnedByClui((HWND)lParam) && !IsOption) { + if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && !CLUI_CheckOwnedByClui((HWND)lParam)) { if (g_bTransparentFlag && bTransparentFocus) CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA,250, NULL); } @@ -2295,13 +2284,12 @@ LRESULT CLUI::OnActivate(UINT msg, WPARAM wParam, LPARAM lParam) RedrawWindow(m_hWnd,NULL,NULL,RDW_INVALIDATE|RDW_ALLCHILDREN); if (g_bTransparentFlag) { BYTE alpha; - if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam) || IsOption || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) + if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam) || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) alpha = db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT); else alpha = g_bTransparentFlag ? db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT) : 255; CLUI_SmoothAlphaTransition(m_hWnd, alpha, 1); - if (IsOption) DefWindowProc(m_hWnd,msg,wParam,lParam); - else return 1; + return 1; } return DefWindowProc(m_hWnd,msg,wParam,lParam); } @@ -2672,7 +2660,7 @@ LRESULT CLUI::OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam) CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 3, dis->itemState); mir_snprintf(buf,SIZEOF(buf),"Main,ID=MainMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); - DrawState(dis->hDC,NULL,NULL,(LPARAM)hIcon, 0, (dis->rcItem.right+dis->rcItem.left-GetSystemMetrics(SM_CXSMICON))/2+dx,(dis->rcItem.bottom+dis->rcItem.top-GetSystemMetrics(SM_CYSMICON))/2+dx, 0, 0, DST_ICON|(dis->itemState&ODS_INACTIVE && FALSE?DSS_DISABLED:DSS_NORMAL)); + DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2 + dx, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + dx, 0, 0, DST_ICON); Skin_ReleaseIcon(hIcon); nMirMenuState = dis->itemState; } diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index bce3cc73a3..24ac15f196 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -188,8 +188,6 @@ int CLUIFrames_ActivateSubContainers( BOOL active) for (i=0;i < g_nFramesCount;i++) if (active && !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide ) { - HWND hwnd = g_pfwFrames[i].OwnerWindow; - hwnd = g_pfwFrames[i].hWnd;//OwnerWindow; if ( db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT)) { SetWindowPos(g_pfwFrames[i].OwnerWindow,HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); @@ -2201,7 +2199,6 @@ static int CLUIFramesResizeFrames(const RECT newsize) g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT); GapBetweenFrames = db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT); - sepw = GapBetweenFrames; if (g_nFramesCount < 1) return 0; newheight = newsize.bottom-newsize.top; diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index 616c7af1c1..24ed62d9f9 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -231,18 +231,6 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam) case WM_MOVE: { - - if (g_CluiData.fDocked && 0) { - RECT rc, rcMonitor; - Docking_GetMonitorRectFromWindow(msg->hwnd,&rcMonitor); - GetWindowRect(msg->hwnd,&rc); - Docking_AdjustPosition(msg->hwnd,&rcMonitor,&rc); - MoveWindow(msg->hwnd,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,TRUE); - Sync(CLUIFrames_OnMoving,msg->hwnd,&rc); - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);// -= -= -= - - return 1; - } ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_ALT_DRAW, NULL); return 0; } diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp index a83ef4ffae..058b48f2e8 100644 --- a/plugins/Clist_modern/src/modern_row.cpp +++ b/plugins/Clist_modern/src/modern_row.cpp @@ -668,33 +668,7 @@ void rowPositioning(pROWCELL cell, int &dist) w -= size; if (curchild->sizing) { - if ((0&!curchild->fitwidth) || r>1) //пока отключено -проблемы с выравниванием - { - if (curchild->hasfixed) - fixedsized -= curchild->fixed_width; - switch (cell->halign) - { - case TC_RIGHT: - size = (w-fixedsized)-(autosized-max(curchild->full_width,curchild->w)); - break; - case TC_LEFT: - size = min(w-fixedsized,max(curchild->full_width,curchild->w)); - break; - case TC_HCENTER: - if (autosized) {size = max(curchild->full_width,curchild->w)*w/autosized; break;} - default: - size = w / r; - } - autosized -= (max(curchild->full_width,curchild->w)); - if (autosized < 0) autosized = 0; - if (size < 0) size = 0; - } - else size = w; - /* пока отключено ибо параметр влияет на выравнивание включается по левому краю - if (0 && !curchild->fitwidth) - if (size>max(curchild->full_width,curchild->w)) - size = max(curchild->full_width,curchild->w); - */ + size = w; r--; } else diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index b8d4940024..c8e4e54783 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -229,7 +229,6 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i contact->type == CLCIT_CONTACT && (hasAvatar || (dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1))) { - SIZE sz = {0}; int iW = 0, iH = 0; if (dat->use_avatar_service) { if (contact->avatar_data) { @@ -241,7 +240,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i iW = dat->avatar_cache.nodes[contact->avatar_pos].width; iH = dat->avatar_cache.nodes[contact->avatar_pos].height; } - sz = GetAvatarSize(iW,iH,dat->avatars_maxwidth_size,dat->avatars_maxheight_size); + SIZE sz = GetAvatarSize(iW,iH,dat->avatars_maxwidth_size,dat->avatars_maxheight_size); if ((sz.cx == 0 || sz.cy == 0) && dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1) sz.cx = ICON_HEIGHT, sz.cy = ICON_HEIGHT; diff --git a/plugins/Clist_modern/src/modern_skineditor.cpp b/plugins/Clist_modern/src/modern_skineditor.cpp index 76ae48cb3f..14d81f762d 100644 --- a/plugins/Clist_modern/src/modern_skineditor.cpp +++ b/plugins/Clist_modern/src/modern_skineditor.cpp @@ -244,13 +244,10 @@ void SetControls(HWND hwndDlg, TCHAR *str) { case 1: { - int r,g,b,a; - r = g = b = 200; - a = 255; - r = _ttoi(GetParamN(str,buf,SIZEOF(buf),2,',',TRUE)); - g = _ttoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); - b = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); - a = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); + int r = _ttoi(GetParamN(str,buf,SIZEOF(buf),2,',',TRUE)); + int g = _ttoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); + int b = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); + int a = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_COLOR,CPM_SETCOLOUR, 0, (LPARAM)RGB(r,g,b)); SendDlgItemMessage(hwndDlg,IDC_COLOR,CPM_SETDEFAULTCOLOUR, 0, (LPARAM)RGB(r,g,b)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS, 0, MAKELONG(a,0)); @@ -258,17 +255,13 @@ void SetControls(HWND hwndDlg, TCHAR *str) break; case 2: { - int a; - int l,t,r,b; int fitmode = 0; - l = t = r = b = 0; - a = 255; - l = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); - t = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); - r = _ttoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); - b = _ttoi(GetParamN(str,buf,SIZEOF(buf),7,',',TRUE)); - a = _ttoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); + int l = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); + int t = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); + int r = _ttoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); + int b = _ttoi(GetParamN(str,buf,SIZEOF(buf),7,',',TRUE)); + int a = _ttoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS, 0, MAKELONG(a,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_LEFT,UDM_SETPOS, 0, MAKELONG(l,0)); @@ -290,24 +283,18 @@ void SetControls(HWND hwndDlg, TCHAR *str) break; case 3: { - int a; - int l,t,r,b; - int x,y,w,h; int fitmode = 0; - l = t = r = b = 0; - x = y = w = h = 0; - a = 255; - x = _ttoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); - y = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); - w = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); - h = _ttoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); - - l = _ttoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); - t = _ttoi(GetParamN(str,buf,SIZEOF(buf),9,',',TRUE)); - r = _ttoi(GetParamN(str,buf,SIZEOF(buf),10, ',',TRUE)); - b = _ttoi(GetParamN(str,buf,SIZEOF(buf),11,',',TRUE)); - a = _ttoi(GetParamN(str,buf,SIZEOF(buf),12,',',TRUE)); + int x = _ttoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); + int y = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); + int w = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); + int h = _ttoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); + + int l = _ttoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); + int t = _ttoi(GetParamN(str,buf,SIZEOF(buf),9,',',TRUE)); + int r = _ttoi(GetParamN(str,buf,SIZEOF(buf),10, ',',TRUE)); + int b = _ttoi(GetParamN(str,buf,SIZEOF(buf),11,',',TRUE)); + int a = _ttoi(GetParamN(str,buf,SIZEOF(buf),12,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS, 0, MAKELONG(a,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_LEFT,UDM_SETPOS, 0, MAKELONG(l,0)); @@ -631,7 +618,6 @@ INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (HIWORD(wParam) == BN_CLICKED) { TCHAR str[MAX_PATH] = {0}; OPENFILENAME ofn = {0}; - TCHAR filter[512] = {0}; int res = 0; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index cfe4f3e1a5..cba4682996 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -212,7 +212,7 @@ int IniParser::GetSkinFolder( IN const TCHAR * szFileName, OUT TCHAR * pszFolder *b3 = _T('\0'); GetPrivateProfileString(_T("Skin_Description_Section"),_T("SkinFolder"),_T(""),cus,SIZEOF(custom_folder),szFileName); - if ( cus && _tcslen(cus)>0) + if (cus[0] != 0) mir_sntprintf(pszFolderName, MAX_PATH, _T("%s\\%s"), custom_folder, cus); mir_free(szBuff); @@ -1662,7 +1662,7 @@ void ske_PreMultiplyChanells(HBITMAP hbmp,BYTE Mult) return; } -int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder,BOOL madeAbsolute) +int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder, BOOL madeAbsolute) { TCHAR *SkinPlace = db_get_tsa(NULL,SKIN,"SkinFolder"); if (SkinPlace == NULL) @@ -1680,7 +1680,7 @@ int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder,BOOL ma else PathToAbsoluteT(b2, buf); } - else _tcsncpy(buf, b2, SIZEOF(buf)); + else _tcsncpy(buf, b2, MAX_PATH); mir_free(SkinPlace); return 0; @@ -1877,7 +1877,7 @@ static HBITMAP ske_LoadGlyphImage_Png2Dib(const TCHAR *tszFilename) } else { BYTE *ptPixels = pt; - HBITMAP hBitmap = CreateDIBSection(NULL,bi, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); + hBitmap = CreateDIBSection(NULL,bi, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); memcpy(ptPixels,pt,bi->bmiHeader.biSizeImage); } GlobalFree( pDib ); @@ -2478,9 +2478,6 @@ static BOOL ske_DrawTextEffect(BYTE* destPt,BYTE* maskPt, DWORD width, DWORD hei rl = GetRValue(effect->EffectColor1); gl = GetGValue(effect->EffectColor1); bl = GetBValue(effect->EffectColor1); - rd = GetRValue(effect->EffectColor2); - gd = GetGValue(effect->EffectColor2); - bd = GetBValue(effect->EffectColor2); ad = 255-((BYTE)(effect->EffectColor2>>24)); rd = GetRValue(effect->EffectColor2); gd = GetGValue(effect->EffectColor2); @@ -2534,9 +2531,8 @@ static BOOL ske_DrawTextEffect(BYTE* destPt,BYTE* maskPt, DWORD width, DWORD hei for (matrixHor = mcLeftStart; matrixHor < mcRightEnd;matrixHor++) { - int a = as; buflineTop = buflineTopS; - a = x+matrixHor-2; + int a = x+matrixHor-2; if (buflineTop && a >= 0 && (DWORD)a < width) buflineTop += matrixHor-2; else buflineTop = NULL; if (buflineTop) @@ -3079,21 +3075,6 @@ BOOL ske_DrawIconEx(HDC hdcDst,int xLeft,int yTop,HICON hIcon,int cxWidth,int cy SelectObject(tempDC1,otBmp); DeleteDC(tempDC1); } - /* - if (imbt.bmBitsPixel != 32) - { - HDC tempDC1; - HBITMAP otBmp; - no32bit = TRUE; - tempDC1 = ske_RequestBufferDC(hdcDst,BUFFER_DRAWICON,imbt.bmWidth,imbt.bmHeight); - if (tempDC1) - { - DrawIconEx(tempDC1, 0, 0, hIcon,imbt.bmWidth,imbt.bmHeight,istepIfAniCur,hbrFlickerFreeDraw,DI_IMAGE); - noMirrorMask = TRUE; - ske_ReleaseBufferDC(tempDC1,2000); //keep buffer for 2 seconds - } - } - */ if (imbt.bmBits == NULL) { NoDIBImage = TRUE; diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 7fb29421e3..aa5a246e9c 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -208,7 +208,6 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara { //TODO:Draw hPreviewBitmap here int mWidth, mHeight; - RECT workRect = {0}; HBRUSH hbr = CreateSolidBrush( GetSysColor( COLOR_3DFACE )); DRAWITEMSTRUCT *dis = ( DRAWITEMSTRUCT * )lParam; mWidth = dis->rcItem.right-dis->rcItem.left; @@ -216,7 +215,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara HDC memDC = CreateCompatibleDC( dis->hDC ); HBITMAP hbmp = ske_CreateDIB32( mWidth, mHeight ); HBITMAP holdbmp = ( HBITMAP )SelectObject( memDC, hbmp ); - workRect = dis->rcItem; + RECT workRect = dis->rcItem; OffsetRect( &workRect, -workRect.left, -workRect.top ); FillRect( memDC, &workRect, hbr ); DeleteObject( hbr ); @@ -540,12 +539,9 @@ INT_PTR SvcApplySkin(WPARAM wParam, LPARAM lParam) INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam) { DRAWITEMSTRUCT *dis = ( DRAWITEMSTRUCT * )wParam; - - int mWidth, mHeight; - RECT workRect = {0}; - mWidth = dis->rcItem.right-dis->rcItem.left; - mHeight = dis->rcItem.bottom-dis->rcItem.top; - workRect = dis->rcItem; + int mWidth = dis->rcItem.right-dis->rcItem.left; + int mHeight = dis->rcItem.bottom-dis->rcItem.top; + RECT workRect = dis->rcItem; OffsetRect( &workRect, -workRect.left, -workRect.top ); if (lParam) { diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 6b8a71e8c4..eb1221ccf1 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -166,16 +166,17 @@ int ClearMaskList(LISTMODERNMASK * mmTemplateList) mmTemplateList->dwMaskCnt = 0; return 0; } -int DeleteMaskByItID(DWORD mID,LISTMODERNMASK * mmTemplateList) + +int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList) { if ( !mmTemplateList) return -1; - if (mID < 0 || mID >= mmTemplateList->dwMaskCnt) return -1; + if (mID >= mmTemplateList->dwMaskCnt) return -1; if (mmTemplateList->dwMaskCnt == 1) { SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[0])); mir_free_and_nil(mmTemplateList->pl_Masks); mmTemplateList->pl_Masks = NULL; - mmTemplateList->dwMaskCnt; + mmTemplateList->dwMaskCnt--; } else { @@ -200,8 +201,8 @@ int DeleteMaskByItID(DWORD mID,LISTMODERNMASK * mmTemplateList) int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK * mmTemplateList) { if ( !mmTemplateList) return 0; - if (mID1 < 0 || mID1 >= mmTemplateList->dwMaskCnt) return 0; - if (mID2 < 0 || mID2 >= mmTemplateList->dwMaskCnt) return 0; + if (mID1 >= mmTemplateList->dwMaskCnt) return 0; + if (mID2 >= mmTemplateList->dwMaskCnt) return 0; if (mID1 == mID2) return 0; { MODERNMASK mm; @@ -211,6 +212,7 @@ int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK * mmTemplateList) } return 1; } + int SortMaskList(LISTMODERNMASK * mmList) { DWORD pos = 1; @@ -394,13 +396,12 @@ int ParseToModernMask(MODERNMASK *mm, char * szText) return 0; }; -BOOL CompareModernMask(MODERNMASK *mmValue,MODERNMASK *mmTemplate) +BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate) { //TODO BOOL res = TRUE; - BOOL exit = FALSE; BYTE pVal = 0, pTemp = 0; - while (pTemp < mmTemplate->dwParamCnt && pVal < mmValue->dwParamCnt && !exit) + while (pTemp < mmTemplate->dwParamCnt && pVal < mmValue->dwParamCnt) { // find pTemp parameter in mValue DWORD vh, ph; diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 95609a3105..c0aa02a0d9 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -455,7 +455,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) } if (hIcon == NULL && (hxIcon == NULL || ((p.xStatusMode & 3) == 3))) { - if (hIcon == NULL && (p.connectingIcon == 1) && p.ProtoStatus >= ID_STATUS_CONNECTING && p.ProtoStatus <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) { + if ((p.connectingIcon == 1) && p.ProtoStatus >= ID_STATUS_CONNECTING && p.ProtoStatus <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) { hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)p.AccountName,0); if (hIcon) NeedDestroy = TRUE; diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp index 3fce815114..729814fc7d 100644 --- a/plugins/Clist_modern/src/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp @@ -475,7 +475,6 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l db_set_b(NULL, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO)); for (int i=0; i < count; i++) { - HWND hwndComboBox = GetDlgItem( hwndDlg, IDC_STATUSBAR_PROTO_LIST ); StatusBarProtocolOptions sbpo = dat[i]; char *defProto = sbpo.szName; diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index f2f8a77b0c..f2374775e2 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -403,8 +403,8 @@ void SaveState() item.cchTextMax = 255; item.iItem = i; SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item); - strncat(newProtoFilter, szTemp, 2048); - strncat(newProtoFilter, "|", 2048); + strncat(newProtoFilter, szTemp, SIZEOF(newProtoFilter)); + strncat(newProtoFilter, "|", SIZEOF(newProtoFilter)); newProtoFilter[2047] = 0; } } @@ -424,8 +424,8 @@ void SaveState() item.cchTextMax = 255; item.iItem = i; SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item); - _tcsncat(newGroupFilter, szTemp, 2048); - _tcsncat(newGroupFilter, _T("|"), 2048); + _tcsncat(newGroupFilter, szTemp, SIZEOF(newGroupFilter)); + _tcsncat(newGroupFilter, _T("|"), SIZEOF(newGroupFilter)); newGroupFilter[2047] = 0; } } @@ -820,7 +820,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_NEWVIEMODE, szBuf, 256); szBuf[255] = 0; - if (lstrlen(szBuf) > 0) { + if (szBuf[0] != 0) { char *szUTF8Buf = mir_utf8encodeT(szBuf); if (db_get_dw(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1) diff --git a/plugins/Clist_modern/src/modern_xptheme.cpp b/plugins/Clist_modern/src/modern_xptheme.cpp index 89cc699c56..c4d54d0e1a 100644 --- a/plugins/Clist_modern/src/modern_xptheme.cpp +++ b/plugins/Clist_modern/src/modern_xptheme.cpp @@ -153,9 +153,10 @@ HRESULT xpt_DrawTheme(XPTHANDLE xptHandle, HWND hwnd, HDC hdc, int type, int sta xptlock(); if (xpt_IsThemed(xptHandle)) { - if (IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state)) - res = DrawThemeParentBackground(hwnd,hdc,sizeRect); + if (IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state)) { + DrawThemeParentBackground(hwnd,hdc,sizeRect); res = DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect); + } } xptunlock(); return res; -- cgit v1.2.3