From b7c74cd5b22618d544a3f4ae124985d4837e3a22 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jun 2015 22:12:13 +0000 Subject: new mir_snprintf templates without SIZEOF git-svn-id: http://svn.miranda-ng.org/main/trunk@14002 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdaway/src/sendmsg.cpp | 2 +- src/core/stdchat/src/options.cpp | 2 +- src/core/stdchat/src/tools.cpp | 10 +++++----- src/core/stdclist/src/clcfonts.cpp | 2 +- src/core/stdclist/src/cluiopts.cpp | 4 ++-- src/core/stdfile/src/filerecvdlg.cpp | 8 ++++---- src/core/stdfile/src/filesenddlg.cpp | 2 +- src/core/stdmsg/src/msgoptions.cpp | 12 ++++++------ src/core/stduserinfo/src/contactinfo.cpp | 16 ++++++++-------- src/core/stduserinfo/src/stdinfo.cpp | 14 +++++++------- 10 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/core') diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 4b36e6aa15..5f5246dde4 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -75,7 +75,7 @@ static const char *StatusModeToDbSetting(int status, const char *suffix) case ID_STATUS_IDLE: prefix = "Idl"; break; default: return NULL; } - mir_snprintf(str, SIZEOF(str), "%s%s", prefix, suffix); + mir_snprintf(str, "%s%s", prefix, suffix); return str; } diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 8a5536ec24..84b1fc6fb4 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -309,7 +309,7 @@ void AddIcons(void) HICON LoadIconEx(char* pszIcoLibName, BOOL big) { char szTemp[256]; - mir_snprintf(szTemp, SIZEOF(szTemp), "chat_%s", pszIcoLibName); + mir_snprintf(szTemp, "chat_%s", pszIcoLibName); return Skin_GetIcon(szTemp, big); } diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index b886edf0d5..284499ef98 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -28,16 +28,16 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour) int i = 8; // MSGFONTID_MESSAGEAREA if (colour) { - mir_snprintf(str, SIZEOF(str), "SRMFont%dCol", i); + mir_snprintf(str, "SRMFont%dCol", i); *colour = db_get_dw(NULL, "SRMM", str, 0); } if (lf) { - mir_snprintf(str, SIZEOF(str), "SRMFont%dSize", i); + mir_snprintf(str, "SRMFont%dSize", i); lf->lfHeight = (char)db_get_b(NULL, "SRMM", str, -12); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; - mir_snprintf(str, SIZEOF(str), "SRMFont%dSty", i); + mir_snprintf(str, "SRMFont%dSty", i); int style = db_get_b(NULL, "SRMM", str, 0); lf->lfWeight = style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & DBFONTF_ITALIC ? 1 : 0; @@ -47,7 +47,7 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour) lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - mir_snprintf(str, SIZEOF(str), "SRMFont%d", i); + mir_snprintf(str, "SRMFont%d", i); DBVARIANT dbv; if (db_get_ts(NULL, "SRMM", str, &dbv)) @@ -56,7 +56,7 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour) mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); db_free(&dbv); } - mir_snprintf(str, SIZEOF(str), "SRMFont%dSet", i); + mir_snprintf(str, "SRMFont%dSet", i); lf->lfCharSet = db_get_b(NULL, "SRMM", str, DEFAULT_CHARSET); } return true; diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index 02ae7b298e..873fb00d56 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -73,7 +73,7 @@ void RegisterCListFonts() _tcsncpy(fontid.name, clistFontDescr[i].tszName, SIZEOF(fontid.name)); char idstr[10]; - mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); + mir_snprintf(idstr, "Font%d", i); strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); fontid.order = i; FontRegisterT(&fontid); diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 5a755bec3c..50b947abf1 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -140,9 +140,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_HSCROLL: { char str[10]; - mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255); + mir_snprintf(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255); SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str); - mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255); + mir_snprintf(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255); SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str); } if (wParam != 0x12345678) diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index d49fd5f3db..a092b1449f 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l for (int i = 0; i < MAX_MRU_DIRS; i++) { char idstr[32]; - mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i); + mir_snprintf(idstr, "MruDir%d", i); DBVARIANT dbv; if (db_get_ts(NULL, "SRFile", idstr, &dbv)) @@ -276,7 +276,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case CNFT_DWORD: hasName = 1; - mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal); + mir_snprintf(buf, "%u", ci.dVal); break; } } @@ -348,9 +348,9 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int i; DBVARIANT dbv; for (i = MAX_MRU_DIRS-2;i>=0;i--) { - mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i); + mir_snprintf(idstr, "MruDir%d", i); if (db_get_ts(NULL, "SRFile", idstr, &dbv)) continue; - mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i+1); + mir_snprintf(idstr, "MruDir%d", i+1); db_set_ts(NULL, "SRFile", idstr, dbv.ptszVal); db_free(&dbv); } diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index bb4128b9dd..5516373588 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case CNFT_DWORD: hasName = 1; - mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal); + mir_snprintf(buf, "%u", ci.dVal); break; } } diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index f7e1ddeb2a..d2a22249e3 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -59,16 +59,16 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) char str[32]; if (colour) { - mir_snprintf(str, SIZEOF(str), "SRMFont%dCol", i); + mir_snprintf(str, "SRMFont%dCol", i); *colour = db_get_dw(NULL, SRMMMOD, str, fontOptionsList[i].defColour); } if (lf) { - mir_snprintf(str, SIZEOF(str), "SRMFont%dSize", i); + mir_snprintf(str, "SRMFont%dSize", i); lf->lfHeight = (char)db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; - mir_snprintf(str, SIZEOF(str), "SRMFont%dSty", i); + mir_snprintf(str, "SRMFont%dSty", i); int style = db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defStyle); lf->lfWeight = style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & DBFONTF_ITALIC ? 1 : 0; @@ -78,7 +78,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - mir_snprintf(str, SIZEOF(str), "SRMFont%d", i); + mir_snprintf(str, "SRMFont%d", i); DBVARIANT dbv; if (db_get_ts(NULL, SRMMMOD, str, &dbv)) @@ -87,7 +87,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); db_free(&dbv); } - mir_snprintf(str, SIZEOF(str), "SRMFont%dSet", i); + mir_snprintf(str, "SRMFont%dSet", i); lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); } return true; @@ -103,7 +103,7 @@ void RegisterSRMMFonts(void) strncpy_s(fontid.dbSettingsGroup, SRMMMOD, _TRUNCATE); _tcsncpy_s(fontid.group, LPGENT("Message log"), _TRUNCATE); _tcsncpy_s(fontid.name, fontOptionsList[i].szDescr, _TRUNCATE); - mir_snprintf(idstr, SIZEOF(idstr), "SRMFont%d", i); + mir_snprintf(idstr, "SRMFont%d", i); strncpy_s(fontid.prefix, idstr, _TRUNCATE); fontid.order = i; diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index 301371a4ef..b06a8c795d 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -277,7 +277,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.pszText = TranslateT("Primary"); } else { - mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i); + mir_snprintf(idstr, "e-mail%d", i); if (db_get_ts(hContact, szProto, idstr, &dbv)) break; @@ -292,7 +292,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iSubItem = 0; for (i=0;;i++) { lvi.lParam = i; - mir_snprintf(idstr, SIZEOF(idstr), "Mye-mail%d", i); + mir_snprintf(idstr, "Mye-mail%d", i); if (db_get_ts(hContact, "UserInfo", idstr, &dbv)) break; lvi.pszText = idstr2; @@ -353,7 +353,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iSubItem = 0; for (i=0;; i++) { lvi.lParam = i; - mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d", i); + mir_snprintf(idstr, "MyPhone%d", i); if (db_get_ts(hContact, "UserInfo", idstr, &dbv)) break; lvi.pszText = idstr2; @@ -464,7 +464,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szNewData)) break; for (int i=0;; i++) { - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i); + mir_snprintf(idstr, szIdTemplate, i); if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break; db_free(&dbv); } @@ -477,13 +477,13 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char idstr[33]; DBVARIANT dbv; for (i = lvi.lParam;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i+1); + mir_snprintf(idstr, szIdTemplate, i+1); if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break; - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i); + mir_snprintf(idstr, szIdTemplate, i); db_set_s(hContact, "UserInfo", idstr, dbv.pszVal); db_free(&dbv); } - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i); + mir_snprintf(idstr, szIdTemplate, i); db_unset(hContact, "UserInfo", idstr); SendMessage(hwndDlg, M_REMAKELISTS, 0, 0); } @@ -491,7 +491,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP //edit char szText[256], idstr[33]; DBVARIANT dbv; - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam); + mir_snprintf(idstr, szIdTemplate, lvi.lParam); if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break; mir_strncpy(szText, dbv.pszVal, SIZEOF(szText)); db_free(&dbv); diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 3b6e387dd0..197d24440c 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -97,7 +97,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule if (dbv.cVal == -100) unspecified = 1; else { pstr = str; - mir_snprintf(str, SIZEOF(str), dbv.cVal ? "UTC%+d:%02d" : "UTC", -dbv.cVal / 2, (dbv.cVal & 1) * 30); + mir_snprintf(str, dbv.cVal ? "UTC%+d:%02d" : "UTC", -dbv.cVal / 2, (dbv.cVal & 1) * 30); } } else { @@ -406,11 +406,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iSubItem = 0; lvi.iItem = 0; for (i=0;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i); + mir_snprintf(idstr, "Past%d", i); if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) || ( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv))) break; - mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i); + mir_snprintf(idstr, "Past%dText", i); if (db_get_ts(hContact, szProto, idstr, &dbvText)) {if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;} lvi.pszText = dbv.ptszVal; @@ -425,11 +425,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } for (i=0;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i); + mir_snprintf(idstr, "Affiliation%d", i); if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) || ( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv))) break; - mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i); + mir_snprintf(idstr, "Affiliation%dText", i); if (db_get_ts(hContact, szProto, idstr, &dbvText)) {if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;} lvi.pszText = dbv.ptszVal; @@ -451,11 +451,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iSubItem = 0; lvi.iItem = 0; for (i=0;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i); + mir_snprintf(idstr, "Interest%dCat", i); if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) || ( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv))) break; - mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i); + mir_snprintf(idstr, "Interest%dText", i); if (db_get_ts(hContact, szProto, idstr, &dbvText)) {if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;} lvi.pszText = dbv.ptszVal; -- cgit v1.2.3