From 5e01c907bf4cace9542f880bae418f71c0fd0c07 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 24 Oct 2013 15:21:30 +0000 Subject: more warning fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@6608 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/CLCButton.cpp | 2 +- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 10 +-- plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 6 +- plugins/Clist_nicer/src/Coolsb/coolscroll.cpp | 76 +---------------------- plugins/Clist_nicer/src/alphablend.cpp | 58 +++++++++-------- plugins/Clist_nicer/src/clc.cpp | 6 +- plugins/Clist_nicer/src/clcpaint.cpp | 10 ++- plugins/Clist_nicer/src/clcutils.cpp | 8 ++- plugins/Clist_nicer/src/clui.cpp | 2 - plugins/Clist_nicer/src/extBackg.cpp | 2 +- plugins/Clist_nicer/src/viewmodes.cpp | 8 +-- 11 files changed, 53 insertions(+), 135 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index e706fb7760..a0db5e52e6 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -308,7 +308,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) int ix = (rcClient.right - rcClient.left) / 2 - (g_cxsmIcon / 2); int iy = (rcClient.bottom - rcClient.top) / 2 - (g_cxsmIcon / 2); HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon; - if (lstrlen(ctl->szText) == 0) { + if (ctl->szText[0] == 0) { if (ctl->iIcon) ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); else diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index ed66938009..b0acb8a6e8 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -584,9 +584,6 @@ int CLUIFramesGetalClientFrame(void) if (FramesSysNotStarted) return -1; - if (alclientFrame != -1) - return alclientFrame; - if (alclientFrame != -1) { /* this value could become invalid if RemoveItemFromList was called, * so we double-check */ @@ -2822,7 +2819,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } ulockfrm(); } - if (wParam & MK_LBUTTON) { + if (wParam & MK_RBUTTON) { int newh = -1, prevold; if (GetCapture() != hwnd) @@ -3141,7 +3138,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) lockfrm(); wParam = id2pos((INT_PTR)wParam); - if (wParam >= 0 && (int)wParam < nFramescount) { + if ((int)wParam >= 0 && (int)wParam < nFramescount) { if (Frames[wParam].floating) { SetParent(Frames[wParam].hWnd, pcli->hwndContactList); SetParent(Frames[wParam].TitleBar.hwnd, pcli->hwndContactList); @@ -3370,8 +3367,7 @@ int UnLoadCLUIFramesModule(void) if (Frames[i].TitleBar.tbname != NULL) mir_free(Frames[i].TitleBar.tbname); } - if (Frames) - free(Frames); + free(Frames); Frames = NULL; nFramescount = 0; UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); diff --git a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp index 127d11f173..4fbe772dec 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp @@ -414,7 +414,7 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f if (lpsi->fMask & SIF_PAGE) { UINT t = (UINT)(mysi->nMax - mysi->nMin + 1); - mysi->nPage = min(max(0, lpsi->nPage), t); + mysi->nPage = min(lpsi->nPage, t); } //The nPos member must specify a value between nMin and nMax - max(nPage - 1, 0). @@ -527,7 +527,7 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; - sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); + sbar->fScrollFlags |= fShow ? CSBS_VISIBLE : 0; //bFailed = TRUE; if (fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL); @@ -538,7 +538,7 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; - sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); + sbar->fScrollFlags |= fShow ? CSBS_VISIBLE : 0; //bFailed = TRUE; if (fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_VSCROLL); diff --git a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp index dcafafdd7c..c1547121d9 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp @@ -1412,21 +1412,15 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) { SCROLLBAR *sb; HDC hdc; - HRGN hrgn; RECT winrect, rect; HRGN clip = 0; - BOOL fUpdateAll = ((LONG)wParam == 1); BOOL fCustomDraw = FALSE; LRESULT ret; DWORD dwStyle; GetWindowRect(hwnd, &winrect); - //if entire region needs painting, then make a region to cover the entire window - if (fUpdateAll) - hrgn = (HRGN)wParam; - else - hrgn = (HRGN)wParam; + HRGN hrgn = (HRGN)wParam; //hdc = GetWindowDC(hwnd); hdc = CoolSB_GetDC(hwnd, wParam); @@ -1445,40 +1439,6 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //make the coordinates relative to the window for drawing OffsetRect(&rect, -winrect.left, -winrect.top); -#ifdef INCLUDE_BUTTONS - - //work out the size of any inserted buttons so we can dra them - sb->nButSizeBefore = GetButtonSize(sb, hwnd, SBBP_LEFT); - sb->nButSizeAfter = GetButtonSize(sb, hwnd, SBBP_RIGHT); - - //make sure there is room for the buttons - hbarwidth = rect.right - rect.left; - - //check that we can fit any left/right buttons in the available space - if (sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE)) - { - //adjust the scrollbar rectangle to fit the buttons into - sb->fButVisibleAfter = TRUE; - rect.right -= sb->nButSizeAfter; - leftright |= SBBP_RIGHT; - - //check that there is enough space for the right buttons - if (sb->nButSizeBefore + sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE)) - { - sb->fButVisibleBefore = TRUE; - rect.left += sb->nButSizeBefore; - leftright |= SBBP_LEFT; - } - else - sb->fButVisibleBefore = FALSE; - } - else - sb->fButVisibleAfter = FALSE; - - - DrawHorzButtons(sb, hdc, &rect, leftright); -#endif// INCLUDE_BUTTONS - if (uCurrentScrollbar == SB_HORZ) fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); else @@ -1499,40 +1459,6 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //make the coordinates relative to the window for drawing OffsetRect(&rect, -winrect.left, -winrect.top); -#ifdef INCLUDE_BUTTONS - - //work out the size of any inserted buttons so we can dra them - sb->nButSizeBefore = GetButtonSize(sb, hwnd, SBBP_LEFT); - sb->nButSizeAfter = GetButtonSize(sb, hwnd, SBBP_RIGHT); - - //make sure there is room for the buttons - vbarheight = rect.bottom - rect.top; - - //check that we can fit any left/right buttons in the available space - if (sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE)) - { - //adjust the scrollbar rectangle to fit the buttons into - sb->fButVisibleAfter = TRUE; - rect.bottom -= sb->nButSizeAfter; - updown |= SBBP_BOTTOM; - - //check that there is enough space for the right buttons - if (sb->nButSizeBefore + sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE)) - { - sb->fButVisibleBefore = TRUE; - rect.top += sb->nButSizeBefore; - updown |= SBBP_TOP; - } - else - sb->fButVisibleBefore = FALSE; - } - else - sb->fButVisibleAfter = FALSE; - - - DrawVertButtons(sb, hdc, &rect, updown); -#endif // INCLUDE_BUTTONS - if (uCurrentScrollbar == SB_VERT) fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); else diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index 1b93fbf652..23cf9d76a2 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -47,38 +47,36 @@ DWORD __forceinline argb_from_cola(COLORREF col, UINT32 alpha) void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) { - if (BORDERSTYLE >= 0) { - HPEN hPenOld = 0; - POINT pt; + HPEN hPenOld = 0; + POINT pt; - switch(BORDERSTYLE) { - case BDR_RAISEDOUTER: // raised - MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); - hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DBright)); - LineTo(hdcwnd, rc->left, rc->top); - LineTo(hdcwnd, rc->right, rc->top); - SelectObject(hdcwnd, cfg::dat.hPen3DDark); - MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); - LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); - LineTo(hdcwnd, rc->left - 1, rc->bottom - 1); - break; - case BDR_SUNKENINNER: - MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); - hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DDark)); - LineTo(hdcwnd, rc->left, rc->top); - LineTo(hdcwnd, rc->right, rc->top); - MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); - SelectObject(hdcwnd, cfg::dat.hPen3DBright); - LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); - LineTo(hdcwnd, rc->left, rc->bottom - 1); - break; - default: - DrawEdge(hdcwnd, rc, BORDERSTYLE, BF_RECT | BF_SOFT); - break; - } - if (hPenOld) - SelectObject(hdcwnd, hPenOld); + switch(BORDERSTYLE) { + case BDR_RAISEDOUTER: // raised + MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); + hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DBright)); + LineTo(hdcwnd, rc->left, rc->top); + LineTo(hdcwnd, rc->right, rc->top); + SelectObject(hdcwnd, cfg::dat.hPen3DDark); + MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); + LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); + LineTo(hdcwnd, rc->left - 1, rc->bottom - 1); + break; + case BDR_SUNKENINNER: + MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); + hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DDark)); + LineTo(hdcwnd, rc->left, rc->top); + LineTo(hdcwnd, rc->right, rc->top); + MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); + SelectObject(hdcwnd, cfg::dat.hPen3DBright); + LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); + LineTo(hdcwnd, rc->left, rc->bottom - 1); + break; + default: + DrawEdge(hdcwnd, rc, BORDERSTYLE, BF_RECT | BF_SOFT); + break; } + if (hPenOld) + SelectObject(hdcwnd, hPenOld); } void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *imageItem) { diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 9c764b1048..067b6116ad 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -168,18 +168,18 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, wParam, lParam); } } - else if (wParam == 0 && !__strcmp(cws->szModule, cfg::dat.szMetaName)) { + else if (!__strcmp(cws->szModule, cfg::dat.szMetaName)) { BYTE bMetaEnabled = cfg::getByte(cfg::dat.szMetaName, "Enabled", 1); if (bMetaEnabled != (BYTE)cfg::dat.bMetaEnabled) { cfg::dat.bMetaEnabled = bMetaEnabled; pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); } } - else if (wParam == 0 && !__strcmp(cws->szModule, "Skin")) { + else if (!__strcmp(cws->szModule, "Skin")) { cfg::dat.soundsOff = cfg::getByte(cws->szModule, cws->szSetting, 0) ? 0 : 1; ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff ? BST_UNCHECKED : BST_CHECKED); } - else if (szProto == NULL && wParam == 0) { + else if (szProto == NULL) { if ( !__strcmp(cws->szSetting, "XStatusId")) CluiProtocolStatusChanged(0, cws->szModule); } diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 8be64075d9..64935ee526 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -608,11 +608,11 @@ set_bg_l: rc.bottom = y + rowHeight - ssingleitem->MARGIN_BOTTOM; // draw odd/even contact underlay - if ((scanIndex == 0 || scanIndex % 2 == 0) && !sevencontact_pos->IGNORED) { + if (!sevencontact_pos->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sevencontact_pos->COLOR, sevencontact_pos->ALPHA, sevencontact_pos->COLOR2, sevencontact_pos->COLOR2_TRANSPARENT, sevencontact_pos->GRADIENT, ssingleitem->CORNER, ssingleitem->BORDERSTYLE, sevencontact_pos->imageItem); } - else if (scanIndex % 2 != 0 && !soddcontact_pos->IGNORED) { + else if (!soddcontact_pos->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, ssingleitem->CORNER, ssingleitem->BORDERSTYLE, soddcontact_pos->imageItem); } @@ -632,11 +632,11 @@ set_bg_l: rc.bottom = y + rowHeight - sfirstitem->MARGIN_BOTTOM; // draw odd/even contact underlay - if ((scanIndex == 0 || scanIndex % 2 == 0) && !sevencontact_pos->IGNORED) { + if (!sevencontact_pos->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sevencontact_pos->COLOR, sevencontact_pos->ALPHA, sevencontact_pos->COLOR2, sevencontact_pos->COLOR2_TRANSPARENT, sevencontact_pos->GRADIENT, sfirstitem->CORNER, sevencontact_pos->BORDERSTYLE, sevencontact_pos->imageItem); } - else if (scanIndex % 2 != 0 && !soddcontact_pos->IGNORED) { + else if (!soddcontact_pos->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, sfirstitem->CORNER, soddcontact_pos->BORDERSTYLE, soddcontact_pos->imageItem); } @@ -655,7 +655,6 @@ set_bg_l: rc.top = y + slastitem->MARGIN_TOP; rc.right = clRect->right - slastitem->MARGIN_RIGHT - bg_indent_r; rc.bottom = y + rowHeight - slastitem->MARGIN_BOTTOM; - rc.bottom = y + rowHeight - slastitem->MARGIN_BOTTOM; // draw odd/even contact underlay if ((scanIndex == 0 || scanIndex % 2 == 0) && !sevencontact_pos->IGNORED) { @@ -1240,7 +1239,6 @@ nodisplay: if (type == CLCIT_CONTACT) { rc.left = rcContent.left; rc.top = y + ((rowHeight - fontHeight) >> 1); - rc.right = clRect->right - rightOffset; rc.right = rcContent.right; rc.bottom = rc.top; if (twoRows) diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index d329aa0460..644aa65cdd 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -580,13 +580,15 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) } if (cfg::getByte("CLCExt", "EXBK_FillWallpaper", 0)) { char wpbuf[MAX_PATH]; - if (dat->hBmpBackground) - DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; + if (dat->hBmpBackground) { + DeleteObject(dat->hBmpBackground); + dat->hBmpBackground = NULL; + } SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, wpbuf, 0); // we have a wallpaper string - if (strlen(wpbuf) > 0) { + if (wpbuf[0] != 0) { dat->hBmpBackground = reinterpret_cast(LoadImageA(NULL, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); } cfg::dat.bmpBackground = dat->hBmpBackground; diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 46120e83d1..870b4c5533 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -242,7 +242,6 @@ static int CluiModulesLoaded(WPARAM wParam, LPARAM lParam) static const char *szPrefix = "clist_nicer_plus "; static char *component = "CList Nicer+"; - static char szCurrentVersion[30]; static char *szVersionUrl = "http://download.miranda.or.at/clist_nicer/0.9/versionW.txt"; static char *szUpdateUrl = "http://download.miranda.or.at/clist_nicer/0.9/clist_nicer_plusW.zip"; @@ -682,7 +681,6 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) SelectClipRgn(hdcScroll, rgn); break; case HTSCROLL_THUMB: - uItemID = nmcsbcd->uState == CDIS_HOT ? ID_EXTBKSCROLLTHUMBHOVER : ID_EXTBKSCROLLTHUMB; uItemID = nmcsbcd->uState == CDIS_SELECTED ? ID_EXTBKSCROLLTHUMBPRESSED : ID_EXTBKSCROLLTHUMB; break; default: diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 0da73ccb76..37c3a00a0c 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1411,7 +1411,7 @@ void extbk_import(char *file, HWND hwndDlg) i++; } GetPrivateProfileStringA("Global", "BkBitmap", "", szString, MAX_PATH, file); - if (lstrlenA(szString) > 0) + if (szString[0] != 0) cfg::writeString(NULL, "CLC", "BkBitmap", szString); } diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index c33fbb9b15..06340ca3e3 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -354,8 +354,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; } } @@ -376,8 +376,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; } } -- cgit v1.2.3