summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-07-25 20:15:05 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-07-25 20:15:05 +0000
commit9d32b9cd791fb5f51dad17567152c70a8511a500 (patch)
treefd7aa3250ed409e720f26c341c0a5d736ed8083c /plugins/Clist_nicer
parent125a25c86eed41352d45eb8fb6f994f65700c3ec (diff)
replace sprintf to mir_snprintf (part 6)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5485 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r--plugins/Clist_nicer/src/Include/commonheaders.h4
-rw-r--r--plugins/Clist_nicer/src/clc.cpp4
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp2
-rw-r--r--plugins/Clist_nicer/src/cluiopts.cpp4
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp4
-rw-r--r--plugins/Clist_nicer/src/init.cpp4
-rw-r--r--plugins/Clist_nicer/src/rowheight_funcs.cpp4
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp4
8 files changed, 13 insertions, 17 deletions
diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h
index 7dafdfee0a..b18d89fae1 100644
--- a/plugins/Clist_nicer/src/Include/commonheaders.h
+++ b/plugins/Clist_nicer/src/Include/commonheaders.h
@@ -188,12 +188,8 @@ extern ImageItem *g_glyphItem;
*/
-#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0]))
-
typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight);
-#define safe_sizeof(a) (sizeof((a)) / sizeof((a)[0]))
-
BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem);
void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item);
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 93811cec7d..9c764b1048 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -415,7 +415,7 @@ LBL_Def:
ClcContact *contact;
if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
- lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
+ lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
RTL_DetectAndSet(contact, 0);
@@ -499,7 +499,7 @@ LBL_Def:
contact->proto = GetContactProto((HANDLE)wParam);
CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
- lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
+ lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
RTL_DetectAndSet(contact, 0);
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 0952f744e7..2783641b9e 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -506,7 +506,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
}
if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) {
if ( !cfg::getTString(hContact, "CList", "Group", &dbv)) {
- _sntprintf(szGroupMask, safe_sizeof(szGroupMask), _T("%s|"), &dbv.ptszVal[1]);
+ mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[1]);
filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0));
mir_free(dbv.ptszVal);
}
diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp
index 82513b0b05..1efd0b020e 100644
--- a/plugins/Clist_nicer/src/cluiopts.cpp
+++ b/plugins/Clist_nicer/src/cluiopts.cpp
@@ -160,9 +160,9 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case WM_HSCROLL:
{
char str[10];
- wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
+ mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str);
- wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
+ mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str);
}
if (wParam != 0x12345678) {
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index cf31a0747e..7093cc95df 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -704,12 +704,12 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file)
this_item->ALPHA = min(this_item->ALPHA, 100);
clr = RGB(GetBValue(defaults->COLOR), GetGValue(defaults->COLOR), GetRValue(defaults->COLOR));
- _snprintf(def_color, 15, "%6.6x", clr);
+ mir_snprintf(def_color, 15, "%6.6x", clr);
GetPrivateProfileStringA(szItem, "Color1", def_color, buffer, 400, file);
this_item->COLOR = HexStringToLong(buffer);
clr = RGB(GetBValue(defaults->COLOR2), GetGValue(defaults->COLOR2), GetRValue(defaults->COLOR2));
- _snprintf(def_color, 15, "%6.6x", clr);
+ mir_snprintf(def_color, 15, "%6.6x", clr);
GetPrivateProfileStringA(szItem, "Color2", def_color, buffer, 400, file);
this_item->COLOR2 = HexStringToLong(buffer);
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp
index 6a1852e33e..7b8b31de25 100644
--- a/plugins/Clist_nicer/src/init.cpp
+++ b/plugins/Clist_nicer/src/init.cpp
@@ -123,7 +123,7 @@ void _DebugTraceW(const wchar_t *fmt, ...)
lstrcpyW(debug, L"CLN: ");
- _vsnwprintf(&debug[5], ibsize - 10, fmt, va);
+ mir_vsnwprintf(&debug[5], ibsize - 10, fmt, va);
OutputDebugStringW(debug);
#endif
}
@@ -137,7 +137,7 @@ void _DebugTraceA(const char *fmt, ...)
va_start(va, fmt);
lstrcpyA(debug, "CLN: ");
- _vsnprintf(&debug[5], ibsize - 10, fmt, va);
+ mir_vsnprintf(&debug[5], ibsize - 10, fmt, va);
#ifdef _DEBUG
OutputDebugStringA(debug);
#else
diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp
index d3c9d52589..b2460204d3 100644
--- a/plugins/Clist_nicer/src/rowheight_funcs.cpp
+++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp
@@ -105,7 +105,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd)
int other_fonts[] = {FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS};
// Get contact font size
- for (i = 0 ; i < MAX_REGS(contact_fonts) ; i++)
+ for (i = 0 ; i < SIZEOF(contact_fonts) ; i++)
{
if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight)
max_height = dat->fontInfo[contact_fonts[i]].fontHeight;
@@ -115,7 +115,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd)
max_height += ROW_SPACE_BEETWEEN_LINES + dat->fontInfo[FONTID_STATUS].fontHeight;
// Get other font sizes
- for (i = 0 ; i < MAX_REGS(other_fonts) ; i++) {
+ for (i = 0 ; i < SIZEOF(other_fonts) ; i++) {
if (max_height < dat->fontInfo[other_fonts[i]].fontHeight)
max_height = dat->fontInfo[other_fonts[i]].fontHeight;
}
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index 29a816f5e5..acf7e07cda 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -1079,8 +1079,8 @@ void ApplyViewMode(const char *name)
mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
if ( !cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (lstrlen(dbv.ptszVal) >= 2) {
- _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, safe_sizeof(cfg::dat.groupFilter));
- cfg::dat.groupFilter[safe_sizeof(cfg::dat.groupFilter) - 1] = 0;
+ _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter));
+ cfg::dat.groupFilter[SIZEOF(cfg::dat.groupFilter) - 1] = 0;
cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
}
mir_free(dbv.ptszVal);