summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-12-08 22:13:57 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-12-08 22:13:57 +0000
commit13eb83bea655c3302c74a82d826d75bceb9232a2 (patch)
treeea992cbd9002e078a06e9fe65a73698eec4fbc22 /plugins
parentef741fcb36d679b094e44d01714f423c34357383 (diff)
code cleanup around mir_snprintf
git-svn-id: http://svn.miranda-ng.org/main/trunk@11285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Boltun/src/boltun.cpp2
-rw-r--r--plugins/CSList/src/cslist.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp56
-rw-r--r--plugins/Clist_nicer/src/clistmod.cpp2
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp2
-rw-r--r--plugins/Clist_nicer/src/config.cpp4
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp48
-rw-r--r--plugins/Clist_nicer/src/init.cpp2
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp50
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp2
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp10
-rw-r--r--plugins/MirOTR/MirOTR/src/utils.cpp2
-rw-r--r--plugins/NewEventNotify/src/popup.cpp4
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp24
-rw-r--r--plugins/Non-IM Contact/src/namereplacing.cpp2
-rw-r--r--plugins/Nudge/src/nudge.cpp64
-rw-r--r--plugins/Ping/src/icmp.cpp2
-rw-r--r--plugins/Ping/src/utils.cpp14
-rw-r--r--plugins/Popup/src/font.cpp4
-rw-r--r--plugins/Popup/src/services.cpp4
-rw-r--r--plugins/QuickMessages/src/options.cpp6
-rw-r--r--plugins/QuickReplies/src/options.cpp2
-rw-r--r--plugins/Scriver/src/msgs.cpp2
-rw-r--r--plugins/SecureIM/src/splitmsg.cpp8
-rw-r--r--plugins/SeenPlugin/src/utils.cpp26
-rw-r--r--plugins/Spamotron/src/utils.cpp4
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp2
-rw-r--r--plugins/TabSRMM/src/container.cpp28
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp2
-rw-r--r--plugins/TabSRMM/src/modplus.cpp2
-rw-r--r--plugins/TabSRMM/src/msglog.cpp12
-rw-r--r--plugins/TabSRMM/src/selectcontainer.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp14
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp7
-rw-r--r--plugins/TabSRMM/src/srmm.cpp6
-rw-r--r--plugins/TabSRMM/src/utils.cpp10
-rw-r--r--plugins/TipperYM/src/options.cpp6
-rw-r--r--plugins/TipperYM/src/skin_parser.cpp10
-rw-r--r--plugins/TipperYM/src/translations.cpp38
-rw-r--r--plugins/UserInfoEx/src/classMAnnivDate.cpp12
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp8
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp4
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp4
-rw-r--r--plugins/UserInfoEx/src/psp_profile.cpp8
-rw-r--r--plugins/YAMN/src/browser/mailbrowser.cpp2
-rw-r--r--plugins/YAPP/src/options.cpp6
-rw-r--r--plugins/YAPP/src/services.cpp6
48 files changed, 270 insertions, 271 deletions
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index 4364533bf7..e25daa39dd 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -117,7 +117,7 @@ static bool LoadMind(const TCHAR* filename, int &line)
#ifdef DEBUG_LOAD_TIME
t = __rdtsc() - t;
char dest[101];
- mir_snprintf(dest, 100, "%I64d ticks\n", t / 3200000);
+ mir_snprintf(dest, SIZEOF(dest), "%I64d ticks\n", t / 3200000);
MessageBoxA(NULL, dest, NULL, 0);
//exit(0);
#endif
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp
index beb71a82d5..7030fe1109 100644
--- a/plugins/CSList/src/cslist.cpp
+++ b/plugins/CSList/src/cslist.cpp
@@ -261,14 +261,14 @@ void importCustomStatuses(CSWindow* csw, int result)
StatusItem* si = new StatusItem();
si->m_iIcon = i-1;
- mir_snprintf(bufTitle, 32, "XStatus%dName", i);
+ mir_snprintf(bufTitle, SIZEOF(bufTitle), "XStatus%dName", i);
if ( !db_get_ts( NULL, protoName, bufTitle, &dbv )) {
mir_tstrcpy(si->m_tszTitle, dbv.ptszVal);
db_free(&dbv);
}
else si->m_tszTitle[0] = 0;
- mir_snprintf(bufMessage, 32, "XStatus%dMsg", i);
+ mir_snprintf(bufMessage, SIZEOF(bufMessage), "XStatus%dMsg", i);
if ( !db_get_ts( NULL, protoName, bufMessage, &dbv )) {
mir_tstrcpy(si->m_tszMessage, dbv.ptszVal);
db_free(&dbv);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index 4b66621650..642bbe0dd4 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -363,17 +363,17 @@ void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szPr
CLVM_EnumModes( DeleteAutoModesCallback );
char szSetting[512];
- mir_snprintf(szSetting, 512, "%c%s_PF", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, name);
db_set_s(NULL, CLVM_MODULE, szSetting, szProtoFilter);
- mir_snprintf(szSetting, 512, "%c%s_GF", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, name);
db_set_ws(NULL, CLVM_MODULE, szSetting, szGroupFilter);
- mir_snprintf(szSetting, 512, "%c%s_SM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, name);
db_set_dw(NULL, CLVM_MODULE, szSetting, statusMask);
- mir_snprintf(szSetting, 512, "%c%s_SSM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, name);
db_set_dw(NULL, CLVM_MODULE, szSetting, stickyStatusMask);
- mir_snprintf(szSetting, 512, "%c%s_OPT", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, name);
db_set_dw(NULL, CLVM_MODULE, szSetting, options);
- mir_snprintf(szSetting, 512, "%c%s_LM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_LM", 246, name);
db_set_dw(NULL, CLVM_MODULE, szSetting, lmdat);
db_set_dw(NULL, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
@@ -522,22 +522,22 @@ static void UpdateFilters()
szBuf = mir_utf8encodeT(szTempBuf);
strncpy(g_szModename, szBuf, SIZEOF(g_szModename));
g_szModename[SIZEOF(g_szModename) - 1] = 0;
- mir_sntprintf(szTemp, 100, TranslateT("Configuring view mode: %s"), szTempBuf);
+ mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Configuring view mode: %s"), szTempBuf);
SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
- mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, szBuf);
if (db_get_s(NULL, CLVM_MODULE, szSetting, &dbv_pf))
goto cleanup;
- mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, szBuf);
if (db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv_gf))
goto cleanup;
- mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, szBuf);
if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1)
{
SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
}
- mir_snprintf(szSetting, 128, "%c%s_SM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, szBuf);
statusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
- mir_snprintf(szSetting, 128, "%c%s_SSM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, szBuf);
stickyStatusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
dwFlags = db_get_dw(NULL, CLVM_MODULE, szBuf, 0);
{
@@ -555,7 +555,7 @@ static void UpdateFilters()
{
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- mir_snprintf(szMask, 256, "%s|", szTemp);
+ mir_snprintf(szMask, SIZEOF(szMask), "%s|", szTemp);
if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -616,7 +616,7 @@ static void UpdateFilters()
EnableWindow(GetDlgItem(clvmHwnd, IDC_LASTMSGVALUE), useLastMsg);
EnableWindow(GetDlgItem(clvmHwnd, IDC_LASTMESSAGEUNIT), useLastMsg);
- mir_snprintf(szSetting, 128, "%c%s_LM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_LM", 246, szBuf);
lmdat = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
SetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE);
@@ -638,15 +638,15 @@ void DeleteViewMode( char * szName )
{
char szSetting[256];
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, szName);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, szName);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, szName);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, szName);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, szName);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, szName);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_VA", 246, szName);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_VA", 246, szName);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szName);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, szName);
db_unset(NULL, CLVM_MODULE, szSetting);
db_unset(NULL, CLVM_MODULE, szName);
@@ -1268,7 +1268,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
g_CluiData.bFilterEffective = 0;
- mir_snprintf(szSetting, 256, "%c_LastMode", 246);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c_LastMode", 246);
if (!Name) { // Name is null - apply last stored view mode
if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
@@ -1283,7 +1283,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
g_CluiData.bFilterEffective = 0;
// remove last applied view mode
- mir_snprintf(szSetting, 256, "%c_LastMode", 246);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c_LastMode", 246);
db_unset(NULL, CLVM_MODULE, szSetting);
if (g_CluiData.bOldUseGroups != (BYTE)-1)
@@ -1304,7 +1304,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
}
if (!onlySelector) {
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, Name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, Name);
if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_strlen(dbv.pszVal) >= 2) {
strncpy(g_CluiData.protoFilter, dbv.pszVal, SIZEOF(g_CluiData.protoFilter));
@@ -1313,7 +1313,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
}
mir_free(dbv.pszVal);
}
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, Name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, Name);
if (!db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_tstrlen(dbv.ptszVal) >= 2) {
_tcsncpy(g_CluiData.groupFilter, dbv.ptszVal, SIZEOF(g_CluiData.groupFilter));
@@ -1322,12 +1322,12 @@ void ApplyViewMode(const char *Name, bool onlySelector )
}
mir_free(dbv.ptszVal);
}
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, Name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, Name);
g_CluiData.statusMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
if (g_CluiData.statusMaskFilter >= 1)
g_CluiData.bFilterEffective |= CLVM_FILTER_STATUS;
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, Name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, Name);
g_CluiData.stickyMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
if (g_CluiData.stickyMaskFilter != -1)
g_CluiData.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
@@ -1337,14 +1337,14 @@ void ApplyViewMode(const char *Name, bool onlySelector )
KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
if (g_CluiData.filterFlags & CLVM_AUTOCLEAR) {
- mir_snprintf(szSetting, 256, "%c%s_OPT", 246, Name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, Name);
DWORD timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
strncpy(g_CluiData.old_viewmode, g_CluiData.current_viewmode, 256);
g_CluiData.old_viewmode[255] = 0;
CLUI_SafeSetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
}
else { //store last selected view mode only if it is not autoclear
- mir_snprintf(szSetting, 256, "%c_LastMode", 246);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c_LastMode", 246);
db_set_s(NULL, CLVM_MODULE, szSetting, Name);
}
strncpy(g_CluiData.current_viewmode, Name, 256);
@@ -1361,7 +1361,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
g_CluiData.bSortByOrder[0] = bSaved;
g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG;
- mir_snprintf(szSetting, 256, "%c%s_LM", 246, Name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_LM", 246, Name);
g_CluiData.lastMsgFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
if (LOBYTE(HIWORD(g_CluiData.lastMsgFilter)))
g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN;
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp
index 1ee7074df1..897f6cfc00 100644
--- a/plugins/Clist_nicer/src/clistmod.cpp
+++ b/plugins/Clist_nicer/src/clistmod.cpp
@@ -66,7 +66,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON
if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) {
if (szProto) {
char szBuf[128];
- mir_snprintf(szBuf, 128, "%s_conn", szProto);
+ mir_snprintf(szBuf, SIZEOF(szBuf), "%s_conn", szProto);
*phIcon = Skin_GetIcon(szBuf);
}
}
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index 832a308d4f..cf9e441f5f 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -33,7 +33,7 @@ static INT_PTR GetClistVersion(WPARAM wParam, LPARAM lParam)
{
static char g_szVersionString[256];
- mir_snprintf(g_szVersionString, 256, "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version)));
+ mir_snprintf(g_szVersionString, SIZEOF(g_szVersionString), "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version)));
if ( !IsBadWritePtr((LPVOID)lParam, 4))
*((DWORD *)lParam) = pluginInfo.version;
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp
index 5cda86fb36..6351448c3c 100644
--- a/plugins/Clist_nicer/src/config.cpp
+++ b/plugins/Clist_nicer/src/config.cpp
@@ -311,8 +311,8 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, TCH
memcpy(&exRecord, ep->ExceptionRecord, sizeof(EXCEPTION_RECORD));
memcpy(&exCtx, ep->ContextRecord, sizeof(CONTEXT));
- mir_snprintf(exSzFile, MAX_PATH, "%s%s", szName, szExt);
- mir_sntprintf(exReason, 256, _T("An application error has occured: %s"), szReason);
+ mir_snprintf(exSzFile, SIZEOF(exSzFile), "%s%s", szName, szExt);
+ mir_sntprintf(exReason, SIZEOF(exReason), _T("An application error has occured: %s"), szReason);
exLine = line;
exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0);
exAllowContinue = fAllowContinue;
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 74e848468d..5dca791388 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -287,12 +287,12 @@ void LoadExtBkSettingsFromDB()
*p = _StatusItems[0];
ID_EXTBK_LAST++;
- mir_snprintf(p->szDBname, 30, "EXBK_%s", accs[i]->szModuleName);
+ mir_snprintf(p->szDBname, SIZEOF(p->szDBname), "EXBK_%s", accs[i]->szModuleName);
if (i == 0) {
- mir_strncpy(p->szName, "{-}", 30);
- strncat(p->szName, accs[i]->szModuleName, 30);
+ mir_strncpy(p->szName, "{-}", SIZEOF(p->szName));
+ strncat(p->szName, accs[i]->szModuleName, SIZEOF(p->szName));
}
- else mir_strncpy(p->szName, accs[i]->szModuleName, 30);
+ else mir_strncpy(p->szName, accs[i]->szModuleName, SIZEOF(p->szName));
p->statusID = ID_EXTBK_LAST;
arStatusItems.insert(p);
}
@@ -487,34 +487,34 @@ void extbk_export(char *file)
}
for (n = 0; n <= FONTID_LAST; n++) {
- mir_snprintf(szSection, 255, "Font%d", n);
+ mir_snprintf(szSection, SIZEOF(szSection), "Font%d", n);
- mir_snprintf(szKey, 255, "Font%dName", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dName", n);
if (!cfg::getString(NULL, "CLC", szKey, &dbv)) {
WritePrivateProfileStringA(szSection, "Name", dbv.pszVal, file);
mir_free(dbv.pszVal);
}
- mir_snprintf(szKey, 255, "Font%dSize", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dSize", n);
data = (DWORD)cfg::getByte("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Size", &data, 1, file);
- mir_snprintf(szKey, 255, "Font%dSty", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dSty", n);
data = (DWORD)cfg::getByte("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Style", &data, 1, file);
- mir_snprintf(szKey, 255, "Font%dSet", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dSet", n);
data = (DWORD)cfg::getByte("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Set", &data, 1, file);
- mir_snprintf(szKey, 255, "Font%dCol", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dCol", n);
data = cfg::getDword("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Color", &data, 4, file);
- mir_snprintf(szKey, 255, "Font%dFlags", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dFlags", n);
data = (DWORD)cfg::getDword("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Flags", &data, 4, file);
- mir_snprintf(szKey, 255, "Font%dAs", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dAs", n);
data = (DWORD)cfg::getWord("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "SameAs", &data, 2, file);
}
@@ -713,12 +713,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));
- mir_snprintf(def_color, 15, "%6.6x", clr);
+ mir_snprintf(def_color, SIZEOF(def_color), "%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));
- mir_snprintf(def_color, 15, "%6.6x", clr);
+ mir_snprintf(def_color, SIZEOF(def_color), "%6.6x", clr);
GetPrivateProfileStringA(szItem, "Color2", def_color, buffer, 400, file);
this_item->COLOR2 = HexStringToLong(buffer);
@@ -790,7 +790,7 @@ done_with_glyph:
strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName));
tmpItem.szName[sizeof(tmpItem.szName) - 1] = 0;
_splitpath(szFileName, szDrive, szPath, NULL, NULL);
- mir_snprintf(szFinalName, MAX_PATH, "%s\\%s\\%s", szDrive, szPath, buffer);
+ mir_snprintf(szFinalName, SIZEOF(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer);
tmpItem.alpha = GetPrivateProfileIntA(itemname, "Alpha", 100, szFileName);
tmpItem.alpha = min(tmpItem.alpha, 100);
tmpItem.alpha = (BYTE)((FLOAT)(((FLOAT)tmpItem.alpha) / 100) * 255);
@@ -868,7 +868,7 @@ done_with_glyph:
goto imgread_done;
}
for (n = 0; ; n++) {
- mir_snprintf(szItemNr, 30, "Item%d", n);
+ mir_snprintf(szItemNr, SIZEOF(szItemNr), "Item%d", n);
GetPrivateProfileStringA(itemname, szItemNr, "None", buffer, 500, szFileName);
if (!strcmp(buffer, "None"))
break;
@@ -1365,38 +1365,38 @@ void extbk_import(char *file, HWND hwndDlg)
GetPrivateProfileStructA("Global", "Version", &version, 4, file);
if (version >= 2) {
for (n = 0; n <= FONTID_LAST; n++) {
- mir_snprintf(szSection, 255, "Font%d", n);
+ mir_snprintf(szSection, SIZEOF(szSection), "Font%d", n);
- mir_snprintf(szKey, 255, "Font%dName", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dName", n);
GetPrivateProfileStringA(szSection, "Name", "Arial", buffer, sizeof(buffer), file);
cfg::writeString(NULL, "CLC", szKey, buffer);
- mir_snprintf(szKey, 255, "Font%dSize", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dSize", n);
data = 0;
GetPrivateProfileStructA(szSection, "Size", &data, 1, file);
cfg::writeByte("CLC", szKey, (BYTE)data);
- mir_snprintf(szKey, 255, "Font%dSty", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dSty", n);
data = 0;
GetPrivateProfileStructA(szSection, "Style", &data, 1, file);
cfg::writeByte("CLC", szKey, (BYTE)data);
- mir_snprintf(szKey, 255, "Font%dSet", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dSet", n);
data = 0;
GetPrivateProfileStructA(szSection, "Set", &data, 1, file);
cfg::writeByte("CLC", szKey, (BYTE)data);
- mir_snprintf(szKey, 255, "Font%dCol", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dCol", n);
data = 0;
GetPrivateProfileStructA(szSection, "Color", &data, 4, file);
cfg::writeDword("CLC", szKey, data);
- mir_snprintf(szKey, 255, "Font%dFlags", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dFlags", n);
data = 0;
GetPrivateProfileStructA(szSection, "Flags", &data, 4, file);
cfg::writeDword("CLC", szKey, (WORD)data);
- mir_snprintf(szKey, 255, "Font%dAs", n);
+ mir_snprintf(szKey, SIZEOF(szKey), "Font%dAs", n);
data = 0;
GetPrivateProfileStructA(szSection, "SameAs", &data, 2, file);
cfg::writeDword("CLC", szKey, (WORD)data);
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp
index d9b664c1ee..8e7ea1f6c1 100644
--- a/plugins/Clist_nicer/src/init.cpp
+++ b/plugins/Clist_nicer/src/init.cpp
@@ -116,7 +116,7 @@ void _DebugTraceA(const char *fmt, ...)
FILE *f;
CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath);
- mir_snprintf(szLogFileName, MAX_PATH, "%s\\%s", szDataPath, "clist_nicer.log");
+ mir_snprintf(szLogFileName, SIZEOF(szLogFileName), "%s\\%s", szDataPath, "clist_nicer.log");
f = fopen(szLogFileName, "a+");
if (f) {
fputs(debug, f);
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index 4d8eb05820..714d8447da 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -302,17 +302,17 @@ void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szPr
{
char szSetting[512];
- mir_snprintf(szSetting, 512, "%c%s_PF", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, name);
cfg::writeString(NULL, CLVM_MODULE, szSetting, szProtoFilter);
- mir_snprintf(szSetting, 512, "%c%s_GF", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, name);
cfg::writeTString(NULL, CLVM_MODULE, szSetting, szGroupFilter);
- mir_snprintf(szSetting, 512, "%c%s_SM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, name);
cfg::writeDword(CLVM_MODULE, szSetting, statusMask);
- mir_snprintf(szSetting, 512, "%c%s_SSM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, name);
cfg::writeDword(CLVM_MODULE, szSetting, stickyStatusMask);
- mir_snprintf(szSetting, 512, "%c%s_OPT", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, name);
cfg::writeDword(CLVM_MODULE, szSetting, options);
- mir_snprintf(szSetting, 512, "%c%s_LM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_LM", 246, name);
cfg::writeDword(CLVM_MODULE, szSetting, lmdat);
cfg::writeDword(CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
@@ -449,21 +449,21 @@ void UpdateFilters()
SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szBuf);
strncpy(g_szModename, szBuf, sizeof(g_szModename));
g_szModename[sizeof(g_szModename) - 1] = 0;
- mir_snprintf(szTemp, 100, Translate("Current view mode: %s"), g_szModename);
+ mir_snprintf(szTemp, SIZEOF(szTemp), Translate("Current view mode: %s"), g_szModename);
SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
- mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, szBuf);
if (db_get(NULL, CLVM_MODULE, szSetting, &dbv_pf))
goto cleanup;
- mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, szBuf);
if (cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
goto cleanup;
- mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, szBuf);
if ((opt = cfg::getDword(NULL, CLVM_MODULE, szSetting, -1)) != -1) {
SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
}
- mir_snprintf(szSetting, 128, "%c%s_SM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, szBuf);
statusMask = cfg::getDword(CLVM_MODULE, szSetting, -1);
- mir_snprintf(szSetting, 128, "%c%s_SSM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, szBuf);
stickyStatusMask = cfg::getDword(CLVM_MODULE, szSetting, -1);
dwFlags = cfg::getDword(CLVM_MODULE, szBuf, 0);
{
@@ -480,7 +480,7 @@ void UpdateFilters()
for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- mir_snprintf(szMask, 256, "%s|", szTemp);
+ mir_snprintf(szMask, SIZEOF(szMask), "%s|", szTemp);
if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -538,7 +538,7 @@ void UpdateFilters()
Utils::enableDlgControl(clvmHwnd, IDC_LASTMSGVALUE, useLastMsg);
Utils::enableDlgControl(clvmHwnd, IDC_LASTMESSAGEUNIT, useLastMsg);
- mir_snprintf(szSetting, 128, "%c%s_LM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_LM", 246, szBuf);
lmdat = cfg::getDword(CLVM_MODULE, szSetting, 0);
SetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE);
@@ -652,15 +652,15 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP
char *szBuf = (char*)malloc(iLen + 1);
if (szBuf) {
SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), (LPARAM)szBuf);
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, szBuf);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, szBuf);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, szBuf);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_VA", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_VA", 246, szBuf);
db_unset(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szBuf);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, szBuf);
db_unset(NULL, CLVM_MODULE, szSetting);
db_unset(NULL, CLVM_MODULE, szBuf);
if (!strcmp(cfg::dat.current_viewmode, szBuf) && mir_strlen(szBuf) == mir_strlen(cfg::dat.current_viewmode)) {
@@ -1048,7 +1048,7 @@ void ApplyViewMode(const char *name)
cfg::dat.bFilterEffective = 0;
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, name);
if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_strlen(dbv.pszVal) >= 2) {
strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter));
@@ -1057,7 +1057,7 @@ void ApplyViewMode(const char *name)
}
mir_free(dbv.pszVal);
}
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, name);
if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_tstrlen(dbv.ptszVal) >= 2) {
_tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter));
@@ -1066,12 +1066,12 @@ void ApplyViewMode(const char *name)
}
mir_free(dbv.ptszVal);
}
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, name);
cfg::dat.statusMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1);
if (cfg::dat.statusMaskFilter >= 1)
cfg::dat.bFilterEffective |= CLVM_FILTER_STATUS;
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SSM", 246, name);
cfg::dat.stickyMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1);
if (cfg::dat.stickyMaskFilter != -1)
cfg::dat.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
@@ -1082,7 +1082,7 @@ void ApplyViewMode(const char *name)
if (cfg::dat.filterFlags & CLVM_AUTOCLEAR) {
DWORD timerexpire;
- mir_snprintf(szSetting, 256, "%c%s_OPT", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, name);
timerexpire = LOWORD(cfg::getDword(CLVM_MODULE, szSetting, 0));
strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
cfg::dat.old_viewmode[255] = 0;
@@ -1103,7 +1103,7 @@ void ApplyViewMode(const char *name)
cfg::dat.sortOrder[0] = bSaved;
cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG;
- mir_snprintf(szSetting, 256, "%c%s_LM", 246, name);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_LM", 246, name);
cfg::dat.lastMsgFilter = cfg::getDword(CLVM_MODULE, szSetting, 0);
if (LOBYTE(HIWORD(cfg::dat.lastMsgFilter)))
cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN;
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 1a42fb6794..89821d51c0 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -534,7 +534,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
for(int i = 0; i < STATUS_COUNT ; i++) {
char buff[128];
- mir_snprintf(buff,_countof(buff), "Status%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Status%d", i);
settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE);
db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0);
}
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index e2500cdcd6..c237745bff 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -102,19 +102,19 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam)
break;
case DBVT_BYTE:
- mir_snprintf(data, 32, "0x%02X (%s)", dbv->bVal, itoa(dbv->bVal,tmp,10));
+ mir_snprintf(data, SIZEOF(data), "0x%02X (%s)", dbv->bVal, itoa(dbv->bVal,tmp,10));
ListView_SetItemText(hwnd2list,index,4,data);
ListView_SetItemText(hwnd2list,index,3,"BYTE");
break;
case DBVT_WORD:
- mir_snprintf(data, 32, "0x%04X (%s)", dbv->wVal, itoa(dbv->wVal,tmp,10));
+ mir_snprintf(data, SIZEOF(data), "0x%04X (%s)", dbv->wVal, itoa(dbv->wVal,tmp,10));
ListView_SetItemText(hwnd2list,index,4,data);
ListView_SetItemText(hwnd2list,index,3,"WORD");
break;
case DBVT_DWORD:
- mir_snprintf(data, 32, "0x%08X (%s)", dbv->dVal, itoa(dbv->dVal,tmp,10));
+ mir_snprintf(data, SIZEOF(data), "0x%08X (%s)", dbv->dVal, itoa(dbv->dVal,tmp,10));
ListView_SetItemText(hwnd2list,index,4,data);
ListView_SetItemText(hwnd2list,index,3,"DWORD");
break;
@@ -295,9 +295,9 @@ void popupWatchedVar(MCONTACT hContact,const char* module,const char* setting)
// contacts nick
char szProto[256];
if (GetValue(hContact,"Protocol","p",szProto,SIZEOF(szProto)))
- mir_snprintf(lpzContactName, MAX_SECONDLINE, "%s (%s)", (char*)GetContactName(hContact, szProto, 0), szProto);
+ mir_snprintf(lpzContactName, SIZEOF(lpzContactName), "%s (%s)", (char*)GetContactName(hContact, szProto, 0), szProto);
else
- mir_snprintf(lpzContactName, MAX_SECONDLINE, nick_unknown);
+ mir_snprintf(lpzContactName, SIZEOF(lpzContactName), nick_unknown);
}
else strcpy(lpzContactName,Translate("Settings"));
diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp
index 5998a2daf6..695486ff42 100644
--- a/plugins/MirOTR/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/MirOTR/src/utils.cpp
@@ -329,7 +329,7 @@ void ShowMessageInline(const MCONTACT hContact, const TCHAR *msg) {
void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg) {
char buff[1024];
- mir_snprintf(buff, 1024, "%s%s", Translate(LANG_INLINE_PREFIX), msg);
+ mir_snprintf(buff, SIZEOF(buff), "%s%s", Translate(LANG_INLINE_PREFIX), msg);
PROTORECVEVENT pre = {0};
pre.timestamp = time(0);
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp
index 90d12c5816..eb514b5406 100644
--- a/plugins/NewEventNotify/src/popup.cpp
+++ b/plugins/NewEventNotify/src/popup.cpp
@@ -254,7 +254,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
char *pszLast = pszFirst + strlen(pszFirst) + 1;
char *pszEmail = pszLast + strlen(pszLast) + 1;
- mir_snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
+ mir_snprintf(szUin, SIZEOF(szUin), "%d", *((DWORD*)dbei->pBlob));
if (strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
szNick = mir_utf8decodeT(pszNick);
@@ -290,7 +290,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
char *pszLast = pszFirst + strlen(pszFirst) + 1;
char *pszEmail = pszLast + strlen(pszLast) + 1;
- mir_snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
+ mir_snprintf(szUin, SIZEOF(szUin), "%d", *((DWORD*)dbei->pBlob));
if (strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
szNick = mir_utf8decodeT(pszNick);
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 25cd58230b..9b8aec3b3e 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -1413,21 +1413,21 @@ void ExportGpGKeysFunc(int type)
case DBVT_BYTE:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.bVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.bVal);
id += _id;
}
break;
case DBVT_WORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.wVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.wVal);
id += _id;
}
break;
case DBVT_DWORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.dVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.dVal);
id += _id;
}
break;
@@ -1464,21 +1464,21 @@ void ExportGpGKeysFunc(int type)
case DBVT_BYTE:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.bVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.bVal);
id += _id;
}
break;
case DBVT_WORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.wVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.wVal);
id += _id;
}
break;
case DBVT_DWORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.dVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.dVal);
id += _id;
}
break;
@@ -1617,7 +1617,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
case DBVT_BYTE:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.bVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.bVal);
id += _id;
if(id == login)
acc = accs[i]->szModuleName;
@@ -1626,7 +1626,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
case DBVT_WORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.wVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.wVal);
id += _id;
if(id == login)
acc = accs[i]->szModuleName;
@@ -1635,7 +1635,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
case DBVT_DWORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.dVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.dVal);
id += _id;
if(id == login)
acc = accs[i]->szModuleName;
@@ -1686,7 +1686,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
case DBVT_BYTE:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.bVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.bVal);
id += _id;
if(id == contact_id)
found = true;
@@ -1695,7 +1695,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
case DBVT_WORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.wVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.wVal);
id += _id;
if(id == contact_id)
found = true;
@@ -1704,7 +1704,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
case DBVT_DWORD:
{
char _id[64];
- mir_snprintf(_id, 64, "%d", dbv.dVal);
+ mir_snprintf(_id, SIZEOF(_id), "%d", dbv.dVal);
id += _id;
if(id == contact_id)
found = true;
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp
index d8706731d9..690402cd0c 100644
--- a/plugins/Non-IM Contact/src/namereplacing.cpp
+++ b/plugins/Non-IM Contact/src/namereplacing.cpp
@@ -422,7 +422,7 @@ int lastChecked(char *newStr, const char *str)
if (GetLastWriteTime(hFile, tszFileName)) {
CloseHandle(hFile);
strcat(newStr, tszFileName);
- mir_snprintf(tszFileName, MAX_PATH, "%s%d))", szPattern, file);
+ mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s%d))", szPattern, file);
return (int)strlen(tszFileName);
}
CloseHandle(hFile);
diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp
index 66f8c47fbb..75dc07b063 100644
--- a/plugins/Nudge/src/nudge.cpp
+++ b/plugins/Nudge/src/nudge.cpp
@@ -3,55 +3,55 @@
void CNudge::Save(void)
{
char SectionName[512];
- mir_snprintf(SectionName, 512, "useByProtocol");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "useByProtocol");
db_set_b(NULL, MODULENAME, SectionName, this->useByProtocol);
- mir_snprintf(SectionName, 512, "RecvTimeSec");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "RecvTimeSec");
db_set_dw(NULL, MODULENAME, SectionName, this->recvTimeSec);
- mir_snprintf(SectionName, 512, "SendTimeSec");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "SendTimeSec");
db_set_dw(NULL, MODULENAME, SectionName, this->sendTimeSec);
- mir_snprintf(SectionName, 512, "ResendDelaySec");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "ResendDelaySec");
db_set_dw(NULL, MODULENAME, SectionName, this->resendDelaySec);
}
void CNudge::Load(void)
{
char SectionName[512];
- mir_snprintf(SectionName, 512, "useByProtocol");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "useByProtocol");
this->useByProtocol = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
- mir_snprintf(SectionName, 512, "RecvTimeSec");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "RecvTimeSec");
this->recvTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
- mir_snprintf(SectionName, 512, "SendTimeSec");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "SendTimeSec");
this->sendTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
- mir_snprintf(SectionName, 512, "ResendDelaySec");
+ mir_snprintf(SectionName, SIZEOF(SectionName), "ResendDelaySec");
this->resendDelaySec = db_get_dw(NULL, MODULENAME, SectionName, 3);
}
void CNudgeElement::Save(void)
{
char SectionName[512];
- mir_snprintf(SectionName, 512, "%s-openMessageWindow", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openMessageWindow", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->openMessageWindow);
- mir_snprintf(SectionName, 512, "%s-openContactList", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openContactList", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->openContactList);
- mir_snprintf(SectionName, 512, "%s-useIgnore", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-useIgnore", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->useIgnoreSettings);
- mir_snprintf(SectionName, 512, "%s-showStatus", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showStatus", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->showStatus);
- mir_snprintf(SectionName, 512, "%s-showPopup", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showPopup", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->showPopup);
- mir_snprintf(SectionName, 512, "%s-shakeClist", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeClist", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->shakeClist);
- mir_snprintf(SectionName, 512, "%s-shakeChat", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeChat", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->shakeChat);
- mir_snprintf(SectionName, 512, "%s-enabled", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-enabled", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->enabled);
- mir_snprintf(SectionName, 512, "%s-autoResend", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-autoResend", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->autoResend);
- mir_snprintf(SectionName, 512, "%s-statusFlags", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-statusFlags", ProtocolName);
db_set_dw(NULL, MODULENAME, SectionName, this->statusFlags);
- mir_snprintf(SectionName, 512, "%s-recText", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-recText", ProtocolName);
db_set_ts(NULL, MODULENAME, SectionName, this->recText);
- mir_snprintf(SectionName, 512, "%s-senText", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-senText", ProtocolName);
db_set_ts(NULL, MODULENAME, SectionName, this->senText);
}
@@ -59,28 +59,28 @@ void CNudgeElement::Load(void)
{
DBVARIANT dbv;
char SectionName[512];
- mir_snprintf(SectionName, 512, "%s-openMessageWindow", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openMessageWindow", ProtocolName);
this->openMessageWindow = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-openContactList", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openContactList", ProtocolName);
this->openContactList = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-useIgnore", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-useIgnore", ProtocolName);
this->useIgnoreSettings = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-showStatus", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showStatus", ProtocolName);
this->showStatus = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-showPopup", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showPopup", ProtocolName);
this->showPopup = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-shakeClist", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeClist", ProtocolName);
this->shakeClist = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-shakeChat", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeChat", ProtocolName);
this->shakeChat = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-enabled", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-enabled", ProtocolName);
this->enabled = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, 512, "%s-autoResend", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-autoResend", ProtocolName);
this->autoResend = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
- mir_snprintf(SectionName, 512, "%s-statusFlags", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-statusFlags", ProtocolName);
this->statusFlags = db_get_dw(NULL, MODULENAME, SectionName, 967);
- mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
+ mir_snprintf(SectionName,SIZEOF(SectionName),"%s-recText", ProtocolName);
if (!db_get_ts(NULL, MODULENAME, SectionName, &dbv)) {
_tcsncpy(this->recText, dbv.ptszVal, TEXT_LEN);
if (_tcsclen(this->recText) < 1)
@@ -89,7 +89,7 @@ void CNudgeElement::Load(void)
}
else _tcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN);
- mir_snprintf(SectionName, 512, "%s-senText", ProtocolName);
+ mir_snprintf(SectionName, SIZEOF(SectionName), "%s-senText", ProtocolName);
if (!db_get_ts(NULL, MODULENAME, SectionName, &dbv)) {
_tcsncpy(this->senText, dbv.ptszVal, TEXT_LEN);
if (_tcsclen(this->senText) < 1)
diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp
index 3cd34384bc..dfa0c86578 100644
--- a/plugins/Ping/src/icmp.cpp
+++ b/plugins/Ping/src/icmp.cpp
@@ -68,7 +68,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply)
{
char winmsg[512], msg[1024];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, code, 0, winmsg, 512, 0);
- mir_snprintf(msg, 1024, "Ping error (%d): %s", code, winmsg);
+ mir_snprintf(msg, SIZEOF(msg), "Ping error (%d): %s", code, winmsg);
PUShowMessage(msg, SM_NOTIFY);
return false;
}
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp
index 814e4d6f81..8aaf1d21b6 100644
--- a/plugins/Ping/src/utils.cpp
+++ b/plugins/Ping/src/utils.cpp
@@ -237,30 +237,30 @@ INT_PTR DblClick(WPARAM wParam, LPARAM lParam) {
void import_ping_address(int index, PINGADDRESS &pa) {
DBVARIANT dbv;
char buf[256];
- mir_snprintf(buf, 256, "Address%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Address%d", index);
if(!db_get_ts(0, "PingPlug", buf, &dbv)) {
_tcsncpy(pa.pszName, dbv.ptszVal, MAX_PINGADDRESS_STRING_LENGTH);
db_free(&dbv);
} else
_tcsncpy(pa.pszName, TranslateT("Unknown Address"), MAX_PINGADDRESS_STRING_LENGTH);
- mir_snprintf(buf, 256, "Label%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Label%d", index);
if(!db_get_ts(0, "PingPlug", buf, &dbv)) {
_tcsncpy(pa.pszLabel, dbv.ptszVal, MAX_PINGADDRESS_STRING_LENGTH);
db_free(&dbv);
} else
_tcsncpy(pa.pszLabel, TranslateT("Unknown"), MAX_PINGADDRESS_STRING_LENGTH);
- mir_snprintf(buf, 256, "Port%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Port%d", index);
pa.port = (int)db_get_dw(0, "PingPlug", buf, -1);
- mir_snprintf(buf, 256, "Proto%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Proto%d", index);
if(!db_get_s(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszProto, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
db_free(&dbv);
- mir_snprintf(buf, 256, "Status%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Status%d", index);
pa.set_status = db_get_w(0, "PingPlug", buf, ID_STATUS_ONLINE);
- mir_snprintf(buf, 256, "Status2%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Status2%d", index);
pa.get_status = db_get_w(0, "PingPlug", buf, ID_STATUS_OFFLINE);
} else
pa.pszProto[0] = '\0';
@@ -274,7 +274,7 @@ void import_ping_address(int index, PINGADDRESS &pa) {
pa.pszParams[0] = '\0';
pa.item_id = 0;
- mir_snprintf(buf, 256, "Enabled%d", index);
+ mir_snprintf(buf, SIZEOF(buf), "Enabled%d", index);
if(db_get_b(0, "PingPlug", buf, 1) == 1)
pa.status = PS_NOTRESPONDING;
else
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp
index 716472f9fd..e8df778714 100644
--- a/plugins/Popup/src/font.cpp
+++ b/plugins/Popup/src/font.cpp
@@ -130,10 +130,10 @@ void ReloadFonts()
char setting[256];
for (int i = 0; i < gTreeData.getCount(); i++) {
if (gTreeData[i]->typ == 2) {
- mir_snprintf(setting, 256, "%s/TextCol", gTreeData[i]->pupClass.pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/TextCol", gTreeData[i]->pupClass.pszName);
gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText =
(COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clText);
- mir_snprintf(setting, 256, "%s/BgCol", gTreeData[i]->pupClass.pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/BgCol", gTreeData[i]->pupClass.pszName);
gTreeData[i]->colorBack = gTreeData[i]->pupClass.colorBack =
(COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
}
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index d1a71e5752..92b97f1b24 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -377,7 +377,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
LoadClassSettings(ptd, PU_MODULCLASS);
// we ignore pc->colorText and use fonts.text as default (if no setting found in DB)
- mir_snprintf(setting, 256, "%s/TextCol", ptd->pupClass.pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/TextCol", ptd->pupClass.pszName);
ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
FontIDT fid = {0};
fid.cbSize = sizeof(FontIDT);
@@ -395,7 +395,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
FontRegisterT(&fid);
// we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB)
- mir_snprintf(setting, 256, "%s/BgCol", ptd->pupClass.pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/BgCol", ptd->pupClass.pszName);
ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
ColourIDT cid = {0};
cid.cbSize = sizeof(ColourIDT);
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp
index 88bfada40c..e57801ed0d 100644
--- a/plugins/QuickMessages/src/options.cpp
+++ b/plugins/QuickMessages/src/options.cpp
@@ -260,7 +260,7 @@ void SaveMenuTree(HWND hdlg)
if(ld->ptszQValue)
{
- mir_snprintf(szMEntry,255,"ButtonValue_%u",iBl);
+ mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonValue_%u", iBl);
db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszQValue);
}
@@ -276,13 +276,13 @@ void SaveMenuTree(HWND hdlg)
}
- mir_snprintf(szMEntry,255,"ButtonName_%u",iBl);
+ mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonName_%u", iBl);
db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
ld->dwOPFlags=0;
ld->dwPos=iBl;
ld->bIsServName=ld->bIsOpServName;
- mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",iBl);
+ mir_snprintf(szMEntry, SIZEOF(szMEntry), "RCEntryIsServiceName_%u", iBl);
db_set_b(NULL, PLGNAME,szMEntry,ld->bIsServName);
bDeleted=FALSE;
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp
index b622789864..862247e955 100644
--- a/plugins/QuickReplies/src/options.cpp
+++ b/plugins/QuickReplies/src/options.cpp
@@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int pos = -1, prev = 0;
while ((pos = replies.Find(_T("\r\n"), prev)) != -1)
{
- mir_snprintf(key, 64, "Reply_%x_%x", iNumber, count++);
+ mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, count++);
db_set_ws(NULL, MODULE, key, replies.Mid(prev, pos - prev).GetBuffer());
prev = pos + 2;
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index aa2fdfc480..9d2938f0ac 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -299,7 +299,7 @@ static INT_PTR GetWindowAPI(WPARAM wParam, LPARAM lParam)
static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
{
char *szBuf = (char*)wParam;
- int size = (int)lParam;
+ size_t size = (size_t)lParam;
mir_snprintf(szBuf, size, "Scriver");
return 0;
}
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp
index 259d636955..64e1577ad9 100644
--- a/plugins/SecureIM/src/splitmsg.cpp
+++ b/plugins/SecureIM/src/splitmsg.cpp
@@ -5,16 +5,16 @@ LPSTR splitMsg(LPSTR szMsg, int iLen)
{
Sent_NetLog("split: msg: -----\n%s\n-----\n", szMsg);
- int len = (int)strlen(szMsg);
+ size_t len = strlen(szMsg);
LPSTR out = (LPSTR)mir_alloc(len * 2);
LPSTR buf = out;
WORD msg_id = db_get_w(0, MODULENAME, "msgid", 0) + 1;
db_set_w(0, MODULENAME, "msgid", msg_id);
- int part_all = (len + iLen - 1) / iLen;
- for (int part_num = 0; part_num<part_all; part_num++) {
- int sz = (len>iLen) ? iLen : len;
+ size_t part_all = (len + iLen - 1) / iLen;
+ for (size_t part_num = 0; part_num<part_all; part_num++) {
+ size_t sz = (len>iLen) ? iLen : len;
mir_snprintf(buf, 32, "%s%04X%02X%02X", SIG_SECP, msg_id, part_num, part_all);
memcpy(buf + LEN_SECP + 8, szMsg, sz);
*(buf + LEN_SECP + 8 + sz) = '\0';
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 3c9bc669fb..a5fcd575ce 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -570,11 +570,12 @@ int UpdateValues(WPARAM hContact,LPARAM lparam)
db_set_b(hContact, S_MOD, "Offline", 1);
{
DWORD t;
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",proto);
- t = db_get_dw(NULL,S_MOD,str,0);
- if (!t) t = time(NULL);
- free(str);
+ char str[MAXMODULELABELLENGTH + 9];
+
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", proto);
+ t = db_get_dw(NULL, S_MOD, str, 0);
+ if (!t)
+ t = time(NULL);
DBWriteTimeTS(t, hContact);
}
@@ -653,10 +654,9 @@ static void cleanThread(void *param)
}
}
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",infoParam->sProtoName);
- db_unset(NULL,S_MOD,str);
- free(str);
+ char str[MAXMODULELABELLENGTH + 9];
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", infoParam->sProtoName);
+ db_unset(NULL, S_MOD, str);
}
free(infoParam);
}
@@ -690,12 +690,12 @@ int ModeChange(WPARAM wparam,LPARAM lparam)
else if ((isetting==ID_STATUS_OFFLINE)&&((WORD)ack->hProcess>ID_STATUS_OFFLINE)) {
//we have just loged-off
if (IsWatchedProtocol(ack->szModule)) {
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
+ char str[MAXMODULELABELLENGTH + 9];
time_t t;
+
time(&t);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",ack->szModule);
- db_set_dw(NULL,S_MOD,str,t);
- free(str);
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", ack->szModule);
+ db_set_dw(NULL, S_MOD, str, t);
}
}
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp
index c47406e435..f074225187 100644
--- a/plugins/Spamotron/src/utils.cpp
+++ b/plugins/Spamotron/src/utils.cpp
@@ -468,9 +468,9 @@ int LogToSystemHistory(char *message, char *origmessage)
dbei.szModule = PLUGIN_NAME;
dbei.pBlob = (PBYTE)msg;
if (origmessage)
- dbei.cbBlob = (1 + mir_snprintf(msg, MAX_BUFFER_LENGTH, "%s: %s%s %s: %s", PLUGIN_NAME, message, DOT(message), Translate("Their message was"), origmessage));
+ dbei.cbBlob = (1 + mir_snprintf(msg, SIZEOF(msg), "%s: %s%s %s: %s", PLUGIN_NAME, message, DOT(message), Translate("Their message was"), origmessage));
else
- dbei.cbBlob = (1 + mir_snprintf(msg, MAX_BUFFER_LENGTH, "%s: %s%s", PLUGIN_NAME, message, DOT(message)));
+ dbei.cbBlob = (1 + mir_snprintf(msg, SIZEOF(msg), "%s: %s%s", PLUGIN_NAME, message, DOT(message)));
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_READ;
db_event_add(NULL, &dbei);
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index b179170d7c..019a2ae6e1 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -817,7 +817,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (streamData->dat->dwFlags & MWF_DIVIDERWANTED || lin->dwFlags & MWF_DIVIDERWANTED) {
static char szStyle_div[128] = "\0";
if (szStyle_div[0] == 0)
- mir_snprintf(szStyle_div, 128, "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", 17, 18, 0, 0, 5);
+ mir_snprintf(szStyle_div, SIZEOF(szStyle_div), "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", 17, 18, 0, 0, 5);
lin->dwFlags |= MWF_DIVIDERWANTED;
if (lin->prev || !streamData->bRedraw)
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index 994a7feabe..f692288afe 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -190,7 +190,7 @@ static void OnLoadSettings()
for (int i = 0; i < 5; i++) {
char szBuf[40];
- mir_snprintf(szBuf, 20, "NickColor%d", i);
+ mir_snprintf(szBuf, SIZEOF(szBuf), "NickColor%d", i);
g_Settings.nickColors[i] = M.GetDword(CHAT_MODULE, szBuf, g_Settings.UserListColors[0]);
}
g_Settings.nickColors[5] = M.GetDword(CHAT_MODULE, "NickColor5", GetSysColor(COLOR_HIGHLIGHT));
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 45ddd99900..194f14fc89 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1448,14 +1448,14 @@ panel_found:
pContainer->settings = &PluginConfig.globalContainerSettings;
pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
- mir_snprintf(szCname, 40, "%s_theme", CONTAINER_PREFIX);
+ mir_snprintf(szCname, SIZEOF(szCname), "%s_theme", CONTAINER_PREFIX);
if (!db_get_ts(pContainer->hContactFrom, SRMSGMOD_T, szCname, &dbv))
szThemeName = dbv.ptszVal;
}
else {
Utils::ReadPrivateContainerSettings(pContainer);
if (szThemeName == NULL) {
- mir_snprintf(szCname, 40, "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCname, SIZEOF(szCname), "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex);
if (!db_get_ts(NULL, SRMSGMOD_T, szCname, &dbv))
szThemeName = dbv.ptszVal;
}
@@ -1839,13 +1839,13 @@ panel_found:
}
else {
char szCName[40];
- mir_snprintf(szCName, 40, "%s%dx", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s%dx", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
- mir_snprintf(szCName, 40, "%s%dy", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s%dy", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
- mir_snprintf(szCName, 40, "%s%dwidth", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s%dwidth", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- mir_snprintf(szCName, 40, "%s%dheight", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s%dheight", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
db_set_b(0, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd == SW_SHOWMAXIMIZED) ? 1 : 0));
@@ -1864,7 +1864,7 @@ panel_found:
SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
char szCName[40];
- mir_snprintf(szCName, 40, "%s_theme", CONTAINER_PREFIX);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s_theme", CONTAINER_PREFIX);
if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
@@ -1988,7 +1988,7 @@ void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size)
{
- int cutMax = PluginConfig.m_CutContactNameTo;
+ size_t cutMax = PluginConfig.m_CutContactNameTo;
if (mir_tstrlen(oldname) <= cutMax)
_tcsncpy_s(newname, size, oldname, _TRUNCATE);
@@ -2169,17 +2169,17 @@ void TSAPI DeleteContainer(int iIndex)
}
char szSetting[CONTAINER_NAMELEN + 30];
- mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Flags", CONTAINER_PREFIX, iIndex);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s%d_Flags", CONTAINER_PREFIX, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Trans", CONTAINER_PREFIX, iIndex);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s%d_Trans", CONTAINER_PREFIX, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dwidth", CONTAINER_PREFIX, iIndex);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s%dwidth", CONTAINER_PREFIX, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dheight", CONTAINER_PREFIX, iIndex);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s%dheight", CONTAINER_PREFIX, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dx", CONTAINER_PREFIX, iIndex);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s%dx", CONTAINER_PREFIX, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dy", CONTAINER_PREFIX, iIndex);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s%dy", CONTAINER_PREFIX, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
}
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index 5cd8f77982..b4ee63b512 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -268,7 +268,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
else {
if (pContainer->settings != &PluginConfig.globalContainerSettings) {
char szCname[40];
- mir_snprintf(szCname, 40, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
+ mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
pContainer->settings->fPrivate = false;
db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
mir_free(pContainer->settings);
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp
index 180faa8a89..ebbccf651c 100644
--- a/plugins/TabSRMM/src/modplus.cpp
+++ b/plugins/TabSRMM/src/modplus.cpp
@@ -43,7 +43,7 @@
static TCHAR* getMenuEntry(int i)
{
char MEntry[256];
- mir_snprintf(MEntry, 255, "MenuEntry_%u", i);
+ mir_snprintf(MEntry, SIZEOF(MEntry), "MenuEntry_%u", i);
return db_get_tsa(NULL, "tabmodplus", MEntry);
}
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index ad276f5bdf..91f580daf7 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -266,7 +266,7 @@ static int AppendUnicodeToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbB
else {
char szTemp[10];
int colindex = GetColorIndex(GetRTFFont(LOWORD(mode) ? (MSGFONTID_MYMSG + (HIWORD(mode) ? 8 : 0)) : (MSGFONTID_YOURMSG + (HIWORD(mode) ? 8 : 0))));
- mir_snprintf(szTemp, 4, "%02d", colindex);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%02d", colindex);
d[3] = szTemp[0];
d[4] = szTemp[1];
d[5] = ' ';
@@ -364,7 +364,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int
if (!begin) {
char szTemp[10];
int colindex = GetColorIndex(GetRTFFont(LOWORD(mode) ? (MSGFONTID_MYMSG + (HIWORD(mode) ? 8 : 0)) : (MSGFONTID_YOURMSG + (HIWORD(mode) ? 8 : 0))));
- mir_snprintf(szTemp, 4, "%02d", colindex);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%02d", colindex);
(*buffer)[i + 3] = szTemp[0];
(*buffer)[i + 4] = szTemp[1];
}
@@ -458,7 +458,7 @@ static void Build_RTF_Header(char *&buffer, size_t &bufferEnd, size_t &bufferAll
// custom template colors...
for (i = 1; i <= 5; i++) {
char szTemp[30];
- mir_snprintf(szTemp, 10, "cc%d", i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i);
colour = theme->custom_colors[i - 1];
if (colour == 0)
colour = RGB(1, 1, 1);
@@ -622,7 +622,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
if (dwEffectiveFlags & MWF_DIVIDERWANTED) {
static char szStyle_div[128] = "\0";
if (szStyle_div[0] == 0)
- mir_snprintf(szStyle_div, 128, "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", H_MSGFONTID_DIVIDERS, H_MSGFONTID_DIVIDERS, 0, 0, 5);
+ mir_snprintf(szStyle_div, SIZEOF(szStyle_div), "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", H_MSGFONTID_DIVIDERS, H_MSGFONTID_DIVIDERS, 0, 0, 5);
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\sl-1\\slmult0\\highlight%d\\cf%d\\-\\par\\sl0", H_MSGFONTID_DIVIDERS, H_MSGFONTID_DIVIDERS);
dat->dwFlags &= ~MWF_DIVIDERWANTED;
@@ -1105,7 +1105,7 @@ skip:
}
else {
char temp[24];
- mir_snprintf(temp, 24, "{\\uc1\\u%d?}", (int)ci);
+ mir_snprintf(temp, SIZEOF(temp), "{\\uc1\\u%d?}", (int)ci);
AppendToBuffer(buffer, bufferEnd, bufferAlloced, temp);
i++;
}
@@ -1291,7 +1291,7 @@ static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppe
if (dat->hHistoryEvents && dat->curHistory == dat->maxHistory) {
char szPattern[50];
- mir_snprintf(szPattern, 40, "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
+ mir_snprintf(szPattern, SIZEOF(szPattern), "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
FINDTEXTEXA fi;
fi.lpstrText = szPattern;
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp
index 088d0c9940..81d7576d7f 100644
--- a/plugins/TabSRMM/src/selectcontainer.cpp
+++ b/plugins/TabSRMM/src/selectcontainer.cpp
@@ -179,7 +179,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
char szValue[10];
TContainerData *pContainer = 0;
do {
- mir_snprintf(szValue, 8, "%d", iCounter);
+ mir_snprintf(szValue, SIZEOF(szValue), "%d", iCounter);
if (db_get_ts(NULL, szKey, szValue, &dbv))
break; // end of list
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index fc800e8194..a9931f78a9 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -64,7 +64,7 @@ bool CSendLaterJob::mustDelete()
void CSendLaterJob::cleanDB()
{
if (isPersistentJob()) {
- char szKey[100];
+ char szKey[100];
db_unset(hContact, "SendLater", szId);
int iCount = db_get_dw(hContact, "SendLater", "count", 0);
@@ -73,7 +73,7 @@ void CSendLaterJob::cleanDB()
db_set_dw(hContact, "SendLater", "count", iCount);
// delete flags
- mir_snprintf(szKey, 100, "$%s", szId);
+ mir_snprintf(szKey, SIZEOF(szKey), "$%s", szId);
db_unset(hContact, "SendLater", szKey);
}
}
@@ -84,10 +84,10 @@ void CSendLaterJob::cleanDB()
void CSendLaterJob::readFlags()
{
if (isPersistentJob()) {
- char szKey[100];
- DWORD localFlags;
+ char szKey[100];
+ DWORD localFlags;
- mir_snprintf(szKey, 100, "$%s", szId);
+ mir_snprintf(szKey, SIZEOF(szKey), "$%s", szId);
localFlags = db_get_dw(hContact, "SendLater", szKey, 0);
if (localFlags & SLF_SUSPEND)
@@ -102,9 +102,9 @@ void CSendLaterJob::writeFlags()
{
if (isPersistentJob()) {
DWORD localFlags = (bCode == JOB_HOLD ? SLF_SUSPEND : 0);
- char szKey[100];
+ char szKey[100];
- mir_snprintf(szKey, 100, "$%s", szId);
+ mir_snprintf(szKey, SIZEOF(szKey), "$%s", szId);
db_set_dw(hContact, "SendLater", szKey, localFlags);
}
}
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 6cc6dd33e4..fc8801cf85 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -142,11 +142,11 @@ static void DoSplitSendW(LPVOID param)
SendJob *job = sendQueue->getJobByIndex((int)param);
BOOL fFirstSend = FALSE;
WCHAR *wszSaved, savedChar;
- int iCur = 0, iSavedCur = 0, i;
+ size_t iCur = 0, iSavedCur = 0, i;
BOOL fSplitting = TRUE;
MCONTACT hContact = job->hContact;
DWORD dwFlags = job->dwFlags;
- int chunkSize = job->chunkSize / 2;
+ size_t chunkSize = job->chunkSize / 2;
char *szProto = GetContactProto(hContact);
size_t iLen = mir_strlen(job->szSendBuffer);
@@ -812,8 +812,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b
time_t now = time(0);
TCHAR tszTimestamp[30];
_tcsftime(tszTimestamp, SIZEOF(tszTimestamp), _T("%Y.%m.%d - %H:%M"), _localtime32((__time32_t *)&now));
- tszTimestamp[29] = 0;
- mir_snprintf(szKeyName, 20, "S%d", now);
+ mir_snprintf(szKeyName, SIZEOF(szKeyName), "S%d", now);
mir_sntprintf(tszHeader, SIZEOF(tszHeader), TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp);
}
else mir_sntprintf(tszHeader, SIZEOF(tszHeader), _T("M%d|"), time(0));
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp
index 4b30b796dc..15eb8d0094 100644
--- a/plugins/TabSRMM/src/srmm.cpp
+++ b/plugins/TabSRMM/src/srmm.cpp
@@ -110,7 +110,7 @@ int _DebugTraceW(const wchar_t *fmt, ...)
GetLocalTime(&st);
- mir_snprintf(tszTime, 50, "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
+ mir_snprintf(tszTime, SIZEOF(tszTime), "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
mir_vsntprintf(debug, ibsize - 10, fmt, va);
@@ -122,7 +122,7 @@ int _DebugTraceW(const wchar_t *fmt, ...)
FILE *f;
CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath);
- mir_snprintf(szLogFileName, MAX_PATH, "%s\\%s", szDataPath, "tabsrmm_debug.log");
+ mir_snprintf(szLogFileName, SIZEOF(szLogFileName), "%s\\%s", szDataPath, "tabsrmm_debug.log");
f = fopen(szLogFileName, "a+");
if (f) {
char *szDebug = mir_utf8encodeT(debug);
@@ -156,7 +156,7 @@ int _DebugTraceA(const char *fmt, ...)
{
char szLogFileName[MAX_PATH], szDataPath[MAX_PATH];
CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath);
- mir_snprintf(szLogFileName, MAX_PATH, "%s\\tabsrmm_debug.log", szDataPath);
+ mir_snprintf(szLogFileName, SIZEOF(szLogFileName), "%s\\tabsrmm_debug.log", szDataPath);
FILE *f = fopen(szLogFileName, "a+");
if (f) {
fputs(debug, f);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 6fe641661b..1258284c44 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -682,10 +682,10 @@ void Utils::ContainerToSettings(TContainerData *pContainer)
void Utils::ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce)
{
- char szCname[50];
+ char szCname[50];
TContainerSettings csTemp = {0};
- mir_snprintf(szCname, 40, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
+ mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
Utils::ReadContainerSettingsFromDB(0, &csTemp, szCname);
if (csTemp.fPrivate || fForce) {
if (pContainer->settings == 0 || pContainer->settings == &PluginConfig.globalContainerSettings)
@@ -698,14 +698,14 @@ void Utils::ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce
void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSetting)
{
- char szCName[50];
+ char szCName[50];
pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
if (pContainer->settings->fPrivate) {
- mir_snprintf(szCName, 40, "%s%d_Blob", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s%d_Blob", szSetting, pContainer->iContainerIndex);
WriteContainerSettingsToDB(0, pContainer->settings, szCName);
}
- mir_snprintf(szCName, 40, "%s%d_theme", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, SIZEOF(szCName), "%s%d_theme", szSetting, pContainer->iContainerIndex);
if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index b9edda957c..d9afc09f7a 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -324,16 +324,16 @@ void LoadObsoleteSkinSetting()
for (int i = 0; i < SKIN_ITEMS_COUNT; i++)
{
- mir_snprintf(setting, 128, "SPaintMode%d", i);
+ mir_snprintf(setting, SIZEOF(setting), "SPaintMode%d", i);
opt.transfMode[i] = (TransformationMode)db_get_b(0, MODULE, setting, 0);
- mir_snprintf(setting, 128, "SImgFile%d", i);
+ mir_snprintf(setting, SIZEOF(setting), "SImgFile%d", i);
if (!db_get_ts(NULL, MODULE, setting, &dbv))
{
opt.szImgFile[i] = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
- mir_snprintf(setting, 128, "SGlyphMargins%d", i);
+ mir_snprintf(setting, SIZEOF(setting), "SGlyphMargins%d", i);
DWORD margins = db_get_dw(NULL, MODULE, setting, 0);
opt.margins[i].top = LOBYTE(LOWORD(margins));
opt.margins[i].right = HIBYTE(LOWORD(margins));
diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp
index 92bca196e0..d5db13e01d 100644
--- a/plugins/TipperYM/src/skin_parser.cpp
+++ b/plugins/TipperYM/src/skin_parser.cpp
@@ -172,15 +172,15 @@ char *GetSettingName(TCHAR *szValue, char *szPostfix, char *buff)
buff[0] = 0;
if (_tcsstr(szValue, _T("traytitle")))
- mir_snprintf(buff, 64, "FontTrayTitle%s", szPostfix);
+ mir_snprintf(buff, SIZEOF(buff), "FontTrayTitle%s", szPostfix);
else if (_tcsstr(szValue, _T("title")))
- mir_snprintf(buff, 64, "FontFirst%s", szPostfix);
+ mir_snprintf(buff, SIZEOF(buff), "FontFirst%s", szPostfix);
else if (_tcsstr(szValue, _T("label")))
- mir_snprintf(buff, 64, "FontLabels%s", szPostfix);
+ mir_snprintf(buff, SIZEOF(buff), "FontLabels%s", szPostfix);
else if (_tcsstr(szValue, _T("value")))
- mir_snprintf(buff, 64, "FontValues%s", szPostfix);
+ mir_snprintf(buff, SIZEOF(buff), "FontValues%s", szPostfix);
else if (_tcsstr(szValue, _T("divider")))
- mir_snprintf(buff, 64, "Divider%s", szPostfix);
+ mir_snprintf(buff, SIZEOF(buff), "Divider%s", szPostfix);
if (buff[0]) return buff;
else return NULL;
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp
index 4b3050ce9e..fa37d0cb99 100644
--- a/plugins/TipperYM/src/translations.cpp
+++ b/plugins/TipperYM/src/translations.cpp
@@ -247,21 +247,21 @@ TCHAR *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const cha
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, 256, "%sDay", prefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", prefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMonth", prefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", prefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sYear", prefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", prefix);
int year = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -295,21 +295,21 @@ TCHAR *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, 256, "%sDay", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMonth", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sYear", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", szPrefix);
int year = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -344,21 +344,21 @@ TCHAR *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, co
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, 256, "%sHours", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMinutes", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix);
int minutes = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sSeconds", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sSeconds", szPrefix);
int seconds = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -388,14 +388,14 @@ TCHAR *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const cha
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, 256, "%sHours", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMinutes", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix);
int minutes = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -424,42 +424,42 @@ TCHAR *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const ch
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, 256, "%sDay", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMonth", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sYear", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", szPrefix);
int year = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &year))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sHours", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMinutes", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix);
int minutes = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sSeconds", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sSeconds", szPrefix);
int seconds = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -526,14 +526,14 @@ TCHAR *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName,
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, 256, "%sDay", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, 256, "%sMonth", szPrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp
index 3078c2f4bd..b736d434d4 100644
--- a/plugins/UserInfoEx/src/classMAnnivDate.cpp
+++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp
@@ -265,13 +265,13 @@ int MAnnivDate::DBGetReminderOpts(MCONTACT hContact)
_wDaysEarlier = db_get_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, (WORD)-1);
}
else if (_wID <= ANID_LAST) {
- CHAR pszSetting[MAXSETTING];
+ char pszSetting[MAXSETTING];
// read reminder option
- mir_snprintf(pszSetting, MAXSETTING, "Anniv%dReminder", _wID);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dReminder", _wID);
_bRemind = db_get_b(hContact, Module(), pszSetting, BST_INDETERMINATE);
// read offset
- mir_snprintf(pszSetting, MAXSETTING, "Anniv%dOffset", _wID);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dOffset", _wID);
_wDaysEarlier = db_get_w(hContact, Module(), pszSetting, (WORD)-1);
}
else {
@@ -305,16 +305,16 @@ int MAnnivDate::DBWriteReminderOpts(MCONTACT hContact)
db_set_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, _wDaysEarlier);
}
else if (_wID <= ANID_LAST) {
- CHAR pszSetting[MAXSETTING];
+ char pszSetting[MAXSETTING];
// read reminder option
- mir_snprintf(pszSetting, MAXSETTING, "Anniv%dReminder", _wID);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dReminder", _wID);
if (_bRemind == BST_INDETERMINATE)
db_unset(hContact, USERINFO, pszSetting);
else
db_set_b(hContact, USERINFO, pszSetting, _bRemind);
// read offset
- mir_snprintf(pszSetting, MAXSETTING, "Anniv%dOffset", _wID);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dOffset", _wID);
if (_wDaysEarlier == (WORD)-1)
db_unset(hContact, USERINFO, pszSetting);
else
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index 8028dbc8a1..438c37dd4e 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -1349,7 +1349,7 @@ int CtrlContactAddMyItemsFromDB(
cbi.pszIcon = szIcon;
for (i = 0;
- SUCCEEDED(mir_snprintf(pszSetting, MAXSETTING, szFormatVal, i)) &&
+ SUCCEEDED(mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatVal, i)) &&
(cbi.wFlags = DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, pszSetting, &dbv));
i++)
{
@@ -1360,7 +1360,7 @@ int CtrlContactAddMyItemsFromDB(
dbv.ptszVal = NULL;
// read category
- if (SUCCEEDED(mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i))) {
+ if (SUCCEEDED(mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatCat, i))) {
if (cbi.wFlags & CTRLF_HASCUSTOM) {
if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbv))
dbv.type = DBVT_DELETED;
@@ -1480,13 +1480,13 @@ int CtrlContactWriteMyItemsToDB(
if (cbi.wFlags & CBEXIF_SMS) {
mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal));
}
- mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatCat, i);
if (*szCat && _tcsncmp(szCat, pszOther, ccOther)) {
if (db_set_ts(hContact, pszModule, pszSetting, szCat)) return 1;
}
else
db_unset(hContact, pszModule, pszSetting);
- mir_snprintf(pszSetting, MAXSETTING, szFormatVal, i);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatVal, i);
if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
cbi.wFlags &= ~CTRLF_CHANGED;
cbi.wMask = CBEXIM_FLAGS;
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index 234c070383..3f24799ba9 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -868,11 +868,11 @@ public:
if (_hDlg) {
// save list state
if (_hList) {
- CHAR pszSetting[MAXSETTING];
+ char pszSetting[MAXSETTING];
int c, cc = Header_GetItemCount(ListView_GetHeader(_hList));
for (c = 0; c < cc; c++) {
- mir_snprintf(pszSetting, MAXSETTING, "AnnivDlg_Col%d", c);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), "AnnivDlg_Col%d", c);
db_set_w(NULL, MODNAME, pszSetting, (WORD)ListView_GetColumnWidth(_hList, c));
}
DeleteAllItems();
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index e0a577d7b8..6730104dfd 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -387,9 +387,9 @@ BYTE Exists(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
void DeleteArray(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart)
{
- CHAR pszSetting[MAXSETTING];
+ char pszSetting[MAXSETTING];
do {
- mir_snprintf(pszSetting, MAXSETTING, pszFormat, iStart++);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), pszFormat, iStart++);
}
while (!db_unset(hContact, pszModule, pszSetting));
}
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp
index d8267f28bc..edeb7e472c 100644
--- a/plugins/UserInfoEx/src/psp_profile.cpp
+++ b/plugins/UserInfoEx/src/psp_profile.cpp
@@ -487,12 +487,12 @@ static int ProfileList_AddItemlistFromDB(
for (i = 0, lvi.iItem = iItem; ; i++) {
// read the setting from db
- mir_snprintf(pszSetting, MAXSETTING, szValFormat, i);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), szValFormat, i);
if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbvVal))
break;
if (dbvVal.type != DBVT_TCHAR)
continue;
- mir_snprintf(pszSetting, MAXSETTING, szCatFormat, i);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), szCatFormat, i);
DB::Setting::GetAString(hContact, pszModule, pszSetting, &dbvCat);
// create the itemobject
if (!(pItem = (LPLCITEM)mir_alloc(sizeof(LCITEM)))) {
@@ -1219,10 +1219,10 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
if (!pItem->pszText[1] || !*pItem->pszText[1])
continue;
if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) {
- mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), pFmt[iFmt].szValFmt, iItem);
db_set_ts(hContact, pszModule, pszSetting, pItem->pszText[1]);
// save category
- mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem);
+ mir_snprintf(pszSetting, SIZEOF(pszSetting), pFmt[iFmt].szCatFmt, iItem);
if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
db_set_s(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText);
else if (pItem->pszText[0] && *pItem->pszText[0])
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp
index 6b0cd74b25..b3bbdc880c 100644
--- a/plugins/YAMN/src/browser/mailbrowser.cpp
+++ b/plugins/YAMN/src/browser/mailbrowser.cpp
@@ -654,7 +654,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopupRun+MN->Virtual.PopupRun))
{
char sMsg[250];
- mir_snprintf(sMsg, 249, Translate("%s : %d new mail message(s), %d total"), ActualAccount->Name, MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC);
+ mir_snprintf(sMsg, SIZEOF(sMsg), Translate("%s : %d new mail message(s), %d total"), ActualAccount->Name, MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC);
if (!(nflags & YAMN_ACC_CONTNOEVENT)) {
CLISTEVENT cEvent;
cEvent.cbSize = sizeof(CLISTEVENT);
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp
index c679060a6b..36fffaa00d 100644
--- a/plugins/YAPP/src/options.cpp
+++ b/plugins/YAPP/src/options.cpp
@@ -453,11 +453,11 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
char setting[256];
for (int i = 0; i < arClasses.getCount(); i++) {
POPUPCLASS *pc = arClasses[i];
- mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/Timeout", pc->pszName);
db_set_w(0, MODULE, setting, pc->iSeconds);
- mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/TextCol", pc->pszName);
db_set_dw(0, MODULE, setting, (DWORD)pc->colorText);
- mir_snprintf(setting, 256, "%s/BgCol", pc->pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/BgCol", pc->pszName);
db_set_dw(0, MODULE, setting, (DWORD)pc->colorBack);
}
return TRUE;
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index 040e30f899..fd9454bb82 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -338,12 +338,12 @@ static INT_PTR RegisterPopupClass(WPARAM wParam, LPARAM lParam)
pc->pszDescription = mir_strdup(pc->pszDescription);
char setting[256];
- mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/Timeout", pc->pszName);
pc->iSeconds = db_get_w(0, MODULE, setting, pc->iSeconds);
if (pc->iSeconds == (WORD)-1) pc->iSeconds = -1;
- mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/TextCol", pc->pszName);
pc->colorText = (COLORREF)db_get_dw(0, MODULE, setting, (DWORD)pc->colorText);
- mir_snprintf(setting, 256, "%s/BgCol", pc->pszName);
+ mir_snprintf(setting, SIZEOF(setting), "%s/BgCol", pc->pszName);
pc->colorBack = (COLORREF)db_get_dw(0, MODULE, setting, (DWORD)pc->colorBack);
arClasses.insert(pc);