From b499ebc740aa5480be013d40e0d8097066800642 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 22 May 2015 10:18:21 +0000 Subject: replace _tcslen to mir_tstrlen git-svn-id: http://svn.miranda-ng.org/main/trunk@13748 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/image_utils.cpp | 2 +- plugins/Alarms/src/alarm_win.cpp | 2 +- plugins/Alarms/src/alarmlist.cpp | 2 +- plugins/BasicHistory/src/ExportManager.cpp | 6 +- plugins/BasicHistory/src/HistoryWindow.cpp | 4 +- plugins/BasicHistory/src/Options.cpp | 12 +-- plugins/BasicHistory/src/RichHtmlExport.cpp | 2 +- plugins/BasicHistory/src/Searcher.cpp | 4 +- plugins/Boltun/src/boltun.cpp | 8 +- plugins/Boltun/src/config.cpp | 2 +- plugins/CSList/src/cslist.cpp | 2 +- .../ChangeKeyboardLayout/src/text_operations.cpp | 30 +++--- plugins/Clist_nicer/src/config.cpp | 2 +- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 4 +- plugins/ConnectionNotify/src/debug.cpp | 6 +- plugins/CrashDumper/src/utils.cpp | 2 +- plugins/Db3x_mmap/src/ui.cpp | 2 +- plugins/DbChecker/src/progress.cpp | 2 +- plugins/DbChecker/src/selectdb.cpp | 4 +- plugins/Db_autobackups/src/options.cpp | 10 +- plugins/Exchange/src/MirandaExchange.cpp | 14 +-- plugins/Exchange/src/emails.cpp | 2 +- plugins/Exchange/src/utils.cpp | 4 +- plugins/FTPFileYM/src/job_generic.cpp | 4 +- plugins/FTPFileYM/src/utils.cpp | 4 +- plugins/FingerprintNG/src/fingerprint.cpp | 2 +- plugins/FloatingContacts/src/thumbs.cpp | 4 +- plugins/Folders/src/services.cpp | 4 +- plugins/Folders/src/utils.cpp | 4 +- plugins/HistoryLinkListPlus/src/linklist_dlg.cpp | 2 +- plugins/HistoryLinkListPlus/src/linklist_fct.cpp | 4 +- plugins/IEView/src/TemplateHTMLBuilder.cpp | 2 +- plugins/Import/src/utils.cpp | 2 +- plugins/KeyboardNotify/src/main.cpp | 2 +- plugins/KeyboardNotify/src/options.cpp | 22 ++-- plugins/LotusNotify/src/LotusNotify.cpp | 8 +- plugins/MirOTR/src/otr.cpp | 2 +- plugins/MirOTR/src/utils.cpp | 6 +- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 2 +- plugins/NewEventNotify/src/popup.cpp | 6 +- plugins/NewXstatusNotify/src/main.cpp | 2 +- plugins/NewXstatusNotify/src/xstatus.cpp | 2 +- plugins/New_GPG/src/gpg_wrapper.cpp | 2 +- plugins/New_GPG/src/main.cpp | 18 ++-- plugins/New_GPG/src/messages.cpp | 10 +- plugins/New_GPG/src/options.cpp | 32 +++--- plugins/New_GPG/src/utilities.cpp | 36 +++---- plugins/NotesAndReminders/src/notes.cpp | 2 +- plugins/NotesAndReminders/src/options.cpp | 2 +- plugins/QuickMessages/src/Utils.cpp | 10 +- plugins/QuickMessages/src/main.cpp | 12 +-- plugins/QuickMessages/src/options.cpp | 16 +-- plugins/Quotes/src/QuoteInfoDlg.cpp | 2 +- plugins/Quotes/src/QuotesProviderGoogleFinance.cpp | 4 +- plugins/Scriver/src/chat/window.cpp | 4 +- plugins/Scriver/src/msgwindow.cpp | 2 +- plugins/SimpleAR/src/Main.cpp | 4 +- plugins/SimpleStatusMsg/src/main.cpp | 2 +- plugins/SmileyAdd/src/options.cpp | 8 +- plugins/Spamotron/src/options.cpp | 10 +- plugins/Spamotron/src/spamotron.cpp | 6 +- plugins/Spamotron/src/utils.cpp | 26 ++--- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 4 +- plugins/StatusPlugins/StartupStatus/profiles.cpp | 2 +- plugins/StopSpamMod/src/utilities.cpp | 4 +- plugins/TabSRMM/src/chat/tools.cpp | 2 +- plugins/TabSRMM/src/chat/window.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.cpp | 4 +- plugins/TabSRMM/src/taskbar.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 4 +- plugins/TipperYM/src/popwin.cpp | 14 +-- plugins/TipperYM/src/skin_parser.cpp | 2 +- plugins/TipperYM/src/str_utils.cpp | 2 +- plugins/TipperYM/src/subst.cpp | 28 ++--- plugins/TooltipNotify/src/TooltipNotify.cpp | 4 +- plugins/TooltipNotify/src/Utils.cpp | 2 +- plugins/TrafficCounter/src/TrafficCounter.cpp | 2 +- plugins/TrafficCounter/src/misc.cpp | 16 +-- plugins/TrafficCounter/src/options.cpp | 2 +- plugins/UserGuide/src/main.cpp | 6 +- plugins/UserInfoEx/src/ctrl_contact.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 2 +- plugins/UserInfoEx/src/psp_origin.cpp | 2 +- plugins/Variables/src/contact.cpp | 14 +-- plugins/Variables/src/help.cpp | 4 +- plugins/Variables/src/parse_alias.cpp | 18 ++-- plugins/Variables/src/parse_external.cpp | 6 +- plugins/Variables/src/parse_logic.cpp | 8 +- plugins/Variables/src/parse_math.cpp | 12 +-- plugins/Variables/src/parse_miranda.cpp | 42 ++++---- plugins/Variables/src/parse_str.cpp | 114 ++++++++++----------- plugins/Variables/src/parse_system.cpp | 46 ++++----- plugins/Variables/src/parse_variables.cpp | 4 +- plugins/Variables/src/tokenregister.cpp | 2 +- plugins/Variables/src/variables.cpp | 32 +++--- plugins/Weather/src/weather_contacts.cpp | 8 +- plugins/Weather/src/weather_conv.cpp | 10 +- plugins/Weather/src/weather_data.cpp | 6 +- plugins/Weather/src/weather_ini.cpp | 6 +- plugins/Weather/src/weather_update.cpp | 8 +- plugins/WebView/src/webview_alerts.cpp | 4 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 4 +- plugins/XSoundNotify/src/options.cpp | 2 +- plugins/YAMN/src/browser/mailbrowser.cpp | 8 +- plugins/YAPP/src/popwin.cpp | 4 +- plugins/YAPP/src/yapp_history_dlg.cpp | 6 +- protocols/AimOscar/src/chat.cpp | 2 +- protocols/AimOscar/src/popup.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 2 +- protocols/Gadu-Gadu/src/core.cpp | 4 +- protocols/Gadu-Gadu/src/dialogs.cpp | 14 +-- protocols/Gadu-Gadu/src/gg_proto.cpp | 10 +- protocols/Gadu-Gadu/src/groupchat.cpp | 4 +- protocols/Gadu-Gadu/src/image.cpp | 10 +- protocols/Gadu-Gadu/src/import.cpp | 26 ++--- protocols/Gadu-Gadu/src/services.cpp | 2 +- protocols/IRCG/src/options.cpp | 2 +- protocols/JabberG/src/jabber_caps.cpp | 2 +- protocols/JabberG/src/jabber_disco.cpp | 2 +- protocols/JabberG/src/jabber_form.cpp | 2 +- protocols/JabberG/src/jabber_groupchat.cpp | 2 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 2 +- protocols/JabberG/src/jabber_iqid.cpp | 6 +- protocols/JabberG/src/jabber_misc.cpp | 4 +- protocols/JabberG/src/jabber_opt.cpp | 4 +- protocols/JabberG/src/jabber_privacy.cpp | 8 +- protocols/JabberG/src/jabber_proto.cpp | 6 +- protocols/JabberG/src/jabber_svc.cpp | 2 +- protocols/JabberG/src/jabber_thread.cpp | 10 +- protocols/JabberG/src/jabber_userinfo.cpp | 4 +- protocols/JabberG/src/jabber_util.cpp | 2 +- protocols/JabberG/src/jabber_xml.cpp | 2 +- protocols/MSN/src/msn_libstr.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/Sametime/src/sametime_proto.cpp | 6 +- protocols/Sametime/src/sametime_session.cpp | 2 +- protocols/SkypeClassic/src/gchat.cpp | 6 +- protocols/Xfire/src/Xfire_base.cpp | 2 +- protocols/Xfire/src/tools.cpp | 2 +- protocols/Yahoo/src/file_transfer.cpp | 2 +- src/core/stdfile/src/fileexistsdlg.cpp | 4 +- src/core/stdfile/src/fileopts.cpp | 2 +- src/core/stdfile/src/filexferdlg.cpp | 6 +- src/core/stdmsg/src/msgdialog.cpp | 6 +- src/core/stdmsg/src/msglog.cpp | 4 +- src/modules/chat/clist.cpp | 2 +- src/modules/clist/genmenu.cpp | 4 +- src/modules/clist/movetogroup.cpp | 2 +- src/modules/database/database.cpp | 4 +- src/modules/metacontacts/meta_addto.cpp | 2 +- src/modules/netlib/netlibsecurity.cpp | 2 +- src/modules/options/filter.cpp | 10 +- src/modules/options/filter.h | 2 +- src/modules/plugins/newplugins.cpp | 2 +- src/modules/utils/path.cpp | 2 +- 156 files changed, 556 insertions(+), 556 deletions(-) diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 1f251954ed..f546a252e2 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -212,7 +212,7 @@ int BmpFilterSaveBitmap(HBITMAP hBmp, const TCHAR *ptszFile, int flags) if (!PathToAbsoluteT(ptszFile, tszFilename)) _tcsncpy_s(tszFilename, ptszFile, _TRUNCATE); - if (_tcslen(tszFilename) <= 4) + if (mir_tstrlen(tszFilename) <= 4) return -1; IMGSRVC_INFO i = { 0 }; diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index 9cabb6b70d..092911db54 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar #define AddItem(x) \ mmi.wID++; \ mmi.dwTypeData = TranslateT(x); \ - mmi.cch = ( UINT )_tcslen(mmi.dwTypeData); \ + mmi.cch = ( UINT )mir_tstrlen(mmi.dwTypeData); \ InsertMenuItem(hMenu, mmi.wID, FALSE, &mmi); AddItem(LPGEN("5 mins")); diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index cd60fe2a50..71e5171469 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -326,7 +326,7 @@ void SaveAlarms() { mir_snprintf(buff, SIZEOF(buff), "ActionFlags%d", index); db_set_dw(0, MODULE, buff, i->action); if (i->action & AAF_COMMAND) { - if (_tcslen(i->szCommand)) { + if (mir_tstrlen(i->szCommand)) { mir_snprintf(buff, SIZEOF(buff), "ActionCommand%d", index); db_set_ts(0, MODULE, buff, i->szCommand); if (mir_tstrlen(i->szCommandParams)) { diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 734ef0971d..36fc670db7 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -42,15 +42,15 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open) _tcscpy_s(extUpper, ext); extUpper[0] = std::toupper(ext[0], loc); mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext); - size_t len = _tcslen(filter) + 1; + size_t len = mir_tstrlen(filter) + 1; mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext); - len += _tcslen(filter + len); + len += mir_tstrlen(filter + len); filter[++len] = 0; TCHAR stzFilePath[1024]; _tcscpy_s(stzFilePath, TranslateT("History")); _tcscat_s(stzFilePath, _T(".")); _tcscat_s(stzFilePath, ext); - len = _tcslen(stzFilePath) + 1; + len = mir_tstrlen(stzFilePath) + 1; stzFilePath[len] = 0; OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 74fe25d110..5c18fcf4a5 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1488,7 +1488,7 @@ void HistoryWindow::SelectEventGroup(int sel) } tmi.printTimeStamp(NULL, data.timestamp, formatDate, str, MAXSELECTSTR, 0); - *strLen = (unsigned int)_tcslen(str) * sizeof(TCHAR); + *strLen = (unsigned int)mir_tstrlen(str) * sizeof(TCHAR); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutTimestamp : Options::InTimestamp); @@ -1501,7 +1501,7 @@ void HistoryWindow::SelectEventGroup(int sel) mir_sntprintf(str, MAXSELECTSTR, _T("%s\n"), myName); else mir_sntprintf(str, MAXSELECTSTR, _T("%s\n"), contactName); - *strLen = (unsigned int)_tcslen(str) * sizeof(TCHAR); + *strLen = (unsigned int)mir_tstrlen(str) * sizeof(TCHAR); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutName : Options::InName); diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 6307b9bffc..f5994e4d2c 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -806,24 +806,24 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR* _tcscpy_s(extUpper, ext); extUpper[0] = std::toupper(ext[0], loc); mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext); - size_t len = _tcslen(filter) + 1; + size_t len = mir_tstrlen(filter) + 1; mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext); - len += _tcslen(filter + len) + 1; + len += mir_tstrlen(filter + len) + 1; _tcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)")); - len += _tcslen(filter + len) + 1; + len += mir_tstrlen(filter + len) + 1; _tcscpy_s(filter + len, 1024 - len, _T("*.*")); - len += _tcslen(filter + len) + 1; + len += mir_tstrlen(filter + len) + 1; filter[len] = 0; TCHAR stzFilePath[1024]; Edit_GetText(hwndEdit, stzFilePath, 1023); if (stzFilePath[0] == 0) { _tcscpy_s(stzFilePath, defName); - len = _tcslen(stzFilePath) + 1; + len = mir_tstrlen(stzFilePath) + 1; stzFilePath[len] = 0; } else { - len = _tcslen(stzFilePath) + 1; + len = mir_tstrlen(stzFilePath) + 1; stzFilePath[len] = 0; } diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index c9552f7cb8..c3c0cefbc2 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -256,7 +256,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon) bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true) { - size_t len = _tcslen(lpszDir); + size_t len = mir_tstrlen(lpszDir); TCHAR *pszFrom = new TCHAR[len+2]; _tcscpy_s(pszFrom, len+2, lpszDir); pszFrom[len] = 0; diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index 6370ce783e..88a7355350 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -75,7 +75,7 @@ bool Searcher::CompareStr(std::wstring str, TCHAR *strFind) return str.find(strFind) < str.length(); size_t findid = str.find(strFind); - size_t findLen = _tcslen(strFind); + size_t findLen = mir_tstrlen(strFind); while(findid < str.length()) { if ((findid == 0 || std::isspace(str[findid - 1], loc) || std::ispunct(str[findid - 1], loc)) && (findid + findLen >= str.length() || std::isspace(str[findid + findLen], loc) || std::ispunct(str[findid + findLen], loc))) @@ -111,7 +111,7 @@ void Searcher::Find() } if (!matchCase) { std::locale loc; - std::transform(str, str + _tcslen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc)); + std::transform(str, str + mir_tstrlen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc)); } bool findBack1 = findBack ^ !searchForInMes; diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 13fbecfee9..7a3796ecc9 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -67,11 +67,11 @@ void UpdateEngine() TCHAR* GetFullName(const TCHAR* filename) { - size_t flen = _tcslen(filename); + size_t flen = mir_tstrlen(filename); TCHAR* fullname = const_cast(filename); if (!_tcschr(filename, _T(':'))) { - size_t plen = _tcslen(path); + size_t plen = mir_tstrlen(path); fullname = new TCHAR[plen + flen + 1]; fullname[0] = NULL; _tcscat(fullname, path); @@ -390,8 +390,8 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP TCHAR* mind = TranslateTS(MIND_FILE_DESC); TCHAR* anyfile = TranslateTS(ALL_FILES_DESC); - size_t l = _tcslen(MIND_DIALOG_FILTER) - + _tcslen(mind) + _tcslen(anyfile); + size_t l = mir_tstrlen(MIND_DIALOG_FILTER) + + mir_tstrlen(mind) + mir_tstrlen(anyfile); TCHAR *filt = new TCHAR[l]; mir_sntprintf(filt, l, MIND_DIALOG_FILTER, mind, anyfile); for (size_t i = 0; i < l; i++) diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index 40517216c1..c92db86fdf 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -58,7 +58,7 @@ inline TCHAR* GetString(char* key, const TCHAR* def) inline const TCHAR* SetString(char* key, const TCHAR* value) { - size_t len = _tcslen(value) + 1; + size_t len = mir_tstrlen(value) + 1; TCHAR* val = new TCHAR[len]; _tcscpy_s(val, len, value); db_set_ts(NULL, BOLTUN_KEY, key, val); diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 29de682404..d82121c760 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -533,7 +533,7 @@ void CSAMWindow::checkFieldLimit(WORD action, WORD item) GetDlgItemText(m_handle, item, ptszInputText, limit + 8); - if (_tcslen(ptszInputText) > limit) + if (mir_tstrlen(ptszInputText) > limit) { TCHAR tszPopupTip[MAX_PATH]; EDITBALLOONTIP ebt = { 0 }; diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 135409e4be..52de730db6 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -31,7 +31,7 @@ LPTSTR GeTStringFromStreamData(EditStreamData *esd) LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR)); LPTSTR ptszTemp = (TCHAR*)esd->pbBuff; - for (i = k = 0; i < _tcslen(ptszTemp); i++) { + for (i = k = 0; i < mir_tstrlen(ptszTemp); i++) { if ((ptszTemp[i] == 0x0A) || (ptszTemp[i] == 0x2028)) ptszOutText[k++] = 0x0D; else if (ptszTemp[i] == 0x0D) { @@ -52,7 +52,7 @@ BOOL CopyTextToClipboard(LPTSTR ptszText) return FALSE; EmptyClipboard(); - HGLOBAL hCopy = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(ptszText) + 1)*sizeof(TCHAR)); + HGLOBAL hCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(ptszText) + 1)*sizeof(TCHAR)); _tcscpy((TCHAR*)GlobalLock(hCopy), ptszText); GlobalUnlock(hCopy); SetClipboardData(CF_UNICODETEXT, hCopy); @@ -97,7 +97,7 @@ LPTSTR GenerateLayoutString(HKL hklLayout) ptszTemp[0] = 0; DWORD i; - for (i = 0; i < _tcslen(ptszKeybEng); i++) { + for (i = 0; i < mir_tstrlen(ptszKeybEng); i++) { SHORT shVirtualKey = VkKeyScanEx(ptszKeybEng[i], hklEng); UINT iScanCode = MapVirtualKeyEx(shVirtualKey & 0x00FF, 0, hklEng); @@ -141,7 +141,7 @@ LPTSTR ChangeTextCase(LPCTSTR ptszInText) LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR)); _tcscpy(ptszOutText, ptszInText); - for (DWORD i = 0; i < _tcslen(ptszInText); i++) { + for (DWORD i = 0; i < mir_tstrlen(ptszInText); i++) { CharUpperBuff(&ptszOutText[i], 1); if (ptszOutText[i] == ptszInText[i]) CharLowerBuff(&ptszOutText[i], 1); @@ -162,20 +162,20 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw if (ptszKeybCur == 0 || ptszKeybNext == 0) return ptszOutText; - for (DWORD i = 0; i < _tcslen(ptszInText); i++) { + for (DWORD i = 0; i < mir_tstrlen(ptszInText); i++) { BOOL Found = FALSE; - for (DWORD j = 0; j < _tcslen(ptszKeybCur) && !Found; j++) + for (DWORD j = 0; j < mir_tstrlen(ptszKeybCur) && !Found; j++) if (ptszKeybCur[j] == ptszInText[i]) { Found = TRUE; - if (_tcslen(ptszKeybNext) >= j) + if (mir_tstrlen(ptszKeybNext) >= j) ptszOutText[i] = ptszKeybNext[j]; } if (TwoWay && !Found) - for (DWORD j = 0; j < _tcslen(ptszKeybNext) && !Found; j++) + for (DWORD j = 0; j < mir_tstrlen(ptszKeybNext) && !Found; j++) if (ptszKeybNext[j] == ptszInText[i]) { Found = TRUE; - if (_tcslen(ptszKeybCur) >= j) + if (mir_tstrlen(ptszKeybCur) >= j) ptszOutText[i] = ptszKeybCur[j]; } } @@ -188,7 +188,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) LPTSTR ptszKeybBuff = ptszLayStrings[0]; DWORD dwMaxSymbols = 0, dwTemp = 0; - for (DWORD j = 0; j < _tcslen(ptszInText); j++) + for (DWORD j = 0; j < mir_tstrlen(ptszInText); j++) if (_tcschr(ptszKeybBuff, ptszInText[j]) != NULL) ++dwMaxSymbols; @@ -196,7 +196,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) ptszKeybBuff = ptszLayStrings[i]; DWORD dwCountSymbols = 0; - for (DWORD j = 0; j<_tcslen(ptszInText); j++) + for (DWORD j = 0; j 0)) { crTemp.cpMin = 0; - crTemp.cpMax = (int)_tcslen(ptszInText); + crTemp.cpMax = (int)mir_tstrlen(ptszInText); } else { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); @@ -351,7 +351,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) // Получаем текущее слово if (CurrentWord) { for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (_tcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--); - for (dwEndWord = crSelection.cpMin; (dwEndWord < (_tcslen(ptszInText))) && (_tcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++); + for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_tstrlen(ptszInText))) && (_tcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++); crTemp.cpMin = dwStartWord; crTemp.cpMax = dwEndWord; @@ -379,7 +379,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) ptszTemp[crTemp.cpMax - crTemp.cpMin] = 0; _tcscpy(ptszInText, ptszTemp); - if (_tcslen(ptszInText) == 0) { + if (mir_tstrlen(ptszInText) == 0) { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); InvalidateRect(hTextWnd, NULL, FALSE); @@ -416,7 +416,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else { for (i = 0; i < bLayNum; i++) if (hklLayouts[i] != hklCurLay) { - if (_tcslen(ptszMBox) != 0) + if (mir_tstrlen(ptszMBox) != 0) _tcscat(ptszMBox, _T("\n\n")); ptrT ptszTemp(GetShortNameOfLayout(hklLayouts[i])); _tcscat(ptszMBox, ptszTemp); diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 185affedf0..dbbf58a4ba 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -342,7 +342,7 @@ HMODULE Utils::loadSystemLibrary(const TCHAR* szFilename, bool useGetHandle) throw(CRTException("Error while loading system library", szFilename)); sysPathName[MAX_PATH - 1] = 0; - if (_tcslen(sysPathName) + _tcslen(szFilename) >= MAX_PATH) + if (mir_tstrlen(sysPathName) + mir_tstrlen(szFilename) >= MAX_PATH) throw(CRTException("Error while loading system library", szFilename)); mir_tstrcat(sysPathName, szFilename); diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 3b8417abfd..32eaf32610 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -75,11 +75,11 @@ BOOL strrep(TCHAR *src, TCHAR *needle, TCHAR *newstring) _tcsncpy_s(begining, src, pos); begining[pos] = 0; - pos = pos + _tcslen(needle); + pos = pos + mir_tstrlen(needle); _tcsncpy_s(tail, src + pos, _TRUNCATE); begining[pos] = 0; - pos = mir_sntprintf(src, _tcslen(src), _T("%s%s%s"), begining, newstring, tail); + pos = mir_sntprintf(src, mir_tstrlen(src), _T("%s%s%s"), begining, newstring, tail); return TRUE; } diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp index d20d46f314..633a048af4 100644 --- a/plugins/ConnectionNotify/src/debug.cpp +++ b/plugins/ConnectionNotify/src/debug.cpp @@ -29,7 +29,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...) TCHAR* s = va_arg(argptr, TCHAR *); mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s); _tcsncpy(format, OutMsg, _countof(OutMsg)); - j = (int)_tcslen(format); + j = (int)mir_tstrlen(format); _tcscat(format, _T(" ")); break; } @@ -39,7 +39,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...) char c = (char)va_arg(argptr, int); mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c); _tcsncpy(format, OutMsg, _countof(OutMsg)); - j = (int)_tcslen(format); + j = (int)mir_tstrlen(format); _tcscat(format, _T(" ")); break; } @@ -49,7 +49,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...) int d = va_arg(argptr, int); mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d); _tcsncpy(format, OutMsg, _countof(OutMsg)); - j = (int)_tcslen(format); + j = (int)mir_tstrlen(format); _tcscat(format, _T(" ")); break; } diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 164e63dfd0..09ea0ed003 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -230,7 +230,7 @@ void GetISO8061Time(SYSTEMTIME *stLocal, LPTSTR lpszString, DWORD dwSize) if (clsdates) { GetDateFormat(LOCALE_INVARIANT, 0, stLocal, TEXT("d MMM yyyy"), lpszString, dwSize); - int dlen = (int)_tcslen(lpszString); + int dlen = (int)mir_tstrlen(lpszString); GetTimeFormat(LOCALE_INVARIANT, 0, stLocal, TEXT(" H:mm:ss"), lpszString + dlen, dwSize - dlen); } else { diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index 0e202dc457..d168b99906 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -202,7 +202,7 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam case IDOK: TCHAR buf2[100]; GetDlgItemText(hwndDlg, IDC_USERPASS1, buf2, SIZEOF(buf2)); - if (_tcslen(buf2) < 3) { + if (mir_tstrlen(buf2) < 3) { SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Password is too short!")); goto LBL_Error; } diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index d38b5627ba..562f0cabb4 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -147,7 +147,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break; } if (bold) hoFont = (HFONT)SelectObject(dis->hDC, hBoldFont); - ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)_tcslen(str), NULL); + ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_tstrlen(str), NULL); if (bold) SelectObject(dis->hDC, hoFont); } return TRUE; diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index 4eeef524d3..cc51a1a434 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -160,7 +160,7 @@ void FindAdd(HWND hdlg, TCHAR *szProfileDir, TCHAR *szPrefix) TCHAR *addstring(TCHAR *str, TCHAR *add) { _tcscpy(str, add); - return str + _tcslen(add) + 1; + return str + mir_tstrlen(add) + 1; } INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -265,7 +265,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM TCHAR *filter, *tmp, *tmp1, *tmp2; tmp1 = TranslateT("Miranda Databases (*.dat)"); tmp2 = TranslateT("All Files"); - filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1) + _tcslen(tmp2) + 11)*sizeof(TCHAR)); + filter = tmp = (TCHAR*)_alloca((mir_tstrlen(tmp1) + mir_tstrlen(tmp2) + 11)*sizeof(TCHAR)); tmp = addstring(tmp, tmp1); tmp = addstring(tmp, _T("*.DAT")); tmp = addstring(tmp, tmp2); diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 4c5f399de6..91cdbf8601 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -45,7 +45,7 @@ int LoadOptions(void) if (!db_get_ts(0, "AutoBackups", "Folder", &dbv)) { TCHAR *tmp = Utils_ReplaceVarsT(dbv.ptszVal); - if (_tcslen(tmp) >= 2 && tmp[1] == ':') + if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':') _tcsncpy_s(options.folder, dbv.ptszVal, _TRUNCATE); else mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s\\%s"), profilePath, dbv.ptszVal); @@ -77,8 +77,8 @@ int SaveOptions(void) db_set_b(0, "AutoBackups", "PeriodType", (BYTE)options.period_type); mir_sntprintf(prof_dir, SIZEOF(prof_dir), _T("%s\\"), profilePath); - size_t prof_len = _tcslen(prof_dir); - size_t opt_len = _tcslen(options.folder); + size_t prof_len = mir_tstrlen(prof_dir); + size_t opt_len = mir_tstrlen(options.folder); if (opt_len > prof_len && _tcsncmp(options.folder, prof_dir, prof_len) == 0) { db_set_ts(0, "AutoBackups", "Folder", (options.folder + prof_len)); @@ -87,7 +87,7 @@ int SaveOptions(void) db_set_ts(0, "AutoBackups", "Folder", options.folder); TCHAR *tmp = Utils_ReplaceVarsT(options.folder); - if (_tcslen(tmp) < 2 || tmp[1] != ':') { + if (mir_tstrlen(tmp) < 2 || tmp[1] != ':') { _tcsncpy_s(prof_dir, options.folder, _TRUNCATE); mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s\\%s"), profilePath, prof_dir); } @@ -343,7 +343,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP BOOL folder_ok = TRUE; TCHAR *tmp = Utils_ReplaceVarsT(folder_buff); - if (_tcslen(tmp) >= 2 && tmp[1] == ':') + if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':') _tcsncpy_s(backupfolder, tmp, _TRUNCATE); else mir_sntprintf(backupfolder, SIZEOF(backupfolder), _T("%s\\%s"), profilePath, tmp); diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 6d9f455f35..2026967762 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -116,14 +116,14 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) m_nSizeEntryID = 0 ; if (NULL != szSender) { - m_nSizeSender = (UINT)_tcslen(szSender)+1; + m_nSizeSender = (UINT)mir_tstrlen(szSender)+1; m_szSender = new TCHAR[ m_nSizeSender ]; memset(m_szSender, 0, m_nSizeSender * sizeof(TCHAR)); _tcscpy(m_szSender, szSender); } if (NULL != szSubject) { - m_nSizeSubject = (UINT)_tcslen(szSubject) +1; + m_nSizeSubject = (UINT)mir_tstrlen(szSubject) +1; m_szSubject = new TCHAR[m_nSizeSubject]; memset(m_szSubject, 0, m_nSizeSubject * sizeof(TCHAR)); _tcscpy(m_szSubject, szSubject); @@ -392,7 +392,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass short nSizeOfTCHAR = sizeof( TCHAR ); if (m_szUsername == NULL && NULL != szUsername) { - nSize = (UINT)_tcslen(szUsername); + nSize = (UINT)mir_tstrlen(szUsername); if (nSize > 0) { nSize++; m_szUsername = new TCHAR[nSize]; @@ -402,7 +402,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass } if (m_szPassword == NULL && NULL != szPassword) { - nSize = (UINT)_tcslen(szPassword); + nSize = (UINT)mir_tstrlen(szPassword); if (nSize > 0) { nSize++; m_szPassword = new TCHAR[nSize]; @@ -412,7 +412,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass } if (m_szExchangeServer == NULL && NULL != szExchangeServer) { - nSize = (UINT)_tcslen(szExchangeServer); + nSize = (UINT)mir_tstrlen(szExchangeServer); if (nSize > 0) { nSize++; m_szExchangeServer = new TCHAR[nSize]; @@ -562,7 +562,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) if (FAILED(hr)) return hr; - nSize = _tcslen(m_szUsername); + nSize = mir_tstrlen(m_szUsername); szUniqName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (nSize + 4)); if (szUniqName != NULL) { memcpy(szUniqName, _T("="), sizeof(TCHAR)); @@ -867,7 +867,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) if ( NULL != szTheEnd ) { - szRegValue[ _tcslen(szRegValue) - _tcslen(szTheEnd) +5 ] = _T('\0'); + szRegValue[ mir_tstrlen(szRegValue) - mir_tstrlen(szTheEnd) +5 ] = _T('\0'); _tcscat( szRegValue, _T(" /recycle") ); STARTUPINFO si; PROCESS_INFORMATION pi; diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 23be8a9359..ae6b2309e7 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -69,7 +69,7 @@ int CExchangeServer::Connect(int bForceConnect) GetStringFromDatabase("Server", _T(""), server, _countof(server)); int port = db_get_dw(NULL, ModuleName, "Port", EXCHANGE_PORT); - if (_tcslen(server) > 0) //only connect if there's a server to connect to + if (mir_tstrlen(server) > 0) //only connect if there's a server to connect to return DoConnect(user, password, server, port); _popupUtil(TranslateT("Server is not configured...")); diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index c580d67925..0cda52c2df 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -116,7 +116,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, dbv.type = DBVT_ASCIIZ; if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) { res = 0; - int tmp = _tcslen(dbv.ptszVal); + int tmp = mir_tstrlen(dbv.ptszVal); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, dbv.ptszVal, len); szResult[len] = '\0'; @@ -124,7 +124,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, } else { res = 1; - int tmp = _tcslen(szError); + int tmp = mir_tstrlen(szError); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, szError, len); szResult[len] = '\0'; diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index e7a78e75a3..eac1b16c21 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -79,7 +79,7 @@ void GenericJob::getFilesFromOpenDialog() { TCHAR stzFile[MAX_PATH]; - size_t length = _tcslen(this->stzFilePath); + size_t length = mir_tstrlen(this->stzFilePath); if (this->stzFilePath[0] && this->stzFilePath[length+1]) // multiple files { TCHAR *ptr = this->stzFilePath + length + 1; @@ -87,7 +87,7 @@ void GenericJob::getFilesFromOpenDialog() { mir_sntprintf(stzFile, SIZEOF(stzFile), _T("%s\\%s"), this->stzFilePath, ptr); this->addFile(stzFile); - ptr += _tcslen(ptr) + 1; + ptr += mir_tstrlen(ptr) + 1; } } else diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index ca8f7d3b04..ddecc51625 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -61,7 +61,7 @@ TCHAR *Utils::getFileNameFromPath(TCHAR *stzPath) TCHAR *Utils::getTextFragment(TCHAR *stzText, size_t length, TCHAR *buff) { - if (_tcslen(stzText) > length) + if (mir_tstrlen(stzText) > length) { _tcscpy(buff, stzText); buff[length - 1] = 0; @@ -171,7 +171,7 @@ INT_PTR CALLBACK Utils::DlgProcSetFileName(HWND hwndDlg, UINT msg, WPARAM wParam if (GetDlgCtrlID((HWND)wParam) != IDC_NAME) { SetFocus(GetDlgItem(hwndDlg, IDC_NAME)); - SendDlgItemMessage(hwndDlg, IDC_NAME, EM_SETSEL, 0, _tcslen(fileName) - 4); + SendDlgItemMessage(hwndDlg, IDC_NAME, EM_SETSEL, 0, mir_tstrlen(fileName) - 4); return FALSE; } diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 154cca7085..6505b3313a 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -57,7 +57,7 @@ void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) if (!mask->szMask || !bEnable) return; - size_t iMaskLen = _tcslen(mask->szMask) + 1; + size_t iMaskLen = mir_tstrlen(mask->szMask) + 1; LPTSTR pszNewMask = (LPTSTR)HeapAlloc(hHeap, HEAP_NO_SERIALIZE, iMaskLen * sizeof(TCHAR)); _tcscpy_s(pszNewMask, iMaskLen, mask->szMask); _tcsupr_s(pszNewMask, iMaskLen); diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index f63bc1cf54..e5ea984121 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -273,7 +273,7 @@ void ThumbInfo::ResizeThumb() // Get text and icon sizes SIZEL sizeText; - GetTextExtentPoint32( hdc, ptszName, (int)_tcslen(ptszName), &sizeText); + GetTextExtentPoint32( hdc, ptszName, (int)mir_tstrlen(ptszName), &sizeText); SelectObject(hdc, hOldFont); @@ -635,7 +635,7 @@ void ThumbInfo::UpdateContent() hOldFont = (HFONT)SelectObject(hdcDraw, hFont[index]); SIZE szText; - GetTextExtentPoint32(hdcDraw, ptszName, (int)_tcslen(ptszName), &szText); + GetTextExtentPoint32(hdcDraw, ptszName, (int)mir_tstrlen(ptszName), &szText); SetTextColor(hdcDraw, bkColor); // simple border diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index af435d7fdd..4447fdece5 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -52,7 +52,7 @@ INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size) mir_free(input); - return _tcslen(szResult); + return mir_tstrlen(szResult); } INT_PTR RegisterPathService(WPARAM, LPARAM lParam) @@ -82,7 +82,7 @@ INT_PTR GetPathSizeService(WPARAM wParam, LPARAM lParam) if (lstRegisteredFolders.getIndex(p) != -1) { TCHAR tmp[MAX_FOLDER_SIZE]; p->Expand(tmp, SIZEOF(tmp)); - len = _tcslen(tmp); + len = mir_tstrlen(tmp); } else len = 0; diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 6ec62a1599..4b3a310871 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -184,7 +184,7 @@ int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *sz size_t len; DBVARIANT dbv; if (db_get_ws(NULL, ModuleName, szSettingName, &dbv) == 0) { - size_t tmp = _tcslen(dbv.ptszVal); + size_t tmp = mir_tstrlen(dbv.ptszVal); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, dbv.ptszVal, len); szResult[len] = '\0'; @@ -192,7 +192,7 @@ int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *sz return 0; } - size_t tmp = _tcslen(szError); + size_t tmp = mir_tstrlen(szError); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, szError, len); szResult[len] = '\0'; diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index a163166dd6..07da9e4f59 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -177,7 +177,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; EmptyClipboard(); - dataLen = (_tcslen(link) + 1) * sizeof(TCHAR); + dataLen = (mir_tstrlen(link) + 1) * sizeof(TCHAR); hData = GlobalAlloc(GMEM_MOVEABLE, dataLen); _tcscpy_s((LPTSTR)GlobalLock(hData), dataLen / 2, link); GlobalUnlock(hData); diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 38e4ec32b9..e745d627fc 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -116,7 +116,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) CharLower(wordsearch); for (j = 0; j < SIZEOF(hyperlinkPrefixes); j ++) { - if (!_tcsncmp(wordsearch, hyperlinkPrefixes[j], _tcslen(hyperlinkPrefixes[j]))) { + if (!_tcsncmp(wordsearch, hyperlinkPrefixes[j], mir_tstrlen(hyperlinkPrefixes[j]))) { isLink = 1; break; } @@ -803,7 +803,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz { (*elementCount)++; - tempLen = _tcslen(actualElement->link); + tempLen = mir_tstrlen(actualElement->link); if (*maxLen < tempLen) *maxLen = tempLen; } diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index d2267fdbba..34b013d07b 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -61,7 +61,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) } } if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) { - if (_tcslen(dbv.ptszVal) > 0) { + if (mir_tstrlen(dbv.ptszVal) > 0) { TCHAR *ext = _tcsrchr(dbv.ptszVal, '.'); if (ext && mir_tstrcmpi(ext, _T(".xml")) == 0) result = (TCHAR*)getFlashAvatar(dbv.ptszVal, (hContact == NULL) ? 1 : 0); diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index f224873f78..a7ac2cef78 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -34,7 +34,7 @@ int CreateGroup(const TCHAR *group, MCONTACT hContact) if (group == NULL) return 0; - size_t cbName = _tcslen(group); + size_t cbName = mir_tstrlen(group); TCHAR *tszGrpName = (TCHAR*)_alloca((cbName + 2)*sizeof(TCHAR)); tszGrpName[0] = 1 | GROUPF_EXPANDED; _tcscpy(tszGrpName + 1, group); diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 8a9b7c36b8..eb6b3f68ff 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -692,7 +692,7 @@ void createEventPrefix(TCHAR *prefixName, size_t maxLen) while (str = _tcschr(profileName, _T('\\'))) *str = _T('/'); - if ((len = _tcslen(profileName)) <= maxLen) + if ((len = mir_tstrlen(profileName)) <= maxLen) _tcsncpy_s(prefixName, maxLen, profileName, _TRUNCATE); else { str = profileName + len - maxLen / 2; diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 72bf91d5f6..8fbb05e2a9 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -873,13 +873,13 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ofn.hInstance = NULL; _tcscpy(filter, TranslateT("Keyboard Notify Theme")); wcscat(filter, _T(" (*.knt)")); - pfilter = filter + _tcslen(filter) + 1; + pfilter = filter + mir_tstrlen(filter) + 1; _tcscpy(pfilter, _T("*.knt")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; _tcscpy(pfilter, TranslateT("All Files")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; _tcscpy(pfilter, _T("*.*")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; *pfilter = _T('\0'); ofn.lpstrFilter = filter; ofn.lpstrFile = path; @@ -901,13 +901,13 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ofn.hInstance = NULL; _tcscpy(filter, TranslateT("Keyboard Notify Theme")); wcscat(filter, _T(" (*.knt)")); - pfilter = filter + _tcslen(filter) + 1; + pfilter = filter + mir_tstrlen(filter) + 1; _tcscpy(pfilter, _T("*.knt")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; _tcscpy(pfilter, TranslateT("All Files")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; _tcscpy(pfilter, _T("*.*")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; *pfilter = _T('\0'); ofn.lpstrFilter = filter; ofn.lpstrFile = path; @@ -1038,7 +1038,7 @@ void importThemes(const TCHAR *filename, BOOL overrideExisting) for (str=buffer; *str && isspace(*str); str++); //ltrim if (!*str || *str == ';') //empty line or comment continue; - for (i=_tcslen(str)-1; isspace(str[i]); str[i--]='\0'); //rtrim + for (i=mir_tstrlen(str)-1; isspace(str[i]); str[i--]='\0'); //rtrim switch (status) { case 0: if (i > 1 && str[0] == '[' && str[i] == ']') { @@ -1166,7 +1166,7 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR szFileNameAux[MAX_PATH+1]; SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux); - ProcessListAux.szFileName[i] = (TCHAR *)malloc((_tcslen(szFileNameAux) + 1)*sizeof(TCHAR)); + ProcessListAux.szFileName[i] = (TCHAR *)malloc((mir_tstrlen(szFileNameAux) + 1)*sizeof(TCHAR)); if (ProcessListAux.szFileName[i]) _tcscpy(ProcessListAux.szFileName[i], szFileNameAux); } @@ -1193,7 +1193,7 @@ void createProcessListAux(void) if (!ProcessList.szFileName[i]) ProcessListAux.szFileName[i] = NULL; else { - ProcessListAux.szFileName[i] = (TCHAR *)malloc((_tcslen(ProcessList.szFileName[i]) + 1)*sizeof(TCHAR)); + ProcessListAux.szFileName[i] = (TCHAR *)malloc((mir_tstrlen(ProcessList.szFileName[i]) + 1)*sizeof(TCHAR)); if (ProcessListAux.szFileName[i]) _tcscpy(ProcessListAux.szFileName[i], ProcessList.szFileName[i]); } diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 90470b4a8b..9a46adf9c5 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1480,15 +1480,15 @@ void checkEnvPath(TCHAR *path) cur = _tgetenv(_T("PATH")); _tcslwr(cur); found = _tcsstr(cur,path); - len = (int)_tcslen(path); + len = (int)mir_tstrlen(path); if(found != NULL && (found[len] == ';' || found[len] == 0 || (found[len] == '\\' && (found[len+1] == ';' || found[len+1] == 0)))) { return; } - assert(_tcslen(path) + _tcslen(cur) + 1 < SIZEOF(nowy)); + assert(mir_tstrlen(path) + mir_tstrlen(cur) + 1 < SIZEOF(nowy)); _tcsncpy_s(nowy, _T("PATH="), _TRUNCATE); _tcscat_s(nowy, cur); - if(cur[_tcslen(cur)-1]!=';') + if(cur[mir_tstrlen(cur)-1]!=';') _tcscat_s(nowy, _T(";")); _tcscat_s(nowy, path); _tcscat_s(nowy, _T(";")); @@ -1521,7 +1521,7 @@ static int modulesloaded(WPARAM, LPARAM) GetLotusPath(path, sizeof(path)); checkEnvPath(path); _tcscat_s(path, _countof(path), _T("nnotes.dll")); - assert(_tcslen(path)>0); + assert(mir_tstrlen(path)>0); log_p(L"Loading dll: %s", path); diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index e8f0bcbe22..8c185d99af 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -180,7 +180,7 @@ extern "C" { mir_sntprintf(buff, SIZEOF(buff), TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } if (context->protocol_version < MIROTR_PROTO_LATEST){ - size_t remaining = _tcslen(buff); + size_t remaining = mir_tstrlen(buff); TCHAR *offset = buff + remaining; remaining = SIZEOF(buff) - remaining; mir_sntprintf(offset, remaining, TranslateT("\nusing older protocol version %i"), context->protocol_version); diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 997abd82e6..9755c3fc18 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -164,7 +164,7 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTA mir_sntprintf(title, SIZEOF(title), _T("%s Message"), _T(MODULENAME)); if(line1 && line2) { - int size = int(_tcslen(line1) + _tcslen(line2) + 3); + int size = int(mir_tstrlen(line1) + mir_tstrlen(line2) + 3); TCHAR *message = new TCHAR[size]; // newline and null terminator mir_sntprintf(message, size, _T("%s\r\n%s"), line1, line2); MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION ); @@ -217,7 +217,7 @@ void ShowWarning(TCHAR *msg) { switch(disp) { case ED_POP: { - int size = int(_tcslen(msg) + 515); + int size = int(mir_tstrlen(msg) + 515); message = new TCHAR[size]; // newline and null terminator mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg); PUShowMessageT(message, SM_WARNING); @@ -264,7 +264,7 @@ void ShowError(TCHAR *msg) { switch(disp) { case ED_POP: { - int size = int(_tcslen(msg) + 515); + int size = int(mir_tstrlen(msg) + 515); message = new TCHAR[size]; // newline and null terminator mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg); PUShowMessageT(message, SM_WARNING); diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 3c493878dd..7625b0cc9a 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -80,7 +80,7 @@ static LRESULT CALLBACK MsgEditSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, int nLen = GetWindowTextLength(hWnd); TCHAR *text = (TCHAR*)_alloca((nLen + 1) * sizeof(TCHAR)); GetWindowText(hWnd, text, nLen + 1); - memmove(text + start, text + end, sizeof(TCHAR)* (_tcslen(text) + 1 - end)); + memmove(text + start, text + end, sizeof(TCHAR)* (mir_tstrlen(text) + 1 - end)); SetWindowText(hWnd, text); SendMessage(hWnd, EM_SETSEL, start, start); diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index ad88f82562..c2b22c702b 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -182,7 +182,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) // utf-8 in blob comment1 = mir_utf8decodeT((char*)dbei->pBlob); } - else if (dbei->cbBlob == (_tcslen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { + else if (dbei->cbBlob == (mir_tstrlen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { // wchar in blob (the old hack) comment1 = mir_tstrdup((TCHAR*)dbei->pBlob); } @@ -342,7 +342,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) // utf-8 in blob comment1 = mir_utf8decodeT((char*)dbei->pBlob); } - else if (dbei->cbBlob == (_tcslen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { + else if (dbei->cbBlob == (mir_tstrlen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { // wchar in blob (the old hack) comment1 = mir_tstrdup((TCHAR*)dbei->pBlob); } @@ -359,7 +359,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) // utf-8 in blob comment1 = mir_utf8decodeT((char*)dbei->pBlob); } - else if (dbei->cbBlob == (_tcslen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { + else if (dbei->cbBlob == (mir_tstrlen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { // wchar in blob (the old hack) comment1 = mir_tstrdup((TCHAR*)dbei->pBlob); } diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index f333ab12d0..c06d1bd639 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -687,7 +687,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) { // cut message if needed TCHAR *copyText = NULL; - if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (_tcslen(smi.newstatusmsg) > opt.PSMsgLen)) { + if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_tstrlen(smi.newstatusmsg) > opt.PSMsgLen)) { TCHAR buff[MAX_TEXT_LEN + 3]; copyText = mir_tstrdup(smi.newstatusmsg); _tcsncpy(buff, smi.newstatusmsg, opt.PSMsgLen); diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index fc5ce104c3..42ec34c325 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -189,7 +189,7 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc) // cut message if needed TCHAR *copyText = NULL; - if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (_tcslen(xsc->stzText) > opt.PXMsgLen)) { + if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (mir_tstrlen(xsc->stzText) > opt.PXMsgLen)) { TCHAR buff[MAX_TEXT_LEN + 3]; copyText = mir_tstrdup(xsc->stzText); _tcsncpy(buff, xsc->stzText, opt.PXMsgLen); diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index 57f8d79205..2c9c57fc92 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -48,7 +48,7 @@ pxResult pxExecute(std::vector &aargv, string *aoutput, LPDWORD ae env.push_back(L"LC_ALL=English"); argv.push_back(bin_path); TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - if(_tcslen(home_dir)) //this check are required for first run gpg binary validation + if(mir_tstrlen(home_dir)) //this check are required for first run gpg binary validation { argv.push_back(L"--homedir"); argv.push_back(home_dir); diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index ed3737b847..7ca182d3d6 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -861,7 +861,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SetCurrentDirectoryA(mir_path); tmp = mir_a2t(mir_path); mir_free(mir_path); - mir_realloc(path, (_tcslen(path)+128)*sizeof(TCHAR)); + mir_realloc(path, (mir_tstrlen(path)+128)*sizeof(TCHAR)); TCHAR *gpg_path = (TCHAR*)mir_alloc(sizeof(TCHAR) * MAX_PATH), *gpg_lang_path = (TCHAR*)mir_alloc(sizeof(TCHAR) * MAX_PATH); _tcscpy(gpg_path, tmp); _tcscat(gpg_path, _T("\\GnuPG\\gpg.exe")); @@ -1052,8 +1052,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); - while(tmp[_tcslen(tmp)-1] == '\\') - tmp[_tcslen(tmp)-1] = '\0'; + while(tmp[mir_tstrlen(tmp)-1] == '\\') + tmp[mir_tstrlen(tmp)-1] = '\0'; if(!tmp[0]) { MessageBox(0, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); @@ -1130,8 +1130,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); - while(tmp[_tcslen(tmp)-1] == '\\') - tmp[_tcslen(tmp)-1] = '\0'; + while(tmp[mir_tstrlen(tmp)-1] == '\\') + tmp[mir_tstrlen(tmp)-1] = '\0'; if(!tmp[0]) { MessageBox(0, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); @@ -1371,7 +1371,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara { //data sanity checks TCHAR *tmp = (TCHAR*)mir_alloc(sizeof(TCHAR)*5); GetDlgItemText(hwndDlg, IDC_KEY_TYPE, tmp, 5); - if(_tcslen(tmp) < 3) + if(mir_tstrlen(tmp) < 3) { mir_free(tmp); tmp = NULL; MessageBox(0, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK); @@ -1390,7 +1390,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara } tmp = (TCHAR*)mir_alloc(sizeof(TCHAR)*12); GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 11); - if(_tcslen(tmp) != 10 && tmp[0] != '0') + if(mir_tstrlen(tmp) != 10 && tmp[0] != '0') { MessageBox(0, TranslateT("Invalid date"), TranslateT("Error"), MB_OK); mir_free(tmp); @@ -1399,7 +1399,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara mir_free(tmp); tmp = (TCHAR*)mir_alloc(sizeof(TCHAR)*128); GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 127); - if(_tcslen(tmp) < 5) + if(mir_tstrlen(tmp) < 5) { MessageBox(0, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK); mir_free(tmp); @@ -1414,7 +1414,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara mir_free(tmp); tmp = (TCHAR*)mir_alloc(sizeof(TCHAR)*128); GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128); - if((_tcslen(tmp)) < 5 || (!_tcschr(tmp, _T('@'))) || (!_tcschr(tmp, _T('.')))) + if((mir_tstrlen(tmp)) < 5 || (!_tcschr(tmp, _T('@'))) || (!_tcschr(tmp, _T('.')))) { MessageBox(0, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK); mir_free(tmp); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index b29af2b1d4..ea2b7370f3 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -72,7 +72,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags debuglog<hContact, GCDNF_TCHAR))); - s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); + s2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")); db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str()); { //gpg execute block std::vector cmd; @@ -499,11 +499,11 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) void ShowNewKeyDialog(); if(((s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) { - s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); + s2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")); } else if(((s2 = str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((s1 = str.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) { - s2 += _tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")); + s2 += mir_tstrlen(_T("-----END PGP PRIVATE KEY BLOCK-----")); } new_key.append(str.substr(s1,s2-s1)); //new_key_hcnt_mutex.lock(); @@ -976,7 +976,7 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam } if(password) mir_free(password); - password = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); + password = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(tmp)+1)); _tcscpy(password, tmp); } mir_free(tmp); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 80b49f59c7..045623b8b0 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -135,7 +135,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); tmp = mir_a2t(tmp2); mir_free(tmp2); - ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); + ListView_SetItemText(hwndList, iRow, 1, (mir_tstrlen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); char *tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", ""); if(!toUTF16(tmp2).empty()) @@ -143,7 +143,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T("")); mir_free(tmp2); - ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); + ListView_SetItemText(hwndList, iRow, 2, (mir_tstrlen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", ""); if(!toUTF16(tmp2).empty()) @@ -151,7 +151,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T("")); mir_free(tmp2); - ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); + ListView_SetItemText(hwndList, iRow, 3, (mir_tstrlen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); if(db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)) ListView_SetCheckState(hwndList, iRow, 1); @@ -166,7 +166,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP } } tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", _T("")); - SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (_tcslen(tmp) > 1)?tmp:_T("c:\\GPGdebug.log")); + SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (mir_tstrlen(tmp) > 1)?tmp:_T("c:\\GPGdebug.log")); mir_free(tmp); CheckStateLoadDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog", 0); EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09); @@ -571,8 +571,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp)); db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); - while(tmp[_tcslen(tmp)-1] == '\\') - tmp[_tcslen(tmp)-1] = '\0'; + while(tmp[mir_tstrlen(tmp)-1] == '\\') + tmp[mir_tstrlen(tmp)-1] = '\0'; db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); return TRUE; } @@ -638,22 +638,22 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, SIZEOF(tmp)); db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp); mir_free(inopentag); - inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); + inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1)); _tcscpy(inopentag, tmp); GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, SIZEOF(tmp)); db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp); mir_free(inclosetag); - inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); + inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1)); _tcscpy(inclosetag, tmp); GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, SIZEOF(tmp)); db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp); mir_free(outopentag); - outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); + outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1)); _tcscpy(outopentag, tmp); GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, SIZEOF(tmp)); db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp); mir_free(outclosetag); - outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); + outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(tmp)+1)); _tcscpy(outclosetag, tmp); } return TRUE; @@ -855,16 +855,16 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam ws1 = 0; if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) { - begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1)); + begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1)); _tcscpy(begin, _T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); - end = (TCHAR*)mir_alloc(sizeof( TCHAR) * (_tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1)); + end = (TCHAR*)mir_alloc(sizeof( TCHAR) * (mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1)); _tcscpy(end, _T("-----END PGP PUBLIC KEY BLOCK-----")); } else if(((ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) { - begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1)); + begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1)); _tcscpy(begin, _T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); - end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1)); + end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1)); _tcscpy(end, _T("-----END PGP PRIVATE KEY BLOCK-----")); } else @@ -872,7 +872,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam MessageBox(0, TranslateT("This is not public or private key"), _T("INFO"), MB_OK); break; } - ws2 += _tcslen(end); + ws2 += mir_tstrlen(end); bool allsubcontacts = false; { if(db_mc_isMeta(hContact)) @@ -1252,7 +1252,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam MessageBox(0, TranslateT("There is no public or private key."), TranslateT("Info"), MB_OK); break; } - ws2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); + ws2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")); SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1,ws2-ws1).c_str()); key_buf.clear(); } diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 63ece6aab0..76b338c6a3 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -62,15 +62,15 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx ofn.Flags=OFN_EXPLORER; ofn.lpstrTitle=TranslateW(WindowTittle); _tcsncpy(filter,TranslateW(szExtDesc), SIZEOF(filter)-1); - pfilter=filter+_tcslen(filter)+1; + pfilter=filter+mir_tstrlen(filter)+1; _tcscpy(pfilter, szExt); - pfilter[_tcslen(pfilter)+1] = '\0'; - pfilter[_tcslen(pfilter)+2] = '\0'; + pfilter[mir_tstrlen(pfilter)+1] = '\0'; + pfilter[mir_tstrlen(pfilter)+2] = '\0'; ofn.lpstrFilter=filter; tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T("")); _tcsncpy(str, tmp, SIZEOF(str)-1); mir_free(tmp); - if(_tcslen(str)< 2) + if(mir_tstrlen(str)< 2) str[0] = '\0'; ofn.lpstrFile=str; ofn.nMaxFile=_MAX_PATH; @@ -89,13 +89,13 @@ TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool sav ofn.Flags=OFN_EXPLORER; ofn.lpstrTitle=TranslateW(WindowTittle); _tcscpy(filter,TranslateW(szExtDesc)); - pfilter=filter+_tcslen(filter)+1; + pfilter=filter+mir_tstrlen(filter)+1; _tcscpy(pfilter, szExt); - pfilter[_tcslen(pfilter)+1] = '\0'; - pfilter[_tcslen(pfilter)+2] = '\0'; + pfilter[mir_tstrlen(pfilter)+1] = '\0'; + pfilter[mir_tstrlen(pfilter)+2] = '\0'; ofn.lpstrFilter=filter; _tcscpy(str, _T("")); - if(_tcslen(str)< 2) + if(mir_tstrlen(str)< 2) str[0] = '\0'; ofn.lpstrFile=str; ofn.nMaxFile=_MAX_PATH; @@ -336,7 +336,7 @@ int onProtoAck(WPARAM w, LPARAM l) cmd.push_back(L"-o"); wstring file = filename; wstring::size_type p1 = file.rfind(_T(".gpg")); - file.erase(p1, _tcslen(_T(".gpg"))); + file.erase(p1, mir_tstrlen(_T(".gpg"))); if(boost::filesystem::exists(file)) { if(MessageBox(0, TranslateT("Target file exists, do you want to replace it?"), TranslateT("Warning"), MB_YESNO) == IDNO) @@ -354,16 +354,16 @@ int onProtoAck(WPARAM w, LPARAM l) dbsetting += keyid; dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); - if(_tcslen(pass) > 0 && bDebugLog) + if(mir_tstrlen(pass) > 0 && bDebugLog) debuglog<hContact, GCDNF_TCHAR))+" with password"); } else { pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); - if(_tcslen(pass) > 0 && bDebugLog) + if(mir_tstrlen(pass) > 0 && bDebugLog) debuglog<hContact, GCDNF_TCHAR))+" with password"); } - if(_tcslen(pass) > 0) + if(mir_tstrlen(pass) > 0) { cmd.push_back(L"--passphrase"); cmd.push_back(pass); @@ -483,8 +483,8 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename) name = filename; else name++; - TCHAR *file_out = new TCHAR [_tcslen(name) + _tcslen(_T(".gpg")) + 1]; - mir_sntprintf(file_out, _tcslen(name) + _tcslen(_T(".gpg")) + 1, _T("%s.gpg"), name); + TCHAR *file_out = new TCHAR [mir_tstrlen(name) + mir_tstrlen(_T(".gpg")) + 1]; + mir_sntprintf(file_out, mir_tstrlen(name) + mir_tstrlen(_T(".gpg")) + 1, _T("%s.gpg"), name); cmd.push_back(szKeyid); if(db_get_b(hcnt, szGPGModuleName, "bAlwaysTrust", 0)) { @@ -723,7 +723,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU { wstring data = str; xi.setText(local_node, _T("This message is encrypted.")); - wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + _tcslen(_T("-----BEGIN PGP MESSAGE-----")); + wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + mir_tstrlen(_T("-----BEGIN PGP MESSAGE-----")); while(data.find(_T("Version: "), p1) != wstring::npos) { p1 = data.find(_T("Version: "), p1); @@ -859,7 +859,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU } if(data.find(_T("-----BEGIN PGP SIGNATURE-----")) != wstring::npos && data.find(_T("-----END PGP SIGNATURE-----")) != wstring::npos) { - wstring::size_type p1 = data.find(_T("-----BEGIN PGP SIGNATURE-----")) + _tcslen(_T("-----BEGIN PGP SIGNATURE-----")); + wstring::size_type p1 = data.find(_T("-----BEGIN PGP SIGNATURE-----")) + mir_tstrlen(_T("-----BEGIN PGP SIGNATURE-----")); if(data.find(_T("Version: "), p1) != wstring::npos) { p1 = data.find(_T("Version: "), p1); @@ -1091,7 +1091,7 @@ bool isContactSecured(MCONTACT hContact) bool isContactHaveKey(MCONTACT hContact) { TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); - if(_tcslen(key) > 0) + if(mir_tstrlen(key) > 0) { mir_free(key); return true; @@ -1133,7 +1133,7 @@ bool isGPGValid() SetCurrentDirectoryW(mir_path); tmp = mir_tstrdup(mir_path); mir_free(mir_path); - //mir_realloc(path, (_tcslen(path)+64)*sizeof(TCHAR)); + //mir_realloc(path, (mir_tstrlen(path)+64)*sizeof(TCHAR)); TCHAR *gpg_path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH); _tcscpy(gpg_path, tmp); _tcscat(gpg_path, _T("\\GnuPG\\gpg.exe")); diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index a88a04bb8a..baf56932b8 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1043,7 +1043,7 @@ static void MeasureColorPresetMenuItem(HWND hdlg, LPMEASUREITEMSTRUCT lpMeasureI HDC hdc = GetDC(hdlg); LPTSTR lpsz = TranslateTS(clrPresets->szName); SIZE sz; - GetTextExtentPoint32(hdc, lpsz, (int)_tcslen(lpsz), &sz); + GetTextExtentPoint32(hdc, lpsz, (int)mir_tstrlen(lpsz), &sz); ReleaseDC(hdlg, hdc); lpMeasureItem->itemWidth = 50 + sz.cx; diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index e01f83ad91..a2f366e6d8 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -302,7 +302,7 @@ static void TrimString(TCHAR *s) return; TCHAR *start = s; - UINT n = UINT(_tcslen(s) - 1); + UINT n = UINT(mir_tstrlen(s) - 1); TCHAR *end = s + n; diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 2e2d8ec2b7..ad5517938b 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -365,7 +365,7 @@ TCHAR* getMenuEntry(int buttonnum, int entrynum, BYTE mode) } if (!db_get_ts(NULL, PLGNAME, szMEntry, &dbv)) { - if (_tcslen(dbv.ptszVal)) + if (mir_tstrlen(dbv.ptszVal)) buffer = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -463,7 +463,7 @@ TCHAR* ParseString(MCONTACT hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* pt break; case 'P': ptszName = mir_a2u(GetContactProto(hContact)); - NameLenght = (int)_tcslen(ptszName); + NameLenght = (int)mir_tstrlen(ptszName); p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(TCHAR)); if (!p) { mir_free(ptszName); @@ -488,7 +488,7 @@ TCHAR* ParseString(MCONTACT hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* pt case 'n': ptszName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR); - NameLenght = (int)_tcslen(ptszName); + NameLenght = (int)mir_tstrlen(ptszName); p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(TCHAR)); if (!p) break; @@ -516,7 +516,7 @@ TCHAR* ParseString(MCONTACT hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* pt if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) break; - NameLenght = (int)_tcslen(ci.pszVal); + NameLenght = (int)mir_tstrlen(ci.pszVal); ptszName = ci.pszVal; p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(TCHAR)); if (!p) { @@ -548,7 +548,7 @@ TCHAR* ParseString(MCONTACT hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* pt if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) break; - NameLenght = (int)_tcslen(ci.pszVal); + NameLenght = (int)mir_tstrlen(ci.pszVal); ptszName = ci.pszVal; p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(TCHAR)); if (!p) { diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index 4c3e63473c..c3ee162400 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -98,7 +98,7 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) hData= GetClipboardData(CF_UNICODETEXT); chBuffer= (TCHAR*)GlobalLock(hData); - textLength=(int)_tcslen(chBuffer); + textLength=(int)mir_tstrlen(chBuffer); pszCBText=mir_tstrdup(chBuffer); GlobalUnlock(hData); CloseClipboard(); @@ -115,7 +115,7 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) SendMessage(mwpd->hwnd,EM_GETSELTEXT, 0, (LPARAM)pszText); } if(qd->ptszValue){ - ptszQValue=ParseString(mwpd->hContact,qd->ptszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(qd->ptszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); + ptszQValue=ParseString(mwpd->hContact,qd->ptszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(qd->ptszValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0); if ((bIsService=qd->bIsService)&&ptszQValue) CallService(mir_u2a(ptszQValue),(WPARAM)mwpd->hContact,0); @@ -173,7 +173,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) hData= GetClipboardData(CF_UNICODETEXT); chBuffer= (TCHAR*)GlobalLock(hData); - textLength=(int)_tcslen(chBuffer); + textLength=(int)mir_tstrlen(chBuffer); pszCBText=mir_tstrdup(chBuffer); GlobalUnlock(hData); CloseClipboard(); @@ -206,7 +206,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) switch(state) { case 1: if(ButtonsList[cbcd->dwButtonId]->ptszQValue) - ptszQValue = ParseString(cbcd->hContact,ButtonsList[cbcd->dwButtonId]->ptszQValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(ButtonsList[cbcd->dwButtonId]->ptszQValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); + ptszQValue = ParseString(cbcd->hContact,ButtonsList[cbcd->dwButtonId]->ptszQValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(ButtonsList[cbcd->dwButtonId]->ptszQValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0); if ((bIsService = ButtonsList[cbcd->dwButtonId]->bIsServName) && ptszQValue) CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); break; @@ -215,7 +215,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) { ButtonData *bd = (ButtonData *)sl->items[0]; if(bd && bd->pszValue){ - ptszQValue = ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); + ptszQValue = ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(bd->pszValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0); if ((bIsService = bd->bIsServName)&&ptszQValue) CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); } @@ -263,7 +263,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) bd= (ButtonData *)sl->items[res-1]; bCTRL=(GetKeyState(VK_CONTROL)&0x8000)?1:0; if(bd->pszValue){ - ptszQValue=ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); + ptszQValue=ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(bd->pszValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0); if ((bIsService=bd->bIsServName)&&ptszQValue) CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); } diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index b1c66f66ad..103d0fe923 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -124,7 +124,7 @@ void SetMenuEntryProperties(HWND hdlg) ListData* ld = ( ListData* )tvi.lParam; TCHAR szValue[256]; GetDlgItemText(hdlg, IDC_RCLICKVALUE, szValue, SIZEOF(szValue)); - if(_tcslen(szValue)) + if(mir_tstrlen(szValue)) { if(ld->ptszOPQValue&&(ld->ptszOPQValue!=ld->ptszQValue)) mir_free(ld->ptszOPQValue); @@ -145,9 +145,9 @@ void SetMenuEntryProperties(HWND hdlg) ButtonData* bd = ( ButtonData* )tvi.lParam; TCHAR szValue[256]; GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue)); - if(_tcslen(szValue)) + if(mir_tstrlen(szValue)) { - if(_tcslen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue)) + if(mir_tstrlen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue)) mir_free(bd->pszOpValue); bd->pszOpValue=mir_tstrdup(szValue); } @@ -773,7 +773,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel)); hwndEdit=NULL; - if (!_tcslen(szLabel)) break; + if (!mir_tstrlen(szLabel)) break; if (bd = (ButtonData*)tvi.lParam){ if (!_tcscmp(szLabel,_T("---"))) { if(TreeView_GetChild(hMenuTree,tvi.hItem)) @@ -829,7 +829,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) if (bd) { TCHAR szValue[256]; GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue)); - if(_tcslen(szValue)) + if(mir_tstrlen(szValue)) { if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue)) mir_free(bd->pszOpValue); @@ -905,7 +905,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel)); hwndEdit=NULL; - if (!_tcslen(szLabel)) break; + if (!mir_tstrlen(szLabel)) break; tvi.pszText=szLabel; ((ListData*)tvi.lParam)->dwOPFlags|=QMF_RENAMED; @@ -992,7 +992,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, SIZEOF(namebuff)); tvis.item.mask=TVIF_PARAM|TVIF_TEXT; - tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button"); + tvis.item.pszText=(mir_tstrlen(namebuff))?namebuff:TranslateT("New Button"); tvis.item.lParam=(LPARAM)ld; TreeView_SelectItem(hButtonsList,TreeView_InsertItem(hButtonsList,&tvis)); }break; @@ -1042,7 +1042,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, SIZEOF(namebuff)); bd->dwOPPos=TreeView_GetCount(hMenuTree)-1; - bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry")); + bd->pszOpName=mir_tstrlen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry")); bd->pszOpValue=mir_tstrdup(bd->pszOpName); bd->fEntryOpType=!_tcscmp(namebuff,_T("---"))?QMF_EX_SEPARATOR:0; bd->dwOPFlags=QMF_NEW; diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index 52abaa46df..e94245e3c3 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -77,7 +77,7 @@ namespace TCHAR szTime[50]; if (0 == _tctime_s(szTime, 50, &nFetchTime)) { - szTime[::_tcslen(szTime) - 1] = _T('\0'); + szTime[::mir_tstrlen(szTime) - 1] = _T('\0'); ::SetDlgItemText(hdlg, IDC_EDIT_RATE_FETCH_TIME, szTime); } } diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index d05b7c082c..f4bbc2fe7f 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -89,7 +89,7 @@ namespace tstring get_company_id(const tstring& rsHTML) { static LPCTSTR pszVarName = _T("setCompanyId("); - static size_t cVarNameLength = _tcslen(pszVarName); + static size_t cVarNameLength = mir_tstrlen(pszVarName); tstring sResult; tstring::size_type n = rsHTML.find(pszVarName); @@ -116,7 +116,7 @@ namespace tstring get_company_name(const tstring& rsHTML) { static LPCTSTR pszVarName = _T("var _companyName = "); - static size_t cVarNameLength = _tcslen(pszVarName); + static size_t cVarNameLength = mir_tstrlen(pszVarName); tstring s = get_var_value(rsHTML, pszVarName, cVarNameLength); if (s.size() > 0 && _T('\'') == s[0]) diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index a66f2b3398..6c0323998c 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -221,7 +221,7 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) start -= 2; if (dat->szSearchResult != NULL) { - int cbResult = (int)_tcslen(dat->szSearchResult); + int cbResult = (int)mir_tstrlen(dat->szSearchResult); if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { start -= cbResult; goto LBL_SkipEnd; @@ -276,7 +276,7 @@ LBL_SkipEnd: if (end != start) { ptrT szReplace; if (!isRoom && !isTopic && g_Settings.bAddColonToAutoComplete && start == 0) { - szReplace = (TCHAR*)mir_alloc((_tcslen(pszName) + 4) * sizeof(TCHAR)); + szReplace = (TCHAR*)mir_alloc((mir_tstrlen(pszName) + 4) * sizeof(TCHAR)); _tcscpy(szReplace, pszName); _tcscat(szReplace, _T(": ")); pszName = szReplace; diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 71874509a9..70902bc0b5 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -89,7 +89,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) for (len = 0, p = tmplt; *p; p++, len++) { if (*p == '%') { for (i = 0; i < SIZEOF(titleTokenNames); i++) { - int tnlen = (int)_tcslen(titleTokenNames[i]); + int tnlen = (int)mir_tstrlen(titleTokenNames[i]); if (!_tcsncmp(p, titleTokenNames[i], tnlen)) { len += tokenLen[i] - 1; p += tnlen - 1; diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index aa1e5bdfb9..5b468ea34b 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -209,12 +209,12 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) return FALSE; } - msgLen += (int)_tcslen(dbv.ptszVal); + msgLen += (int)mir_tstrlen(dbv.ptszVal); if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbvHead)) { ptszTemp = dbvHead.ptszVal; ptszTemp.Replace(_T("%user%"), dbvNick.ptszVal); - msgLen += (int)(_tcslen(ptszTemp)); + msgLen += (int)(mir_tstrlen(ptszTemp)); } ptszTemp2 = (TCHAR*)mir_alloc(sizeof(TCHAR) * (msgLen+5)); mir_sntprintf(ptszTemp2, msgLen+5, _T("%s\r\n\r\n%s"), ptszTemp.c_str(), dbv.ptszVal); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index c59d2184e4..3aa567406b 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -122,7 +122,7 @@ static TCHAR *GetWinampSong(void) if (pstr < szTitle + (iTitleLen / 2)) { - memmove(szTitle, pstr + 9, _tcslen(pstr + 9) * sizeof(TCHAR)); + memmove(szTitle, pstr + 9, mir_tstrlen(pstr + 9) * sizeof(TCHAR)); pstr = _tcsstr(pstr + 1, _T(" - Winamp")); if (pstr == NULL) { diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 5d2f6a3d40..f2e0474f86 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -535,14 +535,14 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item) TCHAR filter[512], *pfilter; _tcscpy(filter, TranslateT("Smiley packs")); mir_tstrcat(filter, _T(" (*.msl;*.asl;*.xep)")); - pfilter = filter + _tcslen(filter) + 1; + pfilter = filter + mir_tstrlen(filter) + 1; _tcscpy(pfilter, _T("*.msl;*.asl;*.xep")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; _tcscpy(pfilter, TranslateT("All files")); mir_tstrcat(pfilter, _T(" (*.*)")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; _tcscpy(pfilter, _T("*.*")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; *pfilter = '\0'; ofn.lpstrFilter = filter; diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index dee33a833c..47c231ab6f 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -7,9 +7,9 @@ TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char* DBVARIANT dbv = {0}; _tcsnset(buf, 0, buflen); if (db_get_ts(hContact, PLUGIN_NAME, option, &dbv) != 0) - _tcsncpy(buf, def, min(buflen, _tcslen(def)+1)); + _tcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1)); else if (dbv.type == DBVT_TCHAR) { - _tcsncpy(buf, dbv.ptszVal, min(buflen, _tcslen(dbv.ptszVal)+1)); + _tcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1)); } db_free(&dbv); return buf; @@ -20,12 +20,12 @@ TCHAR* _getMOptS(TCHAR *buf, unsigned int buflen, const char* module, const char DBVARIANT dbv = {0}; _tcsnset(buf, 0, buflen); if (db_get_s(NULL, module, option, &dbv) != 0) - _tcsncpy(buf, def, min(buflen, _tcslen(def)+1)); + _tcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1)); else if (dbv.type == DBVT_TCHAR) { - _tcsncpy(buf, dbv.ptszVal, min(buflen, _tcslen(dbv.ptszVal)+1)); + _tcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1)); } else { tmp = mir_a2u(dbv.pszVal); - _tcsncpy(buf, tmp, min(buflen, _tcslen(tmp)+1)); + _tcsncpy(buf, tmp, min(buflen, mir_tstrlen(tmp)+1)); mir_free(tmp); } db_free(&dbv); diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index f37ae252db..0a0b6a77e0 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -194,7 +194,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) bCorrectResponse = TRUE; } else { if (_tcsstr_cc(message, buf, _getOptB("ResponseCC", defaultResponseCC)) && - (_tcslen(message) == _tcslen(buf))) + (mir_tstrlen(message) == mir_tstrlen(buf))) bCorrectResponse = TRUE; } break; @@ -211,7 +211,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) } } else { if (_tcsstr_cc(message, buf, _getOptB("ResponseCC", defaultResponseCC)) && - (_tcslen(message) == _tcslen(buf))) { + (mir_tstrlen(message) == mir_tstrlen(buf))) { bCorrectResponse = TRUE; break; } @@ -223,7 +223,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (message == NULL) break; _itot(_getCOptD(hContact, "ResponseMath", -1), buf, 10); - if (_tcsstr(message, buf) && (_tcslen(buf) == _tcslen(message))) { + if (_tcsstr(message, buf) && (mir_tstrlen(buf) == mir_tstrlen(message))) { bCorrectResponse = TRUE; } break; diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 81d1493fa7..2c8ba48df7 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -7,7 +7,7 @@ TCHAR *_tcstolower(TCHAR *dst) if (dst == NULL) return NULL; - SIZE_T dst_len = _tcslen(dst); + SIZE_T dst_len = mir_tstrlen(dst); for (SIZE_T i = 0; i < dst_len; i ++) dst[i] = _totlower(dst[i]); return dst; @@ -18,7 +18,7 @@ TCHAR *_tcstoupper(TCHAR *dst) if (dst == NULL) return NULL; - SIZE_T dst_len = _tcslen(dst); + SIZE_T dst_len = mir_tstrlen(dst); for (SIZE_T i = 0; i < dst_len; i ++) dst[i] = _totupper(dst[i]); return dst; @@ -42,7 +42,7 @@ BOOL _isregex(TCHAR* strSearch) regex = mir_tstrdup(strSearch); if (regex == NULL) goto err_out; - rc = pcre16_exec(re, NULL, regex, (int)_tcslen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, regex, (int)mir_tstrlen(regex), 0, 0, ovector, 9); if (rc == 3) ret = TRUE; mir_free(regex); @@ -73,7 +73,7 @@ BOOL _isvalidregex(TCHAR* strSearch) pcre16_free(re); return FALSE; } - rc = pcre16_exec(re, NULL, regex, (int)_tcslen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, regex, (int)mir_tstrlen(regex), 0, 0, ovector, 9); pcre16_free(re); if (rc != 3) goto err_out; @@ -121,7 +121,7 @@ BOOL _regmatch(TCHAR* str, TCHAR* strSearch) pcre16_free(re); return FALSE; } - rc = pcre16_exec(re, NULL, regex, (int)_tcslen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, regex, (int)mir_tstrlen(regex), 0, 0, ovector, 9); pcre16_free(re); if (rc != 3) goto err_out; // [TODO] and log some error (better check for valid regex on options save) @@ -143,7 +143,7 @@ BOOL _regmatch(TCHAR* str, TCHAR* strSearch) re = pcre16_compile(regexp, opts, &error, &erroroffs, NULL); if (re == NULL) goto err_out; - rc = pcre16_exec(re, NULL, data, (int)_tcslen(data), 0, 0, NULL, 0); + rc = pcre16_exec(re, NULL, data, (int)mir_tstrlen(data), 0, 0, NULL, 0); pcre16_free(re); if (rc >= 0) ret = TRUE; @@ -175,7 +175,7 @@ int get_response_id(const TCHAR* strvar) pcre16_free(re); return 0; } - rc = pcre16_exec(re, NULL, _strvar, (int)_tcslen(_strvar), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, _strvar, (int)mir_tstrlen(_strvar), 0, 0, ovector, 9); pcre16_free(re); if (rc < 0) { ret = -1; @@ -274,10 +274,10 @@ BOOL Contains(TCHAR* dst, TCHAR* src) // Checks for occurence of substring from if (tdst == NULL) goto err_out; tdst = _tcstoupper(tdst); - dst_len = _tcslen(tdst); + dst_len = mir_tstrlen(tdst); token = _tcstok(tsrc, _T(",")); while (token) { - token_end = (token + _tcslen(token)); + token_end = (token + mir_tstrlen(token)); while (!_tcsncmp(token, _T(" "), 1)) { /* Skeep spaces at start. */ token ++; } @@ -329,9 +329,9 @@ TCHAR* ReplaceVar(TCHAR *dst, unsigned int len, const TCHAR *var, const TCHAR *r if (dst == NULL || var == NULL || rvar == NULL) return NULL; - dst_len = _tcslen(dst); - var_len = _tcslen(var); - rvar_len = _tcslen(rvar); + dst_len = mir_tstrlen(dst); + var_len = mir_tstrlen(var); + rvar_len = mir_tstrlen(rvar); var_start = _tcsstr(dst, var); while (var_start) { if (len < (dst_len + rvar_len - var_len + 1)) @@ -390,7 +390,7 @@ TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num) mir_free(dstcopy); goto err_out; } - rc = pcre16_exec(re, NULL, _str, (int)_tcslen(_str), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, _str, (int)mir_tstrlen(_str), 0, 0, ovector, 9); if (rc < 0) { ret = -1; } else if (rc == 3) { diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 8551cf26fa..a65e36e22a 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -931,10 +931,10 @@ static int ProcessPopup(int reason, LPARAM lParam) memset(protoInfo, '\0', sizeof(protoInfo)); _tcscpy(protoInfo, _T("\r\n")); for (int i = 0; i < connectionSettings.getCount(); i++) { - if (_tcslen(ps[i]->tszAccName) > 0 && mir_strlen(ps[i]->szName) > 0) { + if (mir_tstrlen(ps[i]->tszAccName) > 0 && mir_strlen(ps[i]->szName) > 0) { if (db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) { mir_sntprintf(protoInfoLine, SIZEOF(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, GSMDF_TCHAR)); - _tcsncat(protoInfo, protoInfoLine, SIZEOF(protoInfo) - _tcslen(protoInfo) - 1); + _tcsncat(protoInfo, protoInfoLine, SIZEOF(protoInfo) - mir_tstrlen(protoInfo) - 1); } } } diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index f9d9ed8d23..7814703f23 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -192,7 +192,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto) if ( (pce[i].profile == profile) && (!strcmp(pce[i].szProto, szProto))) { mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG); if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db - pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(_tcslen(dbv.ptszVal)+1)); + pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(mir_tstrlen(dbv.ptszVal)+1)); if (pce[i].msg != NULL) { _tcscpy(pce[i].msg, dbv.ptszVal); } diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 4e56ea72ef..894d156ad9 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -121,7 +121,7 @@ tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact){ // case-insensitive _tcscmp //by nullbie as i remember... -#define NEWTSTR_MALLOC(A) (A==NULL) ? NULL : _tcscpy((TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(A)+1)),A) +#define NEWTSTR_MALLOC(A) (A==NULL) ? NULL : _tcscpy((TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(A)+1)),A) const int Stricmp(const TCHAR *str, const TCHAR *substr) { int i = 0; @@ -187,7 +187,7 @@ BOOL IsUrlContains(TCHAR * Str) L".tv" }; - if(Str && _tcslen(Str)>0) { + if(Str && mir_tstrlen(Str)>0) { TCHAR *StrLower = NEWTSTR_MALLOC(Str); CharLowerBuff(StrLower, mir_tstrlen(StrLower)); for (int i=0; iptszNick != NULL) { dwMask |= CMUCHighlight::MATCH_NICKNAME; if (si && g_Settings.bLogClassicIndicators) { - size_t len = _tcslen(gce->ptszNick) + 1; + size_t len = mir_tstrlen(gce->ptszNick) + 1; TCHAR *tmp = (TCHAR*)_alloca(sizeof(TCHAR)*(len + 1)); *tmp = GetIndicator(si, gce->ptszNick, 0); _tcscpy(tmp + 1, gce->ptszNick); diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 917c3266c3..bcb1e6d30b 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -451,7 +451,7 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) start -= 2; if (dat->szSearchResult != NULL) { - int cbResult = (int)_tcslen(dat->szSearchResult); + int cbResult = (int)mir_tstrlen(dat->szSearchResult); if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { start -= cbResult; goto LBL_SkipEnd; diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 52e1eef1ad..aa9965f604 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1924,14 +1924,14 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp) return; } - if (tempdirlen <= 0 || tempdirlen >= MAX_PATH - _tcslen(mirandatempdir) - _tcslen(filenametemplate) - 2) // -2 is because %Y takes 4 symbols + if (tempdirlen <= 0 || tempdirlen >= MAX_PATH - mir_tstrlen(mirandatempdir) - mir_tstrlen(filenametemplate) - 2) // -2 is because %Y takes 4 symbols filename[0] = 0; // prompt for a new name else { _tcscpy(filename + tempdirlen, mirandatempdir); if ((GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES || ((GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) == 0)) && CreateDirectory(filename, NULL) == 0) filename[0] = 0; else { - tempdirlen = _tcslen(filename); + tempdirlen = mir_tstrlen(filename); time_t rawtime; time(&rawtime); diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 6ff4c4c4c2..1342aff813 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -900,7 +900,7 @@ void CThumbMUC::renderContent() else { mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Server window")); CSkin::RenderText(m_hdc, m_dat->hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true); - if (mi->tszIdleMsg[0] && _tcslen(mi->tszIdleMsg) > 2) { + if (mi->tszIdleMsg[0] && mir_tstrlen(mi->tszIdleMsg) > 2) { m_rcIcon.top += m_sz.cy; CSkin::RenderText(m_hdc, m_dat->hTheme, &mi->tszIdleMsg[2], &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true); } diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 33f1f2ab27..4c376925b9 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -473,8 +473,8 @@ TCHAR* Utils::GetPreviewWithEllipsis(TCHAR *szText, size_t iMaxLen) TCHAR *p = 0, cSaved; bool fEllipsis = false; - if (_tcslen(szText) <= iMaxLen) { - uRequired = _tcslen(szText) + 4; + if (mir_tstrlen(szText) <= iMaxLen) { + uRequired = mir_tstrlen(szText) + 4; cSaved = 0; } else { diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 23eccb1026..495957a6ae 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -28,7 +28,7 @@ __inline void AddRow(PopupWindowData *pwd, TCHAR *swzLabel, TCHAR *swzValue, cha pwd->rows = pRows; pwd->rows[pwd->iRowCount].swzLabel = swzLabel ? mir_tstrdup(swzLabel) : NULL; pwd->rows[pwd->iRowCount].swzValue = swzValue ? mir_tstrdup(swzValue) : NULL; - pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)_tcslen(swzValue), szProto) : NULL; + pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)mir_tstrlen(swzValue), szProto) : NULL; pwd->rows[pwd->iRowCount].bValueNewline = bNewline; pwd->rows[pwd->iRowCount].bLineAbove = bLineAbove; pwd->rows[pwd->iRowCount].bIsTitle = bIsTitle; @@ -76,7 +76,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa _tcscpy(pwd->swzTitle, pa->tszAccountName); } - if (_tcslen(pwd->swzTitle) == 0) + if (mir_tstrlen(pwd->swzTitle) == 0) a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); if (CallService(MS_PROTO_ISACCOUNTLOCKED, 0, (LPARAM)pwd->clcit.szProto)) @@ -225,7 +225,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } else { TCHAR buff[2048], *swzText = pwd->clcit.swzText; - size_t iBuffPos, i = 0, iSize = _tcslen(pwd->clcit.swzText); + size_t iBuffPos, i = 0, iSize = mir_tstrlen(pwd->clcit.swzText); bool bTopMessage = false; while (i < iSize && swzText[i] != _T('<')) { @@ -772,7 +772,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa for (int i = 0; i < pwd->iRowCount; i++) { if (pwd->rows[i].swzValue) { TCHAR buff[128]; - int iLen = (int)_tcslen(pwd->rows[i].swzValue); + int iLen = (int)mir_tstrlen(pwd->rows[i].swzValue); if (iLen) { if (iLen > MAX_VALUE_LEN) { _tcsncpy(buff, pwd->rows[i].swzValue, MAX_VALUE_LEN); @@ -1066,7 +1066,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->rows[pwd->iRowCount].swzLabel = mir_tstrdup(buff_label); pwd->rows[pwd->iRowCount].swzValue = mir_tstrdup(buff); - pwd->rows[pwd->iRowCount].spi = Smileys_PreParse(buff, (int)_tcslen(buff), szProto); + pwd->rows[pwd->iRowCount].spi = Smileys_PreParse(buff, (int)mir_tstrlen(buff), szProto); pwd->rows[pwd->iRowCount].bValueNewline = node->di.bValueNewline; pwd->rows[pwd->iRowCount].bLineAbove = node->di.bLineAbove; pwd->iRowCount++; @@ -1183,7 +1183,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa else if (hFontLabels) SelectObject(hdc, (HGDIOBJ)hFontLabels); - GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)_tcslen(pwd->rows[i].swzLabel), &sz); + GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)mir_tstrlen(pwd->rows[i].swzLabel), &sz); if (sz.cx > pwd->iLabelWidth) pwd->iLabelWidth = sz.cx; } @@ -1198,7 +1198,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SelectObject(hdc, (HGDIOBJ)hFontLabels); if (pwd->rows[i].swzLabel && pwd->rows[i].swzLabel[0]) - GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)_tcslen(pwd->rows[i].swzLabel), &sz); + GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)mir_tstrlen(pwd->rows[i].swzLabel), &sz); else sz.cy = sz.cx = 0; diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index f93448d397..a36d2fed36 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -206,7 +206,7 @@ void ParseFontPart(FILE *fp, TCHAR *buff) { if (GetSettingName(buff, "", szSetting, sizeof(szSetting) - 1)) { - if (_tcslen(pch) > 32) + if (mir_tstrlen(pch) > 32) pch[32] = 0; db_set_ts(0, MODULE, szSetting, pch); diff --git a/plugins/TipperYM/src/str_utils.cpp b/plugins/TipperYM/src/str_utils.cpp index a79cb3b351..b6b605c7de 100644 --- a/plugins/TipperYM/src/str_utils.cpp +++ b/plugins/TipperYM/src/str_utils.cpp @@ -195,7 +195,7 @@ char *t2utf(const TCHAR *ts) TCHAR *myfgets(TCHAR *Buf, int MaxCount, FILE *File) { _fgetts(Buf, MaxCount, File); - for (size_t i = _tcslen(Buf) - 1; ; i--) + for (size_t i = mir_tstrlen(Buf) - 1; ; i--) { if (Buf[i] == '\n' || Buf[i] == ' ') Buf[i] = 0; diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 9d4c23a4ec..31fa26a4a3 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -85,7 +85,7 @@ void StripBBCodesInPlace(TCHAR *swzText) return; size_t iRead = 0, iWrite = 0; - size_t iLen = _tcslen(swzText); + size_t iLen = mir_tstrlen(swzText); while(iRead <= iLen) { // copy terminating null too while (iRead <= iLen && swzText[iRead] != '[') { @@ -225,7 +225,7 @@ TCHAR* GetStatusMessageText(MCONTACT hContact) return NULL; if (!db_get_ts(hContact, MODULE, "TempStatusMsg", &dbv)) { - if (_tcslen(dbv.ptszVal) != 0) + if (mir_tstrlen(dbv.ptszVal) != 0) swzMsg = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -237,7 +237,7 @@ TCHAR* GetStatusMessageText(MCONTACT hContact) return NULL; if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) { - if (_tcslen(dbv.ptszVal) != 0) + if (mir_tstrlen(dbv.ptszVal) != 0) swzMsg = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -480,7 +480,7 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF // pass to variables plugin if available TCHAR *swzVarSrc = (parseTipperVarsFirst ? mir_tstrdup(swzSource) : variables_parsedup((TCHAR *)swzSource, 0, hContact)); - size_t iSourceLen = _tcslen(swzVarSrc); + size_t iSourceLen = mir_tstrlen(swzVarSrc); size_t si = 0, di = 0, v = 0; TCHAR swzVName[LABEL_LEN], swzRep[VALUE_LEN], swzAlt[VALUE_LEN]; @@ -558,13 +558,13 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF if (p) { *p = 0; // clip swzAlt from swzVName p++; - if (_tcslen(p) > 4 && _tcsncmp(p, _T("raw:"), 4) == 0) { // raw db substitution + if (mir_tstrlen(p) > 4 && _tcsncmp(p, _T("raw:"), 4) == 0) { // raw db substitution char raw_spec[LABEL_LEN]; p += 4; t2a(p, raw_spec, LABEL_LEN); GetRawSubstText(hContact, raw_spec, swzAlt, VALUE_LEN); } - else if (_tcslen(p) > 4 && _tcsncmp(p, _T("sys:"), 4) == 0) { // 'system' substitution + else if (mir_tstrlen(p) > 4 && _tcsncmp(p, _T("sys:"), 4) == 0) { // 'system' substitution p += 4; GetSysSubstText(hContact, p, swzAlt, VALUE_LEN); } @@ -586,7 +586,7 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF } } swzAlt[VALUE_LEN - 1] = 0; - if (_tcslen(swzAlt) != 0) + if (mir_tstrlen(swzAlt) != 0) bAltSubst = true; } @@ -618,12 +618,12 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF } if (bSubst) { - size_t rep_len = _tcslen(swzRep); + size_t rep_len = mir_tstrlen(swzRep); _tcsncpy(&swzDest[di], swzRep, min(rep_len, iDestLen - di)); di += rep_len - 1; // -1 because we inc at bottom of loop } else if (bAltSubst) { - size_t alt_len = _tcslen(swzAlt); + size_t alt_len = mir_tstrlen(swzAlt); _tcsncpy(&swzDest[di], swzAlt, min(alt_len, iDestLen - di)); di += alt_len - 1; // -1 because we inc at bottom of loop } @@ -680,7 +680,7 @@ bool GetValueText(MCONTACT hContact, const DISPLAYITEM &di, TCHAR *buff, size_t void TruncateString(TCHAR *swzText) { if (swzText && opt.iLimitCharCount > 3) { - if ((int)_tcslen(swzText) > opt.iLimitCharCount) { + if ((int)mir_tstrlen(swzText) > opt.iLimitCharCount) { swzText[opt.iLimitCharCount - 3] = 0; _tcscat(swzText, _T("...")); } @@ -731,7 +731,7 @@ TCHAR *GetProtoExtraStatusTitle(char *szProto) return NULL; if (!db_get_ts(0, szProto, "XStatusName", &dbv)) { - if (_tcslen(dbv.ptszVal) != 0) + if (mir_tstrlen(dbv.ptszVal) != 0) swzText = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -756,7 +756,7 @@ TCHAR *GetProtoExtraStatusMessage(char *szProto) TCHAR *swzText = NULL; DBVARIANT dbv; if (!db_get_ts(0, szProto, "XStatusMsg", &dbv)) { - if (_tcslen(dbv.ptszVal) != 0) + if (mir_tstrlen(dbv.ptszVal) != 0) swzText = mir_tstrdup(dbv.ptszVal); db_free(&dbv); @@ -794,7 +794,7 @@ TCHAR *GetListeningTo(char *szProto) return NULL; if (!db_get_ts(0, szProto, "ListeningTo", &dbv)) { - if (_tcslen(dbv.ptszVal) != 0) + if (mir_tstrlen(dbv.ptszVal) != 0) swzText = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -816,7 +816,7 @@ TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szV char szSetting[128]; mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, szSlot, szValue); if (!db_get_ts(0, "AdvStatus", szSetting, &dbv)) { - if (_tcslen(dbv.ptszVal) != 0) + if (mir_tstrlen(dbv.ptszVal) != 0) swzText = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index ff655894f6..e1ab66d706 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -920,8 +920,8 @@ TCHAR *CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR * mir_sntprintf(szString, iBufSize - 1, szFormatString, wszProto, _T(": "), szContactName); - TruncateWithDots(szString, iBufSize-1-_tcslen(szStatus)-_tcslen(szIs)-2); // 2 spaces around szIs - mir_sntprintf(szString + _tcslen(szString), iBufSize - 1 - _tcslen(szString), _T(" %s %s"), szIs, szStatus); + TruncateWithDots(szString, iBufSize-1-mir_tstrlen(szStatus)-mir_tstrlen(szIs)-2); // 2 spaces around szIs + mir_sntprintf(szString + mir_tstrlen(szString), iBufSize - 1 - mir_tstrlen(szString), _T(" %s %s"), szIs, szStatus); return szString; } diff --git a/plugins/TooltipNotify/src/Utils.cpp b/plugins/TooltipNotify/src/Utils.cpp index 63b981bb78..0142470143 100644 --- a/plugins/TooltipNotify/src/Utils.cpp +++ b/plugins/TooltipNotify/src/Utils.cpp @@ -15,7 +15,7 @@ BOOL IsNt50() void TruncateWithDots(TCHAR* szString, size_t iNewLen) { - size_t iOrigLen = _tcslen(szString); + size_t iOrigLen = mir_tstrlen(szString); if (iNewLen < iOrigLen) { TCHAR* p = szString+iNewLen; *p = _T('\0'); diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 4749b7f457..724dba4b04 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -1180,7 +1180,7 @@ void CreateProtocolList(void) { ProtoList[i].name = (char*)mir_alloc(mir_strlen(acc[i]->szModuleName) + 1); strcpy(ProtoList[i].name, acc[i]->szModuleName); - ProtoList[i].tszAccountName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (1 + _tcslen(acc[i]->tszAccountName))); + ProtoList[i].tszAccountName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (1 + mir_tstrlen(acc[i]->tszAccountName))); _tcscpy(ProtoList[i].tszAccountName, acc[i]->tszAccountName); // ProtoList[i].Flags = db_get_b(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, 3); diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index 4b51e25056..72bb146280 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -66,9 +66,9 @@ WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList) else { // Выделяем память под строку. - (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * _tcslen(end)); + (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * mir_tstrlen(end)); // Копируем строку. - _tcsncpy((*RowItemsList)[c].String, end + 1, _tcslen(end)); + _tcsncpy((*RowItemsList)[c].String, end + 1, mir_tstrlen(end)); } c++; @@ -156,7 +156,7 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size) mir_sntprintf(Str1, SIZEOF(Str1), _T("%d.%d"), Value / Divider, Value % Divider); size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0); if (!l) return 0; - l += _tcslen(szUnit) + 1; + l += mir_tstrlen(szUnit) + 1; Res = (TCHAR*)malloc(l * sizeof(TCHAR)); if (!Res) return 0; GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, Res, l); @@ -165,11 +165,11 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size) if (Size && Buffer) { _tcscpy(Buffer, Res); - l = _tcslen(Buffer); + l = mir_tstrlen(Buffer); } else { - l = _tcslen(Res) + 1; + l = mir_tstrlen(Res) + 1; } free(Res); @@ -257,7 +257,7 @@ size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Siz } // Добавим памяти, если нужно. - Length = _tcslen(Res) + _tcslen(Token) + 1; + Length = mir_tstrlen(Res) + mir_tstrlen(Token) + 1; Res = (TCHAR*)realloc(Res, Length * sizeof(TCHAR)); _tcscat(Res, Token); } @@ -265,11 +265,11 @@ size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Siz if (Size && Buffer) { _tcsncpy(Buffer, Res, Size); - Length = _tcslen(Buffer); + Length = mir_tstrlen(Buffer); } else { - Length = _tcslen(Res) + 1; + Length = mir_tstrlen(Res) + 1; } free(Res); diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index bdbd4cfd6c..76f0f433df 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -194,7 +194,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, { options[i].szSettingName = (char*)mir_alloc(1 + mir_strlen(ProtoList[j].name)); strcpy(options[i].szSettingName, ProtoList[j].name); - size_t l = 20 + _tcslen(ProtoList[j].tszAccountName); + size_t l = 20 + mir_tstrlen(ProtoList[j].tszAccountName); options[i].szOptionName = (TCHAR*)mir_alloc(sizeof(TCHAR) * l); mir_sntprintf(options[i].szOptionName, l, _T("Visible accounts/%s"), ProtoList[j].tszAccountName); options[i].dwFlag = (ProtoList[j++].Enabled ? 1 : OPTTREE_INVISIBLE) | OPTTREE_NOTRANSLATE; diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 33e0181457..ca1b05925a 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -44,12 +44,12 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) if (pszDivider == NULL) { _tcscpy(pszDirName, _T("")); - _tcsncpy(pszFileName, ptszHelpFile, _tcslen(ptszHelpFile)); + _tcsncpy(pszFileName, ptszHelpFile, mir_tstrlen(ptszHelpFile)); } else { - _tcsncpy(pszFileName, pszDivider + 1, _tcslen(ptszHelpFile) - _tcslen(pszDivider) - 1); - pszFileName[_tcslen(ptszHelpFile) - _tcslen(pszDivider) - 1] = 0; + _tcsncpy(pszFileName, pszDivider + 1, mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1); + pszFileName[mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1] = 0; _tcsncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile); pszDirName[pszDivider - ptszHelpFile] = 0; } diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 4ed530558f..a3d22c6061 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -1463,7 +1463,7 @@ int CtrlContactWriteMyItemsToDB( if (!hContact && !(pszModule = pszProto)) return 1; pszOther = TranslateT("Other"); - ccOther = _tcslen(pszOther); + ccOther = mir_tstrlen(pszOther); cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS; cbi.pszCat = szCat; cbi.ccCat = MAX_CAT; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index ffc2423ca2..b67b99b966 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -280,7 +280,7 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM lParam) if (SendMessage(hClist,CLM_GETITEMTYPE, (WPARAM)hItem, 0) == CLCIT_GROUP) { SendMessage(hClist,CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)ptszItem); LPTSTR temp = mir_tstrdup(ptszGroup); - mir_sntprintf(tszGroup, SIZEOF(tszGroup),_T("%s%s%s"), ptszItem, _tcslen(temp)? _T("\\"):_T(""), temp); + mir_sntprintf(tszGroup, SIZEOF(tszGroup),_T("%s%s%s"), ptszItem, mir_tstrlen(temp)? _T("\\"):_T(""), temp); mir_free (temp); } hParent = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_PARENT, (LPARAM)hItem); diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 5d435f4e7d..d7582ca475 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -95,7 +95,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara mt.DateFormatLong(szTime, SIZEOF(szTime)); _tcscat(szTime, _T(" - ")); - ptr = szTime + _tcslen(szTime); + ptr = szTime + mir_tstrlen(szTime); mt.TimeFormat(ptr, SIZEOF(szTime) - (ptr - szTime)); SetDlgItemText(hDlg, TXT_DATEADDED, szTime); } diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 5ccc20cea5..cbb70481bc 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -91,7 +91,7 @@ static HANDLE hContactSettingChangedHook; */ BYTE getContactInfoType(TCHAR* type) { - if (type == NULL || _tcslen(type) == 0 ) + if (type == NULL || mir_tstrlen(type) == 0 ) return 0; for (int i=0; i < SIZEOF(builtinCnfs); i++ ) @@ -206,7 +206,7 @@ int getContactFromString(CONTACTSINFO *ci) tszContact = NEWTSTR_ALLOCA(tmp); mir_free(tmp); } - if ((tszContact == NULL) || (_tcslen(tszContact) == 0)) + if ((tszContact == NULL) || (mir_tstrlen(tszContact) == 0)) return -1; ci->hContacts = NULL; @@ -234,12 +234,12 @@ int getContactFromString(CONTACTSINFO *ci) BOOL bMatch = FALSE; // <_HANDLE_:hContact> - size_t size = _tcslen(_T(PROTOID_HANDLE)) + 36; + size_t size = mir_tstrlen(_T(PROTOID_HANDLE)) + 36; szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR)); if (szFind != NULL) { mir_sntprintf(szFind, size, _T("<%s:%p>"), _T(PROTOID_HANDLE), hContact); - if (!_tcsncmp(tszContact, szFind, _tcslen(tszContact))) + if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact))) bMatch = TRUE; mir_free(szFind); @@ -255,12 +255,12 @@ int getContactFromString(CONTACTSINFO *ci) TCHAR *cInfo = getContactInfoT(CNF_UNIQUEID, hContact); if (cInfo) { - size_t size = _tcslen(cInfo) + mir_strlen(szProto) + 4; + size_t size = mir_tstrlen(cInfo) + mir_strlen(szProto) + 4; szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR)); if (szFind != NULL) { mir_sntprintf(szFind, size, _T("<%S:%s>"), szProto, cInfo); mir_free(cInfo); - if (!_tcsncmp(tszContact, szFind, _tcslen(tszContact))) + if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact))) bMatch = TRUE; mir_free(szFind); } @@ -416,7 +416,7 @@ TCHAR* encodeContactToString(MCONTACT hContact) if (szProto == NULL || tszUniqueId == NULL) return NULL; - size_t size = _tcslen(tszUniqueId) + mir_strlen(szProto) + 4; + size_t size = mir_tstrlen(tszUniqueId) + mir_strlen(szProto) + 4; TCHAR *tszResult = (TCHAR *)mir_calloc(size * sizeof(TCHAR)); if (tszResult) mir_sntprintf(tszResult, size, _T("<%S:%s>"), szProto, tszUniqueId); diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index a76a3a15e9..49f3de4fa7 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -314,7 +314,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr) } else args = NULL; - size_t len = _tcslen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; + size_t len = mir_tstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; TCHAR *desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR)); if (desc == NULL) { mir_free(helpText); @@ -484,7 +484,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar if (tr == NULL) break; - size_t len = _tcslen(tr->tszTokenString) + 2; + size_t len = mir_tstrlen(tr->tszTokenString) + 2; TCHAR *tokenString = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR)); if (tokenString == NULL) break; diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 557f5be2eb..87256051f5 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -45,7 +45,7 @@ static ALIASREGISTER *searchAliasRegister(TCHAR *szAlias) static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg) { - if (_tcslen(tArg) == 0) + if (mir_tstrlen(tArg) == 0) return res; unsigned int cur = 0, ecur = 0; @@ -55,14 +55,14 @@ static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg) while ((*(res + ecur) != ')') && (*(res + ecur) != ',')) ecur++; - if (((signed int)_tcslen(tArg) == (ecur - cur)) && (!_tcsncmp(tArg, res + cur, _tcslen(tArg)))) { - if (_tcslen(rArg) > _tcslen(tArg)) { - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + (_tcslen(rArg) - _tcslen(tArg)) + 1)*sizeof(TCHAR)); + if (((signed int)mir_tstrlen(tArg) == (ecur - cur)) && (!_tcsncmp(tArg, res + cur, mir_tstrlen(tArg)))) { + if (mir_tstrlen(rArg) > mir_tstrlen(tArg)) { + res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + (mir_tstrlen(rArg) - mir_tstrlen(tArg)) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; } - memmove(res + ecur + (_tcslen(rArg) - _tcslen(tArg)), res + ecur, (_tcslen(res + ecur) + 1)*sizeof(TCHAR)); - _tcsncpy(res + cur, rArg, _tcslen(rArg)); + memmove(res + ecur + (mir_tstrlen(rArg) - mir_tstrlen(tArg)), res + ecur, (mir_tstrlen(res + ecur) + 1)*sizeof(TCHAR)); + _tcsncpy(res + cur, rArg, mir_tstrlen(rArg)); } } cur++; @@ -89,7 +89,7 @@ static TCHAR *parseTranslateAlias(ARGUMENTSINFO *ai) static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, TCHAR *szTranslation) { - if (szAlias == NULL || szTranslation == NULL || _tcslen(szAlias) == 0) + if (szAlias == NULL || szTranslation == NULL || mir_tstrlen(szAlias) == 0) return -1; mir_cslock lck(csAliasRegister); @@ -156,9 +156,9 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) TCHAR *szArgs = NULL; for (int i = 0; i < argc; i++) { if (i == 0) - szArgs = (TCHAR*)mir_calloc((_tcslen(argv[i]) + 2)*sizeof(TCHAR)); + szArgs = (TCHAR*)mir_calloc((mir_tstrlen(argv[i]) + 2)*sizeof(TCHAR)); else - szArgs = (TCHAR*)mir_realloc(szArgs, (_tcslen(szArgs) + _tcslen(argv[i]) + 2)*sizeof(TCHAR)); + szArgs = (TCHAR*)mir_realloc(szArgs, (mir_tstrlen(szArgs) + mir_tstrlen(argv[i]) + 2)*sizeof(TCHAR)); _tcscat(szArgs, argv[i]); if (i != argc - 1) diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 47aefa0410..4aec50a9ee 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -37,13 +37,13 @@ static TCHAR *getFullWinampTitleText() mir_free(szWinText); return NULL; } - TCHAR *szTitle = (TCHAR*)mir_alloc((2 * _tcslen(szWinText) + 1)*sizeof(TCHAR)); + TCHAR *szTitle = (TCHAR*)mir_alloc((2 * mir_tstrlen(szWinText) + 1)*sizeof(TCHAR)); if (szTitle == NULL) { mir_free(szWinText); return NULL; } _tcscpy(szTitle, szWinText); - _tcscpy(szTitle + _tcslen(szTitle), szWinText); + _tcscpy(szTitle + mir_tstrlen(szTitle), szWinText); mir_free(szWinText); return szTitle; @@ -61,7 +61,7 @@ static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) TCHAR *scur = _tcschr(szTitle, '.'); TCHAR *cur; - if ((scur == NULL) || ((cur = _tcsstr(scur, _T(" - Winamp"))) == NULL) || (scur >= cur) || (scur > (szTitle + _tcslen(szTitle) - 2)) || (cur > (szTitle + _tcslen(szTitle)))) { + if ((scur == NULL) || ((cur = _tcsstr(scur, _T(" - Winamp"))) == NULL) || (scur >= cur) || (scur > (szTitle + mir_tstrlen(szTitle) - 2)) || (cur > (szTitle + mir_tstrlen(szTitle)))) { mir_free(szTitle); return NULL; } diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 9ce10a3a92..ec1c70e2a3 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -150,7 +150,7 @@ static TCHAR *parseIflonger(ARGUMENTSINFO *ai) if (tszFirst == NULL || tszSecond == NULL) return NULL; - if (_tcslen(tszFirst) > _tcslen(tszSecond)) + if (mir_tstrlen(tszFirst) > mir_tstrlen(tszSecond)) return mir_tstrdup(ai->targv[3]); return mir_tstrdup(ai->targv[4]); @@ -180,13 +180,13 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai) TCHAR *parsed = formatString(&fi); if (parsed != NULL) { if (res == NULL) { - res = (TCHAR*)mir_alloc(_tcslen(parsed) + 1 * sizeof(TCHAR)); + res = (TCHAR*)mir_alloc(mir_tstrlen(parsed) + 1 * sizeof(TCHAR)); if (res == NULL) { mir_free(parsed); return NULL; } } - else res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(parsed) + 1)*sizeof(TCHAR)); + else res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(parsed) + 1)*sizeof(TCHAR)); _tcscat(res, parsed); mir_free(parsed); @@ -228,7 +228,7 @@ static TCHAR *parseLonger(ARGUMENTSINFO *ai) if (ai->argc != 3) return NULL; - if (_tcslen(ai->targv[1]) <= _tcslen(ai->targv[2])) + if (mir_tstrlen(ai->targv[1]) <= mir_tstrlen(ai->targv[2])) ai->flags |= AIF_FALSE; return mir_tstrdup(_T("")); diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index 54820e48f1..2581828c28 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -55,12 +55,12 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) int val = ttoi(ai->targv[1]); int padding = ttoi(ai->targv[2]); mir_sntprintf(szVal, SIZEOF(szVal), _T("%x"), val); - unsigned int zeros = max(padding - (signed int)_tcslen(szVal), 0); - TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR)); + unsigned int zeros = max(padding - (signed int)mir_tstrlen(szVal), 0); + TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(TCHAR)); if (res == NULL) return NULL; - memset(res, 0, ((zeros + _tcslen(szVal) + 3) * sizeof(TCHAR))); + memset(res, 0, ((zeros + mir_tstrlen(szVal) + 3) * sizeof(TCHAR))); _tcscpy(res, _T("0x")); for (i = 0; i < zeros; i++) *(res + 2 + i) = '0'; @@ -140,14 +140,14 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai) if (szVal == NULL) return NULL; - unsigned zeros = max(padding - (signed int)_tcslen(szVal), 0); - TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR)); + unsigned zeros = max(padding - (signed int)mir_tstrlen(szVal), 0); + TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 1)*sizeof(TCHAR)); if (res == NULL) { mir_free(szVal); return NULL; } - memset(res, 0, ((zeros + _tcslen(szVal) + 1) * sizeof(TCHAR))); + memset(res, 0, ((zeros + mir_tstrlen(szVal) + 1) * sizeof(TCHAR))); TCHAR *cur = res; for (unsigned i = 0; i < zeros; i++) *cur++ = '0'; diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index a60aa9871a..e0efa6e192 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -35,34 +35,34 @@ static TCHAR* parseCodeToStatus(ARGUMENTSINFO *ai) static int getContactInfoFlags(TCHAR *tszDesc) { int flags = 0; - for (TCHAR *cur = tszDesc; (cur < (tszDesc + _tcslen(tszDesc))); cur++) { - if (!_tcsnicmp(cur, STR_PROTOID, _tcslen(STR_PROTOID))) { + for (TCHAR *cur = tszDesc; (cur < (tszDesc + mir_tstrlen(tszDesc))); cur++) { + if (!_tcsnicmp(cur, STR_PROTOID, mir_tstrlen(STR_PROTOID))) { flags |= CI_PROTOID; - cur += _tcslen(STR_PROTOID) - 1; + cur += mir_tstrlen(STR_PROTOID) - 1; } - else if (!_tcsnicmp(cur, STR_NICK, _tcslen(STR_NICK))) { + else if (!_tcsnicmp(cur, STR_NICK, mir_tstrlen(STR_NICK))) { flags |= CI_NICK; - cur += _tcslen(STR_NICK) - 1; + cur += mir_tstrlen(STR_NICK) - 1; } - else if (!_tcsnicmp(cur, STR_FIRSTNAME, _tcslen(STR_FIRSTNAME))) { + else if (!_tcsnicmp(cur, STR_FIRSTNAME, mir_tstrlen(STR_FIRSTNAME))) { flags |= CI_FIRSTNAME; - cur += _tcslen(STR_FIRSTNAME) - 1; + cur += mir_tstrlen(STR_FIRSTNAME) - 1; } - else if (!_tcsnicmp(cur, STR_LASTNAME, _tcslen(STR_LASTNAME))) { + else if (!_tcsnicmp(cur, STR_LASTNAME, mir_tstrlen(STR_LASTNAME))) { flags |= CI_LASTNAME; - cur += _tcslen(STR_LASTNAME) - 1; + cur += mir_tstrlen(STR_LASTNAME) - 1; } - else if (!_tcsnicmp(cur, STR_DISPLAY, _tcslen(STR_DISPLAY))) { + else if (!_tcsnicmp(cur, STR_DISPLAY, mir_tstrlen(STR_DISPLAY))) { flags |= CI_LISTNAME; - cur += _tcslen(STR_DISPLAY) - 1; + cur += mir_tstrlen(STR_DISPLAY) - 1; } - else if (!_tcsnicmp(cur, STR_EMAIL, _tcslen(STR_EMAIL))) { + else if (!_tcsnicmp(cur, STR_EMAIL, mir_tstrlen(STR_EMAIL))) { flags |= CI_EMAIL; - cur += _tcslen(STR_EMAIL) - 1; + cur += mir_tstrlen(STR_EMAIL) - 1; } - else if (!_tcsnicmp(cur, STR_UNIQUEID, _tcslen(STR_UNIQUEID))) { + else if (!_tcsnicmp(cur, STR_UNIQUEID, mir_tstrlen(STR_UNIQUEID))) { flags |= CI_UNIQUEID; - cur += _tcslen(STR_UNIQUEID) - 1; + cur += mir_tstrlen(STR_UNIQUEID) - 1; } } if (flags == 0) { @@ -210,7 +210,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai) return NULL; MCONTACT hContact = NULL; - if (_tcslen(ai->targv[1]) > 0) { + if (mir_tstrlen(ai->targv[1]) > 0) { CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); ci.tszContact = ai->targv[1]; @@ -236,7 +236,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai) return NULL; } - TCHAR *szDefaultValue = ((ai->argc > 4 && _tcslen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL); + TCHAR *szDefaultValue = ((ai->argc > 4 && mir_tstrlen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL); TCHAR *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue); mir_free(szDefaultValue); mir_free(szSetting); @@ -265,7 +265,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai) } TCHAR *szFormat; - if (ai->argc == 2 || (ai->argc > 2 && _tcslen(ai->targv[2]) == 0)) + if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0)) szFormat = NULL; else szFormat = ai->targv[2]; @@ -319,7 +319,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai) } TCHAR *szFormat; - if (ai->argc == 2 || (ai->argc > 2 && _tcslen(ai->targv[2]) == 0)) + if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0)) szFormat = NULL; else szFormat = ai->targv[2]; @@ -402,7 +402,7 @@ static TCHAR* parseMyStatus(ARGUMENTSINFO *ai) return NULL; int status; - if (ai->argc == 1 || _tcslen(ai->targv[1]) == 0) + if (ai->argc == 1 || mir_tstrlen(ai->targv[1]) == 0) status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); else status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0); @@ -475,7 +475,7 @@ static TCHAR* parseSpecialContact(ARGUMENTSINFO *ai) if (szUniqueID == NULL) return NULL; - size_t size = mir_strlen(szProto) + _tcslen(szUniqueID) + 4; + size_t size = mir_strlen(szProto) + mir_tstrlen(szUniqueID) + 4; TCHAR *res = (TCHAR*)mir_alloc(size * sizeof(TCHAR)); if (res == NULL) return NULL; diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 0f6cb00b0d..cd61ae483d 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -84,9 +84,9 @@ static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) log_debug(cur); int loc = cur - res; - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + 2)*sizeof(TCHAR)); + res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 2)*sizeof(TCHAR)); cur = res + loc; - memmove(cur + 2, cur + 1, (_tcslen(cur + 1) + 1)*sizeof(TCHAR)); + memmove(cur + 2, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(TCHAR)); memcpy(cur, _T("\r\n"), 2 * sizeof(TCHAR)); cur += 2; } @@ -113,7 +113,7 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[1]); cur--; - TCHAR *res = (TCHAR*)mir_alloc((cur - ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((cur - ai->targv[1] + mir_tstrlen(szReplacement) + 1)*sizeof(TCHAR)); if (res == NULL) return res; @@ -133,26 +133,26 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) } TCHAR *res = mir_tstrdup(ai->targv[1]); - for (size_t pos = 0; pos < _tcslen(res); pos++) { + for (size_t pos = 0; pos < mir_tstrlen(res); pos++) { TCHAR *cur = res + pos; TCHAR *szEol = NULL; - if (!_tcsncmp(cur, _T("\r\n"), _tcslen(_T("\r\n")))) + if (!_tcsncmp(cur, _T("\r\n"), mir_tstrlen(_T("\r\n")))) szEol = _T("\r\n"); if (*cur == '\n') szEol = _T("\n"); if (szEol != NULL) { - if (_tcslen(szReplacement) > _tcslen(szEol)) { - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szReplacement) - _tcslen(szEol) + 1)*sizeof(TCHAR)); + if (mir_tstrlen(szReplacement) > mir_tstrlen(szEol)) { + res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szReplacement) - mir_tstrlen(szEol) + 1)*sizeof(TCHAR)); cur = res + pos; } - memmove(cur + _tcslen(szReplacement), cur + _tcslen(szEol), (_tcslen(cur + _tcslen(szEol)) + 1)*sizeof(TCHAR)); - memcpy(cur, szReplacement, _tcslen(szReplacement)*sizeof(TCHAR)); - pos += _tcslen(szReplacement) - 1; + memmove(cur + mir_tstrlen(szReplacement), cur + mir_tstrlen(szEol), (mir_tstrlen(cur + mir_tstrlen(szEol)) + 1)*sizeof(TCHAR)); + memcpy(cur, szReplacement, mir_tstrlen(szReplacement)*sizeof(TCHAR)); + pos += mir_tstrlen(szReplacement) - 1; } } - return (TCHAR*)mir_realloc(res, (_tcslen(res) + 1)*sizeof(TCHAR)); + return (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR)); } static TCHAR *parseInsert(ARGUMENTSINFO *ai) @@ -161,17 +161,17 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai) return NULL; unsigned int pos = ttoi(ai->targv[3]); - if (pos > _tcslen(ai->targv[1])) + if (pos > mir_tstrlen(ai->targv[1])) return NULL; - TCHAR *res = (TCHAR*)mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; - memset(res, 0, ((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1) * sizeof(TCHAR))); + memset(res, 0, ((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1) * sizeof(TCHAR))); _tcsncpy(res, ai->targv[1], pos); _tcscpy(res + pos, ai->targv[2]); - _tcscpy(res + pos + _tcslen(ai->targv[2]), ai->targv[1] + pos); + _tcscpy(res + pos + mir_tstrlen(ai->targv[2]), ai->targv[1] + pos); return res; } @@ -184,7 +184,7 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai) if (len < 0) return NULL; - len = min(len, (signed int)_tcslen(ai->targv[1])); + len = min(len, (signed int)mir_tstrlen(ai->targv[1])); TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; @@ -199,7 +199,7 @@ static TCHAR *parseLen(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - return itot((int)_tcslen(ai->targv[1])); + return itot((int)mir_tstrlen(ai->targv[1])); } static TCHAR *parseLineCount(ARGUMENTSINFO *ai) @@ -209,7 +209,7 @@ static TCHAR *parseLineCount(ARGUMENTSINFO *ai) int count = 1; TCHAR *cur = ai->targv[1]; - while (cur < (ai->targv[1] + _tcslen(ai->targv[1]))) { + while (cur < (ai->targv[1] + mir_tstrlen(ai->targv[1]))) { if (!_tcsncmp(cur, _T("\r\n"), 2)) { count++; cur++; @@ -242,7 +242,7 @@ static TCHAR *parseLongest(ARGUMENTSINFO *ai) unsigned int iLong = 1; for (unsigned int i = 2; i < ai->argc; i++) - if (_tcslen(ai->targv[i]) > _tcslen(ai->targv[iLong])) + if (mir_tstrlen(ai->targv[i]) > mir_tstrlen(ai->targv[iLong])) iLong = i; return mir_tstrdup(ai->targv[iLong]); @@ -269,12 +269,12 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai) if (padding < 0) return NULL; - unsigned int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0); - TCHAR *res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR)); + unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0); + TCHAR *res = (TCHAR*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; - memset(res, 0, ((addcount + _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR))); + memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR))); TCHAR *cur = res; for (unsigned int i = 0; i < addcount; i++) *cur++ = padchar; @@ -296,14 +296,14 @@ static TCHAR *parsePadright(ARGUMENTSINFO *ai) if (padding < 0) return NULL; - unsigned int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0); - TCHAR *res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR)); + unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0); + TCHAR *res = (TCHAR*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; - memset(res, 0, ((addcount + _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR))); + memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR))); _tcscpy(res, ai->targv[1]); - TCHAR *cur = res + _tcslen(ai->targv[1]); + TCHAR *cur = res + mir_tstrlen(ai->targv[1]); for (unsigned int i = 0; i < addcount; i++) *cur++ = padchar; @@ -323,7 +323,7 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) if (padding < 0) return NULL; - int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0); + int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0); TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; @@ -352,7 +352,7 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) if (padding < 0) return NULL; - int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0); + int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0); TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; @@ -377,11 +377,11 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai) if (count < 0) return NULL; - TCHAR *res = (TCHAR*)mir_alloc((count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((count * mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; - memset(res, 0, ((count * _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR))); + memset(res, 0, ((count * mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR))); for (int i = 0; i < count; i++) _tcscat(res, ai->targv[1]); @@ -398,22 +398,22 @@ static TCHAR *parseReplace(ARGUMENTSINFO *ai) size_t pos = 0; TCHAR *res = mir_tstrdup(ai->targv[1]); for (size_t i = 2; i < ai->argc; i += 2) { - if (_tcslen(ai->targv[i]) == 0) + if (mir_tstrlen(ai->targv[i]) == 0) continue; - for (pos = 0; pos<_tcslen(res); pos++) { + for (pos = 0; postargv[i], _tcslen(ai->targv[i]))) { - if (_tcslen(ai->targv[i + 1]) > _tcslen(ai->targv[i])) { - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(ai->targv[i + 1]) - _tcslen(ai->targv[i]) + 1)*sizeof(TCHAR)); + if (!_tcsncmp(cur, ai->targv[i], mir_tstrlen(ai->targv[i]))) { + if (mir_tstrlen(ai->targv[i + 1]) > mir_tstrlen(ai->targv[i])) { + res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(ai->targv[i + 1]) - mir_tstrlen(ai->targv[i]) + 1)*sizeof(TCHAR)); cur = res + pos; } - memmove(cur + _tcslen(ai->targv[i + 1]), cur + _tcslen(ai->targv[i]), (_tcslen(cur + _tcslen(ai->targv[i])) + 1)*sizeof(TCHAR)); - memcpy(cur, ai->targv[i + 1], _tcslen(ai->targv[i + 1])*sizeof(TCHAR)); - pos += _tcslen(ai->targv[i + 1]) - 1; + memmove(cur + mir_tstrlen(ai->targv[i + 1]), cur + mir_tstrlen(ai->targv[i]), (mir_tstrlen(cur + mir_tstrlen(ai->targv[i])) + 1)*sizeof(TCHAR)); + memcpy(cur, ai->targv[i + 1], mir_tstrlen(ai->targv[i + 1])*sizeof(TCHAR)); + pos += mir_tstrlen(ai->targv[i + 1]) - 1; } } - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + 1)*sizeof(TCHAR)); + res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR)); } return res; @@ -428,13 +428,13 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai) if (len < 0) return NULL; - len = min(len, (signed int)_tcslen(ai->targv[1])); + len = min(len, (signed int)mir_tstrlen(ai->targv[1])); TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; memset(res, 0, ((len + 1)*sizeof(TCHAR))); - _tcsncpy(res, ai->targv[1] + _tcslen(ai->targv[1]) - len, len); + _tcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len); return res; } @@ -446,24 +446,24 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) if (ai->argc != 4) return NULL; - if (_tcslen(ai->targv[1]) == 0) + if (mir_tstrlen(ai->targv[1]) == 0) return mir_tstrdup(ai->targv[1]); - size_t move = ttoi(ai->targv[3]) % _tcslen(ai->targv[1]); + size_t move = ttoi(ai->targv[3]) % mir_tstrlen(ai->targv[1]); size_t display = ttoi(ai->targv[2]); - if (display > _tcslen(ai->targv[1])) - display = (unsigned)_tcslen(ai->targv[1]); + if (display > mir_tstrlen(ai->targv[1])) + display = (unsigned)mir_tstrlen(ai->targv[1]); - TCHAR *res = (TCHAR*)mir_alloc((2 * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((2 * mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; - memset(res, 0, ((2 * _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR))); + memset(res, 0, ((2 * mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR))); _tcscpy(res, ai->targv[1]); _tcscat(res, ai->targv[1]); - memmove(res, res + move, (_tcslen(res + move) + 1)*sizeof(TCHAR)); + memmove(res, res + move, (mir_tstrlen(res + move) + 1)*sizeof(TCHAR)); *(res + display) = 0; - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + 1)*sizeof(TCHAR)); + res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR)); return res; } @@ -475,7 +475,7 @@ static TCHAR *parseShortest(ARGUMENTSINFO *ai) int iShort = 1; for (unsigned i = 2; i < ai->argc; i++) - if (_tcslen(ai->targv[i]) < _tcslen(ai->targv[iShort])) + if (mir_tstrlen(ai->targv[i]) < mir_tstrlen(ai->targv[iShort])) iShort = i; return mir_tstrdup(ai->targv[iShort]); @@ -594,9 +594,9 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) int to, from = max(ttoi(ai->targv[2]) - 1, 0); if (ai->argc > 3) - to = min(ttoi(ai->targv[3]), (int)_tcslen(ai->targv[1])); + to = min(ttoi(ai->targv[3]), (int)mir_tstrlen(ai->targv[1])); else - to = (int)_tcslen(ai->targv[1]); + to = (int)mir_tstrlen(ai->targv[1]); if (to < from) return NULL; @@ -640,7 +640,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) while (*scur == ' ') scur++; - TCHAR *ecur = ai->targv[1] + _tcslen(ai->targv[1]) - 1; + TCHAR *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]) - 1; while ((*ecur == ' ') && (ecur > ai->targv[1])) ecur--; @@ -660,7 +660,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) static TCHAR *parseTab(ARGUMENTSINFO *ai) { int count = 1; - if ((ai->argc == 2) && (_tcslen(ai->targv[1]) > 0)) + if ((ai->argc == 2) && (mir_tstrlen(ai->targv[1]) > 0)) count = ttoi(ai->targv[1]); if (count < 0) @@ -701,7 +701,7 @@ static TCHAR *getNthWord(TCHAR *szString, int w) scur++; count++; - while ((count < w) && (scur < szString + _tcslen(szString))) { + while ((count < w) && (scur < szString + mir_tstrlen(szString))) { if (*scur == ' ') { while (*scur == ' ') scur++; @@ -735,7 +735,7 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) TCHAR *res = NULL; int to, from = ttoi(ai->targv[2]); if (ai->argc == 4) { - if (_tcslen(ai->targv[3]) > 0) + if (mir_tstrlen(ai->targv[3]) > 0) to = ttoi(ai->targv[3]); else to = 100000; // rework @@ -751,7 +751,7 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) return res; if (res != NULL) { - TCHAR *pres = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR)); + TCHAR *pres = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szWord) + 2)*sizeof(TCHAR)); if (pres != NULL) { res = pres; _tcscat(res, _T(" ")); diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 7551ecab15..35ba4e21df 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -51,10 +51,10 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - if (_tcslen(ai->targv[1]) == 0) + if (mir_tstrlen(ai->targv[1]) == 0) szCounter = mir_tstrdup(_T("\\Processor(_Total)\\% Processor Time")); else { - int size = (int)_tcslen(ai->targv[1]) + 32; + int size = (int)mir_tstrlen(ai->targv[1]) + 32; szCounter = (TCHAR *)mir_alloc(size * sizeof(TCHAR)); if (szCounter == NULL) return NULL; @@ -116,7 +116,7 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai) { TCHAR *szFormat; - if (ai->argc == 1 || (ai->argc > 1 && _tcslen(ai->targv[1]) == 0)) + if (ai->argc == 1 || (ai->argc > 1 && mir_tstrlen(ai->targv[1]) == 0)) szFormat = NULL; else szFormat = ai->targv[1]; @@ -137,7 +137,7 @@ static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai) static TCHAR *parseCurrentTime(ARGUMENTSINFO *ai) { TCHAR *szFormat; - if (ai->argc == 1 || (ai->argc > 1) && (_tcslen(ai->targv[1]) == 0)) + if (ai->argc == 1 || (ai->argc > 1) && (mir_tstrlen(ai->targv[1]) == 0)) szFormat = NULL; else szFormat = ai->targv[1]; @@ -168,13 +168,13 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[1]); size_t bi, ei; - for (ei = 0; ei < _tcslen(ai->targv[1]); ei++) { + for (ei = 0; ei < mir_tstrlen(ai->targv[1]); ei++) { if (ai->targv[1][ei] == '\\') depth--; if (!depth) break; } - if (ei >= _tcslen(ai->targv[1])) + if (ei >= mir_tstrlen(ai->targv[1])) return ai->targv[1]; for (bi = ei - 1; bi > 0; bi--) @@ -203,7 +203,7 @@ static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) if (depth <= 0) return NULL; - TCHAR *ecur = ai->targv[1] + _tcslen(ai->targv[1]); + TCHAR *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]); while (depth > 0) { while ((*ecur != '\\') && (ecur > ai->targv[1])) ecur--; @@ -226,17 +226,17 @@ static int getTime(TCHAR *szTime, struct tm *date) { // do some extra checks here TCHAR *cur = szTime; - if (cur >= szTime + _tcslen(szTime)) + if (cur >= szTime + mir_tstrlen(szTime)) return -1; date->tm_mon = _tcstoul(cur, &cur, 10) - 1; cur++; - if (cur >= szTime + _tcslen(szTime)) + if (cur >= szTime + mir_tstrlen(szTime)) return -1; date->tm_mday = _tcstoul(cur, &cur, 10); cur++; - if (cur >= szTime + _tcslen(szTime)) + if (cur >= szTime + mir_tstrlen(szTime)) return -1; date->tm_year = _tcstoul(cur, &cur, 10); @@ -247,17 +247,17 @@ static int getTime(TCHAR *szTime, struct tm *date) date->tm_year = date->tm_year < 38 ? date->tm_year + 100 : date->tm_year; cur++; - if (cur >= szTime + _tcslen(szTime)) + if (cur >= szTime + mir_tstrlen(szTime)) return -1; date->tm_hour = _tcstoul(cur, &cur, 10); cur++; - if (cur >= szTime + _tcslen(szTime)) + if (cur >= szTime + mir_tstrlen(szTime)) return -1; date->tm_min = _tcstoul(cur, &cur, 10); cur++; - if (cur >= szTime + _tcslen(szTime)) + if (cur >= szTime + mir_tstrlen(szTime)) return -1; date->tm_sec = _tcstoul(cur, &cur, 10); @@ -386,11 +386,11 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) if (*ai->targv[4] == 'd') bFiles = FALSE; } - if (tszFirst[_tcslen(tszFirst) - 1] == '\\') - _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - _tcslen(tszFirst) - 1); + if (tszFirst[mir_tstrlen(tszFirst) - 1] == '\\') + _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1); else { - _tcsncat(tszFirst, _T("\\"), SIZEOF(tszFirst) - _tcslen(tszFirst) - 1); - _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - _tcslen(tszFirst) - 1); + _tcsncat(tszFirst, _T("\\"), SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1); + _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1); } WIN32_FIND_DATA ffd; @@ -399,17 +399,17 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) return NULL; } if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) { - tszRes = (TCHAR*)mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR)); + tszRes = (TCHAR*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR)); _tcscpy(tszRes, ffd.cFileName); } while (FindNextFile(hFind, &ffd) != 0) { if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) { if (tszRes != NULL) { _tcscat(tszRes, tszSeperator); - tszRes = (TCHAR*)mir_realloc(tszRes, (_tcslen(tszRes) + _tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR)); + tszRes = (TCHAR*)mir_realloc(tszRes, (mir_tstrlen(tszRes) + mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR)); } else { - tszRes = (TCHAR*)mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR)); + tszRes = (TCHAR*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR)); _tcscpy(tszRes, _T("")); } _tcscat(tszRes, ffd.cFileName); @@ -530,7 +530,7 @@ static TCHAR *parseTimestamp2Date(ARGUMENTSINFO *ai) if (timestamp == 0) return NULL; - if ((ai->argc == 2) || ((ai->argc > 2) && (_tcslen(ai->targv[2]) == 0))) + if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0))) szFormat = NULL; else szFormat = ai->targv[2]; @@ -562,7 +562,7 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai) return NULL; TCHAR *szFormat; - if ((ai->argc == 2) || ((ai->argc > 2) && (_tcslen(ai->targv[2]) == 0))) + if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0))) szFormat = NULL; else szFormat = ai->targv[2]; @@ -859,7 +859,7 @@ static TCHAR *parseClipboard(ARGUMENTSINFO *ai) HANDLE hData = GetClipboardData(CF_UNICODETEXT); if (hData != NULL) { TCHAR *tszText = (TCHAR*)GlobalLock(hData); - size_t len = _tcslen(tszText); + size_t len = mir_tstrlen(tszText); res = (TCHAR*)mir_alloc((len + 1) * sizeof(TCHAR)); _tcscpy(res, tszText); res[len] = 0; diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 8a711a1524..ea5a833786 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -26,7 +26,7 @@ static int vrCount = 0; static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) { - if ((szName == NULL) || (szText == NULL) || (_tcslen(szName) <= 0)) + if ((szName == NULL) || (szText == NULL) || (mir_tstrlen(szName) <= 0)) return -1; mir_cslock lck(csVarRegister); @@ -50,7 +50,7 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) static TCHAR *searchVariableRegister(TCHAR *szName) { - if ((szName == NULL) || (_tcslen(szName) <= 0)) + if ((szName == NULL) || (mir_tstrlen(szName) <= 0)) return NULL; mir_cslock lck(csVarRegister); diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index a4722f82d2..6bfb84ad4a 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -41,7 +41,7 @@ unsigned long int hashlittle(void *key, size_t length, unsigned long int initval static DWORD NameHashFunction(TCHAR *tszStr) { - return (DWORD)hashlittle(tszStr, _tcslen(tszStr)*sizeof(TCHAR), 0); + return (DWORD)hashlittle(tszStr, mir_tstrlen(tszStr)*sizeof(TCHAR), 0); } static TokenRegisterEntry* FindTokenRegisterByName(TCHAR *name) diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index fc92c323bc..3c5652f6f1 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -161,7 +161,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) pargv = argv = NULL; //fi->pCount = 0; memcpy(&afi, fi, sizeof(afi)); - for (pos = 0; pos < _tcslen(string); pos++) { + for (pos = 0; pos < mir_tstrlen(string); pos++) { // string may move in memory, iterate by remembering the position in the string cur = string+pos; // mir_free memory from last iteration, this way we can bail out at any time in the loop @@ -175,46 +175,46 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) pargv = argv = NULL; // new round if (*cur == DONTPARSE_CHAR) { - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); if (*cur == DONTPARSE_CHAR) continue; while ( (*cur != DONTPARSE_CHAR) && (*cur != 0)) cur++; - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); pos = cur-string-1; continue; } // remove end of lines else if ((!_tcsncmp(cur, _T("\r\n"), 2)) && (gParseOpts.bStripEOL)) { - memmove(cur, cur+2, (_tcslen(cur+2)+1)*sizeof(TCHAR)); + memmove(cur, cur+2, (mir_tstrlen(cur+2)+1)*sizeof(TCHAR)); pos = cur-string-1; continue; } else if ((*cur == '\n' && gParseOpts.bStripEOL) || (*cur == ' ' && gParseOpts.bStripWS)) { - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); pos = cur - string - 1; continue; } // remove comments - else if (!_tcsncmp(cur, _T(COMMENT_STRING), _tcslen(_T(COMMENT_STRING)))) { + else if (!_tcsncmp(cur, _T(COMMENT_STRING), mir_tstrlen(_T(COMMENT_STRING)))) { scur = cur; while ( _tcsncmp(cur, _T("\r\n"), 2) && *cur != '\n' && *cur != 0) cur++; if (*cur == 0) { *scur = 0; - string = (TCHAR*)mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR)); + string = (TCHAR*)mir_realloc(string, (mir_tstrlen(string)+1)*sizeof(TCHAR)); continue; } - memmove(scur, cur, (_tcslen(cur)+1)*sizeof(TCHAR)); + memmove(scur, cur, (mir_tstrlen(cur)+1)*sizeof(TCHAR)); pos = scur-string-1; continue; } else if ((*cur != FIELD_CHAR) && (*cur != FUNC_CHAR) && (*cur != FUNC_ONCE_CHAR)) { if (gParseOpts.bStripAll) { - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); pos = cur - string - 1; } continue; @@ -255,7 +255,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) } scur = cur; // store this pointer for later use if (*cur == FIELD_CHAR) { - size_t len = _tcslen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); + size_t len = mir_tstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); cur++; if (*(cur + len) != FIELD_CHAR) { // the next char after the token should be % fi->eCount++; @@ -266,7 +266,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) { TCHAR *argcur; - cur += _tcslen(tr->tszTokenString)+1; + cur += mir_tstrlen(tr->tszTokenString)+1; argcur = getArguments(cur, &argv, &argc); if ((argcur == cur) || (argcur == NULL)) { fi->eCount++; @@ -339,8 +339,8 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) } }*/ - size_t parsedTokenLen = _tcslen(parsedToken); - size_t initStrLen = _tcslen(string); + size_t parsedTokenLen = mir_tstrlen(parsedToken); + size_t initStrLen = mir_tstrlen(string); size_t tokenLen = cur-scur; scurPos = scur-string; curPos = cur-string; @@ -354,10 +354,10 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) } scur = string+scurPos; cur = string+curPos; - memmove(scur + parsedTokenLen, cur, (_tcslen(cur)+1)*sizeof(TCHAR)); + memmove(scur + parsedTokenLen, cur, (mir_tstrlen(cur)+1)*sizeof(TCHAR)); memcpy(scur, parsedToken, parsedTokenLen*sizeof(TCHAR)); { - size_t len = _tcslen(string); + size_t len = mir_tstrlen(string); string = (TCHAR*)mir_realloc(string, (len+1)*sizeof(TCHAR)); } if (( ai.flags & AIF_DONTPARSE ) || tmpVarPos >= 0) @@ -375,7 +375,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) mir_free(argv[i]); mir_free(argv); - return (TCHAR*)mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR)); + return (TCHAR*)mir_realloc(string, (mir_tstrlen(string)+1)*sizeof(TCHAR)); } /* diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 17d2c70e31..1949517426 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -295,14 +295,14 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa // set filters _tcsncpy(filter, TranslateT("Text Files"), SIZEOF(filter) - 1); _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); - pfilter = filter + _tcslen(filter)+1; + pfilter = filter + mir_tstrlen(filter)+1; _tcsncpy(pfilter, _T("*.txt"), SIZEOF(filter) - 1); - pfilter = pfilter + _tcslen(pfilter)+1; + pfilter = pfilter + mir_tstrlen(pfilter)+1; _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - 1); _tcsncat(pfilter, _T(" (*.*)"), SIZEOF(filter) - mir_tstrlen(filter)); - pfilter = pfilter + _tcslen(pfilter)+1; + pfilter = pfilter + mir_tstrlen(pfilter)+1; _tcsncpy(pfilter, _T("*.*"), SIZEOF(filter) - 1); - pfilter = pfilter + _tcslen(pfilter)+1; + pfilter = pfilter + mir_tstrlen(pfilter)+1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index c3e1774746..15288b052a 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -84,7 +84,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str) TrimString(tempchar); if (tempchar[0] == '-' && tempchar[1] == ' ') - memmove(&tempchar[1], &tempchar[2], sizeof(TCHAR)*(_tcslen(&tempchar[2])+1)); + memmove(&tempchar[1], &tempchar[2], sizeof(TCHAR)*(mir_tstrlen(&tempchar[2])+1)); // quit if the value obtained is N/A or not a number if ( !_tcscmp(tempchar, NODATA) || !_tcscmp(tempchar, _T("N/A"))) { @@ -395,7 +395,7 @@ WORD GetIcon(const TCHAR* cond, WIDATA *Data) // using the format _T("# Weather #" mir_sntprintf(LangPackStr, SIZEOF(LangPackStr), _T("# Weather %s %i #"), statusStr[i], j); _tcsncpy_s(LangPackStr1, TranslateTS(LangPackStr), _TRUNCATE); - CharLowerBuff(LangPackStr1, (DWORD)_tcslen(LangPackStr1)); + CharLowerBuff(LangPackStr1, (DWORD)mir_tstrlen(LangPackStr1)); if (_tcsstr(cond, LangPackStr1) != NULL) return statusValue[i]; // loop until the translation string exists (ie, the translated string is differ from original) @@ -414,7 +414,7 @@ void CaseConv(TCHAR *str) TCHAR *pstr; BOOL nextUp = TRUE; - CharLowerBuff(str, (DWORD)_tcslen(str)); + CharLowerBuff(str, (DWORD)mir_tstrlen(str)); for(pstr = str; *pstr; pstr++) { if (*pstr == ' ' || *pstr == '-') nextUp = TRUE; @@ -499,7 +499,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) str[0] = 0; // looking character by character - for (i=0; i < _tcslen(dis); i++) { + for (i=0; i < mir_tstrlen(dis); i++) { // for the escape characters if (dis[i] == '\\') { i++; @@ -547,7 +547,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) i++; name[0] = 0; // read the entire variable name - while (dis[i] != ']' && i < _tcslen(dis)) { + while (dis[i] != ']' && i < mir_tstrlen(dis)) { mir_snprintf(temp, SIZEOF(temp), "%c", dis[i++]); strcat(name, temp); } diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index e49019e489..deb04358ec 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -252,7 +252,7 @@ void ConvertDataValue(WIDATAITEM *UpdateData, TCHAR *Data) } // truncating strings for day/month to 2 or 3 characters else if ( !_tcsicmp(UpdateData->Unit, _T("DAY")) || !_tcsicmp(UpdateData->Unit, _T("MONTH"))) - if (opt.dUnit > 1 && _tcslen(Data) > opt.dUnit) + if (opt.dUnit > 1 && mir_tstrlen(Data) > opt.dUnit) Data[opt.dUnit] = '\0'; } } @@ -280,7 +280,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData) start = _tcsstr(szInfo, UpdateData->Start); if (start != NULL) { // set the starting location for getting data - start += _tcslen(UpdateData->Start); + start += mir_tstrlen(UpdateData->Start); szInfo = start; } } @@ -295,7 +295,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData) // set the ending location startloc = 0; endloc = end - szInfo; - end += _tcslen(UpdateData->End); + end += mir_tstrlen(UpdateData->End); last = '\n'; } diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 4fcb96d091..7c69dc38f4 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -131,7 +131,7 @@ void WICondListAdd(char *str, WICONDLIST *List) { WICONDITEM *newItem = (WICONDITEM*)mir_alloc(sizeof(WICONDITEM)); wSetData(&newItem->Item, str); - CharLowerBuff(newItem->Item, (DWORD)_tcslen( newItem->Item )); + CharLowerBuff(newItem->Item, (DWORD)mir_tstrlen( newItem->Item )); newItem->Next = NULL; if (List->Tail == NULL) List->Head = newItem; else List->Tail->Next = newItem; @@ -327,7 +327,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) // initialize the linked list for update items Data->UpdateDataCount = 0; - Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (_tcslen(pszShortFile) + _tcslen(pszFile) + 20)*sizeof( TCHAR ); + Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_tstrlen(pszShortFile) + mir_tstrlen(pszFile) + 20)*sizeof( TCHAR ); Data->UpdateData = NULL; Data->UpdateDataTail = NULL; @@ -453,7 +453,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) else if ( !_stricmp(ValName, "HIDDEN")) { if ( !_stricmp(Value, "TRUE")) { TCHAR *nm = Data->UpdateDataTail->Item.Name; - size_t len = _tcslen(nm) + 1; + size_t len = mir_tstrlen(nm) + 1; Data->UpdateDataTail->Item.Name = nm = ( TCHAR* )mir_realloc(nm, sizeof(TCHAR)*(len + 3)); memmove(nm + 1, nm, len*sizeof( TCHAR )); diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index c16649a62a..8e74b14a38 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -487,14 +487,14 @@ int GetWeatherData(MCONTACT hContact) case '[': // variable, add the value to the result string hasvar = TRUE; if ( !DBGetData(hContact, _T2A(str2), &dbv)) { - _tcsncat(DataValue, dbv.ptszVal, SIZEOF(DataValue) - _tcslen(DataValue)); + _tcsncat(DataValue, dbv.ptszVal, SIZEOF(DataValue) - mir_tstrlen(DataValue)); DataValue[SIZEOF(DataValue)-1] = 0; db_free(&dbv); } break; case'\"': // constant, add it to the result string - _tcsncat(DataValue, TranslateTS(str2), SIZEOF(DataValue) - _tcslen(DataValue)); + _tcsncat(DataValue, TranslateTS(str2), SIZEOF(DataValue) - mir_tstrlen(DataValue)); DataValue[SIZEOF(DataValue)-1] = 0; break; } @@ -527,7 +527,7 @@ int GetWeatherData(MCONTACT hContact) break; // exit if break string is not found } *end = '\0'; - end += _tcslen(Item->Item.Break); + end += mir_tstrlen(Item->Item.Break); while (end[0] == ' ') end++; // remove extra space @@ -557,7 +557,7 @@ int GetWeatherData(MCONTACT hContact) if (cbuf[0] == '#') cbuf = TranslateTS(DataValue); db_set_ts(hContact, WEATHERCONDITION, _T2A(Item->Item.Name), cbuf); - CharLowerBuff(DataValue, (DWORD)_tcslen(DataValue)); + CharLowerBuff(DataValue, (DWORD)mir_tstrlen(DataValue)); cond = GetIcon(DataValue, Data); } else if ( _tcsicmp(Item->Item.Unit, _T("Cond")) == 0) { diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 92679003b7..feffb27c1f 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -125,9 +125,9 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)); TCHAR *displaytext = (TCHAR*)lParam; - if ((_tcslen(displaytext) == MAX_SECONDLINE) || (_tcslen(displaytext) > MAX_SECONDLINE)) + if ((mir_tstrlen(displaytext) == MAX_SECONDLINE) || (mir_tstrlen(displaytext) > MAX_SECONDLINE)) mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), displaytext); - else if (_tcslen(displaytext) < MAX_SECONDLINE) + else if (mir_tstrlen(displaytext) < MAX_SECONDLINE) mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), displaytext); if ( db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0)) { diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index 1f9ae0e06f..04716317e4 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -124,7 +124,7 @@ SIZE GetControlTextSize(HWND hCtrl) TCHAR buffer[maxSize]; SIZE size; GetWindowText(hCtrl, buffer, SIZEOF(buffer)); - GetTextExtentPoint32(hDC, buffer, (int)_tcslen(buffer), &size); + GetTextExtentPoint32(hDC, buffer, (int)mir_tstrlen(buffer), &size); SelectObject(hDC, oldFont); ReleaseDC(hCtrl, hDC); return size; @@ -144,7 +144,7 @@ int EnlargeControl(HWND hCtrl, HWND hGroup, SIZE oldSize) TCHAR *strtrim(TCHAR *str) { size_t i = 0; - size_t len = _tcslen(str); + size_t len = mir_tstrlen(str); while ((i < len) && (str[i] == _T(' '))) { i++; } if (i) { memmove(str, str + i, len - i + 1); diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index b67dcfb15a..7e3a5ba68a 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -78,7 +78,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } TCHAR *nick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR); - size_t value_max_len = (_tcslen(uid) + _tcslen(nick) + 4); + size_t value_max_len = (mir_tstrlen(uid) + mir_tstrlen(nick) + 4); TCHAR *value = (TCHAR *)mir_alloc(sizeof(TCHAR) * value_max_len); mir_sntprintf(value, value_max_len, _T("%s (%s)"), nick, uid); SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)value), hContact); diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index b1b1df711b..e15d71731d 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1618,9 +1618,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname)); ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue)); - size_t headnamelen = _tcslen(headname); + size_t headnamelen = mir_tstrlen(headname); if (headnamelen) sizeNeeded += 1 + headnamelen; - sizeNeeded += 3 + _tcslen(headvalue); + sizeNeeded += 3 + mir_tstrlen(headvalue); } if (sizeNeeded && OpenClipboard(hDlg)) { EmptyClipboard(); @@ -1631,7 +1631,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname)); ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue)); - if (_tcslen(headname)) courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, _T("%s:\t%s\r\n"), headname, headvalue); + if (mir_tstrlen(headname)) courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, _T("%s:\t%s\r\n"), headname, headvalue); else courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, _T("\t%s\r\n"), headvalue); } GlobalUnlock(hData); @@ -2405,7 +2405,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject)); ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size)); ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date)); - sizeNeeded += 5 + _tcslen(from) + _tcslen(subject) + _tcslen(size) + _tcslen(date); + sizeNeeded += 5 + mir_tstrlen(from) + mir_tstrlen(subject) + mir_tstrlen(size) + mir_tstrlen(date); } if (sizeNeeded && OpenClipboard(hDlg)) { EmptyClipboard(); diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index b7e25d2a3a..c29cbeed70 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -584,7 +584,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (options.time_layout != PT_NONE) { SIZE size_t; if (hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime); - GetTextExtentPoint32(hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &size_t); + GetTextExtentPoint32(hdc, pwd->tbuff, (int)mir_tstrlen(pwd->tbuff), &size_t); pwd->time_height = size_t.cy; pwd->time_width = size_t.cx; } @@ -592,7 +592,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // titlebar height if (hFontFirstLine) SelectObject(hdc, (HGDIOBJ)hFontFirstLine); TCHAR *title = mir_u2t(pd->pwzTitle); - GetTextExtentPoint32(hdc, title, (int)_tcslen(title), &size); + GetTextExtentPoint32(hdc, title, (int)mir_tstrlen(title), &size); mir_free(title); pwd->tb_height = size.cy; if (options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) { diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index 04d9eae3a3..1a3d083519 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -120,7 +120,7 @@ static int lastColumn = -1; //last sort column int MatchesFilterCS(const TCHAR *filter, const PopupHistoryData *popupItem) //case sensitive { - if (_tcslen(filter) <= 0) { return 1; } //if no filter is set then the popup item matches the filter + if (mir_tstrlen(filter) <= 0) { return 1; } //if no filter is set then the popup item matches the filter int match = 0; match = (_tcsstr(popupItem->messageT, filter)) ? 1 : match; //check message part @@ -149,7 +149,7 @@ __inline void ConvertCase(TCHAR *dest, const TCHAR *source, size_t size) int MatchesFilterCI(const TCHAR *filterS, const PopupHistoryData *popupItem) { - if (_tcslen(filterS) <= 0) { return 1; } //if no filter is set then the popup item matches the filter + if (mir_tstrlen(filterS) <= 0) { return 1; } //if no filter is set then the popup item matches the filter int match = 0; const int BUFFER_SIZE = 1024; TCHAR buffer[BUFFER_SIZE]; @@ -489,7 +489,7 @@ void CopyPopupDataToClipboard(HWND hList, int selection) if (found) { EmptyClipboard(); - int len = (int)_tcslen(buffer); + int len = (int)mir_tstrlen(buffer); HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(TCHAR)); clipboard = (TCHAR *) GlobalLock(hData); diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index 384a08fa18..73b8a61b91 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -122,7 +122,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) break; case GC_USER_MESSAGE: - if (gch->ptszText && _tcslen(gch->ptszText)) + if (gch->ptszText && mir_tstrlen(gch->ptszText)) { char* msg = mir_utf8encodeT(gch->ptszText); aim_chat_send_message(item->hconn, item->seqno, msg); diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 82ded8680c..61ecaa9d17 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -87,7 +87,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) { if (flags & MAIL_POPUP) { - size_t len = _tcslen(ppd.lptzText); + size_t len = mir_tstrlen(ppd.lptzText); mir_sntprintf(&ppd.lptzText[len], SIZEOF(ppd.lptzText) - len, _T(" %s"), TranslateT("Open mail account?")); if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES) ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index d68cf33608..fef79cf78c 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -338,7 +338,7 @@ HANDLE __cdecl CAimProto::SearchBasic(const PROTOCHAR* szId) HANDLE __cdecl CAimProto::SearchByEmail(const PROTOCHAR* email) { // Maximum email size should really be 320, but the char string is limited to 255. - if (state != 1 || email == NULL || _tcslen(email) >= 254) + if (state != 1 || email == NULL || mir_tstrlen(email) >= 254) return NULL; char* szEmail = mir_t2a(email); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index cfbb68266d..c026f4afc6 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -638,7 +638,7 @@ retry: _tcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE); if (__city) { mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %s"), TranslateT("City:"), __city); - _tcsncat(strFmt2, strFmt1, SIZEOF(strFmt2) - _tcslen(strFmt2)); + _tcsncat(strFmt2, strFmt1, SIZEOF(strFmt2) - mir_tstrlen(strFmt2)); } if (__birthyear) { time_t t = time(NULL); @@ -647,7 +647,7 @@ retry: if (br < (lt->tm_year + 1900) && br > 1900) { mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %d"), TranslateT("Age:"), (lt->tm_year + 1900) - br); - _tcsncat(strFmt2, strFmt1, SIZEOF(strFmt2) - _tcslen(strFmt2)); + _tcsncat(strFmt2, strFmt1, SIZEOF(strFmt2) - mir_tstrlen(strFmt2)); } } diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 82a635c024..50616a407b 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -832,28 +832,28 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, req = gg_pubdir50_new(GG_PUBDIR50_WRITE); GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, text_utf8); mir_free(text_utf8); } GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, text_utf8); mir_free(text_utf8); } GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, text_utf8); mir_free(text_utf8); } GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, text_utf8); mir_free(text_utf8); @@ -872,21 +872,21 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, } GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, text_utf8); mir_free(text_utf8); } GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, text_utf8); mir_free(text_utf8); } GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, SIZEOF(text)); - if (_tcslen(text)){ + if (mir_tstrlen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, text_utf8); mir_free(text_utf8); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index bb8facc711..9f93b0c6f7 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -405,7 +405,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text)); - if (_tcslen(text)) + if (mir_tstrlen(text)) { char *firstName_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); @@ -415,7 +415,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 1 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text)); - if (_tcslen(text)) + if (mir_tstrlen(text)) { char *lastName_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); @@ -425,7 +425,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 2 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text)); - if (_tcslen(text)) + if (mir_tstrlen(text)) { char *nickName_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8); @@ -435,7 +435,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 3 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text)); - if (_tcslen(text)) + if (mir_tstrlen(text)) { char *city_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8); @@ -445,7 +445,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 4 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_AGEFROM, text, SIZEOF(text)); - if (_tcslen(text)) + if (mir_tstrlen(text)) { int yearTo = _tstoi(text); int yearFrom; diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 070f28cb57..5386d62273 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -170,7 +170,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) gce.ptszNick = nickT; // Get rid of CRLF at back - int lc = (int)_tcslen(gch->ptszText) - 1; + int lc = (int)mir_tstrlen(gch->ptszText) - 1; while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r')) gch->ptszText[lc --] = 0; @@ -316,7 +316,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcwindow.ptszStatusbarText = status; // Here we put nice new hash sign - TCHAR *name = (TCHAR*)calloc(_tcslen(gcwindow.ptszName) + 2, sizeof(TCHAR)); + TCHAR *name = (TCHAR*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(TCHAR)); *name = '#'; _tcscpy(name + 1, gcwindow.ptszName); gcwindow.ptszName = name; diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 61452bb6fc..a93de45b5a 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -227,10 +227,10 @@ TCHAR *gg_img_getfilter(TCHAR *szFilter, int nSize) // Make up filter _tcsncpy(pFilter, szFilterName, nSize); - pFilter += _tcslen(pFilter) + 1; + pFilter += mir_tstrlen(pFilter) + 1; if (pFilter >= szFilter + nSize) return NULL; _tcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter)); - pFilter += _tcslen(pFilter) + 1; + pFilter += mir_tstrlen(pFilter) + 1; if (pFilter >= szFilter + nSize) return NULL; *pFilter = 0; @@ -787,7 +787,7 @@ TCHAR *gg_img_hasextension(TCHAR *filename) TCHAR *imgtype = _tcsrchr(filename, '.'); if (imgtype != NULL) { - size_t len = _tcslen(imgtype); + size_t len = mir_tstrlen(imgtype); imgtype++; if (len == 4 && (_tcsicmp(imgtype, _T("bmp")) == 0 || _tcsicmp(imgtype, _T("gif")) == 0 || @@ -818,7 +818,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else { _tcscpy(szPath, path); - tPathLen = _tcslen(szPath); + tPathLen = mir_tstrlen(szPath); } if ( _taccess(szPath, 0)){ @@ -835,7 +835,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, _T("\\%s"), dat->lpszFileName); if ((pImgext = gg_img_hasextension(szPath)) == NULL) - pImgext = szPath + _tcslen(szPath); + pImgext = szPath + mir_tstrlen(szPath); _tcsncpy_s(imgext, pImgext, _TRUNCATE); for (i = 1; ; ++i) { diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 536da7cb30..9a7a880e50 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -337,24 +337,24 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter)); - _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - _tcslen(filter)); - pfilter = filter + _tcslen(filter) + 1; + _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); + pfilter = filter + mir_tstrlen(filter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter)); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter)); - _tcsncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - _tcslen(pfilter)); - pfilter = pfilter + _tcslen(pfilter) + 1; + _tcsncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter)); + pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter)); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; @@ -404,25 +404,25 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) TCHAR filter[512], *pfilter; _tcsncpy(str, TranslateT("contacts"), SIZEOF(str)); - _tcsncat(str, _T(".txt"), SIZEOF(str) - _tcslen(str)); + _tcsncat(str, _T(".txt"), SIZEOF(str) - mir_tstrlen(str)); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter)); - _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - _tcslen(filter)); - pfilter = filter + _tcslen(filter) + 1; + _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); + pfilter = filter + mir_tstrlen(filter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter)); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter)); - _tcsncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - _tcslen(pfilter)); - pfilter = pfilter + _tcslen(pfilter) + 1; + _tcsncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter)); + pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter)); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; *pfilter = '\0'; diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index be57b3020f..1d8994cc44 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -193,7 +193,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) //directly check if contact has protected user avatar set by AVS, and if yes return it as protocol avatar DBVARIANT dbv; if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) { - if ((_tcslen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){ + if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){ debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS"); _tcscpy_s(pai->filename, SIZEOF(pai->filename) ,dbv.ptszVal); pai->format = ProtoGetAvatarFormat(pai->filename); diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index e7582fe1a9..24f51da361 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -62,7 +62,7 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) case DBVT_TCHAR: if (!getTString(p->name, &dbv)) { if (p->size != -1) { - size_t len = min(p->size - 1, _tcslen(dbv.ptszVal)); + size_t len = min(p->size - 1, mir_tstrlen(dbv.ptszVal)); memcpy(ptr, dbv.pszVal, len*sizeof(TCHAR)); *(TCHAR*)&ptr[len*sizeof(TCHAR)] = 0; } diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index aaab23b6f8..7b1cfe11ff 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -671,7 +671,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con mir_tstrncpy(szOsBuffer, _T(""), SIZEOF(szOsBuffer)); else { TCHAR *szOsWindows = _T("Microsoft Windows"); - size_t nOsWindowsLength = _tcslen(szOsWindows); + size_t nOsWindowsLength = mir_tstrlen(szOsWindows); if (!_tcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength)) os += nOsWindowsLength + 1; } diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index db1e38287b..c156b2b0dc 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -456,7 +456,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) } else { sttBrowseMode = SD_BROWSE_NORMAL; - CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(szJid, _tcslen(szNode) ? szNode : NULL, NULL); + CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(szJid, mir_tstrlen(szNode) ? szNode : NULL, NULL); SendBothRequests(pNode, NULL); } lck.unlock(); diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 7d1fc2de63..0da167336d 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -485,7 +485,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (!v) break; if (xmlGetName(v) && !mir_tstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v)) - size += _tcslen(xmlGetText(v)) + 2; + size += mir_tstrlen(xmlGetText(v)) + 2; } valueStr = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); valueStr[0] = '\0'; diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index db120aa0de..65fbced241 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -1080,7 +1080,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (resource == NULL) gcd.iType = GC_EVENT_INFORMATION; - else if (_tcsncmp(msgText, _T("/me "), 4) == 0 && _tcslen(msgText) > 4) { + else if (_tcsncmp(msgText, _T("/me "), 4) == 0 && mir_tstrlen(msgText) > 4) { msgText += 4; gcd.iType = GC_EVENT_ACTION; } diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index c382e37d38..c8222b05d7 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -305,7 +305,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) // Include service pack (if any) and build number. - if (_tcslen(osvi.szCSDVersion) > 0) { + if (mir_tstrlen(osvi.szCSDVersion) > 0) { StringCchCat(pszOS, BUFSIZE, TEXT(" ")); StringCchCat(pszOS, BUFSIZE, osvi.szCSDVersion); } diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 0000b7b6d1..3567c46592 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -403,8 +403,8 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) TCHAR *szPos = NULL; while (szPos = _tcsstr(item->group, szGroupDelimeter)) { *szPos = 0; - szPos += _tcslen(szGroupDelimeter); - TCHAR *szNewGroup = (TCHAR *)mir_alloc(sizeof(TCHAR) * (_tcslen(item->group) + _tcslen(szPos) + 2)); + szPos += mir_tstrlen(szGroupDelimeter); + TCHAR *szNewGroup = (TCHAR *)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(item->group) + mir_tstrlen(szPos) + 2)); _tcscpy(szNewGroup, item->group); _tcscat(szNewGroup, _T("\\")); _tcscat(szNewGroup, szPos); @@ -680,7 +680,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) return; } - size_t len = _tcslen(m_szJabberJID); + size_t len = mir_tstrlen(m_szJabberJID); if (!_tcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) { hContact = NULL; debugLogA("Vcard for myself"); diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 5159477d75..7072c507db 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -119,14 +119,14 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL *q = '/'; // We can't use JabberHContactFromJID() here because of the stripResource option - size_t len = _tcslen(s); + size_t len = mir_tstrlen(s); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) continue; TCHAR *p = jid; - if (p && _tcslen(p) >= len && (p[len]=='\0'||p[len]=='/') && !_tcsnicmp(p, s, len)) + if (p && mir_tstrlen(p) >= len && (p[len]=='\0'||p[len]=='/') && !_tcsnicmp(p, s, len)) return hContact; } diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 4116d1ac6b..6b08ffc451 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1088,9 +1088,9 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) } if (bPushed) { HXML item = query << XCHILD(_T("item")); - if (_tcslen(group)) + if (mir_tstrlen(group)) item << XCHILD(_T("group"), group); - if (_tcslen(name)) + if (mir_tstrlen(name)) item << XATTR(_T("name"), name); item << XATTR(_T("jid"), jid) << XATTR(_T("subscription"), subscr[0] ? subscr : _T("none")); itemCount++; diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index f20c678d00..dbaea138f8 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -1016,17 +1016,17 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) if (dwPackets & JABBER_PL_RULE_TYPE_MESSAGE) _tcscat(szPackets, _T("messages")); if (dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_IN) { - if (_tcslen(szPackets)) + if (mir_tstrlen(szPackets)) _tcscat(szPackets, _T(", ")); _tcscat(szPackets, _T("presence-in")); } if (dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_OUT) { - if (_tcslen(szPackets)) + if (mir_tstrlen(szPackets)) _tcscat(szPackets, _T(", ")); _tcscat(szPackets, _T("presence-out")); } if (dwPackets & JABBER_PL_RULE_TYPE_IQ) { - if (_tcslen(szPackets)) + if (mir_tstrlen(szPackets)) _tcscat(szPackets, _T(", ")); _tcscat(szPackets, _T("queries")); } @@ -1837,7 +1837,7 @@ void CJabberDlgPrivacyLists::btnAddList_OnClick(CCtrlButton*) // FIXME: line length is hard coded in dialog procedure CJabberDlgPrivacyAddList dlgPrivacyAddList(m_proto, m_hwnd); int nRetVal = dlgPrivacyAddList.DoModal(); - if (nRetVal && _tcslen(dlgPrivacyAddList.szLine)) { + if (nRetVal && mir_tstrlen(dlgPrivacyAddList.szLine)) { mir_cslockfull lck(m_proto->m_privacyListManager.m_cs); CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 0df2add95a..a471b49703 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -471,7 +471,7 @@ HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, filetransfer *ft = (filetransfer*)hTransfer; ft->std.tszWorkingDir = mir_tstrdup(szPath); - size_t len = _tcslen(ft->std.tszWorkingDir)-1; + size_t len = mir_tstrlen(ft->std.tszWorkingDir)-1; if (ft->std.tszWorkingDir[len] == '/' || ft->std.tszWorkingDir[len] == '\\') ft->std.tszWorkingDir[len] = 0; @@ -623,7 +623,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) bool bHasResource = _tcscmp(jid, szBareJid) != 0; JABBER_LIST_ITEM *tmpItem = NULL; if (bHasResource && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) { - pResourceStatus him(tmpItem->findResource(szBareJid+_tcslen(szBareJid)+1)); + pResourceStatus him(tmpItem->findResource(szBareJid+mir_tstrlen(szBareJid)+1)); if (him) { item = ListAdd(LIST_VCARD_TEMP, jid); ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority); @@ -1143,7 +1143,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) JABBER_RESOURCE_STATUS *r = item->arResources[i]; if (r->m_tszStatusMessage) { msgCount++; - len += (_tcslen(r->m_tszResourceName) + _tcslen(r->m_tszStatusMessage) + 8); + len += (mir_tstrlen(r->m_tszResourceName) + mir_tstrlen(r->m_tszStatusMessage) + 8); } } diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index f78b97abe9..968ec55fab 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -347,7 +347,7 @@ static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tsz out.AppendFormat(_T("%s\t%s"), TranslateTS(tszTitle), tszValue); else { TCHAR *p = TranslateTS(tszTitle); - out.AppendFormat(_T("%s%s\t%s"), p, _tcslen(p) <= 7 ? _T("\t") : _T(""), tszValue); + out.AppendFormat(_T("%s%s\t%s"), p, mir_tstrlen(p) <= 7 ? _T("\t") : _T(""), tszValue); } } diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 66ef740ca8..7e55a4e57b 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -392,7 +392,7 @@ LBL_FatalError: // User may change status to OFFLINE while we are connecting above if (m_iDesiredStatus != ID_STATUS_OFFLINE || info.bIsReg) { if (!info.bIsReg) { - size_t len = _tcslen(info.conn.username) + mir_strlen(info.conn.server) + 1; + size_t len = mir_tstrlen(info.conn.username) + mir_strlen(info.conn.server) + 1; m_szJabberJID = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1)); mir_sntprintf(m_szJabberJID, len + 1, _T("%s@%S"), info.conn.username, info.conn.server); m_bSendKeepAlive = m_options.KeepAlive != 0; @@ -1066,7 +1066,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) LPCTSTR ptszSubject = xmlGetText(xmlGetChild(node, "subject")); if (ptszSubject && *ptszSubject) { - size_t cbLen = (szMessage ? _tcslen(szMessage) : 0) + _tcslen(ptszSubject) + 128; + size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszSubject) + 128; TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen); szTmp[0] = 0; if (szMessage) @@ -1084,7 +1084,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (addressNode) { const TCHAR *szJid = xmlGetAttrValue(addressNode, _T("jid")); if (szJid) { - size_t cbLen = _tcslen(szMessage) + 1000; + size_t cbLen = mir_tstrlen(szMessage) + 1000; TCHAR *p = (TCHAR*)alloca(sizeof(TCHAR) * cbLen); mir_sntprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage); szMessage = p; @@ -1204,7 +1204,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) TCHAR *prolog = _T("-----BEGIN PGP MESSAGE-----\r\n\r\n"); TCHAR *epilog = _T("\r\n-----END PGP MESSAGE-----\r\n"); - size_t len = _tcslen(prolog) + _tcslen(ptszText) + _tcslen(epilog) + 3; + size_t len = mir_tstrlen(prolog) + mir_tstrlen(ptszText) + mir_tstrlen(epilog) + 3; TCHAR *tempstring = (TCHAR*)_alloca(sizeof(TCHAR)*len); mir_sntprintf(tempstring, len, _T("%s%s%s"), prolog, ptszText, epilog); szMessage = tempstring; @@ -1265,7 +1265,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) else if (!_tcscmp(ptszXmlns, JABBER_FEAT_OOB2)) { LPCTSTR ptszUrl = xmlGetText(xmlGetChild(xNode, "url")); if (ptszUrl != NULL && *ptszUrl) { - size_t cbLen = (szMessage ? _tcslen(szMessage) : 0) + _tcslen(ptszUrl) + 32; + size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszUrl) + 32; TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR)* cbLen); _tcscpy(szTmp, ptszUrl); if (szMessage) { diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 68a08b7449..91cbcd76b9 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -257,7 +257,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti // Idle if (r->m_dwIdleStartTime > 0) { mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); - size_t len = _tcslen(buf); + size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; } @@ -366,7 +366,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM JABBER_RESOURCE_STATUS *r = item->getTemp(); if (r->m_dwIdleStartTime > 0) { mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); - size_t len = _tcslen(buf); + size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; } diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 5416ffa74f..e82202ade2 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -75,7 +75,7 @@ MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, BOOL bStripResource) if (bIsChat) result = mir_tstrcmpi(jid, dbJid); // for chat room we have to have full contact matched else if (TRUE) - result = _tcsnicmp(jid, dbJid, _tcslen(dbJid)); + result = _tcsnicmp(jid, dbJid, mir_tstrlen(dbJid)); else result = JabberCompareJids(jid, dbJid); } diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 813a6c5cea..616ee41f0f 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -246,7 +246,7 @@ HXML __fastcall xmlGetNthChild(HXML hXml, LPCTSTR tag, int nth) { int i, num; - if (!hXml || tag == NULL || _tcslen(tag) <= 0 || nth < 1) + if (!hXml || tag == NULL || mir_tstrlen(tag) <= 0 || nth < 1) return NULL; num = 1; diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index f67299fa4c..c6ed14098e 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -304,7 +304,7 @@ TCHAR* EscapeChatTags(const TCHAR* pszText) if (nChars == 0) return mir_tstrdup(pszText); - TCHAR *pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(pszText) + 1 + nChars)); + TCHAR *pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(pszText) + 1 + nChars)); if (pszNewText == NULL) return mir_tstrdup(pszText); diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index fcf168788d..b6e3f3456e 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -334,7 +334,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, s } else { _tcscpy(pszDest, path); - tPathLen = _tcslen(pszDest); + tPathLen = mir_tstrlen(pszDest); } if (hContact != NULL) { diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 8e1eebc17f..c8e01b99c3 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -502,7 +502,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const PROTOCHAR* ft->std.tszWorkingDir = mir_tstrdup(szCurrDir); } else { - size_t len = _tcslen(ft->std.tszWorkingDir) - 1; + size_t len = mir_tstrlen(ft->std.tszWorkingDir) - 1; if (ft->std.tszWorkingDir[len] == '\\') ft->std.tszWorkingDir[len] = 0; } diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index c807697ad1..1b97b982a0 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -170,7 +170,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) HANDLE CSametimeProto::SearchBasic(const PROTOCHAR* id) { - debugLog(_T("CSametimeProto::SearchBasic() id:len=[%d]"), id == NULL ? -1 : _tcslen(id)); + debugLog(_T("CSametimeProto::SearchBasic() id:len=[%d]"), id == NULL ? -1 : mir_tstrlen(id)); char* id_utf8 = mir_utf8encodeT(id); int ret = SearchForUser(id_utf8, FALSE); mir_free(id_utf8); @@ -183,7 +183,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) TCHAR buf[512]; int ret = 0; if (GetDlgItemText(owner, IDC_EDIT1, buf, SIZEOF(buf))) { - debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : _tcslen(buf)); + debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : mir_tstrlen(buf)); char* buf_utf8 = mir_utf8encodeT(buf); ret = SearchForUser(buf_utf8, TRUE); mir_free(buf_utf8); @@ -303,7 +303,7 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt int CSametimeProto::SetAwayMsg(int iStatus, const PROTOCHAR* msg) { - debugLog(_T("CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]"), iStatus, msg == NULL ? -1 : _tcslen(msg)); + debugLog(_T("CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]"), iStatus, msg == NULL ? -1 : mir_tstrlen(msg)); SetSessionAwayMessage(iStatus, msg); return 0; } diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 871baf250b..3adfbdf8ec 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -317,7 +317,7 @@ int CSametimeProto::SetIdle(bool idle) void CSametimeProto::SetSessionAwayMessage(int status, const PROTOCHAR* msgT) { - debugLog(_T("SetSessionAwayMessage() status=[%d], msgT:len=[%d]"), status, msgT == NULL ? -1 : _tcslen(msgT)); + debugLog(_T("SetSessionAwayMessage() status=[%d], msgT:len=[%d]"), status, msgT == NULL ? -1 : mir_tstrlen(msgT)); ptrA msg(mir_utf8encodeT(msgT)); if (status == ID_STATUS_ONLINE) diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index 93ad849677..55865b0c2a 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -613,13 +613,13 @@ int GCEventHook(WPARAM,LPARAM lParam) { break; } case GC_USER_MESSAGE: - if(gch->ptszText && _tcslen(gch->ptszText) > 0) { + if(gch->ptszText && mir_tstrlen(gch->ptszText) > 0) { DBVARIANT dbv, dbv2; CCSDATA ccs = {0}; TCHAR *pEnd; // remove the ending linebreak - for (pEnd = &gch->ptszText[_tcslen(gch->ptszText) - 1]; + for (pEnd = &gch->ptszText[mir_tstrlen(gch->ptszText) - 1]; *pEnd==_T('\r') || *pEnd==_T('\n'); pEnd--) *pEnd=0; // Send message to the chat-contact if (ccs.hContact = find_chat(gch->pDest->ptszID)) { @@ -633,7 +633,7 @@ int GCEventHook(WPARAM,LPARAM lParam) { // Add our line to the chatlog GCDEST gcd = { gch->pDest->pszModule, gch->pDest->ptszID, 0 }; GCEVENT gce = { sizeof(gce), &gcd }; - if ( _tcsncmp(gch->ptszText, _T("/me "), 4)==0 && _tcslen(gch->ptszText)>4) { + if ( _tcsncmp(gch->ptszText, _T("/me "), 4)==0 && mir_tstrlen(gch->ptszText)>4) { gce.ptszText = gch->ptszText+4; gcd.iType = GC_EVENT_ACTION; } diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index a3247c4301..25990abac9 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -40,7 +40,7 @@ void Xfire_base::strtolowerT(TCHAR*str) return; //lowercase it :) - for (unsigned int i = 0; i < (int)_tcslen(str); i++) + for (unsigned int i = 0; i < (int)mir_tstrlen(str); i++) { str[i] = tolower(str[i]); } diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index f2783b6be3..38dcb396e8 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -270,7 +270,7 @@ BOOL FindTeamSpeak(DWORD*pid, int*vid) { while (Process32Next(hSnapShot, processInfo) != FALSE) { if (processInfo->th32ProcessID != 0) { - int size = _tcslen(processInfo->szExeFile); + int size = mir_tstrlen(processInfo->szExeFile); if (size == 13) { diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index 21faa232d1..08a884023d 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -733,7 +733,7 @@ HANDLE __cdecl CYahooProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const //LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user); ft->pfts.tszWorkingDir = _tcsdup( szPath ); - size_t len = _tcslen(ft->pfts.tszWorkingDir) - 1; + size_t len = mir_tstrlen(ft->pfts.tszWorkingDir) - 1; if (ft->pfts.tszWorkingDir[len] == '\\') ft->pfts.tszWorkingDir[len] = 0; diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index 3c15484676..959a14ccdd 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -289,9 +289,9 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; _tcsncpy(filter, TranslateT("All files"),SIZEOF(filter)-1); _tcscat(filter, _T(" (*)")); - pfilter = filter + _tcslen(filter) + 1; + pfilter = filter + mir_tstrlen(filter) + 1; _tcscpy(pfilter, _T("*")); - pfilter = pfilter + _tcslen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.lpstrFile = str; diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 8fc3cfc8b3..63c1cdcec1 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L TCHAR *pszQuote = _tcschr(str + 1, '"'); if (pszQuote) *pszQuote = 0; - memmove(str, str + 1, (_tcslen(str) * sizeof(TCHAR))); + memmove(str, str + 1, (mir_tstrlen(str) * sizeof(TCHAR))); } else { TCHAR *pszSpace = _tcschr(str, ' '); diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index c89c518fa4..2af724720a 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -102,8 +102,8 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) TCHAR *pszReplace = _tcsstr(dbv.ptszVal, _T("%f")); TCHAR szCmdLine[768]; if (pszReplace) { - if (info->szFile[_tcslen(info->szFile) - 1] == '\\') - info->szFile[_tcslen(info->szFile) - 1] = '\0'; + if (info->szFile[mir_tstrlen(info->szFile) - 1] == '\\') + info->szFile[mir_tstrlen(info->szFile) - 1] = '\0'; *pszReplace = 0; mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2); } else @@ -414,7 +414,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR pszFilename++; if (pszFilename) { - size_t cbFileNameLen = _tcslen(pszFilename); + size_t cbFileNameLen = mir_tstrlen(pszFilename); pszNewFileName = (TCHAR*)mir_alloc(cbFileNameLen * 2 * sizeof(TCHAR)); TCHAR *p = pszNewFileName; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index af2c574587..64a8ec7625 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -55,7 +55,7 @@ static void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) static int RTL_Detect(const TCHAR *ptszText) { - int iLen = (int)_tcslen(ptszText); + int iLen = (int)mir_tstrlen(ptszText); WORD *infoTypeC2 = (WORD*)alloca(sizeof(WORD)* (iLen + 2)); GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE2, ptszText, iLen, infoTypeC2); @@ -965,7 +965,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } if (buf[0] && OpenClipboard(hwndDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, _tcslen(buf) * sizeof(TCHAR)+1); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(buf) * sizeof(TCHAR)+1); _tcscpy((TCHAR*)GlobalLock(hData), buf); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); @@ -1617,7 +1617,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDM_COPYLINK: if (OpenClipboard(hwndDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(tr.lpstrText) + 1) * sizeof(TCHAR)); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(tr.lpstrText) + 1) * sizeof(TCHAR)); _tcscpy((TCHAR*)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index aa8cf996f3..f3e13ccd9d 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -78,7 +78,7 @@ static int AppendToBufferWithRTF(char *&buffer, size_t &cbBufferEnd, size_t &cbB if (line == NULL) return 0; - size_t lineLen = _tcslen(line) * 9 + 8; + size_t lineLen = mir_tstrlen(line) * 9 + 8; if (cbBufferEnd + lineLen > cbBufferAlloced) { cbBufferAlloced += lineLen + 1024 - lineLen % 1024; buffer = (char*)mir_realloc(buffer, cbBufferAlloced); @@ -110,7 +110,7 @@ static int AppendToBufferWithRTF(char *&buffer, size_t &cbBufferEnd, size_t &cbB int i, found = 0; for (i = 0; i < SIZEOF(bbcodes); ++i) { if (line[1] == bbcodes[i][1]) { - size_t lenb = _tcslen(bbcodes[i]); + size_t lenb = mir_tstrlen(bbcodes[i]); if (!_tcsnicmp(line, bbcodes[i], lenb)) { size_t len = mir_strlen(bbcodefmt[i]); memcpy(d, bbcodefmt[i], len); diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index e86ad505fb..7d90bfe084 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -207,7 +207,7 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, TCHAR* fm { TCHAR szBuf[4096]; - if (!fmt || !fmt[0] || _tcslen(fmt) > 2000) + if (!fmt || !fmt[0] || mir_tstrlen(fmt) > 2000) return FALSE; va_list marker; diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 7270447bcd..0193777539 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -936,7 +936,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para // mi.pszName mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName); if (!db_get_ts(NULL, MenuNameItems, DBString, &dbv)) { - if (_tcslen(dbv.ptszVal) > 0) + if (mir_tstrlen(dbv.ptszVal) > 0) replaceStrT(pmi->CustomName, dbv.ptszVal); db_free(&dbv); } @@ -1073,7 +1073,7 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*) if ((p = _tcschr(p, '&')) == NULL) break; - memmove(p, p + 1, sizeof(TCHAR)*(_tcslen(p + 1) + 1)); + memmove(p, p + 1, sizeof(TCHAR)*(mir_tstrlen(p + 1) + 1)); if (*p == '\0') p++; } diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 12ec065367..5b9ca54af2 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -54,7 +54,7 @@ static TCHAR* PrepareGroupName(TCHAR* str) if (p == NULL) return mir_tstrdup(str); - d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2*_tcslen(str)+1)); + d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2*mir_tstrlen(str)+1)); while (*str) { if (*str == '&') *d++='&'; diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 28abf44605..292f0000ab 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -66,7 +66,7 @@ bool IsInsideRootDir(TCHAR* profiledir, bool exact) if (exact) return _tcsicmp(profiledir, pfd) == 0; - return _tcsnicmp(profiledir, pfd, _tcslen(pfd)) == 0; + return _tcsnicmp(profiledir, pfd, mir_tstrlen(pfd)) == 0; } // returns 1 if the profile path was returned, without trailing slash @@ -89,7 +89,7 @@ int getProfilePath(TCHAR *buf, size_t cch) // returns 1 if *.dat spec is matched int isValidProfileName(const TCHAR *name) { - size_t len = _tcslen(name) - 4; + size_t len = mir_tstrlen(name) - 4; return len > 0 && _tcsicmp(&name[len], _T(".dat")) == 0; } diff --git a/src/modules/metacontacts/meta_addto.cpp b/src/modules/metacontacts/meta_addto.cpp index 9311ff97d5..f974b2b3f8 100644 --- a/src/modules/metacontacts/meta_addto.cpp +++ b/src/modules/metacontacts/meta_addto.cpp @@ -52,7 +52,7 @@ static int FillList(HWND list, BOOL sort) // get contact display name from clist TCHAR *swzContactDisplayName = cli.pfnGetContactDisplayName(hMetaUser, 0); // don't insert huge strings that we have to compare with later - if (_tcslen(swzContactDisplayName) > 1023) + if (mir_tstrlen(swzContactDisplayName) > 1023) swzContactDisplayName[1024] = 0; int pos = -1; diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 0e4151d1ad..10a322453d 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -292,7 +292,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, else domainLen /= sizeof(wchar_t); if (domainLen) { - size_t newLoginLen = _tcslen(login) + domainLen + 1; + size_t newLoginLen = mir_tstrlen(login) + domainLen + 1; TCHAR *newLogin = (TCHAR*)alloca(newLoginLen * sizeof(TCHAR)); _tcsncpy(newLogin, domainName, domainLen); diff --git a/src/modules/options/filter.cpp b/src/modules/options/filter.cpp index aa7e2ca7aa..982fe77399 100644 --- a/src/modules/options/filter.cpp +++ b/src/modules/options/filter.cpp @@ -62,7 +62,7 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root) item.cchTextMax = SIZEOF(title); if (TreeView_GetItem(hWndDlg, &item)) - if (_tcslen(title) > 0) + if (mir_tstrlen(title) > 0) AddFilterString(key, title); HTREEITEM child = root; @@ -79,7 +79,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) { TCHAR title[2048]; GetWindowText(hWndDlg, title, SIZEOF(title)); - if (_tcslen(title) > 0) + if (mir_tstrlen(title) > 0) AddFilterString(key, title); TCHAR szClass[64]; @@ -99,7 +99,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) int res = ListBox_GetText(hWndDlg, i, title); if (res != LB_ERR) { title[SIZEOF(title) - 1] = 0; - if (_tcslen(title) > 0) + if (mir_tstrlen(title) > 0) AddFilterString(key, title); } } @@ -113,7 +113,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) title[0] = 0; //safety ListView_GetItemText(hWndDlg, i, 0, title, SIZEOF(title)); - if (_tcslen(title) > 0) + if (mir_tstrlen(title) > 0) AddFilterString(key, title); } return; @@ -128,7 +128,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) if (res != CB_ERR) { title[SIZEOF(title) - 1] = 0; - if (_tcslen(title) > 0) + if (mir_tstrlen(title) > 0) AddFilterString(key, title); } } diff --git a/src/modules/options/filter.h b/src/modules/options/filter.h index 261c99b342..590f74a76f 100644 --- a/src/modules/options/filter.h +++ b/src/modules/options/filter.h @@ -36,7 +36,7 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *plu _inline TCHAR *_tcslwr_locale(TCHAR *buf) { - LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)_tcslen(buf), buf, (int)_tcslen(buf)); + LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)mir_tstrlen(buf), buf, (int)mir_tstrlen(buf)); return buf; } diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index ff12e0d907..b2cabeecab 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -671,7 +671,7 @@ int LoadDefaultServiceModePlugin() if (param == NULL || *param == 0) return SERVICE_CONTINUE; - size_t cbLen = _tcslen(param); + size_t cbLen = mir_tstrlen(param); for (int i = 0; i < servicePlugins.getCount(); i++) { pluginEntry *p = servicePlugins[i]; if (!_tcsnicmp(p->pluginname, param, cbLen)) { diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index f1fa55ea5c..0a2bccb038 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -194,7 +194,7 @@ static __forceinline char *GetPathVarX(char *, int code) static __forceinline int _xcscmp(const TCHAR *s1, const TCHAR *s2) { return _tcscmp(s1, s2); } static __forceinline int _xcsncmp(const TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncmp(s1, s2, n); } -static __forceinline size_t _xcslen(const TCHAR *s1) { return _tcslen(s1); } +static __forceinline size_t _xcslen(const TCHAR *s1) { return mir_tstrlen(s1); } static __forceinline TCHAR *_xcscpy(TCHAR *s1, const TCHAR *s2) { return _tcscpy(s1, s2); } static __forceinline TCHAR *_xcsncpy(TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncpy(s1, s2, n); } static __forceinline TCHAR *_xstrselect(TCHAR *, char *s1, TCHAR *s2) { return s2; } -- cgit v1.2.3