From c370af60855db957c5b200914bf0bde743845528 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Aug 2015 16:22:41 +0000 Subject: mir_sntprintf / mir_snprintf: obsoleted second parameter removed wherever possible git-svn-id: http://svn.miranda-ng.org/main/trunk@15064 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdauth/src/auth.cpp | 10 +-- src/core/stdauth/src/authdialogs.cpp | 24 ++--- src/core/stdaway/src/awaymsg.cpp | 6 +- src/core/stdaway/src/sendmsg.cpp | 4 +- src/core/stdchat/src/main.cpp | 2 +- src/core/stdchat/src/tools.cpp | 2 +- src/core/stdchat/src/window.cpp | 16 ++-- src/core/stdfile/src/file.cpp | 2 +- src/core/stdfile/src/fileexistsdlg.cpp | 4 +- src/core/stdfile/src/fileopts.cpp | 2 +- src/core/stdfile/src/filerecvdlg.cpp | 4 +- src/core/stdfile/src/filesenddlg.cpp | 8 +- src/core/stdfile/src/filexferdlg.cpp | 12 +-- src/core/stdhelp/src/about.cpp | 2 +- src/core/stdmsg/src/msgdialog.cpp | 8 +- src/core/stdmsg/src/msglog.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 8 +- src/core/stdssl/src/netlibssl.cpp | 2 +- src/core/stduihist/src/history.cpp | 4 +- src/core/stduserinfo/src/contactinfo.cpp | 10 +-- src/core/stduserinfo/src/stdinfo.cpp | 4 +- src/core/stduserinfo/src/userinfo.cpp | 4 +- src/core/stduseronline/src/useronline.cpp | 2 +- src/mir_app/src/DefaultExtraIcons.cpp | 2 +- src/mir_app/src/FontOptions.cpp | 2 +- src/mir_app/src/chat_log.cpp | 4 +- src/mir_app/src/chat_opts.cpp | 2 +- src/mir_app/src/chat_tools.cpp | 15 ++-- src/mir_app/src/clc.cpp | 8 +- src/mir_app/src/clcutils.cpp | 2 +- src/mir_app/src/clistmod.cpp | 2 +- src/mir_app/src/clui.cpp | 4 +- src/mir_app/src/cluiservices.cpp | 2 +- src/mir_app/src/database.cpp | 12 +-- src/mir_app/src/dbini.cpp | 2 +- src/mir_app/src/dbutils.cpp | 6 +- src/mir_app/src/groups.cpp | 8 +- src/mir_app/src/hotkeys.cpp | 4 +- src/mir_app/src/icolib.cpp | 2 +- src/mir_app/src/lpopts.cpp | 4 +- src/mir_app/src/menu_clist.cpp | 6 +- src/mir_app/src/menu_options.cpp | 10 +-- src/mir_app/src/menu_utils.cpp | 8 +- src/mir_app/src/meta_menu.cpp | 2 +- src/mir_app/src/meta_services.cpp | 4 +- src/mir_app/src/meta_utils.cpp | 6 +- src/mir_app/src/netlibhttp.cpp | 6 +- src/mir_app/src/netliblog.cpp | 12 +-- src/mir_app/src/netlibopts.cpp | 2 +- src/mir_app/src/netlibsock.cpp | 2 +- src/mir_app/src/netlibupnp.cpp | 17 +--- src/mir_app/src/newplugins.cpp | 14 +-- src/mir_app/src/options.cpp | 2 +- src/mir_app/src/path.cpp | 16 ++-- src/mir_app/src/pluginopts.cpp | 2 +- src/mir_app/src/profilemanager.cpp | 18 ++-- src/mir_app/src/proto_opts.cpp | 8 +- src/mir_app/src/skin2opts.cpp | 6 +- src/mir_app/src/skinicons.cpp | 142 +++++++++++++++--------------- src/mir_app/src/sounds.cpp | 4 +- src/mir_app/src/xmlParser.cpp | 2 +- src/mir_core/src/langpack.cpp | 8 +- src/mir_core/src/miranda.cpp | 4 +- src/mir_core/src/winutil.cpp | 16 ++-- 64 files changed, 264 insertions(+), 276 deletions(-) (limited to 'src') diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp index 29297e7426..74c7855d26 100644 --- a/src/core/stdauth/src/auth.cpp +++ b/src/core/stdauth/src/auth.cpp @@ -80,7 +80,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) break; case CNFT_DWORD: - mir_sntprintf(szUid, _countof(szUid), _T("%u"), ci.dVal); + mir_sntprintf(szUid, _T("%u"), ci.dVal); break; } } @@ -88,9 +88,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) if (dbei.eventType == EVENTTYPE_AUTHREQUEST) { SkinPlaySound("AuthRequest"); if (szUid[0]) - mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%s requests authorization"), szUid); + mir_sntprintf(szTooltip, TranslateT("%s requests authorization"), szUid); else - mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob); + mir_sntprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob); cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST); cli.pszService = MS_AUTH_SHOWREQUEST; @@ -99,9 +99,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) else if (dbei.eventType == EVENTTYPE_ADDED) { SkinPlaySound("AddedEvent"); if (szUid[0]) - mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%s added you to their contact list"), szUid); + mir_sntprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid); else - mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob); + mir_sntprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob); cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD); cli.pszService = MS_AUTH_SHOWADDED; diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 85b08c1a20..0156498b77 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -63,11 +63,11 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TCHAR name[128] = _T(""); int off = 0; if (firstT[0] && lastT[0]) - off = mir_sntprintf(name, _countof(name), _T("%s %s"), firstT, lastT); + off = mir_sntprintf(name, _T("%s %s"), firstT, lastT); else if (firstT[0]) - off = mir_sntprintf(name, _countof(name), _T("%s"), firstT); + off = mir_sntprintf(name, _T("%s"), firstT); else if (lastT[0]) - off = mir_sntprintf(name, _countof(name), _T("%s"), lastT); + off = mir_sntprintf(name, _T("%s"), lastT); if (nickT[0]) { if (off) mir_sntprintf(name + off, _countof(name) - off, _T(" (%s)"), nickT); @@ -79,11 +79,11 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TCHAR hdr[256]; if (uin && emailT[0]) - mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName); else if (uin) - mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName); else - mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName); SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr); @@ -188,11 +188,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR name[128] = _T(""); int off = 0; if (firstT[0] && lastT[0]) - off = mir_sntprintf(name, _countof(name), _T("%s %s"), (TCHAR*)firstT, (TCHAR*)lastT); + off = mir_sntprintf(name, _T("%s %s"), (TCHAR*)firstT, (TCHAR*)lastT); else if (firstT[0]) - off = mir_sntprintf(name, _countof(name), _T("%s"), (TCHAR*)firstT); + off = mir_sntprintf(name, _T("%s"), (TCHAR*)firstT); else if (lastT[0]) - off = mir_sntprintf(name, _countof(name), _T("%s"), (TCHAR*)lastT); + off = mir_sntprintf(name, _T("%s"), (TCHAR*)lastT); if (mir_tstrlen(nickT)) { if (off) mir_sntprintf(name + off, _countof(name) - off, _T(" (%s)"), (TCHAR*)nickT); @@ -204,11 +204,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR hdr[256]; if (uin && emailT[0]) - mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName); else if (uin) - mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName); else - mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName); SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr); SetDlgItemText(hwndDlg, IDC_REASON, reasonT); diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index 9c333cef1b..477749441f 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -61,11 +61,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); GetWindowText(hwndDlg, format, _countof(format)); - mir_sntprintf(str, _countof(str), format, status, contactName); + mir_sntprintf(str, format, status, contactName); SetWindowText(hwndDlg, str); GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format)); - mir_sntprintf(str, _countof(str), format, status); + mir_sntprintf(str, format, status); SetDlgItemText(hwndDlg, IDC_RETRIEVING, str); Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus); @@ -141,7 +141,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) { if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) { TCHAR str[128]; - mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0)); + mir_sntprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0)); Menu_ModifyItem(hAwayMsgMenuItem, str, Skin_LoadProtoIcon(szProto, status), CMIF_NOTOFFLINE); return 0; } diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 9fce5c6ef4..ea1589a372 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -226,7 +226,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa { TCHAR str[256], format[128]; GetWindowText(hwndDlg, format, _countof(format)); - mir_sntprintf(str, _countof(str), format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0)); + mir_sntprintf(str, format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0)); SetWindowText(hwndDlg, str); } GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, _countof(dat->okButtonFormat)); @@ -247,7 +247,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa case WM_TIMER: if (--dat->countdown >= 0) { TCHAR str[64]; - mir_sntprintf(str, _countof(str), dat->okButtonFormat, dat->countdown); + mir_sntprintf(str, dat->okButtonFormat, dat->countdown); SetDlgItemText(hwndDlg, IDOK, str); } else { diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index a65c523c7b..943ddd594b 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -471,7 +471,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg) { WCHAR szwName[64]; char szName[64]; - mir_snprintf(szName, _countof(szName), "s%u", nextStgId++); + mir_snprintf(szName, "s%u", nextStgId++); MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName)); if (pictStg == NULL) return STG_E_MEDIUMFULL; diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 4f721cd819..b8bab73b79 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -135,7 +135,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO if (pszWordText && pszWordText[0]) { TCHAR szMenuText[4096]; - mir_sntprintf(szMenuText, _countof(szMenuText), TranslateT("Look up '%s':"), pszWordText); + mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText); ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText); } else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up")); diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 2ad1e6c126..1fae21565d 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -996,7 +996,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *si } if (tszBuf[0] == 0) - mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"), + mir_sntprintf(tszBuf, _T("%s: %s\r\n%s: %s\r\n%s: %s"), TranslateT("Nickname"), ui->pszNick, TranslateT("Unique ID"), ui->pszUID, TranslateT("Status"), pci->TM_WordToString(si->pStatuses, ui->Status)); @@ -1149,13 +1149,13 @@ static int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, char * szModule, GetWindowPlacement(hwnd, &wp); char szSettingName[64]; - mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix); + mir_snprintf(szSettingName, "%sx", szNamePrefix); int x = db_get_dw(hContact, szModule, szSettingName, -1); - mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix); + mir_snprintf(szSettingName, "%sy", szNamePrefix); int y = (int)db_get_dw(hContact, szModule, szSettingName, -1); - mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix); + mir_snprintf(szSettingName, "%swidth", szNamePrefix); int width = db_get_dw(hContact, szModule, szSettingName, -1); - mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix); + mir_snprintf(szSettingName, "%sheight", szNamePrefix); int height = db_get_dw(hContact, szModule, szSettingName, -1); if (x == -1) @@ -2332,7 +2332,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item); if (ui != NULL) { static TCHAR ptszBuf[1024]; - mir_sntprintf(ptszBuf, _countof(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"), + mir_sntprintf(ptszBuf, _T("%s: %s\r\n%s: %s\r\n%s: %s"), TranslateT("Nickname"), ui->pszNick, TranslateT("Unique ID"), ui->pszUID, TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status)); @@ -2451,11 +2451,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar _tcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE); ValidateFilename(szName); - mir_sntprintf(szFolder, _countof(szFolder), _T("%s\\%s"), g_Settings.pszLogDir, szName); + mir_sntprintf(szFolder, _T("%s\\%s"), g_Settings.pszLogDir, szName); mir_sntprintf(szName, _T("%s.log"), si->ptszID); ValidateFilename(szName); - mir_sntprintf(szFile, _countof(szFile), _T("%s\\%s"), szFolder, szName); + mir_sntprintf(szFile, _T("%s\\%s"), szFolder, szName); ShellExecute(hwndDlg, _T("open"), szFile, NULL, NULL, SW_SHOW); } } diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 49d6cf72b1..9ba716b21f 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -123,7 +123,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) SkinPlaySound("RecvFile"); TCHAR szTooltip[256]; - mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = szTooltip; cle.flags |= CLEF_TCHAR; diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index ea087b0f24..ef765b56bf 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -37,7 +37,7 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime) FileTimeToSystemTime(&filetime, &st); GetTimeFormatA(LOCALE_USER_DEFAULT, 0, &st, NULL, szTime, _countof(szTime)); GetDateFormatA(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szDate, _countof(szDate)); - mir_snprintf(szOutput, _countof(szOutput), "%s %s", szDate, szTime); + mir_snprintf(szOutput, "%s %s", szDate, szTime); SetDlgItemTextA(hwndDlg, idCtrl, szOutput); } @@ -156,7 +156,7 @@ void __cdecl LoadIconsAndTypesThread(void* param) } CharUpper(szExtension); if (fileInfo.szTypeName[0] == '\0') - mir_sntprintf(fileInfo.szTypeName, _countof(fileInfo.szTypeName), TranslateT("%s file"), szExtension); + mir_sntprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension); SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName); SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName); SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0); diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index da087ad49f..b58b539f58 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -127,7 +127,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iScanner >= _countof(virusScanners) || iScanner < 0) break; str[0] = '\0'; if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, _countof(szScanExe))) - mir_sntprintf(str, _countof(str), virusScanners[iScanner].szCommandLine, szScanExe); + mir_sntprintf(str, virusScanners[iScanner].szCommandLine, szScanExe); SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str); } break; diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index e8b7cda08c..09d5b16d99 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -129,7 +129,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO if (tszRecvPath) _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else - mir_sntprintf(tszTemp, _countof(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files")); + mir_sntprintf(tszTemp, _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files")); if (hContact) { hContact = db_mc_tryMeta(hContact); @@ -169,7 +169,7 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) if (tszRecvPath) _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else - mir_sntprintf(tszTemp, _countof(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files")); + mir_sntprintf(tszTemp, _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files")); patchDir(tszTemp, _countof(tszTemp)); RemoveInvalidPathChars(tszTemp); diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index f719012644..75d955897b 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -49,16 +49,16 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) if (i > 1) { TCHAR szFormat[32]; if (fileCount && dirCount) { - mir_sntprintf(szFormat, _countof(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1 ? _T("%d file") : _T("%d files")), TranslateTS(dirCount == 1 ? _T("%d directory") : _T("%d directories"))); - mir_sntprintf(str, _countof(str), szFormat, fileCount, dirCount); + mir_sntprintf(szFormat, _T("%s, %s"), TranslateTS(fileCount == 1 ? _T("%d file") : _T("%d files")), TranslateTS(dirCount == 1 ? _T("%d directory") : _T("%d directories"))); + mir_sntprintf(str, szFormat, fileCount, dirCount); } else if (fileCount) { mir_tstrcpy(szFormat, TranslateT("%d files")); - mir_sntprintf(str, _countof(str), szFormat, fileCount); + mir_sntprintf(str, szFormat, fileCount); } else { mir_tstrcpy(szFormat, TranslateT("%d directories")); - mir_sntprintf(str, _countof(str), szFormat, dirCount); + mir_sntprintf(str, szFormat, dirCount); } SetDlgItemText(hwndDlg, IDC_FILE, str); } diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 1073ce9351..804318123b 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -105,7 +105,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) if (info->szFile[mir_tstrlen(info->szFile) - 1] == '\\') info->szFile[mir_tstrlen(info->szFile) - 1] = '\0'; *pszReplace = 0; - mir_sntprintf(szCmdLine, _countof(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2); + mir_sntprintf(szCmdLine, _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2); } else _tcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); @@ -139,7 +139,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL; if (fn && (fts->totalFiles > 1)) { - mir_sntprintf(msg, _countof(msg), _T("%s: %s (%d %s %d)"), + mir_sntprintf(msg, _T("%s: %s (%d %s %d)"), pcli->pfnGetContactDisplayName(fts->hContact, 0), fn, fts->currentFileNumber + 1, TranslateT("of"), fts->totalFiles); @@ -147,7 +147,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE dat->hIcon = shfi.hIcon; } else if (fn) { - mir_sntprintf(msg, _countof(msg), _T("%s: %s"), pcli->pfnGetContactDisplayName(fts->hContact, 0), fn); + mir_sntprintf(msg, _T("%s: %s"), pcli->pfnGetContactDisplayName(fts->hContact, 0), fn); SHGetFileInfo(fn, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON); dat->hIcon = shfi.hIcon; @@ -322,7 +322,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, _countof(szTime)); } - mir_sntprintf(szDisplay, _countof(szDisplay), _T("%s/%s (%s %s)"), szSpeed, TranslateT("sec"), szTime, TranslateT("remaining")); + mir_sntprintf(szDisplay, _T("%s/%s (%s %s)"), szSpeed, TranslateT("sec"), szTime, TranslateT("remaining")); SetDlgItemText(hwndDlg, IDC_ALLSPEED, szDisplay); } break; @@ -596,14 +596,14 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR const unsigned long nextPos = fts->totalBytes ? (BIGI(100) * fts->totalProgress / fts->totalBytes) : 0; if (lastPos != nextPos || firstTime) { SendDlgItemMessage(hwndDlg, IDC_ALLFILESPROGRESS, PBM_SETPOS, nextPos, 0); - mir_sntprintf(str, _countof(str), _T("%u%%"), nextPos); + mir_sntprintf(str, _T("%u%%"), nextPos); SetDlgItemText(hwndDlg, IDC_ALLPRECENTS, str); } int units; GetSensiblyFormattedSize(fts->totalBytes, szSizeTotal, _countof(szSizeTotal), 0, 1, &units); GetSensiblyFormattedSize(fts->totalProgress, szSizeDone, _countof(szSizeDone), units, 0, NULL); - mir_sntprintf(str, _countof(str), _T("%s/%s"), szSizeDone, szSizeTotal); + mir_sntprintf(str, _T("%s/%s"), szSizeDone, szSizeTotal); str2[0] = 0; GetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str2, _countof(str2)); if (mir_tstrcmp(str, str2)) diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index 366a9929f1..272ff76db1 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -51,7 +51,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(productVersion), (LPARAM)productVersion); TCHAR str[64]; - mir_sntprintf(str, _countof(str), STR_VERSION_FORMAT, productVersion); + mir_sntprintf(str, STR_VERSION_FORMAT, productVersion); SetDlgItemText(hwndDlg, IDC_HEADERBAR, str); } ShowWindow(GetDlgItem(hwndDlg, IDC_CREDITSFILE), SW_HIDE); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index dabe41f5f1..5ed973eab0 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -956,7 +956,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l TCHAR date[64], time[64], fmt[128]; TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, _countof(date), 0); TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, _countof(time), 0); - mir_sntprintf(fmt, _countof(fmt), TranslateT("Last message received on %s at %s."), date, time); + mir_sntprintf(fmt, TranslateT("Last message received on %s at %s."), date, time); SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)fmt); } else SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)_T("")); @@ -1051,9 +1051,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0); if (statusIcon) - mir_sntprintf(newtitle, _countof(newtitle), _T("%s - %s"), contactName, TranslateT("Message session")); + mir_sntprintf(newtitle, _T("%s - %s"), contactName, TranslateT("Message session")); else - mir_sntprintf(newtitle, _countof(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session")); + mir_sntprintf(newtitle, _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session")); DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam; if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) { @@ -1297,7 +1297,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l TCHAR* szContactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); HICON hTyping = Skin_LoadIcon(SKINICON_OTHER_TYPING); - mir_sntprintf(szBuf, _countof(szBuf), TranslateT("%s is typing a message..."), szContactName); + mir_sntprintf(szBuf, TranslateT("%s is typing a message..."), szContactName); dat->nTypeSecs--; SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index c459a50fb8..d1ebe85ad0 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -212,7 +212,7 @@ static char *SetToStyle(int style) LOGFONT lf; LoadMsgDlgFont(style, &lf, NULL); - mir_snprintf(szStyle, _countof(szStyle), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); + mir_snprintf(szStyle, "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); return szStyle; } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 5436d0d6c6..938669c551 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -94,7 +94,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; TCHAR toolTip[256]; - mir_sntprintf(toolTip, _countof(toolTip), TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = toolTip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); return 0; @@ -165,7 +165,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) { TCHAR szTip[256]; - mir_sntprintf(szTip, _countof(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) { MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) }; @@ -257,7 +257,7 @@ static void RestoreUnreadMessageAlerts(void) else { cle.hContact = hContact; cle.hDbEvent = hDbEvent; - mir_sntprintf(toolTip, _countof(toolTip), TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); } } @@ -516,7 +516,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg) { WCHAR szwName[64]; char szName[64]; - mir_snprintf(szName, _countof(szName), "s%u", nextStgId++); + mir_snprintf(szName, "s%u", nextStgId++); MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName)); if (pictStg == NULL) return STG_E_MEDIUMFULL; diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp index 1c5dd33569..8b088867e1 100644 --- a/src/core/stdssl/src/netlibssl.cpp +++ b/src/core/stdssl/src/netlibssl.cpp @@ -84,7 +84,7 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false) } TCHAR szMsgBuf2[512]; - mir_sntprintf(szMsgBuf2, _countof(szMsgBuf2), _T("SSL connection failure (%x %u): %s"), scRet, line, szMsgBuf); + mir_sntprintf(szMsgBuf2, _T("SSL connection failure (%x %u): %s"), scRet, line, szMsgBuf); char* szMsg = Utf8EncodeT(szMsgBuf2); Netlib_Logf(NULL, szMsg); diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 3b9048a3e1..9f6e104b38 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -165,7 +165,7 @@ static void FillHistoryThread(void* param) GetObjectSummary(&dbei, str, _countof(str)); if (str[0]) { TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, _countof(strdatetime), 0); - mir_sntprintf(eventText, _countof(eventText), _T("%s: %s"), strdatetime, str); + mir_sntprintf(eventText, _T("%s: %s"), strdatetime, str); i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText); SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent); } @@ -208,7 +208,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP { TCHAR* contactName, str[200]; contactName = pcli->pfnGetContactDisplayName(hContact, 0); - mir_sntprintf(str, _countof(str), TranslateT("History for %s"), contactName); + mir_sntprintf(str, TranslateT("History for %s"), contactName); SetWindowText(hwndDlg, str); } Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY); diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index 8a679012cd..c142be091b 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -115,7 +115,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar char szPhone[96], szArea[32], szNumber[64]; GetDlgItemTextA(hwndDlg, IDC_AREA, szArea, _countof(szArea)); GetDlgItemTextA(hwndDlg, IDC_NUMBER, szNumber, _countof(szNumber)); - mir_snprintf(szPhone, _countof(szPhone), "+%u (%s) %s", SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0), 0), szArea, szNumber); + mir_snprintf(szPhone, "+%u (%s) %s", SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0), 0), szArea, szNumber); noRecursion = 1; SetDlgItemTextA(hwndDlg, IDC_PHONE, szPhone); noRecursion = 0; @@ -284,7 +284,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; lvi.pszText = idstr2; - mir_sntprintf(idstr2, _countof(idstr2), _T("%d"), i + 2); + mir_sntprintf(idstr2, _T("%d"), i + 2); } ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi); ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal); @@ -298,7 +298,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (db_get_ts(hContact, "UserInfo", idstr, &dbv)) break; lvi.pszText = idstr2; - mir_sntprintf(idstr2, _countof(idstr2), TranslateT("Custom %d"), i + 1); + mir_sntprintf(idstr2, TranslateT("Custom %d"), i + 1); ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi); ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal); db_free(&dbv); @@ -359,7 +359,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (db_get_ts(hContact, "UserInfo", idstr, &dbv)) break; lvi.pszText = idstr2; - mir_sntprintf(idstr2, _countof(idstr2), TranslateT("Custom %d"), i + 1); + mir_sntprintf(idstr2, TranslateT("Custom %d"), i + 1); ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi); if (mir_tstrlen(dbv.ptszVal) > 4 && !mir_tstrcmp(dbv.ptszVal + mir_tstrlen(dbv.ptszVal) - 4, _T(" SMS"))) { ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y")); @@ -439,7 +439,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR szEmail[256]; if (IsOverEmail(hwndDlg, szEmail, _countof(szEmail))) { TCHAR szExec[264]; - mir_sntprintf(szExec, _countof(szExec), _T("mailto:%s"), szEmail); + mir_sntprintf(szExec, _T("mailto:%s"), szEmail); ShellExecute(hwndDlg, _T("open"), szExec, NULL, NULL, SW_SHOW); break; } diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 1dec08f526..4ebc2726cf 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -107,7 +107,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule WORD wSave = dbv.wVal; if (wSave == (WORD)-1) { char szSettingName[100]; - mir_snprintf(szSettingName, _countof(szSettingName), "%sName", szSetting); + mir_snprintf(szSettingName, "%sName", szSetting); if (!db_get_ts(hContact, szModule, szSettingName, &dbv)) { ptstr = dbv.ptszVal; unspecified = false; @@ -215,7 +215,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EMAIL))) { TCHAR szExec[264], szEmail[256]; GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, _countof(szEmail)); - mir_sntprintf(szExec, _countof(szExec), _T("mailto:%s"), szEmail); + mir_sntprintf(szExec, _T("mailto:%s"), szEmail); ShellExecute(hwndDlg, _T("open"), szExec, NULL, NULL, SW_SHOW); } break; diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 4ca8f3332d..f6629445bd 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP name = pcli->pfnGetContactDisplayName(dat->hContact, 0); GetWindowText(hwndDlg, oldTitle, _countof(oldTitle)); - mir_sntprintf(newTitle, _countof(newTitle), oldTitle, name); + mir_sntprintf(newTitle, oldTitle, name); SetWindowText(hwndDlg, newTitle); ////////////////////////////////////////////////////////////////////// @@ -355,7 +355,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_TIMER: TCHAR str[128]; - mir_sntprintf(str, _countof(str), _T("%.*s%s%.*s"), dat->updateAnimFrame % 10, _T("........."), dat->szUpdating, dat->updateAnimFrame % 10, _T(".........")); + mir_sntprintf(str, _T("%.*s%s%.*s"), dat->updateAnimFrame % 10, _T("........."), dat->szUpdating, dat->updateAnimFrame % 10, _T(".........")); SetDlgItemText(hwndDlg, IDC_UPDATING, str); if (++dat->updateAnimFrame == UPDATEANIMFRAMES) dat->updateAnimFrame = 0; diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index 4e916724f4..dc6a5e682b 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -67,7 +67,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) cle.hDbEvent = uniqueEventId++; cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_USERONLINE, false); cle.pszService = "UserOnline/Description"; - mir_sntprintf(tooltip, _countof(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(tooltip, TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = tooltip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); IcoLib_ReleaseIcon(cle.hIcon, 0); diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp index 2f7080f8cb..ece76bf24c 100644 --- a/src/mir_app/src/DefaultExtraIcons.cpp +++ b/src/mir_app/src/DefaultExtraIcons.cpp @@ -112,7 +112,7 @@ struct Info static void EmailOnClick(Info*, const char *text) { char cmd[1024]; - mir_snprintf(cmd, _countof(cmd), "mailto:%s", text); + mir_snprintf(cmd, "mailto:%s", text); ShellExecuteA(NULL, "open", cmd, NULL, NULL, SW_SHOW); } diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index 33bb684cd1..7c5b0d7666 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -1075,7 +1075,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_BTN_EXPORT: { TCHAR fname_buff[MAX_PATH], filter[MAX_PATH]; - mir_sntprintf(filter, _countof(filter), _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0); + mir_sntprintf(filter, _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0); OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index f238fd4217..41eab518cb 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -364,12 +364,12 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) static char szStyle[256]; if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) { int iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1); - mir_snprintf(szStyle, _countof(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / chatApi.logPixelSY); + mir_snprintf(szStyle, "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / chatApi.logPixelSY); Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle); } else { int iii = lin->bIsHighlighted ? 16 : EventToIndex(lin); - mir_snprintf(szStyle, _countof(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / chatApi.logPixelSY); + mir_snprintf(szStyle, "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / chatApi.logPixelSY); Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle); } } diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index a2d6810b51..b631984f2d 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -144,7 +144,7 @@ void RegisterFonts(void) strncpy_s(fontid.dbSettingsGroup, CHATFONT_MODULE, _TRUNCATE); _tcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE); - mir_snprintf(fontid.prefix, _countof(fontid.prefix), "Font%d", index); + mir_snprintf(fontid.prefix, "Font%d", index); fontid.order = index; switch (i) { diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 4ece7906d7..1de143f961 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -184,10 +184,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa pd.lchIcon = LoadIconEx("window", FALSE); PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName); - mir_sntprintf(pd.lptzContactName, _countof(pd.lptzContactName), _T("%s - %s"), - (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, - cli.pfnGetContactDisplayName(hContact, 0)); - + mir_sntprintf(pd.lptzContactName, _T("%s - %s"), (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0)); mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText)); pd.iSeconds = g_Settings->iPopupTimeout; @@ -563,9 +560,9 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) // formatting strings don't need to be translatable - changing them via language pack would // only screw up the log format. if (p) - mir_sntprintf(szLine, _countof(szLine), _T("%s %c %s\r\n"), szTime, p, szBuffer); + mir_sntprintf(szLine, _T("%s %c %s\r\n"), szTime, p, szBuffer); else - mir_sntprintf(szLine, _countof(szLine), _T("%s %s\r\n"), szTime, szBuffer); + mir_sntprintf(szLine, _T("%s %s\r\n"), szTime, szBuffer); if (szLine[0]) { _fputts(szLine, hFile); @@ -590,11 +587,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) _tsplitpath(si->pszLogFileName, tszDrive, tszDir, tszName, tszExt); TCHAR tszNewPath[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20]; - mir_sntprintf(tszNewPath, _countof(tszNewPath), _T("%s%sarchived\\"), tszDrive, tszDir); + mir_sntprintf(tszNewPath, _T("%s%sarchived\\"), tszDrive, tszDir); CreateDirectoryTreeT(tszNewPath); TCHAR tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20]; - mir_sntprintf(tszNewName, _countof(tszNewName), _T("%s%s-%s%s"), tszNewPath, tszName, tszTimestamp, tszExt); + mir_sntprintf(tszNewName, _T("%s%s-%s%s"), tszNewPath, tszName, tszTimestamp, tszExt); fclose(hFile); hFile = 0; if (!PathFileExists(tszNewName)) @@ -742,7 +739,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) TCHAR tszTemp[MAX_PATH], *ptszVarPath; if (g_Settings->pszLogDir[mir_tstrlen(g_Settings->pszLogDir) - 1] == '\\') { - mir_sntprintf(tszTemp, _countof(tszTemp), _T("%s%s"), g_Settings->pszLogDir, _T("%userid%.log")); + mir_sntprintf(tszTemp, _T("%s%s"), g_Settings->pszLogDir, _T("%userid%.log")); ptszVarPath = tszTemp; } else ptszVarPath = g_Settings->pszLogDir; diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index d08d7736b0..4f8e9f3fd7 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -1135,7 +1135,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contacto->hContact, contactn->groupId); else if (contacto->type == CLCIT_GROUP) { //dropee is a group TCHAR szNewName[120]; - mir_sntprintf(szNewName, _countof(szNewName), _T("%s\\%s"), cli.pfnGetGroupName(contactn->groupId, NULL), contacto->szText); + mir_sntprintf(szNewName, _T("%s\\%s"), cli.pfnGetGroupName(contactn->groupId, NULL), contacto->szText); cli.pfnRenameGroup(contacto->groupId, szNewName); } } @@ -1268,8 +1268,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (contact->type == CLCIT_CONTACT) if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), contact->hContact)) break; - - if (contact->type == CLCIT_GROUP) { + + if (contact->type == CLCIT_GROUP) { switch (LOWORD(wParam)) { case POPUP_NEWSUBGROUP: if (contact->type != CLCIT_GROUP) @@ -1290,7 +1290,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break; } - Menu_ProcessCommandById(wParam, (LPARAM)hwnd); + Menu_ProcessCommandById(wParam, (LPARAM)hwnd); } break; diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 203720f278..97fafe101d 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -410,7 +410,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) if (contact->type == CLCIT_GROUP) { if (contact->group->parent && contact->group->parent->parent) { TCHAR szFullName[256]; - mir_sntprintf(szFullName, _countof(szFullName), _T("%s\\%s"), + mir_sntprintf(szFullName, _T("%s\\%s"), cli.pfnGetGroupName(contact->group->parent->groupId, NULL), text); cli.pfnRenameGroup(contact->groupId, szFullName); } diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index e6a6897fed..db63eae84c 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -100,7 +100,7 @@ TCHAR* fnGetStatusModeDescription(int mode, int flags) default: if (IsStatusConnecting(mode)) { const TCHAR* connFmt = LPGENT("Connecting (attempt %d)"); - mir_sntprintf(szMode, _countof(szMode), (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1); + mir_sntprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1); return szMode; } return NULL; diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 90c3d2fe8c..6294142941 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -126,7 +126,7 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP TCHAR szFormat[256], szFinal[256]; GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, _countof(szFormat)); - mir_sntprintf(szFinal, _countof(szFinal), szFormat, cli.pfnGetContactDisplayName(lParam, 0)); + mir_sntprintf(szFinal, szFormat, cli.pfnGetContactDisplayName(lParam, 0)); SetDlgItemText(hWnd, IDC_TOPLINE, szFinal); } SetFocus( GetDlgItem(hWnd, IDNO)); @@ -993,7 +993,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PROTOACCOUNT *pa; TCHAR tszName[64]; if ((pa = Proto_GetAccount(szProto)) != NULL) - mir_sntprintf(tszName, _countof(tszName), _T("%s "), pa->tszAccountName); + mir_sntprintf(tszName, _T("%s "), pa->tszAccountName); else tszName[0] = 0; diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp index 455c7b0614..f3679bcc75 100644 --- a/src/mir_app/src/cluiservices.cpp +++ b/src/mir_app/src/cluiservices.cpp @@ -167,7 +167,7 @@ void fnCluiProtocolStatusChanged(int, const char*) TCHAR tszName[64]; PROTOACCOUNT *pa = Proto_GetAccount(cli.menuProtos[i].szProto); if (pa) - mir_sntprintf(tszName, _countof(tszName), _T("%s "), pa->tszAccountName); + mir_sntprintf(tszName, _T("%s "), pa->tszAccountName); else tszName[0] = 0; diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index 6066d0c059..e7df257bde 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -186,7 +186,7 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE) if (isRootDir) _tcsncpy_s(pfd, VARST(_T("%miranda_path%\\*.dat")), _TRUNCATE); else - mir_sntprintf(pfd, _countof(pfd), _T("%s\\*.dat"), profiledir); + mir_sntprintf(pfd, _T("%s\\*.dat"), profiledir); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(pfd, &ffd); @@ -196,10 +196,10 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE) TCHAR path[MAX_PATH], path2[MAX_PATH]; TCHAR* profile = mir_tstrdup(ffd.cFileName); c = _tcsrchr(profile, '.'); if (c) *c = 0; - mir_sntprintf(path, _countof(path), _T("%s\\%s"), pfd, ffd.cFileName); - mir_sntprintf(path2, _countof(path2), _T("%s\\%s"), profiledir, profile); + mir_sntprintf(path, _T("%s\\%s"), pfd, ffd.cFileName); + mir_sntprintf(path2, _T("%s\\%s"), profiledir, profile); CreateDirectoryTreeT(path2); - mir_sntprintf(path2, _countof(path2), _T("%s\\%s\\%s"), profiledir, profile, ffd.cFileName); + mir_sntprintf(path2, _T("%s\\%s\\%s"), profiledir, profile, ffd.cFileName); if (_taccess(path2, 0) == 0) { TCHAR buf[512]; mir_sntprintf(buf, @@ -241,7 +241,7 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n if (bShowProfileManager || !reqfd) { TCHAR searchspec[MAX_PATH]; - mir_sntprintf(searchspec, _countof(searchspec), _T("%s\\*.*"), profiledir); + mir_sntprintf(searchspec, _T("%s\\*.*"), profiledir); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(searchspec, &ffd); @@ -252,7 +252,7 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n continue; TCHAR newProfile[MAX_PATH]; - mir_sntprintf(newProfile, _countof(newProfile), _T("%s\\%s\\%s.dat"), profiledir, ffd.cFileName, ffd.cFileName); + mir_sntprintf(newProfile, _T("%s\\%s\\%s.dat"), profiledir, ffd.cFileName, ffd.cFileName); if (_taccess(newProfile, 0) != 0) continue; diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp index b876f89c16..b3661aeb76 100644 --- a/src/mir_app/src/dbini.cpp +++ b/src/mir_app/src/dbini.cpp @@ -447,7 +447,7 @@ static void DoAutoExec(void) do { bool secFN = mir_tstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0; - mir_sntprintf(szIniPath, _countof(szIniPath), _T("%s%s"), szFindPath, fd.cFileName); + mir_sntprintf(szIniPath, _T("%s%s"), szFindPath, fd.cFileName); if (!mir_tstrcmpi(szUse, _T("prompt")) && !secFN) { int result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath); if (result == IDC_NOTOALL) break; diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp index c8a9e9dbea..ffce62d4f3 100644 --- a/src/mir_app/src/dbutils.cpp +++ b/src/mir_app/src/dbutils.cpp @@ -61,12 +61,12 @@ static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam) if (!p->textService) { char szServiceName[100]; - mir_snprintf(szServiceName, _countof(szServiceName), "%s/GetEventText%d", p->module, p->eventType); + mir_snprintf(szServiceName, "%s/GetEventText%d", p->module, p->eventType); p->textService = mir_strdup(szServiceName); } if (!p->iconService) { char szServiceName[100]; - mir_snprintf(szServiceName, _countof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType); + mir_snprintf(szServiceName, "%s/GetEventIcon%d", p->module, p->eventType); p->iconService = mir_strdup(szServiceName); } eventTypes.insert(p); @@ -216,7 +216,7 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam) icon = IcoLib_GetIconByHandle(et->eventIcon); if (!icon) { char szName[100]; - mir_snprintf(szName, _countof(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType); + mir_snprintf(szName, "eventicon_%s%d", dbei->szModule, dbei->eventType); icon = IcoLib_GetIcon(szName); } diff --git a/src/mir_app/src/groups.cpp b/src/mir_app/src/groups.cpp index 1788da5629..65eb0c8643 100644 --- a/src/mir_app/src/groups.cpp +++ b/src/mir_app/src/groups.cpp @@ -81,7 +81,7 @@ static INT_PTR CreateGroupInternal(INT_PTR iParent, const TCHAR *ptszName) if (db_get_ts(NULL, "CListGroups", str, &dbv)) return 0; - mir_sntprintf(newBaseName, _countof(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName); + mir_sntprintf(newBaseName, _T("%s\\%s"), dbv.ptszVal + 1, grpName); mir_free(dbv.pszVal); } else mir_tstrncpy(newBaseName, grpName, _countof(newBaseName)); @@ -189,7 +189,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) db_free(&dbv); if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) { TCHAR szQuestion[256 + 100]; - mir_sntprintf(szQuestion, _countof(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), name); + mir_sntprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), name); if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO) return 1; } @@ -243,7 +243,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) break; if (!_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) { if (szNewParent[0]) - mir_sntprintf(szNewName, _countof(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2); + mir_sntprintf(szNewName, _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2); else mir_tstrncpy(szNewName, dbv.ptszVal + len + 2, _countof(szNewName)); cli.pfnRenameGroup(i + 1, szNewName); @@ -302,7 +302,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) break; if (!_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) { - mir_sntprintf(szNewName, _countof(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2); + mir_sntprintf(szNewName, _T("%s\\%s"), szName, dbv.ptszVal + len + 2); RenameGroupWithMove(i, szNewName, 0); //luckily, child groups will never need reordering } db_free(&dbv); diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index b13663b191..72482cdb94 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -154,7 +154,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) if (item->rootHotkey = hotkeys.find(item)) { if (item->rootHotkey->allowSubHotkeys) { char nameBuf[MAXMODULELABELLENGTH]; - mir_snprintf(nameBuf, _countof(nameBuf), "%s$%d", item->rootHotkey->pszName, item->rootHotkey->nSubHotkeys); + mir_snprintf(nameBuf, "%s$%d", item->rootHotkey->pszName, item->rootHotkey->nSubHotkeys); item->pszName = mir_strdup(nameBuf); item->Enabled = TRUE; @@ -221,7 +221,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) char *pszName = (char *)lParam; char pszNamePrefix[MAXMODULELABELLENGTH]; size_t cbNamePrefix; - mir_snprintf(pszNamePrefix, _countof(pszNamePrefix), "%s$", pszName); + mir_snprintf(pszNamePrefix, "%s$", pszName); cbNamePrefix = mir_strlen(pszNamePrefix); for (i = 0; i < hotkeys.getCount(); i++) { diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index ff63098fc4..67f5453622 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -353,7 +353,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon) { TCHAR tszName[100]; - mir_sntprintf(tszName, _countof(tszName), _T("*StaticIcon_%d"), iStaticCount++); + mir_sntprintf(tszName, _T("*StaticIcon_%d"), iStaticCount++); IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem)); newItem->file = IconSourceFile_Get(tszName, false); diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 96f3f78553..919d7ffa9e 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -43,7 +43,7 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack) /* add some note if its incompatible */ if (szLanguageName[0] && szContryName[0]) { - mir_sntprintf(szLocaleName, _countof(szLocaleName), _T("%s (%s)"), TranslateTS(szLanguageName), TranslateTS(szContryName)); + mir_sntprintf(szLocaleName, _T("%s (%s)"), TranslateTS(szLanguageName), TranslateTS(szContryName)); if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) { TCHAR *pszIncompat; pszIncompat = TranslateT("(incompatible)"); @@ -77,7 +77,7 @@ static BOOL InsertPackItemEnumProc(LANGPACK_INFO *pack, WPARAM wParam, LPARAM) /* insert */ TCHAR tszName[512]; - mir_sntprintf(tszName, _countof(tszName), _T("%s [%s]"), + mir_sntprintf(tszName, _T("%s [%s]"), TranslateTS(pack->tszLanguage), pack->flags & LPF_DEFAULT ? TranslateT("built-in") : pack->tszFileName); UINT message = pack->flags & LPF_DEFAULT ? CB_INSERTSTRING : CB_ADDSTRING; diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 55f8863d75..3b09379179 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -822,7 +822,7 @@ void RebuildMenuOrder(void) mi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) { - mir_sntprintf(tbuf, _countof(tbuf), TranslateT("%s (locked)"), pa->tszAccountName); + mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName); mi.name.t = tbuf; } else mi.name.t = pa->tszAccountName; @@ -846,7 +846,7 @@ void RebuildMenuOrder(void) mi.flags |= CMIF_CHECKED; if ((mi.flags & CMIF_CHECKED) && cli.bDisplayLocked) { - mir_sntprintf(tbuf, _countof(tbuf), TranslateT("%s (locked)"), pa->tszAccountName); + mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName); mi.name.t = tbuf; } else mi.name.t = pa->tszAccountName; @@ -1150,7 +1150,7 @@ void InitCustomMenus(void) hkd.dwFlags = HKD_TCHAR; for (int i = 0; i < _countof(statusHotkeys); i++) { char szName[30]; - mir_snprintf(szName, _countof(szName), "StatusHotKey_%d", i); + mir_snprintf(szName, "StatusHotKey_%d", i); hkd.pszName = szName; hkd.lParam = statusModeList[i]; hkd.ptszDescription = fnGetStatusModeDescription(hkd.lParam, 0); diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 4621f5c9df..2b7fafaa97 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -83,13 +83,13 @@ class CGenMenuOptionsPage : public CDlgBase char menuItemName[256], DBString[300]; GetMenuItemName(iod->pimi, menuItemName, sizeof(menuItemName)); - mir_snprintf(DBString, _countof(DBString), "%s_visible", menuItemName); + mir_snprintf(DBString, "%s_visible", menuItemName); db_set_b(NULL, szModule, DBString, tvi.iImage != 0); - mir_snprintf(DBString, _countof(DBString), "%s_pos", menuItemName); + mir_snprintf(DBString, "%s_pos", menuItemName); db_set_dw(NULL, szModule, DBString, runtimepos); - mir_snprintf(DBString, _countof(DBString), "%s_name", menuItemName); + mir_snprintf(DBString, "%s_name", menuItemName); if (iod->name != NULL && iod->defname != NULL && mir_tstrcmp(iod->name, iod->defname) != 0) db_set_ts(NULL, szModule, DBString, iod->name); else @@ -120,7 +120,7 @@ class CGenMenuOptionsPage : public CDlgBase return; char szModule[256]; - mir_snprintf(szModule, _countof(szModule), "%s_Items", pmo->pszName); + mir_snprintf(szModule, "%s_Items", pmo->pszName); CallService(MS_DB_MODULE_DELETE, NULL, (LPARAM)szModule); SaveTreeInternal(m_menuItems.GetRoot(), szModule); } @@ -244,7 +244,7 @@ class CGenMenuOptionsPage : public CDlgBase return false; char szModule[256]; - mir_snprintf(szModule, _countof(szModule), "%s_Items", pmo->pszName); + mir_snprintf(szModule, "%s_Items", pmo->pszName); bRebuild = true; m_menuItems.SendMsg(WM_SETREDRAW, FALSE, 0); diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 583acb9cb4..d1851d2976 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -950,7 +950,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM #ifdef PUTPOSITIONSONMENU if (GetKeyState(VK_CONTROL) & 0x8000) { TCHAR str[256]; - mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData); + mir_sntprintf(str, _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData); mii.dwTypeData = str; } #endif @@ -964,7 +964,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM #ifdef PUTPOSITIONSONMENU if (GetKeyState(VK_CONTROL) & 0x8000) { TCHAR str[256]; - mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData); + mir_sntprintf(str, _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData); mii.dwTypeData = str; } #endif @@ -1046,10 +1046,10 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0); TCHAR sectionName[256]; - mir_sntprintf(sectionName, _countof(sectionName), LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName)); + mir_sntprintf(sectionName, LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName)); char iconame[256]; - mir_snprintf(iconame, _countof(iconame), "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr); + mir_snprintf(iconame, "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr); // remove '&' if (descr) { diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 605dde9a21..661b7a986c 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -291,7 +291,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) // show hide nudge menu item char serviceFunc[256]; - mir_snprintf(serviceFunc, _countof(serviceFunc), "%s%s", GetContactProto(Meta_GetMostOnline(cc)), PS_SEND_NUDGE); + mir_snprintf(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/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 82c2fa90d7..d66a1334ca 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -570,7 +570,7 @@ static int Meta_MessageWindowEvent(WPARAM, LPARAM lParam) static INT_PTR Meta_SrmmCurrentSub(WPARAM hMeta, LPARAM) { - MetaSrmmData tmp = { (UINT_PTR)hMeta }; + MetaSrmmData tmp = { (MCONTACT)hMeta }; if (MetaSrmmData *p = arMetaWindows.find(&tmp)) return p->m_hSub; @@ -853,7 +853,7 @@ void Meta_InitServices() // hidden contact menu items...ho hum for (int i = 0; i < MAX_CONTACTS; i++) { char szServiceName[100]; - mir_snprintf(szServiceName, _countof(szServiceName), "MetaContacts/MenuFunc%d", i); + mir_snprintf(szServiceName, "MetaContacts/MenuFunc%d", i); CreateServiceFunctionParam(szServiceName, MenuFunc, i); } diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index 3be2190071..838faace9b 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -489,8 +489,8 @@ int Meta_SetAllNicks() static void SwapValues(MCONTACT hContact, LPCSTR szSetting, int n1, int n2) { char buf1[100], buf2[100]; - mir_snprintf(buf1, _countof(buf1), "%s%d", szSetting, n1); - mir_snprintf(buf2, _countof(buf2), "%s%d", szSetting, n2); + mir_snprintf(buf1, "%s%d", szSetting, n1); + mir_snprintf(buf2, "%s%d", szSetting, n2); DBVARIANT dbv1, dbv2; int ok1 = !db_get(hContact, META_PROTO, buf1, &dbv1); @@ -526,7 +526,7 @@ int Meta_SwapContacts(DBCachedContact *cc, int n1, int n2) void Meta_GetSubNick(MCONTACT hMeta, int i, CMString &tszDest) { char idStr[50]; - mir_snprintf(idStr, _countof(idStr), "Login%d", i); + mir_snprintf(idStr, "Login%d", i); DBVARIANT dbv; if(db_get(hMeta, META_PROTO, idStr, &dbv)) diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index 5c520f5ec5..88f657022f 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -269,7 +269,7 @@ struct HttpSecurityContext if (szHost && _stricmp(szProvider, "Basic")) { unsigned long ip = inet_addr(szHost); PHOSTENT host = (ip == INADDR_NONE) ? gethostbyname(szHost) : gethostbyaddr((char*)&ip, 4, AF_INET); - mir_snprintf(szSpnStr, _countof(szSpnStr), "HTTP/%s", host && host->h_name ? host->h_name : szHost); + mir_snprintf(szSpnStr, "HTTP/%s", host && host->h_name ? host->h_name : szHost); _strlwr(szSpnStr + 5); NetlibLogf(nlu, "Host SPN: %s", szSpnStr); } @@ -897,9 +897,9 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) char *pspace = strchr(szMirandaVer, ' '); if (pspace) { *pspace++='\0'; - mir_snprintf(szUserAgent, _countof(szUserAgent), "Miranda/%s (%s)", szMirandaVer, pspace); + mir_snprintf(szUserAgent, "Miranda/%s (%s)", szMirandaVer, pspace); } - else mir_snprintf(szUserAgent, _countof(szUserAgent), "Miranda/%s", szMirandaVer); + else mir_snprintf(szUserAgent, "Miranda/%s", szMirandaVer); } if (!doneAcceptEncoding) { nlhrSend.headers[nlhrSend.headersCount].szName = "Accept-Encoding"; diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp index 7c9ae6e08d..7d4f9b454b 100644 --- a/src/mir_app/src/netliblog.cpp +++ b/src/mir_app/src/netliblog.cpp @@ -160,7 +160,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, _countof(str)); { TCHAR filter[200]; - mir_sntprintf(filter, _countof(filter), _T("%s (*)%c*%c"), TranslateT("All files"), 0, 0); + mir_sntprintf(filter, _T("%s (*)%c*%c"), TranslateT("All files"), 0, 0); OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; @@ -307,14 +307,14 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) case TIMEFORMAT_MILLISECONDS: QueryPerformanceCounter(&liTimeNow); liTimeNow.QuadPart -= mirandaStartTime; - mir_snprintf(szTime, _countof(szTime), "%I64u.%03I64u ", liTimeNow.QuadPart / perfCounterFreq, + mir_snprintf(szTime, "%I64u.%03I64u ", liTimeNow.QuadPart / perfCounterFreq, 1000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq); break; case TIMEFORMAT_MICROSECONDS: QueryPerformanceCounter(&liTimeNow); liTimeNow.QuadPart -= mirandaStartTime; - mir_snprintf(szTime, _countof(szTime), "%I64u.%06I64u ", liTimeNow.QuadPart / perfCounterFreq, + mir_snprintf(szTime, "%I64u.%06I64u ", liTimeNow.QuadPart / perfCounterFreq, 1000000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq); break; @@ -325,9 +325,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, _countof(szHead), "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser); + mir_snprintf(szHead, "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser); else - mir_snprintf(szHead, _countof(szHead), "[%s%04X] ", szTime, GetCurrentThreadId()); + mir_snprintf(szHead, "[%s%04X] ", szTime, GetCurrentThreadId()); if (logOptions.toOutputDebugString) { if (szHead[0]) @@ -401,7 +401,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla WaitForSingleObject(hConnectionHeaderMutex, INFINITE); NetlibUser *nlu = nlc ? nlc->nlu : NULL; - int titleLineLen = mir_snprintf(szTitleLine, _countof(szTitleLine), "(%p:%u) Data %s%s\r\n", + int titleLineLen = mir_snprintf(szTitleLine, "(%p:%u) Data %s%s\r\n", nlc, nlc ? nlc->s : 0, sent ? "sent" : "received", flags & MSG_DUMPPROXY ? " (proxy)" : ""); ReleaseMutex(hConnectionHeaderMutex); diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index 90e6a5a555..af53750b65 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, TCHAR str[80]; { int selectedProxyType = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0); - mir_sntprintf(str, _countof(str), TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]); + mir_sntprintf(str, TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]); SetDlgItemText(hwndDlg, IDC_STOFTENPORT, str); if (IsDlgButtonChecked(hwndDlg, IDC_USEPROXY) != BST_UNCHECKED) { int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1; diff --git a/src/mir_app/src/netlibsock.cpp b/src/mir_app/src/netlibsock.cpp index 6ef069a290..c130bcf754 100644 --- a/src/mir_app/src/netlibsock.cpp +++ b/src/mir_app/src/netlibsock.cpp @@ -217,7 +217,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) if (addr->si_family == AF_INET) { char *szIp = inet_ntoa(addr->Ipv4.sin_addr); if (addr->Ipv4.sin_port != 0) { - mir_snprintf(saddr, _countof(saddr), "%s:%d", szIp, htons(addr->Ipv4.sin_port)); + mir_snprintf(saddr, "%s:%d", szIp, htons(addr->Ipv4.sin_port)); return mir_strdup(saddr); } return mir_strdup(szIp); diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp index 578f641c67..ef0c713b2b 100644 --- a/src/mir_app/src/netlibupnp.cpp +++ b/src/mir_app/src/netlibupnp.cpp @@ -261,25 +261,16 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction char szData1[1024]; szReq = mir_strdup(szResult); - sz = mir_snprintf(szData1, _countof(szData1), - soap_action, szActionName, szDev, szReq, szActionName); - - sz = mir_snprintf(szData, 4096, - szPostHdr, szPath, szHost, sPort, - sz, szDev, szActionName, szData1); + sz = mir_snprintf(szData1, soap_action, szActionName, szDev, szReq, szActionName); + sz = mir_snprintf(szData, 4096, szPostHdr, szPath, szHost, sPort, sz, szDev, szActionName, szData1); } break; case ControlQuery: { char szData1[1024]; - - sz = mir_snprintf(szData1, _countof(szData1), - soap_query, szActionName); - - sz = mir_snprintf(szData, 4096, - szPostHdr, szPath, szHost, sPort, - sz, "urn:schemas-upnp-org:control-1-0", "QueryStateVariable", szData1); + sz = mir_snprintf(szData1, soap_query, szActionName); + sz = mir_snprintf(szData, 4096, szPostHdr, szPath, szHost, sPort, sz, "urn:schemas-upnp-org:control-1-0", "QueryStateVariable", szData1); } break; } diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 7858dfe27d..496e1184ae 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -380,7 +380,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) // create the search filter TCHAR search[MAX_PATH]; - mir_sntprintf(search, _countof(search), _T("%s\\Plugins\\*.dll"), exe); + mir_sntprintf(search, _T("%s\\Plugins\\*.dll"), exe); // FFFN will return filenames for things like dot dll+ or dot dllx WIN32_FIND_DATA ffd; @@ -404,7 +404,7 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path) pluginList.insert(p); TCHAR tszFullPath[MAX_PATH]; - mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s\\%s"), path, dir, tszFileName); + mir_sntprintf(tszFullPath, _T("%s\\%s\\%s"), path, dir, tszFileName); // map dll into the memory and check its exports bool bIsPlugin = false; @@ -497,7 +497,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) if (!(p->pclass & PCLASS_BASICAPI)) { BASIC_PLUGIN_INFO bpi; - mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s\\%s"), exe, (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname); + mir_sntprintf(tszFullPath, _T("%s\\%s\\%s"), exe, (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname); if (!checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) { p->pclass |= PCLASS_FAILED; return false; @@ -556,7 +556,7 @@ bool LoadCorePlugin(MuuidReplacement &mr) GetModuleFileName(NULL, exe, _countof(exe)); TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0; - mir_sntprintf(tszPlugName, _countof(tszPlugName), _T("%s.dll"), mr.stdplugname); + mir_sntprintf(tszPlugName, _T("%s.dll"), mr.stdplugname); pluginEntry* pPlug = OpenPlugin(tszPlugName, _T("Core"), exe); if (pPlug->pclass & PCLASS_FAILED) { LBL_Error: @@ -614,14 +614,14 @@ static pluginEntry* getCListModule(TCHAR *exe) if (!isPluginOnWhiteList(p->pluginname)) continue; - mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\Plugins\\%s"), exe, p->pluginname); + mir_sntprintf(tszFullPath, _T("%s\\Plugins\\%s"), exe, p->pluginname); if (loadClistModule(tszFullPath, p)) return p; } MuuidReplacement& stdClist = pluginDefault[10]; if (LoadCorePlugin(stdClist)) { - mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\Core\\%s.dll"), exe, stdClist.stdplugname); + mir_sntprintf(tszFullPath, _T("%s\\Core\\%s.dll"), exe, stdClist.stdplugname); if (loadClistModule(tszFullPath, stdClist.pImpl)) return stdClist.pImpl; } @@ -775,7 +775,7 @@ int LoadNewPluginsModule(void) // if freeimage is present, load it to provide the basic core functions if (plugin_freeimg != NULL) { BASIC_PLUGIN_INFO bpi; - mir_sntprintf(fullPath, _countof(fullPath), _T("%s\\Plugins\\%s"), exe, plugin_freeimg->pluginname); + mir_sntprintf(fullPath, _T("%s\\Plugins\\%s"), exe, plugin_freeimg->pluginname); if (checkAPI(fullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) { plugin_freeimg->bpi = bpi; plugin_freeimg->pclass |= PCLASS_OK | PCLASS_BASICAPI; diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index ceac065583..90409385b3 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -1151,7 +1151,7 @@ void OpenAccountOptions(PROTOACCOUNT *pa) return; TCHAR tszTitle[100]; - mir_sntprintf(tszTitle, _countof(tszTitle), TranslateT("%s options"), pa->tszAccountName); + mir_sntprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName); OPENOPTIONSDIALOG ood = { sizeof(ood) }; ood.pszGroup = LPGEN("Network"); diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index 73189cc361..4cf88ade76 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -144,13 +144,13 @@ static __forceinline char* GetPathVarX(const char*, int code) if (hAvatarFolder != NULL) _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE); else - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); + mir_sntprintf(szFullPath, _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); break; case 2: - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName); + mir_sntprintf(szFullPath, _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName); break; case 3: - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s"), g_profileDir, g_shortProfileName); + mir_sntprintf(szFullPath, _T("%s\\%s"), g_profileDir, g_shortProfileName); break; } return makeFileName(szFullPath); @@ -228,13 +228,13 @@ static __forceinline TCHAR* GetPathVarX(const TCHAR*, int code) if (hAvatarFolder != NULL) _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE); else - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); + mir_sntprintf(szFullPath, _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); break; case 2: - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName); + mir_sntprintf(szFullPath, _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName); break; case 3: - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s"), g_profileDir, g_shortProfileName); + mir_sntprintf(szFullPath, _T("%s\\%s"), g_profileDir, g_shortProfileName); break; } return mir_tstrdup(szFullPath); @@ -387,7 +387,7 @@ MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *wszData, MCONTACT hConta static int OnFoldersChanged(WPARAM, LPARAM) { - mir_sntprintf(tszAvatarRoot, _countof(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); + mir_sntprintf(tszAvatarRoot, _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); TCHAR tmpVar[MAX_PATH]; if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot)) @@ -397,7 +397,7 @@ static int OnFoldersChanged(WPARAM, LPARAM) void InitPathVar() { - mir_sntprintf(tszAvatarRoot, _countof(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); + mir_sntprintf(tszAvatarRoot, _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName); if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) { TCHAR tmpVar[MAX_PATH]; if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot)) diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 55fe0885c3..0c4eb9916a 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -455,7 +455,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (hdr->hdr.code == PSN_APPLY) { bool needRestart = false; TCHAR bufRestart[1024]; - int bufLen = mir_sntprintf(bufRestart, _countof(bufRestart), _T("%s\n"), TranslateT("Miranda NG must be restarted to apply changes for these plugins:")); + int bufLen = mir_sntprintf(bufRestart, _T("%s\n"), TranslateT("Miranda NG must be restarted to apply changes for these plugins:")); HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST); for (int iRow = 0; iRow != -1;) { diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index bda73395a4..caa4215997 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -46,7 +46,7 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA { // find in Miranda NG profile subfolders TCHAR searchspec[MAX_PATH]; - mir_sntprintf(searchspec, _countof(searchspec), _T("%s\\*.*"), szProfileDir); + mir_sntprintf(searchspec, _T("%s\\*.*"), szProfileDir); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(searchspec, &ffd); @@ -59,7 +59,7 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA TCHAR buf[MAX_PATH], profile[MAX_PATH]; mir_sntprintf(buf, _T("%s\\%s\\%s.dat"), szProfileDir, ffd.cFileName, ffd.cFileName); if (_taccess(buf, 0) == 0) { - mir_sntprintf(profile, _countof(profile), _T("%s.dat"), ffd.cFileName); + mir_sntprintf(profile, _T("%s.dat"), ffd.cFileName); if (!callback(buf, profile, lParam)) break; } @@ -264,11 +264,11 @@ class CChooseProfileDlg : public CDlgBase struct _stat statbuf; if (_tstat(tszFullPath, &statbuf) == 0) { if (statbuf.st_size > 1000000) { - mir_sntprintf(sizeBuf, _countof(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0); + mir_sntprintf(sizeBuf, _T("%.3lf"), (double)statbuf.st_size / 1048576.0); mir_tstrcpy(sizeBuf + 5, _T(" MB")); } else { - mir_sntprintf(sizeBuf, _countof(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0); + mir_sntprintf(sizeBuf, _T("%.3lf"), (double)statbuf.st_size / 1024.0); mir_tstrcpy(sizeBuf + 5, _T(" KB")); } bFileLocked = !fileExist(tszFullPath); @@ -319,7 +319,7 @@ class CChooseProfileDlg : public CDlgBase if (!m_profileList.GetItem(&item)) return; - mir_sntprintf(fullName, _countof(fullName), _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profile, profile); + mir_sntprintf(fullName, _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profile, profile); CallService(MS_DB_CHECKPROFILE, (WPARAM)fullName, item.iImage == 2); } @@ -338,11 +338,11 @@ class CChooseProfileDlg : public CDlgBase if (!m_profileList.GetItem(&item)) return; - mir_sntprintf(profilef, _countof(profilef), TranslateT("Are you sure you want to remove profile \"%s\"?"), profile); + mir_sntprintf(profilef, TranslateT("Are you sure you want to remove profile \"%s\"?"), profile); if (IDYES != MessageBox(NULL, profilef, _T("Miranda NG"), MB_YESNO | MB_TASKMODAL | MB_ICONWARNING)) return; - mir_sntprintf(profilef, _countof(profilef), _T("%s\\%s%c"), m_pd->ptszProfileDir, profile, 0); + mir_sntprintf(profilef, _T("%s\\%s%c"), m_pd->ptszProfileDir, profile, 0); SHFILEOPSTRUCT sf = { 0 }; sf.wFunc = FO_DELETE; @@ -383,7 +383,7 @@ class CChooseProfileDlg : public CDlgBase // profile is placed in "profile_name" subfolder TCHAR tmpPath[MAX_PATH]; - mir_sntprintf(tmpPath, _countof(tmpPath), _T("%s\\%s.dat"), m_pd->ptszProfileDir, profile); + mir_sntprintf(tmpPath, _T("%s\\%s.dat"), m_pd->ptszProfileDir, profile); if (_taccess(tmpPath, 2)) mir_sntprintf(m_pd->ptszProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profile, profile); else @@ -520,7 +520,7 @@ public: TCHAR profilename[MAX_PATH], tszFullPath[MAX_PATH]; struct _stat statbuf; m_profileList.GetItemText(pTip->iItem, 0, profilename, _countof(profilename)); - mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profilename, profilename); + mir_sntprintf(tszFullPath, _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profilename, profilename); _tstat(tszFullPath, &statbuf); mir_sntprintf(pTip->pszText, pTip->cchTextMax, _T("%s\n%s: %s\n%s: %s"), tszFullPath, TranslateT("Created"), rtrimt(NEWTSTR_ALLOCA(_tctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimt(NEWTSTR_ALLOCA(_tctime(&statbuf.st_mtime)))); } diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 151a3c2ff8..2ac28e13af 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -143,13 +143,13 @@ static bool OnCreateAccount(HWND hwndDlg) if (param->action == PRAC_UPGRADED) { BOOL oldProto = pa->bOldProto; TCHAR szPlugin[MAX_PATH]; - mir_sntprintf(szPlugin, _countof(szPlugin), _T("%s.dll"), _A2T(pa->szProtoName)); + mir_sntprintf(szPlugin, _T("%s.dll"), _A2T(pa->szProtoName)); int idx = accounts.getIndex(pa); UnloadAccount(pa, false, false); accounts.remove(idx); if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) { TCHAR szNewName[MAX_PATH]; - mir_sntprintf(szNewName, _countof(szNewName), _T("%s~"), szPlugin); + mir_sntprintf(szNewName, _T("%s~"), szPlugin); MoveFile(szPlugin, szNewName); } param->action = PRAC_ADDED; @@ -202,9 +202,9 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam TCHAR str[200]; if (param->action == PRAC_CHANGED) { // update EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOTYPECOMBO), FALSE); - mir_sntprintf(str, _countof(str), _T("%s: %s"), TranslateT("Editing account"), param->pa->tszAccountName); + mir_sntprintf(str, _T("%s: %s"), TranslateT("Editing account"), param->pa->tszAccountName); } - else mir_sntprintf(str, _countof(str), _T("%s: %s"), TranslateT("Upgrading account"), param->pa->tszAccountName); + else mir_sntprintf(str, _T("%s: %s"), TranslateT("Upgrading account"), param->pa->tszAccountName); SetWindowText(hwndDlg, str); SetDlgItemText(hwndDlg, IDC_ACCNAME, param->pa->tszAccountName); diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index defdcb097b..c05d98d258 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -118,7 +118,7 @@ static void __fastcall MySetCursor(TCHAR* nCursor) static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) { TCHAR path[MAX_PATH]; - mir_sntprintf(path, _countof(path), _T("%s,"), filename); + mir_sntprintf(path, _T("%s,"), filename); size_t suffIndx = mir_tstrlen(path); mir_cslock lck(csIconList); @@ -418,7 +418,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.iItem = 0; int count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR); for (int i = 0; i < count; lvi.iItem++, i++) { - mir_sntprintf(caption, _countof(caption), _T("%d"), i + 1); + mir_sntprintf(caption, _T("%d"), i + 1); lvi.pszText = caption; HICON hIcon = NULL; @@ -520,7 +520,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.mask = LVIF_PARAM; lvi.iItem = dragItem; lvi.iSubItem = 0; ListView_GetItem(hPreview, &lvi); - mir_sntprintf(path, _countof(path), _T("%s,%d"), filename, (int)lvi.lParam); + mir_sntprintf(path, _T("%s,%d"), filename, (int)lvi.lParam); SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path); ListView_SetItemState(GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED); } diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 698f7d4b72..73dae4a49b 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -29,70 +29,70 @@ struct StandardIconDescription int id; LPCSTR description; int resource_id; - int pf2; + UINT pf2; LPCSTR section; HANDLE hIcolib; }; static struct StandardIconDescription mainIcons[] = { - { SKINICON_OTHER_MIRANDA, LPGEN("Miranda NG"), -IDI_MIRANDA }, // 0 - { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG }, // 1 - { SKINICON_EVENT_URL, LPGEN("URL"), -IDI_URL }, // 2 - { SKINICON_EVENT_FILE, LPGEN("File"), -IDI_FILE }, // 3 - { SKINICON_OTHER_USERONLINE, LPGEN("User online"), -IDI_USERONLINE }, // 4 - { SKINICON_OTHER_GROUPOPEN, LPGEN("Group (open)"), -IDI_GROUPOPEN }, // 5 - { SKINICON_OTHER_GROUPSHUT, LPGEN("Group (closed)"), -IDI_GROUPSHUT }, // 6 - { SKINICON_OTHER_CONNECTING, LPGEN("Connecting"), -IDI_LOAD }, // 7 - { SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact"), -IDI_ADDCONTACT }, // 8 - { SKINICON_OTHER_USERDETAILS, LPGEN("User details"), -IDI_USERDETAILS }, // 9 - { SKINICON_OTHER_HISTORY, LPGEN("History"), -IDI_HISTORY }, // 10 - { SKINICON_OTHER_DOWNARROW, LPGEN("Down arrow"), -IDI_DOWNARROW }, // 11 - { SKINICON_OTHER_FINDUSER, LPGEN("Find user"), -IDI_FINDUSER }, // 12 - { SKINICON_OTHER_OPTIONS, LPGEN("Options"), -IDI_OPTIONS }, // 13 - { SKINICON_OTHER_SENDEMAIL, LPGEN("Send e-mail"), -IDI_SENDEMAIL }, // 14 - { SKINICON_OTHER_DELETE, LPGEN("Delete"), -IDI_DELETE }, // 15 - { SKINICON_OTHER_RENAME, LPGEN("Rename"), -IDI_RENAME }, // 16 - { SKINICON_OTHER_SMS, LPGEN("SMS"), -IDI_SMS }, // 17 - { SKINICON_OTHER_SEARCHALL, LPGEN("Search all"), -IDI_SEARCHALL }, // 18 - { SKINICON_OTHER_TICK, LPGEN("Tick"), -IDI_TICK }, // 19 - { SKINICON_OTHER_NOTICK, LPGEN("No tick"), -IDI_NOTICK }, // 20 - { SKINICON_OTHER_HELP, LPGEN("Help"), -IDI_HELP }, // 21 - { SKINICON_OTHER_MIRANDAWEB, LPGEN("Miranda website"), -IDI_MIRANDAWEBSITE }, // 22 - { SKINICON_OTHER_TYPING, LPGEN("Typing"), -IDI_TYPING }, // 23 - { SKINICON_OTHER_SMALLDOT, LPGEN("Small dot"), -IDI_SMALLDOT }, // 24 - { SKINICON_OTHER_FILLEDBLOB, LPGEN("Filled blob"), -IDI_FILLEDBLOB }, // 25 - { SKINICON_OTHER_EMPTYBLOB, LPGEN("Empty blob"), -IDI_EMPTYBLOB }, // 26 - { SKINICON_OTHER_UNICODE, LPGEN("Unicode plugin"), -IDI_UNICODE }, // 27 - { SKINICON_OTHER_ANSI, LPGEN("ANSI plugin"), -IDI_ANSI }, // 28 - { SKINICON_OTHER_LOADED, LPGEN("Running plugin"), -IDI_LOADED }, // 29 - { SKINICON_OTHER_NOTLOADED, LPGEN("Unloaded plugin"), -IDI_NOTLOADED }, // 30 - { SKINICON_OTHER_UNDO, LPGEN("Undo"), -IDI_UNDO }, // 31 - { SKINICON_OTHER_WINDOW, LPGEN("Window"), -IDI_WINDOW }, // 32 - { SKINICON_OTHER_WINDOWS, LPGEN("System"), -IDI_WINDOWS }, // 33 - { SKINICON_OTHER_ACCMGR, LPGEN("Accounts"), -IDI_ACCMGR }, // 34 - { SKINICON_OTHER_SHOWHIDE, LPGEN("Show/Hide"), -IDI_SHOWHIDE }, // 35 - { SKINICON_OTHER_EXIT, LPGEN("Exit"), -IDI_EXIT }, // 36 - { SKINICON_OTHER_MAINMENU, LPGEN("Main menu"), -IDI_MAINMENU }, // 37 - { SKINICON_OTHER_STATUS, LPGEN("Status"), -IDI_ONLINE }, // 38 - { SKINICON_CHAT_JOIN, LPGEN("Join chat"), -IDI_JOINCHAT }, // 39 - { SKINICON_CHAT_LEAVE, LPGEN("Leave chat"), -IDI_LEAVECHAT }, // 40 - { SKINICON_OTHER_GROUP, LPGEN("Move to group"), -IDI_MOVETOGROUP }, // 41 - { SKINICON_OTHER_ON, LPGEN("On"), -IDI_ON }, // 42 - { SKINICON_OTHER_OFF, LPGEN("Off"), -IDI_OFF }, // 43 - { SKINICON_OTHER_LOADEDGRAY, LPGEN("Running core plugin"), -IDI_LOADED_GRAY }, // 44 - { SKINICON_OTHER_NOTLOADEDGRAY, LPGEN("Non-loadable plugin"), -IDI_NOTLOADED_GRAY }, // 45 - { SKINICON_OTHER_FRAME, LPGEN("Frames"), -IDI_FRAME }, // 46 - { SKINICON_OTHER_GROUPADD, LPGEN("Add group"), -IDI_ADDGROUP }, // 47 - { SKINICON_AUTH_ADD, LPGEN("Add to list"), -IDI_AUTH_ADD }, // 48 - { SKINICON_AUTH_REQUEST, LPGEN("Request authorization"), -IDI_AUTH_REQUEST }, // 49 - { SKINICON_AUTH_GRANT, LPGEN("Grant authorization"), -IDI_AUTH_GRANT }, // 50 - { SKINICON_AUTH_REVOKE, LPGEN("Revoke authorization"), -IDI_AUTH_REVOKE }, // 51 - { SKINICON_FATAL, LPGEN("Fatal error"), -IDI_MFATAL }, // 52 - { SKINICON_ERROR, LPGEN("Error"), -IDI_MERROR }, // 53 - { SKINICON_WARNING, LPGEN("Warning"), -IDI_MWARNING }, // 54 - { SKINICON_INFORMATION, LPGEN("Information"), -IDI_MINFO }, // 55 - + { SKINICON_OTHER_MIRANDA, LPGEN("Miranda NG"), -IDI_MIRANDA, 0, 0 }, // 0 + { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG, 0, 0 }, // 1 + { SKINICON_EVENT_URL, LPGEN("URL"), -IDI_URL, 0, 0 }, // 2 + { SKINICON_EVENT_FILE, LPGEN("File"), -IDI_FILE, 0, 0 }, // 3 + { SKINICON_OTHER_USERONLINE, LPGEN("User online"), -IDI_USERONLINE, 0, 0 }, // 4 + { SKINICON_OTHER_GROUPOPEN, LPGEN("Group (open)"), -IDI_GROUPOPEN, 0, 0 }, // 5 + { SKINICON_OTHER_GROUPSHUT, LPGEN("Group (closed)"), -IDI_GROUPSHUT, 0, 0 }, // 6 + { SKINICON_OTHER_CONNECTING, LPGEN("Connecting"), -IDI_LOAD, 0, 0 }, // 7 + { SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact"), -IDI_ADDCONTACT, 0, 0 }, // 8 + { SKINICON_OTHER_USERDETAILS, LPGEN("User details"), -IDI_USERDETAILS, 0, 0 }, // 9 + { SKINICON_OTHER_HISTORY, LPGEN("History"), -IDI_HISTORY, 0, 0 }, // 10 + { SKINICON_OTHER_DOWNARROW, LPGEN("Down arrow"), -IDI_DOWNARROW, 0, 0 }, // 11 + { SKINICON_OTHER_FINDUSER, LPGEN("Find user"), -IDI_FINDUSER, 0, 0 }, // 12 + { SKINICON_OTHER_OPTIONS, LPGEN("Options"), -IDI_OPTIONS, 0, 0 }, // 13 + { SKINICON_OTHER_SENDEMAIL, LPGEN("Send e-mail"), -IDI_SENDEMAIL, 0, 0 }, // 14 + { SKINICON_OTHER_DELETE, LPGEN("Delete"), -IDI_DELETE, 0, 0 }, // 15 + { SKINICON_OTHER_RENAME, LPGEN("Rename"), -IDI_RENAME, 0, 0 }, // 16 + { SKINICON_OTHER_SMS, LPGEN("SMS"), -IDI_SMS, 0, 0 }, // 17 + { SKINICON_OTHER_SEARCHALL, LPGEN("Search all"), -IDI_SEARCHALL, 0, 0 }, // 18 + { SKINICON_OTHER_TICK, LPGEN("Tick"), -IDI_TICK, 0, 0 }, // 19 + { SKINICON_OTHER_NOTICK, LPGEN("No tick"), -IDI_NOTICK, 0, 0 }, // 20 + { SKINICON_OTHER_HELP, LPGEN("Help"), -IDI_HELP, 0, 0 }, // 21 + { SKINICON_OTHER_MIRANDAWEB, LPGEN("Miranda website"), -IDI_MIRANDAWEBSITE, 0, 0 }, // 22 + { SKINICON_OTHER_TYPING, LPGEN("Typing"), -IDI_TYPING, 0, 0 }, // 23 + { SKINICON_OTHER_SMALLDOT, LPGEN("Small dot"), -IDI_SMALLDOT, 0, 0 }, // 24 + { SKINICON_OTHER_FILLEDBLOB, LPGEN("Filled blob"), -IDI_FILLEDBLOB, 0, 0 }, // 25 + { SKINICON_OTHER_EMPTYBLOB, LPGEN("Empty blob"), -IDI_EMPTYBLOB, 0, 0 }, // 26 + { SKINICON_OTHER_UNICODE, LPGEN("Unicode plugin"), -IDI_UNICODE, 0, 0 }, // 27 + { SKINICON_OTHER_ANSI, LPGEN("ANSI plugin"), -IDI_ANSI, 0, 0 }, // 28 + { SKINICON_OTHER_LOADED, LPGEN("Running plugin"), -IDI_LOADED, 0, 0 }, // 29 + { SKINICON_OTHER_NOTLOADED, LPGEN("Unloaded plugin"), -IDI_NOTLOADED, 0, 0 }, // 30 + { SKINICON_OTHER_UNDO, LPGEN("Undo"), -IDI_UNDO, 0, 0 }, // 31 + { SKINICON_OTHER_WINDOW, LPGEN("Window"), -IDI_WINDOW, 0, 0 }, // 32 + { SKINICON_OTHER_WINDOWS, LPGEN("System"), -IDI_WINDOWS, 0, 0 }, // 33 + { SKINICON_OTHER_ACCMGR, LPGEN("Accounts"), -IDI_ACCMGR, 0, 0 }, // 34 + { SKINICON_OTHER_SHOWHIDE, LPGEN("Show/Hide"), -IDI_SHOWHIDE, 0, 0 }, // 35 + { SKINICON_OTHER_EXIT, LPGEN("Exit"), -IDI_EXIT, 0, 0 }, // 36 + { SKINICON_OTHER_MAINMENU, LPGEN("Main menu"), -IDI_MAINMENU, 0, 0 }, // 37 + { SKINICON_OTHER_STATUS, LPGEN("Status"), -IDI_ONLINE, 0, 0 }, // 38 + { SKINICON_CHAT_JOIN, LPGEN("Join chat"), -IDI_JOINCHAT, 0, 0 }, // 39 + { SKINICON_CHAT_LEAVE, LPGEN("Leave chat"), -IDI_LEAVECHAT, 0, 0 }, // 40 + { SKINICON_OTHER_GROUP, LPGEN("Move to group"), -IDI_MOVETOGROUP, 0, 0 }, // 41 + { SKINICON_OTHER_ON, LPGEN("On"), -IDI_ON, 0, 0 }, // 42 + { SKINICON_OTHER_OFF, LPGEN("Off"), -IDI_OFF, 0, 0 }, // 43 + { SKINICON_OTHER_LOADEDGRAY, LPGEN("Running core plugin"), -IDI_LOADED_GRAY, 0, 0 }, // 44 + { SKINICON_OTHER_NOTLOADEDGRAY, LPGEN("Non-loadable plugin"), -IDI_NOTLOADED_GRAY, 0, 0 }, // 45 + { SKINICON_OTHER_FRAME, LPGEN("Frames"), -IDI_FRAME, 0, 0 }, // 46 + { SKINICON_OTHER_GROUPADD, LPGEN("Add group"), -IDI_ADDGROUP, 0, 0 }, // 47 + { SKINICON_AUTH_ADD, LPGEN("Add to list"), -IDI_AUTH_ADD, 0, 0 }, // 48 + { SKINICON_AUTH_REQUEST, LPGEN("Request authorization"), -IDI_AUTH_REQUEST, 0, 0 }, // 49 + { SKINICON_AUTH_GRANT, LPGEN("Grant authorization"), -IDI_AUTH_GRANT, 0, 0 }, // 50 + { SKINICON_AUTH_REVOKE, LPGEN("Revoke authorization"), -IDI_AUTH_REVOKE, 0, 0 }, // 51 + { SKINICON_FATAL, LPGEN("Fatal error"), -IDI_MFATAL, 0, 0 }, // 52 + { SKINICON_ERROR, LPGEN("Error"), -IDI_MERROR, 0, 0 }, // 53 + { SKINICON_WARNING, LPGEN("Warning"), -IDI_MWARNING, 0, 0 }, // 54 + { SKINICON_INFORMATION, LPGEN("Information"), -IDI_MINFO, 0, 0 }, // 55 + { SKINICON_OTHER_VISIBLE_ALL, LPGEN("Always visible"), -IDI_ALWAYSVIS, 0, LPGEN("Contact list") }, { SKINICON_OTHER_INVISIBLE_ALL, LPGEN("Always invisible"), -IDI_NEVERVIS, 0, LPGEN("Contact list") }, { SKINICON_OTHER_STATUS_LOCKED, LPGEN("Locked status"), -IDI_STATUS_LOCKED, 0, LPGEN("Status icons") }, @@ -230,7 +230,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) caps2 = 0; if (IsStatusConnecting(status)) { - mir_snprintf(iconName, _countof(iconName), "%s%d", mainIconsFmt, 7); + mir_snprintf(iconName, "%s%d", mainIconsFmt, 7); return IcoLib_GetIcon(iconName, big); } @@ -249,7 +249,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) // Otherwise return the global icon. This affects the global status menu mainly. if (accounts.getCount() == 1) { // format: core_status_%proto%statusindex - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, statusIndx); HICON hIcon = IcoLib_GetIcon(iconName, big); if (hIcon) @@ -257,12 +257,12 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) } // format: core_status_%s%d - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx); return IcoLib_GetIcon(iconName, big); } // format: core_status_%s%d - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, statusIndx); HICON hIcon = IcoLib_GetIcon(iconName, big); if (hIcon == NULL && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) { PROTOACCOUNT *pa = Proto_GetAccount(szProto); @@ -272,7 +272,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) // Queried protocol isn't in list, adding TCHAR tszSection[MAX_PATH]; - mir_sntprintf(tszSection, _countof(tszSection), _T(PROTOCOLS_PREFIX)_T("/%s"), pa->tszAccountName); + mir_sntprintf(tszSection, _T(PROTOCOLS_PREFIX)_T("/%s"), pa->tszAccountName); SKINICONDESC sid = { 0 }; sid.section.t = tszSection; @@ -281,11 +281,11 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) str = _tcsrchr(szPath, '\\'); if (str != NULL) *str = 0; - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\Icons\\proto_%S.dll"), szPath, pa->szProtoName); + mir_sntprintf(szFullPath, _T("%s\\Icons\\proto_%S.dll"), szPath, pa->szProtoName); if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES) sid.defaultFile.t = szFullPath; else { - mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\Plugins\\%S.dll"), szPath, szProto); + mir_sntprintf(szFullPath, _T("%s\\Plugins\\%S.dll"), szPath, szProto); if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) { DestroyIcon(hIcon); sid.defaultFile.t = szFullPath; @@ -309,7 +309,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) for (int i = lowidx; i < highidx; i++) if (caps2 == 0 || (caps2 & statusIcons[i].pf2)) { // format: core_%s%d - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, i); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, i); sid.pszName = iconName; sid.description.t = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0); sid.iDefaultIndex = statusIcons[i].resource_id; @@ -318,14 +318,14 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) } // format: core_status_%s%d - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, statusIndx); hIcon = IcoLib_GetIcon(iconName, big); if (hIcon) return hIcon; } if (hIcon == NULL) { - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx); hIcon = IcoLib_GetIcon(iconName, big); } @@ -347,7 +347,7 @@ MIR_APP_DLL(char*) Skin_GetIconName(int idx) for (int i = 0; i < _countof(mainIcons); i++) { if (idx == mainIcons[i].id) { - mir_snprintf(szIconName, _countof(szIconName), "%s%d", mainIconsFmt, i); + mir_snprintf(szIconName, "%s%d", mainIconsFmt, i); return szIconName; } } @@ -383,7 +383,7 @@ int LoadSkinIcons(void) // Add main icons to list for (int i = 0; i < _countof(mainIcons); i++) { - mir_snprintf(iconName, _countof(iconName), "%s%d", mainIconsFmt, i); + mir_snprintf(iconName, "%s%d", mainIconsFmt, i); sid.section.a = mainIcons[i].section == NULL ? LPGEN("Main icons") : (char*)mainIcons[i].section; sid.description.a = (char*)mainIcons[i].description; sid.iDefaultIndex = mainIcons[i].resource_id; @@ -396,7 +396,7 @@ int LoadSkinIcons(void) // Asterisk is used, to avoid conflict with proto-plugins // 'coz users can't rename it to name with '*' for (int i = 0; i < _countof(statusIcons); i++) { - mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i); + mir_snprintf(iconName, "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i); sid.pszName = iconName; sid.description.a = (char*)statusIcons[i].description; sid.iDefaultIndex = statusIcons[i].resource_id; diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index c4623211bb..cd90608e55 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -307,9 +307,9 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM OPENFILENAME ofn; memset(&ofn, 0, sizeof(ofn)); if (GetModuleHandle(_T("bass_interface.dll"))) - mir_sntprintf(filter, _countof(filter), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*)%c*%c"), TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0); + mir_sntprintf(filter, _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*)%c*%c"), TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0); else - mir_sntprintf(filter, _countof(filter), _T("%s (*.wav)%c*.wav%c%s (*)%c*%c"), TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0); + mir_sntprintf(filter, _T("%s (*.wav)%c*.wav%c%s (*)%c*%c"), TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = GetParent(hwndDlg); ofn.hInstance = NULL; diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp index 8911efec03..9e79495845 100644 --- a/src/mir_app/src/xmlParser.cpp +++ b/src/mir_app/src/xmlParser.cpp @@ -402,7 +402,7 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) // create message char message[2000], *s1 = (char*)"", *s3 = (char*)""; XMLCSTR s2 = _CXML(""); if (pResults.error == eXMLErrorFirstTagNotFound) { s1 = (char*)"First Tag should be '"; s2 = tag; s3 = (char*)"'.\n"; } - mir_snprintf(message, _countof(message), + mir_snprintf(message, #ifdef _XMLWIDECHAR "XML Parsing error inside file '%S'.\n%S\nAt line %i, column %i.\n%s%S%s" #else diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp index e28e07d21e..75bd198fe4 100644 --- a/src/mir_core/src/langpack.cpp +++ b/src/mir_core/src/langpack.cpp @@ -219,7 +219,7 @@ static void LoadLangPackFile(FILE *fp, char *line) TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\'); if (p) *p = 0; - mir_sntprintf(tszFileName, _countof(tszFileName), _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9)); + mir_sntprintf(tszFileName, _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9)); if (p) *p = '\\'; @@ -380,7 +380,7 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *ptszLangPack) // ensure that a lang's name is a full file name TCHAR tszFullPath[MAX_PATH]; if (!PathIsAbsoluteT(ptszLangPack)) - mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack); + mir_sntprintf(tszFullPath, _T("%s\\%s"), g_tszRoot, ptszLangPack); else _tcsncpy_s(tszFullPath, ptszLangPack, _TRUNCATE); @@ -653,7 +653,7 @@ void GetDefaultLang() // try to load langpack that matches UserDefaultUILanguage if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, _countof(tszLangName))) { - mir_sntprintf(tszPath, _countof(tszPath), _T("langpack_%s.txt"), _tcslwr(tszLangName)); + mir_sntprintf(tszPath, _T("langpack_%s.txt"), _tcslwr(tszLangName)); if (!LoadLangPack(tszPath)) { db_set_ts(NULL, "Langpack", "Current", tszPath); return; @@ -661,7 +661,7 @@ void GetDefaultLang() } // finally try to load first file - mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\langpack_*.txt"), g_tszRoot); + mir_sntprintf(tszPath, _T("%s\\langpack_*.txt"), g_tszRoot); WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFile(tszPath, &fd); diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp index ac022681dd..208a8731e4 100644 --- a/src/mir_core/src/miranda.cpp +++ b/src/mir_core/src/miranda.cpp @@ -57,9 +57,9 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM) GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath)); if (wParam) { VARST profilename(_T("%miranda_profilename%")); - mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), (TCHAR*)profilename); + mir_sntprintf(cmdLine, _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), (TCHAR*)profilename); } - else mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId()); + else mir_sntprintf(cmdLine, _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId()); CallService("CloseAction", 0, 0); CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &pi); diff --git a/src/mir_core/src/winutil.cpp b/src/mir_core/src/winutil.cpp index e0aeb7c803..42d3c331d8 100644 --- a/src/mir_core/src/winutil.cpp +++ b/src/mir_core/src/winutil.cpp @@ -31,16 +31,16 @@ MIR_CORE_DLL(int) Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const c GetWindowPlacement(hwnd, &wp); char szSettingName[64]; - mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix); + mir_snprintf(szSettingName, "%sx", szNamePrefix); db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.left); - mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix); + mir_snprintf(szSettingName, "%sy", szNamePrefix); db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.top); - mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix); + mir_snprintf(szSettingName, "%swidth", szNamePrefix); db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.right-wp.rcNormalPosition.left); - mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix); + mir_snprintf(szSettingName, "%sheight", szNamePrefix); db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.bottom-wp.rcNormalPosition.top); return 0; } @@ -54,12 +54,12 @@ EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hCont GetWindowPlacement(hwnd, &wp); char szSettingName[64]; - mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix); + mir_snprintf(szSettingName, "%sx", szNamePrefix); int x = db_get_dw(hContact, szModule, szSettingName, -1); if (x == -1) return 1; - mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix); + mir_snprintf(szSettingName, "%sy", szNamePrefix); int y = (int)db_get_dw(hContact, szModule, szSettingName, -1); if (flags & RWPF_NOSIZE) @@ -68,10 +68,10 @@ EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hCont wp.rcNormalPosition.left = x; wp.rcNormalPosition.top = y; - mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix); + mir_snprintf(szSettingName, "%swidth", szNamePrefix); wp.rcNormalPosition.right = wp.rcNormalPosition.left+db_get_dw(hContact, szModule, szSettingName, -1); - mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix); + mir_snprintf(szSettingName, "%sheight", szNamePrefix); wp.rcNormalPosition.bottom = wp.rcNormalPosition.top+db_get_dw(hContact, szModule, szSettingName, -1); } wp.flags = 0; -- cgit v1.2.3