summaryrefslogtreecommitdiff
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
parentef741fcb36d679b094e44d01714f423c34357383 (diff)
code cleanup around mir_snprintf
git-svn-id: http://svn.miranda-ng.org/main/trunk@11285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-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
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp2
-rw-r--r--protocols/IcqOscarJ/src/UI/userinfotab.cpp4
-rw-r--r--protocols/IcqOscarJ/src/fam_04message.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp8
-rw-r--r--protocols/IcqOscarJ/src/fam_15icqserver.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_clients.cpp12
-rw-r--r--protocols/IcqOscarJ/src/icq_firstrun.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_http.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp10
-rw-r--r--protocols/IcqOscarJ/src/log.cpp2
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp2
-rw-r--r--protocols/JabberG/src/jabber_console.cpp10
-rw-r--r--protocols/Tlen/src/tlen_picture.cpp4
-rw-r--r--protocols/VKontakte/src/misc.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_base.cpp36
-rw-r--r--protocols/Xfire/src/Xfire_game.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_icon_mng.cpp4
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.cpp4
-rw-r--r--protocols/Xfire/src/addgamedialog.cpp14
-rw-r--r--protocols/Xfire/src/all_statusmsg.cpp4
-rw-r--r--protocols/Xfire/src/buddylist.cpp2
-rw-r--r--protocols/Xfire/src/iniupdater.cpp4
-rw-r--r--protocols/Xfire/src/main.cpp10
-rw-r--r--protocols/Xfire/src/userdetails.cpp12
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp2
-rw-r--r--protocols/Yahoo/src/yahoo.cpp2
-rw-r--r--src/mir_core/path.cpp4
-rw-r--r--src/modules/metacontacts/meta_menu.cpp2
-rw-r--r--src/modules/netlib/netliblog.cpp4
80 files changed, 361 insertions, 364 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);
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index f54dda4d3e..c43f9e0dfa 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -61,7 +61,7 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
*avatarurl = *avatarts = NULL;
char szUrl[128];
- mir_snprintf(szUrl, 128, "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
+ mir_snprintf(szUrl, SIZEOF(szUrl), "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
NETLIBHTTPREQUEST req = { sizeof(req) };
req.requestType = REQUEST_GET;
@@ -391,7 +391,7 @@ void __cdecl GGPROTO::setavatarthread(void *param)
size_t avatarFileB64EncLen = strlen(avatarFileB64Enc);
char dataPrefix[64];
- mir_snprintf(dataPrefix, 64, "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
+ mir_snprintf(dataPrefix, SIZEOF(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
size_t dataPrefixLen = strlen(dataPrefix);
size_t dataLen = dataPrefixLen + avatarFileB64EncLen;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 95c9902def..bc9bcbb0f1 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -439,7 +439,7 @@ void gg_debughandler(int level, const char *format, va_list ap)
strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
char prefix[6];
- mir_snprintf(prefix, PREFIXLEN, "%lu", GetCurrentThreadId());
+ mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId());
size_t prefixLen = strlen(prefix);
if (prefixLen < PREFIXLEN) memset(prefix + prefixLen, ' ', PREFIXLEN - prefixLen);
memcpy(szText, prefix, PREFIXLEN);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 0d80f7aef8..895f81a314 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -43,7 +43,7 @@ int GGPROTO::gc_init()
gc_enabled = TRUE;
// create & hook event
- mir_snprintf(service, 64, GG_GC_GETCHAT, m_szModuleName);
+ mir_snprintf(service, SIZEOF(service), GG_GC_GETCHAT, m_szModuleName);
debugLogA("gc_init(): Registered with groupchat plugin.");
}
else debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index 8b0f8f4a57..79aad2fa80 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -344,7 +344,7 @@ int GGPROTO::oauth_receivetoken()
mir_free(str);
str = oauth_uri_escape("http://www.mojageneracja.pl");
- mir_snprintf(szUrl, 256, "callback_url=%s&request_token=%s&uin=%s&password=%s",
+ mir_snprintf(szUrl, SIZEOF(szUrl), "callback_url=%s&request_token=%s&uin=%s&password=%s",
str, token, uin, password);
mir_free(str);
str = mir_strdup(szUrl);
diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp
index 4808b0ef7e..bc10bc47da 100644
--- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp
+++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp
@@ -93,11 +93,11 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac
if (dbv.wVal != 0) {
char szExtra[80];
- mir_snprintf(str, 250, "%d", dbv.wVal);
+ mir_snprintf(str, SIZEOF(str), "%d", dbv.wVal);
pstr = str;
if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1)) {
- ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, 80);
+ ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, SIZEOF(szExtra));
strcat(str, (char*)szExtra);
bUtf = 1;
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp
index 2e50ee5b62..fb91e8eafc 100644
--- a/protocols/IcqOscarJ/src/fam_04message.cpp
+++ b/protocols/IcqOscarJ/src/fam_04message.cpp
@@ -2627,7 +2627,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen, WORD wFlags, DW
char szMsg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- mir_snprintf(szMsg, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
+ mir_snprintf(szMsg, SIZEOF(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
ShowPopupMsg(hContact, ICQTranslateUtfStatic(LPGEN("ICQ Note"), szFormat, MAX_PATH), szMsg, LOG_NOTE);
SAFE_FREE((void**)&nick);
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 7ff96e0b9a..109c58cb79 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -179,7 +179,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea
szChange = "Server removed %u item(s) from list";
char szLogText[MAX_PATH];
- mir_snprintf(szLogText, MAX_PATH, szChange, nItems);
+ mir_snprintf(szLogText, SIZEOF(szLogText), szChange, nItems);
debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText);
}
}
@@ -1247,7 +1247,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou
char *nick = NickFromHandleUtf(hContact);
setByte(hContact, "Auth", 0);
- mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, MAX_PATH), nick);
+ mir_snprintf(str, SIZEOF(str), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, SIZEOF(msg)), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
@@ -1257,7 +1257,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou
char *nick = NickFromHandleUtf(hContact);
setByte(hContact, "Auth", 1);
- mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, MAX_PATH), nick);
+ mir_snprintf(str, SIZEOF(str), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, SIZEOF(msg)), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
@@ -1347,7 +1347,7 @@ void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wGrou
char msg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, MAX_PATH), nick);
+ mir_snprintf(str, SIZEOF(str), ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, SIZEOF(msg)), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
index c96e527c64..73e3ee06e6 100644
--- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp
+++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
@@ -525,7 +525,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo
for (int i = 0; i < nRecordDef; i++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, MAX_PATH, pRecordDef[i].szDbSetting, nRecords);
+ mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[i].szDbSetting, nRecords);
switch (pRecordDef[i].dbType) {
case DBVT_UTF8:
@@ -550,7 +550,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo
for (int i = nRecords; i <= nMaxRecords; i++)
for (int j = 0; j < nRecordDef; j++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, MAX_PATH, pRecordDef[j].szDbSetting, i);
+ mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[j].szDbSetting, i);
delSetting(hContact, szItemKey);
}
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp
index e70066b9ca..c69a4c81aa 100644
--- a/protocols/IcqOscarJ/src/icq_clients.cpp
+++ b/protocols/IcqOscarJ/src/icq_clients.cpp
@@ -479,7 +479,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse
strcpy(szClientBuf, "QIP Infium");
if (dwFT1) {
- mir_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
if (dwFT2 == 0x0B)
@@ -490,7 +490,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse
else if (MatchCapability(caps, wLen, &capQip2010, 12)) {
strcpy(szClientBuf, "QIP 2010");
if (dwFT1) {
- mir_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
@@ -499,7 +499,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse
else if (MatchCapability(caps, wLen, &capQip2012, 12)) {
strcpy(szClientBuf, "QIP 2012");
if (dwFT1) {
- mir_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
@@ -513,7 +513,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse
mir_snprintf(szClientBuf, 64, cliQip, ver);
if (dwFT1 && dwFT2 == 0x0E) {
- mir_snprintf(ver, 10, " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
+ mir_snprintf(ver, SIZEOF(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
strcat(szClientBuf, ver);
}
szClient = szClientBuf;
@@ -534,7 +534,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse
if (dwFT2 == 0x0FFFF0011 && dwFT3 == 0x1100FFFF && (dwFT1 >> 0x18)) {
char ver[16];
- mir_snprintf(ver, 10, " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
+ mir_snprintf(ver, SIZEOF(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
if ((dwFT1 & 0xFF) == 0x0B)
strcat(ver, " Beta");
strcat(szClientBuf, ver);
@@ -946,7 +946,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse
capstr* capId;
if (capId = MatchCapability(caps, wLen, &capMimPack, 4)) {
char szPack[16];
- mir_snprintf(szPack, 16, " [%.12s]", (*capId)+4);
+ mir_snprintf(szPack, SIZEOF(szPack), " [%.12s]", (*capId)+4);
// make sure client string is not constant
if (szClient != szClientBuf) {
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp
index 1880dd3364..ecb28faa31 100644
--- a/protocols/IcqOscarJ/src/icq_firstrun.cpp
+++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp
@@ -30,7 +30,7 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg)
char pszUIN[20];
DWORD dwUIN = ppro->getContactUin(NULL);
if (dwUIN) {
- mir_snprintf(pszUIN, 20, "%u", dwUIN);
+ mir_snprintf(pszUIN, SIZEOF(pszUIN), "%u", dwUIN);
SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp
index 545d52a7f3..0855bc5cd7 100644
--- a/protocols/IcqOscarJ/src/icq_http.cpp
+++ b/protocols/IcqOscarJ/src/icq_http.cpp
@@ -54,7 +54,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQU
unpackDWord(&buf, &dwSid2);
unpackDWord(&buf, &dwSid3);
unpackDWord(&buf, &dwSid4);
- mir_snprintf(szSid, 33, "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
+ mir_snprintf(szSid, SIZEOF(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
unpackWord(&buf, &wIpLen);
if(nlhr->dataLength < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1)
@@ -73,8 +73,8 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQU
nlhpi.szHttpGetUrl = szHttpGetUrl;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.firstPostSequence = 1;
- mir_snprintf(szHttpGetUrl, 300, "http://%s/monitor?sid=%s", szHttpServer, szSid);
- mir_snprintf(szHttpPostUrl, 300, "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
+ mir_snprintf(szHttpGetUrl, SIZEOF(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
+ mir_snprintf(szHttpPostUrl, SIZEOF(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
}
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index bb3c7d7a46..24b7350a75 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -740,14 +740,14 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
dat->ppro->setByte(DBSETTING_XSTATUS_ID, dat->bXStatus);
char *szValue = GetDlgItemTextUtf(hwndDlg,IDC_XMSG);
- mir_snprintf(szSetting, 64, "XStatus%dMsg", dat->bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dMsg", dat->bXStatus);
db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue);
db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_MSG, szValue);
SAFE_FREE(&szValue);
if (dat->ppro->m_bXStatusEnabled) {
szValue = GetDlgItemTextUtf(hwndDlg,IDC_XTITLE);
- mir_snprintf(szSetting, 64, "XStatus%dName", dat->bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dName", dat->bXStatus);
db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue);
db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_NAME, szValue);
SAFE_FREE(&szValue);
@@ -793,13 +793,13 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet)
char *szName = NULL, *szMsg = NULL;
if (m_bXStatusEnabled) {
- mir_snprintf(szSetting, 64, "XStatus%dName", bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dName", bXStatus);
szName = getSettingStringUtf(NULL, szSetting, ICQTranslateUtfStatic(nameXStatus[bXStatus-1], str, MAX_PATH));
}
- mir_snprintf(szSetting, 64, "XStatus%dMsg", bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dMsg", bXStatus);
szMsg = getSettingStringUtf(NULL, szSetting, "");
- mir_snprintf(szSetting, 64, "XStatus%dStat", bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dStat", bXStatus);
if (!bQuiet && !getByte(szSetting, 0)) {
InitXStatusData init;
init.ppro = this;
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp
index 9a51c88ea5..ccc3a1f2e8 100644
--- a/protocols/IcqOscarJ/src/log.cpp
+++ b/protocols/IcqOscarJ/src/log.cpp
@@ -144,6 +144,6 @@ void CIcqProto::icq_LogFatalParam(const char *szMsg, WORD wError)
char str[MAX_PATH];
char buf[MAX_PATH];
- mir_snprintf(buf, MAX_PATH, ICQTranslateUtfStatic(szMsg, str, MAX_PATH), wError);
+ mir_snprintf(buf, SIZEOF(buf), ICQTranslateUtfStatic(szMsg, str, SIZEOF(str)), wError);
icq_LogMessage(LOG_FATAL, buf);
}
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index 02a67bb89d..455b45ef4e 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -1587,7 +1587,7 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, size_t len)
char *pszMsg = ICQTranslateUtf(LPGEN("The checksum of file \"%s\" does not match, the file is probably damaged."));
char szBuf[MAX_PATH];
- mir_snprintf(szBuf, MAX_PATH, pszMsg, ExtractFileName(ft->szThisFile));
+ mir_snprintf(szBuf, SIZEOF(szBuf), pszMsg, ExtractFileName(ft->szThisFile));
icq_LogMessage(LOG_ERROR, szBuf);
SAFE_FREE(&pszMsg);
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index 304e48f770..bc5cf87266 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -195,8 +195,8 @@ static void sttEmptyBuf(StringBuf *buf)
static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
{
- char *indentLevel = (char *)mir_alloc(128);
- mir_snprintf(indentLevel, 128, RTF_INDENT_FMT, (int)(indent*200));
+ char indentLevel[128];
+ mir_snprintf(indentLevel, SIZEOF(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
@@ -229,10 +229,9 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
if (xmlGetText(node)) {
if (xmlGetChildCount(node)) {
sttAppendBufRaw(buf, RTF_BEGINTEXT);
- char *indentTextLevel = (char *)mir_alloc(128);
- mir_snprintf(indentTextLevel, 128, RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
+ char indentTextLevel[128];
+ mir_snprintf(indentTextLevel, SIZEOF(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
sttAppendBufRaw(buf, indentTextLevel);
- mir_free(indentTextLevel);
}
sttAppendBufT(buf, xmlGetText(node));
@@ -255,7 +254,6 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
else sttAppendBufRaw(buf, " />");
sttAppendBufRaw(buf, RTF_ENDTAG);
- mir_free(indentLevel);
}
DWORD CALLBACK sttStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp
index 0d39b3db7f..cfda82403b 100644
--- a/protocols/Tlen/src/tlen_picture.cpp
+++ b/protocols/Tlen/src/tlen_picture.cpp
@@ -221,7 +221,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
char fileName[MAX_PATH];
char *ext = TlenXmlGetAttrValue(node, "ext");
char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
- int tPathLen = mir_snprintf(fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath);
+ int tPathLen = mir_snprintf(fileName, SIZEOF(fileName), "%s\\Images\\Tlen", tmpPath);
long oldSize = 0, lSize = atol(size);
DWORD dwAttributes = GetFileAttributesA( fileName );
if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 )
@@ -229,7 +229,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
mir_free(tmpPath);
fileName[ tPathLen++ ] = '\\';
- mir_snprintf( fileName + tPathLen, MAX_PATH - tPathLen, "%s.%s", crc, ext );
+ mir_snprintf( fileName + tPathLen, SIZEOF(fileName) - tPathLen, "%s.%s", crc, ext );
fp = fopen( fileName, "rb" );
if (fp) {
fseek(fp, 0, SEEK_END);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index cd5c8ea838..473bc35bee 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -592,7 +592,7 @@ char* CVkProto::GetStickerId(const char* Msg, int &stickerid)
char* retMsg = NULL;
iRes = sscanf(Msg, "[sticker:%d]", &stickerid);
if (iRes == 1) {
- mir_snprintf(HeadMsg, 32, "[sticker:%d]", stickerid);
+ mir_snprintf(HeadMsg, SIZEOF(HeadMsg), "[sticker:%d]", stickerid);
size_t retLen = mir_strlen(HeadMsg);
if (retLen < mir_strlen(Msg))
retMsg = mir_strdup(&Msg[retLen]);
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp
index 602a198997..dd924bcff3 100644
--- a/protocols/Xfire/src/Xfire_base.cpp
+++ b/protocols/Xfire/src/Xfire_base.cpp
@@ -113,7 +113,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, char**to)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -131,7 +131,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, int id, char**to
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -149,7 +149,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, char**to)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -167,7 +167,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, int id, char
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -186,7 +186,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, int id, char*val)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
db_set_s(NULL, protocolname, temp, val);
}
@@ -198,7 +198,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, char*val)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_s(NULL, protocolname, temp, val);
}
@@ -210,7 +210,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, int id, char*
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -222,7 +222,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, char*val)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -235,7 +235,7 @@ void Xfire_base::writeBytetoDB(char*name, unsigned int dbid, int val)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_b(NULL, protocolname, temp, val);
}
@@ -247,7 +247,7 @@ void Xfire_base::writeWordtoDB(char*name, unsigned int dbid, int val)
return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_w(NULL, protocolname, temp, val);
}
@@ -260,7 +260,7 @@ unsigned char Xfire_base::readBytefromDB(char*name, unsigned int dbid, int defau
return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
return db_get_b(NULL, protocolname, temp, defaultval);
}
@@ -272,7 +272,7 @@ unsigned int Xfire_base::readWordfromDB(char*name, unsigned int dbid, int defaul
return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
return db_get_w(NULL, protocolname, temp, defaultval);
}
@@ -284,7 +284,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid)
return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -305,7 +305,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid, int id)
return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -479,7 +479,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char
return FALSE; //kein pfad bug?!?!
if (subid == 0) {
- mir_snprintf(idstring, 15, "%d", gameid);
+ mir_snprintf(idstring, SIZEOF(idstring), "%d", gameid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -487,7 +487,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char
subid++;
}
- mir_snprintf(idstring, 15, "%d_%d", gameid, subid);
+ mir_snprintf(idstring, SIZEOF(idstring), "%d_%d", gameid, subid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -521,8 +521,8 @@ BOOL Xfire_base::getGamename(unsigned int gameid, char* out, int outsize){
{
//customnamen laden, wenn vorhanden
DBVARIANT dbv;
- char dbstr[80] = "";
- mir_snprintf(dbstr, XFIRE_MAXSIZEOFGAMENAME, "customgamename_%d", gameid);
+ char dbstr[XFIRE_MAXSIZEOFGAMENAME];
+ mir_snprintf(dbstr, SIZEOF(dbstr), "customgamename_%d", gameid);
if (!db_get(NULL, protocolname, dbstr, &dbv)) {
strncpy_s(out, outsize, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp
index 1486ecaf16..776a6493b7 100644
--- a/protocols/Xfire/src/Xfire_game.cpp
+++ b/protocols/Xfire/src/Xfire_game.cpp
@@ -57,7 +57,7 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) {
//port begrenzen
port = port % 65535;
//port in string wandeln
- mir_snprintf(portstr, 6, "%d", port);
+ mir_snprintf(portstr, SIZEOF(portstr), "%d", port);
str_replace(mynetworkparams, "%UA_GAME_HOST_NAME%", ip);
str_replace(mynetworkparams, "%UA_GAME_HOST_PORT%", portstr);
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp
index 74028196f2..b469e44595 100644
--- a/protocols/Xfire/src/Xfire_icon_mng.cpp
+++ b/protocols/Xfire/src/Xfire_icon_mng.cpp
@@ -135,9 +135,9 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) {
//dll konnte geladen werden
if (hIconDll) {
- char resourcename[255] = "";
+ char resourcename[255];
//kurznamen des spiels uppercasen und .ICO anhängen
- mir_snprintf(resourcename, 255, "XF_%s.ICO", shortname);
+ mir_snprintf(resourcename, SIZEOF(resourcename), "XF_%s.ICO", shortname);
Xfire_base::strtoupper(resourcename);
//versuche die resource zufinden
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp
index 66454c026e..1d970d05ce 100644
--- a/protocols/Xfire/src/Xfire_voicechat.cpp
+++ b/protocols/Xfire/src/Xfire_voicechat.cpp
@@ -141,7 +141,7 @@ void Xfire_voicechat::resetSendGameStatus2Packet(SendGameStatus2Packet* packet)
//schreibt derzetigen status in die mirandadb für variables usw
void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) {
//für sprintf
- char temp[32] = "";
+ char temp[32];
if (packet == NULL || packet->gameid == XFIREVOICECHAT_NOVOICE) {
//einträge aus der db entfernen
@@ -151,7 +151,7 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) {
return;
}
//ip speichern
- mir_snprintf(temp, 32, "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch (packet->gameid) {
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp
index be2fae8617..7d1aefb1c0 100644
--- a/protocols/Xfire/src/addgamedialog.cpp
+++ b/protocols/Xfire/src/addgamedialog.cpp
@@ -144,12 +144,12 @@ static void FillGameList(LPVOID hwndDlg) {
if (z2 != zahlbuffer2)
{
listentry.gameid = MAKELONG(gameid, atoi(zahlbuffer2));
- mir_snprintf(gameidtemp, 10, "%d_%d", gameid, atoi(zahlbuffer2));
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid, atoi(zahlbuffer2));
}
else
{
listentry.gameid = gameid;
- mir_snprintf(gameidtemp, 10, "%d", gameid);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid);
}
@@ -345,13 +345,13 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg,
int gameid2 = HIWORD(gameids);
if (gameid2 != 0)
- mir_snprintf(gameidtemp, 10, "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, 10, "%d", gameid1);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
//spielnamen holen
if (xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
- mir_snprintf(gameidtemp, 10, "%d", gameid1);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
//einige felder vorbelegen
SetDlgItemTextA(hPage, IDC_ADD_NAME, ret);
@@ -389,9 +389,9 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg,
char ret[512];
if (gameid2 != 0)
- mir_snprintf(gameidtemp, 10, "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, 10, "%d", gameid1);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
//neuen gameeintrag anlegen
Xfire_game* newgame = new Xfire_game();
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp
index e542806744..46ec481c85 100644
--- a/protocols/Xfire/src/all_statusmsg.cpp
+++ b/protocols/Xfire/src/all_statusmsg.cpp
@@ -63,8 +63,8 @@ BOOL BackupStatusMsg() {
statusid = CallProtoService(temp[i]->szModuleName, PS_GETSTATUS, 0, 0);
XFireLog("Get Status of %s ...", temp[i]->szModuleName);
- char ttemp[128] = "";
- mir_snprintf(ttemp, 128, "%s%s", temp[i]->szModuleName, PS_SETAWAYMSG);
+ char ttemp[128];
+ mir_snprintf(ttemp, SIZEOF(ttemp), "%s%s", temp[i]->szModuleName, PS_SETAWAYMSG);
//xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
if (!temp[i]->bIsEnabled || statusid == ID_STATUS_INVISIBLE || statusid == ID_STATUS_OFFLINE || !mir_strcmpi(temp[i]->szModuleName, protocolname) || !ServiceExists(ttemp) || db_get_b(NULL, temp[i]->szModuleName, "LockMainStatus", 0) == 1)
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp
index 315c3e2a6e..ac3bfbf608 100644
--- a/protocols/Xfire/src/buddylist.cpp
+++ b/protocols/Xfire/src/buddylist.cpp
@@ -146,7 +146,7 @@ namespace xfirelib {
/* ## buddies im miranda verarbietn */
char temp[255];
char * dummy;
- mir_snprintf(temp,255,"Clan_%d",entry->clanid);
+ mir_snprintf(temp,SIZEOF(temp),"Clan_%d",entry->clanid);
DBVARIANT dbv;
if (!db_get(NULL,protocolname,temp,&dbv))
diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp
index 2f8ebe6ea9..f5f1e97aeb 100644
--- a/protocols/Xfire/src/iniupdater.cpp
+++ b/protocols/Xfire/src/iniupdater.cpp
@@ -61,7 +61,7 @@ void UpdateMyXFireIni(LPVOID dummy) {
strcat(file2, "xfire_games.ini");
strcat(file3, "xfire_games.old");
- mir_snprintf(request, 1024, "%s%d", INI_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, SIZEOF(request), "%s%d", INI_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
@@ -101,7 +101,7 @@ void UpdateMyIcons(LPVOID dummy) {
strcat(file2, "icons.dll");
strcat(file3, "icons.old");
- mir_snprintf(request, 1024, "%s%d", ICO_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, SIZEOF(request), "%s%d", ICO_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index 748e007aaa..99be8112ac 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -3081,13 +3081,13 @@ INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam)
void CreateGroup(char*grpn, char*field) {
DBVARIANT dbv;
- char* grp[255];
+ char grp[255];
int val = db_get_b(NULL, protocolname, field, 0);
if (val == 0)
{
- strcpy_s((char*)grp, 255, grpn);//((char*)clan->name[i].c_str());
+ strcpy_s(grp, SIZEOF(grp), grpn);//((char*)clan->name[i].c_str());
}
else
{
@@ -3097,12 +3097,12 @@ void CreateGroup(char*grpn, char*field) {
db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL)
{
- mir_snprintf((char*)grp, 255, "%s\\%s", &dbv.pszVal[1], (char*)grpn);
+ mir_snprintf(grp, SIZEOF(grp), "%s\\%s", &dbv.pszVal[1], grpn);
db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
- strcpy_s((char*)grp, 255, grpn);
+ strcpy_s(grp, SIZEOF(grp), grpn);
db_set_b(NULL, protocolname, field, 0);
}
}
@@ -3126,7 +3126,7 @@ void CreateGroup(char*grpn, char*field) {
db_free(&dbv);
}
strcpy_s(group, 255, "D");
- strcat_s(group, 255, (char*)grp);
+ strcat_s(group, 255, grp);
group[0] = 1 | GROUPF_EXPANDED;
mir_snprintf(temp, SIZEOF(temp), "%d", i + 1);
db_set_s(NULL, "CListGroups", temp, group);
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
index 5134172a2c..7f23afb3c7 100644
--- a/protocols/Xfire/src/userdetails.cpp
+++ b/protocols/Xfire/src/userdetails.cpp
@@ -380,30 +380,30 @@ char status[256]="";
char game[512]="";
if (!db_get(hContact,"ContactPhoto","File",&dbv))
{
-mir_snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
+mir_snprintf(img,SIZEOF(img),"<img src=\"%s\">",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Username",&dbv))
{
-mir_snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
+mir_snprintf(username,SIZEOF(username),"<b>Username:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Nick",&dbv))
{
-mir_snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
+mir_snprintf(nick,SIZEOF(nick),"<b>Nick:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
-mir_snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
+mir_snprintf(status,SIZEOF(status),"<b>Status:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"RGame",&dbv))
{
-mir_snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
+mir_snprintf(game,SIZEOF(game),"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
db_free(&dbv);
}
-mir_snprintf(profil,2056,"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
+mir_snprintf(profil,SIZEOF(profil),"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
WS_CHILD|WS_VISIBLE, 0, 0, 334, 249, hwndDlg, NULL,
::GetModuleHandle(NULL), NULL);
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index c73b469548..1bc0aa3eb6 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -556,7 +556,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_
char z[1024];
struct yahoo_file_info *fi = (struct yahoo_file_info *) f->data;
- mir_snprintf(z, 1024, "%s (%lu)\r\n", fi->filename, fi->filesize);
+ mir_snprintf(z, SIZEOF(z), "%s (%lu)\r\n", fi->filename, fi->filesize);
mir_strcat(fn, z);
fc++;
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index eb920fe9ba..70541ad599 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -1292,7 +1292,7 @@ void CYahooProto::ext_send_http_request(enum yahoo_connection_type type, const c
if (nlhr.requestType == REQUEST_POST) {
httpHeaders[nlhr.headersCount].szName="Content-Length";
- mir_snprintf(z, 1024, "%d", content_length);
+ mir_snprintf(z, SIZEOF(z), "%d", content_length);
httpHeaders[nlhr.headersCount].szValue=z;
nlhr.headersCount++;
diff --git a/src/mir_core/path.cpp b/src/mir_core/path.cpp
index d4148f457d..ab0ee26b14 100644
--- a/src/mir_core/path.cpp
+++ b/src/mir_core/path.cpp
@@ -77,8 +77,8 @@ MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char *base)
if (pSrc[0] == '\\')
pSrc++;
- mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc);
- return GetFullPathNameA(buf, MAX_PATH, pOut, NULL);
+ mir_snprintf(buf, SIZEOF(buf), "%s%s", base, pSrc);
+ return GetFullPathNameA(buf, SIZEOF(buf), pOut, NULL);
}
MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath)
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp
index f2b1822e6d..4dc8c390c1 100644
--- a/src/modules/metacontacts/meta_menu.cpp
+++ b/src/modules/metacontacts/meta_menu.cpp
@@ -296,7 +296,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
// show hide nudge menu item
char serviceFunc[256];
- mir_snprintf(serviceFunc, 256, "%s%s", GetContactProto(Meta_GetMostOnline(cc)), PS_SEND_NUDGE);
+ mir_snprintf(serviceFunc, SIZEOF(serviceFunc), "%s%s", GetContactProto(Meta_GetMostOnline(cc)), PS_SEND_NUDGE);
CallService(MS_NUDGE_SHOWMENU, (WPARAM)META_PROTO, ServiceExists(serviceFunc));
return 0;
}
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index 482aa33200..90c77aafe1 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -329,9 +329,9 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
char *szUser = (logOptions.showUser) ? (nlu == NULL ? NULL : nlu->user.szSettingsModule) : NULL;
if (szUser)
- mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser);
+ mir_snprintf(szHead, SIZEOF(szHead), "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser);
else
- mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%04X] ", szTime, GetCurrentThreadId());
+ mir_snprintf(szHead, SIZEOF(szHead), "[%s%04X] ", szTime, GetCurrentThreadId());
if (logOptions.toOutputDebugString) {
if (szHead[0])