diff options
48 files changed, 129 insertions, 247 deletions
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 75bd6d6ddb..4edddb051e 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -420,7 +420,7 @@ void CSWindow::toggleFilter() {
TCHAR filterText[255];
GetDlgItemText(m_handle, IDC_FILTER_FIELD, filterText, SIZEOF(filterText));
- if ( lstrlen( filterText ) > 0 )
+ if (filterText[0] != 0)
SetDlgItemText( m_handle, IDC_FILTER_FIELD, TEXT( ""));
}
}
@@ -635,9 +635,7 @@ void CSListView::addItem( StatusItem* item, int itemNumber ) lvi.cchTextMax = 256;
lvi.iItem = ListView_GetItemCount( m_handle );
lvi.lParam = itemNumber;
-#if ( WINVER >= 0x501 )
- lvi.iGroupId = ( item->m_bFavourite == TRUE ) ? 0 : 1;
-#endif
+ lvi.iGroupId = item->m_bFavourite ? 0 : 1;
// first column
lvi.iSubItem = 0;
diff --git a/plugins/CSList/src/cslist.h b/plugins/CSList/src/cslist.h index 1a816acc69..b359367fcf 100644 --- a/plugins/CSList/src/cslist.h +++ b/plugins/CSList/src/cslist.h @@ -257,10 +257,10 @@ public: return position;
}
- int remove( const unsigned int item )
+ int remove(const unsigned int item)
{
int position = 0;
- if ( item < 0 || item >= m_count )
+ if (item >= m_count)
return -1;
ListItem< T >* help = m_items;
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index ec2016e1c2..284b5c2d15 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -351,7 +351,7 @@ public: ~HashStringKeyNoCase()
{
- if (_strKey) free (_strKey);
+ free(_strKey);
_strKey = NULL;
_dwKey=0;
}
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 093f0852e6..02690cff9d 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -250,7 +250,7 @@ int AniAva_UnloadModule() for (i=0; i < s_AniAvatarList.getCount(); i++) {
ANIAVA_INFO *aai = s_AniAvatarList[i];
mir_free(aai->tcsFilename);
- if (aai->pFrameDelays) free(aai->pFrameDelays);
+ free(aai->pFrameDelays);
mir_free(aai);
}
s_AniAvatarList.destroy();
@@ -529,7 +529,7 @@ static void _AniAva_RealRemoveAvatar(DWORD UniqueID) _AniAva_PausePainting();
mir_free(aai->tcsFilename);
- if (aai->pFrameDelays) free(aai->pFrameDelays);
+ free(aai->pFrameDelays);
_AniAva_ReduceAvatarImages(aai->nStripTop,aai->FrameSize.cx*aai->nFrameCount, FALSE);
for (int k = 0; k < s_AniAvatarList.getCount(); k++)
if (k != j) {
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 18b29d54df..6a36c8978a 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -2025,8 +2025,7 @@ void CLCPaint::_DrawLines( HWND hWnd, ClcData *dat, HDC hdc, int paintMode, RECT _PaintRowItems( hWnd, pc.hdcMem, dat, Drawing, row_rc, free_row_rc, left_pos, right_pos, selected, hottrack, rcPaint );
if ( mpRequest && !dat->force_in_dialog )
{
- if ( mpRequest->pl_Params[1].szValue )
- free( mpRequest->pl_Params[1].szValue );
+ free(mpRequest->pl_Params[1].szValue);
mpRequest->pl_Params[1].szValue = strdupn("Ovl", 3 );
mpRequest->pl_Params[1].dwValueHash = mod_CalcHash("Ovl");
{
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index a4b940bbbe..354a9ce843 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -188,8 +188,7 @@ int LoadFavoriteContactMenu() int UnloadFavoriteContactMenu()
{
- if (hFavoriteContactMenuItems)
- free (hFavoriteContactMenuItems);
+ free(hFavoriteContactMenuItems);
hFavoriteContactMenuItems = NULL;
if (hFavoriteContactMenu)
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index c8ad998e2c..fd2e204e89 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -378,7 +378,7 @@ int cliShowHide(WPARAM wParam,LPARAM lParam) return 0;
}
- if ((bShow == TRUE || lParam == 1)) {
+ if (bShow || lParam == 1) {
Sync( CLUIFrames_ActivateSubContainers, TRUE );
CLUI_ShowWindowMod(pcli->hwndContactList, SW_RESTORE);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index da0679328b..0081ff777d 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -2110,7 +2110,7 @@ LRESULT CLUI::OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam) for (int i=0; i < 64; i++) {
pt = &CycleStartTick[i];
- if (pt->szProto != NULL && pt->bTimerCreated == 1) {
+ if (pt->szProto != NULL && pt->bTimerCreated) {
if (pt->bGlobal)
status = g_bMultiConnectionMode?ID_STATUS_CONNECTING:0;
else
@@ -2434,7 +2434,7 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ) static RECT rcWindow,rcTree,rcTree2,rcWorkArea,rcOld;
int maxHeight, minHeight,newHeight;
int winstyle;
- if (mutex_bDisableAutoUpdate == 1)
+ if (mutex_bDisableAutoUpdate)
return FALSE;
if (mutex_bDuringSizing)
rcWindow = rcSizingRect;
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index 24ac15f196..cf71f9ad53 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -1479,8 +1479,7 @@ static int _us_DoMoveFrame(WPARAM wParam,LPARAM lParam) }
}
- if (sd != NULL)
- free(sd);
+ free(sd);
CLUIFramesStoreFrameSettings(pos);
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0);
}
@@ -3224,7 +3223,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam //return 0;
};
- if (wParam&MK_LBUTTON) {
+ if (wParam&MK_RBUTTON) {
int newh = -1,prevold;
if (GetCapture() != hwnd){break;};
@@ -4029,7 +4028,7 @@ int UnLoadCLUIFramesModule(void) mir_free_and_nil(g_pfwFrames[i].TitleBar.sztooltip);
}
- if (g_pfwFrames) free(g_pfwFrames);
+ free(g_pfwFrames);
g_pfwFrames = NULL;
g_nFramesCount = 0;
UnregisterClass(CLUIFrameTitleBarClassName,g_hInst);
diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index eb1221ccf1..759b1a5193 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -56,8 +56,8 @@ int SkinSelector_DeleteMask(MODERNMASK *mm) if ( !mm->pl_Params) return 0;
for (i=0;i < (int)mm->dwParamCnt;i++)
{
- if (mm->pl_Params[i].szName) free(mm->pl_Params[i].szName);
- if (mm->pl_Params[i].szValue) free(mm->pl_Params[i].szValue);
+ free(mm->pl_Params[i].szName);
+ free(mm->pl_Params[i].szValue);
}
free(mm->pl_Params);
return 1;
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index 577218a782..5374b67ae1 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -609,9 +609,6 @@ int CLUIFramesStoreAllFrames() // Get client frame
int CLUIFramesGetalClientFrame(void)
{
- if (alclientFrame != -1)
- return alclientFrame;
-
if (alclientFrame != -1) {
/* this value could become invalid if RemoveItemFromList was called,
* so we double-check */
@@ -1209,8 +1206,7 @@ INT_PTR CLUIFramesMoveUpDown(WPARAM wParam,LPARAM lParam) }
}
- if (sd != NULL)
- free(sd);
+ free(sd);
CLUIFramesStoreFrameSettings(pos);
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0);
}
@@ -1515,7 +1511,6 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam,LPARAM lParam) Frames[nFramescount].hWnd = clfrm->hWnd;
Frames[nFramescount].height = clfrm->height;
Frames[nFramescount].TitleBar.hicon = clfrm->hIcon;
- Frames[nFramescount].TitleBar.BackColour;
Frames[nFramescount].floating = FALSE;
//override tbbtip
@@ -1742,7 +1737,6 @@ int CLUIFramesResize(const RECT newsize) GapBetweenFrames = db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",1);
TitleBarH = db_get_dw(NULL,"CLUIFrames","TitleBarH",DEFAULT_TITLEBAR_HEIGHT);
- sepw = GapBetweenFrames;
if (nFramescount < 1)
return 0;
@@ -1873,11 +1867,10 @@ INT_PTR CLUIFramesUpdateFrame(WPARAM wParam,LPARAM lParam) if (wParam == -1) { CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); return 0;}
if (lParam&FU_FMPOS) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,1);
lockfrm();
- wParam = id2pos(wParam);
- if (wParam<0||(int)wParam>=nFramescount) { ulockfrm(); return -1;}
- if (lParam&FU_TBREDRAW) CLUIFramesForceUpdateTB(&Frames[wParam]);
- if (lParam&FU_FMREDRAW) CLUIFramesForceUpdateFrame(&Frames[wParam]);
- //if () {}
+ int pos = id2pos(wParam);
+ if (pos < 0 || pos >= nFramescount) { ulockfrm(); return -1;}
+ if (lParam & FU_TBREDRAW) CLUIFramesForceUpdateTB(&Frames[pos]);
+ if (lParam & FU_FMREDRAW) CLUIFramesForceUpdateFrame(&Frames[pos]);
ulockfrm();
return 0;
@@ -2412,7 +2405,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){break;}
@@ -2933,8 +2926,7 @@ int UnLoadCLUIFramesModule(void) mir_free(Frames[i].TitleBar.tooltip);
}
- if (Frames)
- free(Frames);
+ free(Frames);
Frames = NULL;
nFramescount = 0;
UnregisterClass(CLUIFrameTitleBarClassName,g_hInst);
diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index 1b03281334..2b82d539b4 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -221,7 +221,7 @@ void DrawBackGround(HWND hwnd,HDC mhdc) ds.hDC = hdcMem;
int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
- int extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
+ extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
int nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
RECT rc = { 0 }, clrc;
diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index 26924d1f8c..96e34af520 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -229,7 +229,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L }
}
db_free(&dbv);
- if (_tcslen(contact->szStatusMsg)>0) {
+ if (contact->szStatusMsg[0] != 0) {
contact->flags |= CONTACTF_STATUSMSG;
dat->needsResort = TRUE;
}
diff --git a/plugins/Clist_mw/src/clcidents.cpp b/plugins/Clist_mw/src/clcidents.cpp index 52efd81c30..45987be54f 100644 --- a/plugins/Clist_mw/src/clcidents.cpp +++ b/plugins/Clist_mw/src/clcidents.cpp @@ -160,7 +160,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont void *z = {0};
int ret;
ret = FindItem(hwnd,dat,hItem,(struct ClcContact ** )&z,(struct ClcGroup** )&isv,NULL);
- if (ret = 0) {return 0;}
+ if (ret == 0) {return 0;}
cacheEntry->ClcContact = (void *)z;
}
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 12b8e2304f..ac35462c4b 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -172,7 +172,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group }
}
db_free(&dbv);
- if (_tcslen(group->cl.items[i]->szStatusMsg)>0) {
+ if (group->cl.items[i]->szStatusMsg[0] != 0) {
group->cl.items[i]->flags |= CONTACTF_STATUSMSG;
}
}
diff --git a/plugins/Clist_mw/src/clcpaint.cpp b/plugins/Clist_mw/src/clcpaint.cpp index b08e989b06..f6bd3e34c4 100644 --- a/plugins/Clist_mw/src/clcpaint.cpp +++ b/plugins/Clist_mw/src/clcpaint.cpp @@ -154,7 +154,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) RECT testrc;
// yes I know about GetSysColorBrush()
- COLORREF tmpbkcolour = style&CLS_CONTACTLIST ? ( /*dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) :*/ dat->bkColour ) : dat->bkColour;
+ COLORREF tmpbkcolour = dat->bkColour;
if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(status) || style&WS_DISABLED) grey = 1;
else if (GetFocus() != hwnd && dat->greyoutFlags&GREYF_UNFOCUS) grey = 1;
@@ -373,7 +373,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) SetHotTrackColour(hdcMem,dat);
//checkboxes
- if (checkboxWidth && (subindex == -1 ||1)) {
+ if (checkboxWidth) {
RECT rc;
HANDLE hTheme = OpenThemeData(hwnd,L"BUTTON");
@@ -473,7 +473,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) rc.top = y+((dat->rowHeight-fontHeight)>>1);
rc.bottom = rc.top+dat->rowHeight;
rc.right = clRect.right;
- if (Drawing->type = CLCIT_CONTACT)
+ if (Drawing->type == CLCIT_CONTACT)
if (hottrack)
ChangeToFont(hdcMem,dat,FONTID_CONTACTSHOVER,&fontHeight);
diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index d04b463c6e..c8c22f6cc8 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -183,7 +183,7 @@ HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean r sid.pszSection = SectName;
sid.pszName = IconName;
sid.pszDescription = Description;
- if (strlen(szMyPath) != 0)
+ if (szMyPath[0] != 0)
sid.pszDefaultFile = szMyPath;
sid.iDefaultIndex = internalidx;
diff --git a/plugins/Clist_mw/src/init.cpp b/plugins/Clist_mw/src/init.cpp index be7d95d862..220ed4be88 100644 --- a/plugins/Clist_mw/src/init.cpp +++ b/plugins/Clist_mw/src/init.cpp @@ -124,7 +124,7 @@ INT_PTR SetDrawer(WPARAM wParam,LPARAM lParam) pDrawerServiceStruct DSS = (pDrawerServiceStruct)wParam;
if (DSS->cbSize != sizeof(*DSS)) return -1;
if (DSS->PluginName == NULL) return -1;
- if (DSS->PluginName == NULL) return -1;
+ if (DSS->GetDrawFuncsServiceName == NULL) return -1;
if ( !ServiceExists(DSS->GetDrawFuncsServiceName)) return -1;
diff --git a/plugins/Clist_nicer/skineditor/src/main.cpp b/plugins/Clist_nicer/skineditor/src/main.cpp index 929748d68a..65a3df340c 100644 --- a/plugins/Clist_nicer/skineditor/src/main.cpp +++ b/plugins/Clist_nicer/skineditor/src/main.cpp @@ -424,31 +424,31 @@ static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index) if (ChangedSItems.bALPHA) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_ALPHA), buf, 10); // can be removed now
- if (lstrlenA(buf) > 0)
+ if (buf[0] != 0)
p->ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_LEFT) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_LEFT), buf, 10);
- if (lstrlenA(buf) > 0)
+ if (buf[0] != 0)
p->MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_TOP) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_TOP), buf, 10);
- if (lstrlenA(buf) > 0)
+ if (buf[0] != 0)
p->MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_RIGHT) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT), buf, 10);
- if (lstrlenA(buf) > 0)
+ if (buf[0] != 0)
p->MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_BOTTOM) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM), buf, 10);
- if (lstrlenA(buf) > 0)
+ if (buf[0] != 0)
p->MARGIN_BOTTOM = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bBORDERSTYLE) {
@@ -727,7 +727,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SelectObject(dis->hDC, hPenOld);
DeleteObject((HGDIOBJ)hPen);
}
- else if (dis->itemID >= 0 && item) {
+ else if (item) {
char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName;
TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, lstrlenA(szName));
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<HPEN>(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<HPEN>(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<HPEN>(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<HPEN>(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<HBITMAP>(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;
}
}
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index b0cf21c1ca..b06c70bf4e 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1045,10 +1045,10 @@ void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PRepl reply->code = MIMRES_FAILURE;
mir_snprintf(reply->message, reply->cMessage, Translate("Invalid parameter '%s' passed to CallService command."), (wParam) ? argv[4] : argv[3]);
}
-
- if (wParam) { free(wParam); }
- if (lParam) { free(lParam); }
-
+
+ free(wParam);
+ free(lParam);
+
}
else{
reply->code = MIMRES_FAILURE;
@@ -1330,11 +1330,8 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r reply->code = MIMRES_SUCCESS;
mir_snprintf(reply->message, reply->cMessage, Translate("Wrote '%s:%s' to database entry '%s/%s'."), wrote, argv[5] + 1, module, key);
}
-
- if (value)
- {
- free(value);
- }
+
+ free(value);
}
else{
HandleWrongParametersCount(command, reply);
@@ -1613,7 +1610,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe if (ok)
{
- if (strlen(reply->message) > 0)
+ if (reply->message[0] != 0)
{
strncat(reply->message, "\n", reply->cMessage);
strncat(reply->message, buffer, reply->cMessage);
@@ -1882,7 +1879,7 @@ void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) mir_snprintf(buffer, sizeof(buffer), "[%s] %15s: %s", timestamp, sender, message);
- if (strlen(reply->message) > 0)
+ if (reply->message[0] != 0)
{
strncat(reply->message, "\n", reply->cMessage);
strncat(reply->message, buffer, reply->cMessage);
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index 6f0dba3271..f7f08be649 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -98,7 +98,6 @@ int MyPUShowMessage(char *lpzText, BYTE kind) char *BinToHex(int size, PBYTE data)
{
char *szresult = NULL;
- char buffer[32] = {0}; //should be more than enough
int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[ maxSize ];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
@@ -344,7 +343,7 @@ HANDLE GetContactFromID(TCHAR *szID, char *szProto) if ((szHandle) && ((_tcsicmp(szHandle, szID) == 0) || (_tcsicmp(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0)))
found = 1;
- if (szHandle) free(szHandle);
+ free(szHandle);
if (found) return hContact;
}
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index 2570826157..fbcfbe1bba 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -82,7 +82,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM case ID_OK:
{
TCHAR tmpPort[6];
- if (bOptionsOpen==TRUE)
+ if (bOptionsOpen)
{
MessageBox(hWnd,TranslateT("First close options window"),_T("ConnectionNotify"),MB_OK | MB_ICONSTOP);
break;
diff --git a/plugins/ConnectionNotify/src/pid2name.cpp b/plugins/ConnectionNotify/src/pid2name.cpp index 60dba4d241..76d7b49441 100644 --- a/plugins/ConnectionNotify/src/pid2name.cpp +++ b/plugins/ConnectionNotify/src/pid2name.cpp @@ -2,11 +2,9 @@ void pid2name(DWORD procid, TCHAR *buffer, size_t bufLen)
{
- HANDLE hSnap = INVALID_HANDLE_VALUE;
- HANDLE hProcess = INVALID_HANDLE_VALUE;
PROCESSENTRY32 ProcessStruct;
ProcessStruct.dwSize = sizeof(PROCESSENTRY32);
- hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap == INVALID_HANDLE_VALUE)
return;
if (Process32First(hSnap, &ProcessStruct) == FALSE)
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index d6c4c8816c..c60ea9a5e1 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -207,7 +207,7 @@ void GetOSDisplayString(bkstring& buffer) }
}
- if (_tcslen(osvi.szCSDVersion) > 0) {
+ if (osvi.szCSDVersion[0] != 0) {
buffer.append(TEXT(" "));
buffer.append(osvi.szCSDVersion);
}
diff --git a/plugins/Db3x_mmap/src/dbintfm.cpp b/plugins/Db3x_mmap/src/dbintfm.cpp index 55c4cf52da..352728299f 100644 --- a/plugins/Db3x_mmap/src/dbintfm.cpp +++ b/plugins/Db3x_mmap/src/dbintfm.cpp @@ -33,8 +33,7 @@ CDb3Mmap::CDb3Mmap(const TCHAR* tszFileName) : CDb3Mmap::~CDb3Mmap()
{
- if (m_pNull)
- free(m_pNull);
+ free(m_pNull);
}
DWORD CDb3Mmap::GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc,DWORD ofsContact,DWORD ofsModuleName)
diff --git a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp index 509b837905..0326166d7f 100644 --- a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp @@ -38,7 +38,7 @@ int CDb3Base::WorkModuleChain(int firstTime) cb->pfnAddLogMessage(STATUS_MESSAGE,TranslateT("Processing module name chain"));
modChainCount = 0;
last_mod = 0;
- if (modChain != NULL) free(modChain);
+ free(modChain);
modChain = (ModChainEntry*)malloc(sizeof(ModChainEntry));
phase = 0;
ofsCurrent = m_dbHeader.ofsFirstModuleName;
diff --git a/plugins/Dbx_tree/src/BTree.h b/plugins/Dbx_tree/src/BTree.h index 277f206b2b..f1d44ccd27 100644 --- a/plugins/Dbx_tree/src/BTree.h +++ b/plugins/Dbx_tree/src/BTree.h @@ -186,7 +186,7 @@ CBTree<TKey, SizeParam>::~CBTree() while (i != m_ManagedIterators.end())
{
i->second->m_Tree = NULL;
- i++;
+ ++i;
}
if (m_DestroyTree)
@@ -910,8 +910,7 @@ void CBTree<TKey, SizeParam>::DestroyTree() DeleteNode(node);
}
- if (m_Alloc)
- free(m_Alloc);
+ free(m_Alloc);
m_Alloc = NULL;
m_AllocCount = 0;
m_Count = 0;
diff --git a/plugins/Dbx_tree/src/BlockManager.cpp b/plugins/Dbx_tree/src/BlockManager.cpp index 82fe27e4f2..b6a7d22feb 100644 --- a/plugins/Dbx_tree/src/BlockManager.cpp +++ b/plugins/Dbx_tree/src/BlockManager.cpp @@ -252,8 +252,7 @@ inline void CBlockManager::_PendingRemove(TPendingOperation * Pending, bool Free else
m_PendingTail = Pending->Prev;
- if (Pending->EncryptionBuffer)
- free(Pending->EncryptionBuffer);
+ free(Pending->EncryptionBuffer);
if (m_PendingLast == Pending)
m_PendingLast = Pending->Prev;
@@ -340,8 +339,7 @@ inline void CBlockManager::_PendingFlush(bool FullFlush) i = m_PendingHead;
while (i)
{
- if (i->EncryptionBuffer)
- free(i->EncryptionBuffer);
+ free(i->EncryptionBuffer);
if (i->CacheEntry)
i->CacheEntry->Pending = NULL;
@@ -430,8 +428,7 @@ inline void CBlockManager::_CacheErase(uint32_t Idx) }
*l = i->Next;
- if (i->Cache)
- free(i->Cache);
+ free(i->Cache);
free(i);
}
diff --git a/plugins/Dbx_tree/src/DataBase.cpp b/plugins/Dbx_tree/src/DataBase.cpp index 451ce89a00..683f0b66a8 100644 --- a/plugins/Dbx_tree/src/DataBase.cpp +++ b/plugins/Dbx_tree/src/DataBase.cpp @@ -66,9 +66,9 @@ CDataBase::CDataBase(const TCHAR *FileName) }
CDataBase::~CDataBase()
{
- if (m_Events) delete m_Events;
- if (m_Settings) delete m_Settings;
- if (m_Entities) delete m_Entities;
+ delete m_Events;
+ delete m_Settings;
+ delete m_Entities;
m_Entities = NULL;
m_Settings = NULL;
@@ -76,9 +76,9 @@ CDataBase::~CDataBase() for (int i = DBFileMax - 1; i >= 0; --i)
{
- if (m_BlockManager[i]) delete m_BlockManager[i];
- if (m_FileAccess[i]) delete m_FileAccess[i];
- if (m_EncryptionManager[i]) delete m_EncryptionManager[i];
+ delete m_BlockManager[i];
+ delete m_FileAccess[i];
+ delete m_EncryptionManager[i];
m_BlockManager[i] = NULL;
m_FileAccess[i] = NULL;
diff --git a/plugins/Dbx_tree/src/EncryptionManager.cpp b/plugins/Dbx_tree/src/EncryptionManager.cpp index 7274178ee7..ceaff9a015 100644 --- a/plugins/Dbx_tree/src/EncryptionManager.cpp +++ b/plugins/Dbx_tree/src/EncryptionManager.cpp @@ -93,11 +93,9 @@ CEncryptionManager::CEncryptionManager() }
CEncryptionManager::~CEncryptionManager()
{
- if (m_Ciphers[CURRENT].Cipher)
- delete m_Ciphers[CURRENT].Cipher;
+ delete m_Ciphers[CURRENT].Cipher;
m_Ciphers[CURRENT].Cipher = NULL;
- if (m_Ciphers[OLD].Cipher)
- delete m_Ciphers[OLD].Cipher;
+ delete m_Ciphers[OLD].Cipher;
m_Ciphers[OLD].Cipher = NULL;
CipherListRefCount--;
diff --git a/plugins/Dbx_tree/src/Entities.cpp b/plugins/Dbx_tree/src/Entities.cpp index 74af4d6665..590cf6f85b 100644 --- a/plugins/Dbx_tree/src/Entities.cpp +++ b/plugins/Dbx_tree/src/Entities.cpp @@ -736,7 +736,6 @@ TDBTEntityHandle CEntities::IterationNext(TDBTEntityIterationHandle Iteration) item = iter->q->front();
iter->q->pop_front();
- std::deque<TEntityIterationItem> tmp;
TEntityIterationItem newitem;
// children
@@ -879,7 +878,7 @@ TDBTEntityHandle CEntities::IterationNext(TDBTEntityIterationHandle Iteration) {
if (acci->Handle == acc)
acc = 0;
- acci++;
+ ++acci;
}
if (acc != 0)
{
diff --git a/plugins/Dbx_tree/src/Logger.cpp b/plugins/Dbx_tree/src/Logger.cpp index 7b732b6cfd..79b7bedd72 100644 --- a/plugins/Dbx_tree/src/Logger.cpp +++ b/plugins/Dbx_tree/src/Logger.cpp @@ -119,7 +119,6 @@ void CLogger::MessageBoxAsync(void * MsgBoxParams) {
MSGBOXPARAMS* p = reinterpret_cast<MSGBOXPARAMS*>(MsgBoxParams);
MessageBoxIndirect(p);
- if (p->lpszText)
- delete [] p->lpszText;
+ delete [] p->lpszText;
delete p;
}
\ No newline at end of file diff --git a/plugins/Dbx_tree/src/Settings.cpp b/plugins/Dbx_tree/src/Settings.cpp index c2acd8ddfc..17d8fe635f 100644 --- a/plugins/Dbx_tree/src/Settings.cpp +++ b/plugins/Dbx_tree/src/Settings.cpp @@ -48,8 +48,7 @@ TDBTSettingHandle CSettingsTree::_FindSetting(const uint32_t Hash, const char * }
}
- if (str)
- free(str);
+ free(str);
return res;
}
@@ -119,8 +118,7 @@ CSettings::~CSettings() TModulesMap::iterator it2 = m_Modules.begin();
while (it2 != m_Modules.end())
{
- if (it2->second)
- delete [] it2->second;
+ delete [] it2->second;
++it2;
}
}
@@ -1419,8 +1417,7 @@ unsigned int CSettings::IterationClose(TDBTSettingIterationHandle Iteration) delete iter->Heap; // only this needs synchronization
}
- if (iter->Filter.NameStart)
- delete [] iter->Filter.NameStart;
+ delete [] iter->Filter.NameStart;
if (iter->Filter.Descriptor && iter->Filter.Descriptor->pszSettingName)
{
@@ -1444,8 +1441,7 @@ unsigned int CSettings::IterationClose(TDBTSettingIterationHandle Iteration) while (!iter->Frame->empty())
{
- if (iter->Frame->front().Name)
- free(iter->Frame->front().Name);
+ free(iter->Frame->front().Name);
iter->Frame->pop();
}
diff --git a/plugins/Dbx_tree/src/TLS.h b/plugins/Dbx_tree/src/TLS.h index d309090a34..bc7e1ed2d0 100644 --- a/plugins/Dbx_tree/src/TLS.h +++ b/plugins/Dbx_tree/src/TLS.h @@ -73,8 +73,7 @@ CThreadLocalStorage<TAdministrator, TData>::CThreadLocalStorage() template <typename TAdministrator, typename TData>
CThreadLocalStorage<TAdministrator, TData>::~CThreadLocalStorage()
{
- if (m_LockfreeList)
- delete m_LockfreeList;
+ delete m_LockfreeList;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index a28c94f75f..b3010317c5 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -52,8 +52,7 @@ TAAAProtoSetting::TAAAProtoSetting( PROTOACCOUNT* pa ) TAAAProtoSetting::~TAAAProtoSetting()
{
- if ( szMsg )
- free( szMsg );
+ free(szMsg);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 1954ccb49f..5de614c838 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -176,8 +176,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_DESTROY:
for (int i=0; i < count; i++ ) {
- if (settings[i]->msg != NULL)
- free(settings[i]->msg);
+ free(settings[i]->msg);
free(settings[i]);
}
free(settings);
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index 33271696fb..cc8e608c84 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -38,8 +38,7 @@ struct TConfirmSetting : public PROTOCOLSETTINGEX ~TConfirmSetting()
{
- if ( szMsg )
- free( szMsg );
+ free(szMsg);
}
};
|