From 5aed15a8d8d8e4f913539761be496e0d1ba2c4f0 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 24 May 2015 12:20:50 +0000 Subject: replace wcslen to mir_wstrlen git-svn-id: http://svn.miranda-ng.org/main/trunk@13813 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/src/config.cpp | 4 ++-- plugins/CmdLine/src/utils.cpp | 4 ++-- plugins/DbEditorPP/src/main.cpp | 2 +- plugins/ExternalAPI/delphi/m_folders.inc | 2 +- plugins/ExternalAPI/m_folders.h | 2 +- plugins/FingerprintNG/src/fingerprint.cpp | 2 +- plugins/Folders/src/utils.cpp | 14 +++++++------- plugins/HistoryStats/src/_strfunc.h | 2 +- plugins/IEView/src/TextToken.cpp | 10 +++++----- plugins/IEView/src/Utils.cpp | 4 ++-- plugins/ListeningTo/src/listeningto.cpp | 4 ++-- plugins/LotusNotify/src/LotusNotify.cpp | 10 +++++----- plugins/MirFox/src/MirfoxMiranda.cpp | 4 ++-- plugins/MirOTR/src/dbfilter.cpp | 4 ++-- plugins/Popup/src/popup_wnd2.cpp | 2 +- plugins/QuickReplies/src/options.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 2 +- plugins/Scriver/src/msglog.cpp | 4 ++-- plugins/SendScreenshotPlus/src/mir_string.cpp | 4 ++-- plugins/TabSRMM/src/chat/window.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 8 ++++---- plugins/UserInfoEx/src/commonheaders.cpp | 4 ++-- plugins/UserInfoEx/src/mir_string.cpp | 2 +- plugins/Weather/src/weather_conv.cpp | 2 +- plugins/Weather/src/weather_data.cpp | 2 +- plugins/YAMN/src/account.cpp | 2 +- plugins/YAMN/src/browser/badconnect.cpp | 4 ++-- plugins/YAMN/src/browser/mailbrowser.cpp | 18 +++++++++--------- plugins/YAMN/src/debug.cpp | 2 +- plugins/YAMN/src/mails/decode.cpp | 6 +++--- plugins/YAMN/src/mails/mime.cpp | 6 +++--- plugins/YAMN/src/proto/pop3/pop3opt.cpp | 4 ++-- plugins/YAMN/src/services.cpp | 4 ++-- plugins/YAPP/src/popwin.cpp | 2 +- plugins/YAPP/src/services.cpp | 2 +- plugins/YahooGroups/src/utils.cpp | 4 ++-- protocols/AimOscar/src/conv.cpp | 4 ++-- protocols/IcqOscarJ/src/icq_db.cpp | 2 +- protocols/MSN/src/msn_mime.cpp | 2 +- src/modules/clist/contacts.cpp | 4 ++-- src/modules/xml/xmlParser.cpp | 4 ++-- 41 files changed, 86 insertions(+), 86 deletions(-) diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index c92db86fdf..27aefdf329 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -42,14 +42,14 @@ inline TCHAR* GetString(char* key, const TCHAR* def) TCHAR* val; if (!db_get_ts(NULL, BOLTUN_KEY, key, &dbv)) { - size_t len = wcslen(dbv.ptszVal) + 1; + size_t len = mir_wstrlen(dbv.ptszVal) + 1; val = new TCHAR[len]; _tcscpy_s(val, len, dbv.ptszVal); db_free(&dbv); } else { - size_t len = wcslen(def) + 1; + size_t len = mir_wstrlen(def) + 1; val = new TCHAR[len]; _tcscpy_s(val, len, def); } diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index b7dce2a279..7a6aad0e3e 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -168,7 +168,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, (int) count); } else{ - size_t tmp = wcslen(dbv.pwszVal); + size_t tmp = mir_wstrlen(dbv.pwszVal); len = (tmp < count - 1) ? tmp : count - 1; wcsncpy(szResult, dbv.pwszVal, len); szResult[len] = L'\0'; @@ -179,7 +179,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 1; if (szError) { - size_t tmp = wcslen(szError); + size_t tmp = mir_wstrlen(szError); len = (tmp < count - 1) ? tmp : count - 1; wcsncpy(szResult, szError, len); szResult[len] = L'\0'; diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index b8b97cec80..a821adde05 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -476,7 +476,7 @@ WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode) if (r = GetDatabaseString(hContact, proto, "FirstName", res, SIZEOF(res), unicode)) { if (unicode) - len = (int)wcslen(res); + len = (int)mir_wstrlen(res); else len = (int)mir_strlen((char *)res); } diff --git a/plugins/ExternalAPI/delphi/m_folders.inc b/plugins/ExternalAPI/delphi/m_folders.inc index a0bb09ba19..a20a70e857 100644 --- a/plugins/ExternalAPI/delphi/m_folders.inc +++ b/plugins/ExternalAPI/delphi/m_folders.inc @@ -91,7 +91,7 @@ const wParam - (WPARAM) (int) - handle to registered path lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path string (not including the null character). Depending on the flags set when creating the path - it will either call mir_strlen() or wcslen() to get the length of the string. + it will either call mir_strlen() or mir_wstrlen() to get the length of the string. Returns the size of the buffer. } MS_FOLDERS_GET_SIZE:PAnsiChar = 'Folders/Get/PathSize'; diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h index 271237e574..34c00ac33e 100644 --- a/plugins/ExternalAPI/m_folders.h +++ b/plugins/ExternalAPI/m_folders.h @@ -109,7 +109,7 @@ FOLDERSDATA; wParam - (WPARAM) (int) - handle to registered path lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path string (not including the null character). Depending on the flags set when creating the path - it will either call mir_strlen() or wcslen() to get the length of the string. + it will either call mir_strlen() or mir_wstrlen() to get the length of the string. Returns the size of the buffer. */ #define MS_FOLDERS_GET_SIZE "Folders/Get/PathSize" diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index b7883c1238..3202d22ff5 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -216,7 +216,7 @@ BOOL __fastcall WildCompareW(LPWSTR wszName, LPWSTR wszMask) return wildcmpw(wszName, wszMask); size_t s = 1, e = 1; - LPWSTR wszTemp = (LPWSTR)_alloca(wcslen(wszMask) * sizeof(WCHAR) + sizeof(WCHAR)); + LPWSTR wszTemp = (LPWSTR)_alloca(mir_wstrlen(wszMask) * sizeof(WCHAR) + sizeof(WCHAR)); BOOL bExcept; while (wszMask[e] != L'\0') diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 4b3a310871..e41afda394 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -49,7 +49,7 @@ char *StrDelete(char *source, size_t index, size_t count) wchar_t *StrDelete(wchar_t *source, size_t index, size_t count) { - size_t len = wcslen(source); + size_t len = mir_wstrlen(source); count = (count + index > len) ? len - index : count; for (size_t i = index; i + count <= len; i++) source[i] = source[i + count]; @@ -73,8 +73,8 @@ char *StrInsert(char *source, size_t index, const char *what) wchar_t *StrInsert(wchar_t *source, size_t index, const wchar_t *what) { - size_t whatLen = wcslen(what); - size_t sourceLen = wcslen(source); + size_t whatLen = mir_wstrlen(what); + size_t sourceLen = mir_wstrlen(source); size_t i; for (i = sourceLen; i >= index; i--) source[i + whatLen] = source[i]; @@ -107,8 +107,8 @@ char *StrReplace(char *source, const char *what, const char *withWhat) wchar_t *StrReplace(wchar_t *source, const wchar_t *what, const wchar_t *withWhat) { - size_t whatLen = wcslen(what); - size_t withWhatLen = wcslen(withWhat); + size_t whatLen = mir_wstrlen(what); + size_t withWhatLen = mir_wstrlen(withWhat); wchar_t *pos; while ((pos = wcsstr(source, what))) { @@ -143,12 +143,12 @@ char *StrTrim(char *szText, const char *szTrimChars) wchar_t *StrTrim(wchar_t *szText, const wchar_t *szTrimChars) { - size_t i = wcslen(szText) - 1; + size_t i = mir_wstrlen(szText) - 1; while (wcschr(szTrimChars, szText[i])) szText[i--] = '\0'; i = 0; - while ((i < wcslen(szText)) && (wcschr(szTrimChars, szText[i]))) + while ((i < mir_wstrlen(szText)) && (wcschr(szTrimChars, szText[i]))) i++; if (i) diff --git a/plugins/HistoryStats/src/_strfunc.h b/plugins/HistoryStats/src/_strfunc.h index dfaf172c79..c0a7a1084f 100644 --- a/plugins/HistoryStats/src/_strfunc.h +++ b/plugins/HistoryStats/src/_strfunc.h @@ -33,7 +33,7 @@ namespace ext static int coll(const WCHAR* string1, const WCHAR* string2) { return wcscoll(string1, string2); } static int icoll(const WCHAR* string1, const WCHAR* string2) { return _wcsicoll(string1, string2); } static const WCHAR* str(const WCHAR* string, const WCHAR* strSearch) { return wcsstr(string, strSearch); } - static size_t len(const WCHAR* string) { return wcslen(string); } + static size_t len(const WCHAR* string) { return mir_wstrlen(string); } static size_t ftime(WCHAR* strDest, size_t maxsize, const WCHAR* format, const struct tm* timeptr) { return wcsftime(strDest, maxsize, format, timeptr); } static int sprintf(WCHAR* buffer, const WCHAR* format, ...) { va_list args; va_start(args, format); return vswprintf(buffer, format, args); } }; diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index e44dc5e35b..ad08ee7856 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -78,7 +78,7 @@ static int countNoWhitespace(const wchar_t *str) TextToken* TextToken::tokenizeBBCodes(const wchar_t *text) { - return tokenizeBBCodes(text, (int)wcslen(text)); + return tokenizeBBCodes(text, (int)mir_wstrlen(text)); } // TODO: Add the following BBCodes: code @@ -239,7 +239,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) { TextToken *firstToken = NULL, *lastToken = NULL; int textLen = 0; - int l = (int)wcslen(text); + int l = (int)mir_wstrlen(text); for (int i = 0; i <= l;) { int newTokenType, newTokenSize; int urlLen = Utils::detectURL(text + i); @@ -295,7 +295,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, const wchar_t *text, bool isSent) { TextToken *firstToken = NULL, *lastToken = NULL; - int l = (int)wcslen(text); + int l = (int)mir_wstrlen(text); if (!Options::isSmileyAdd()) return new TextToken(TEXT, text, l); @@ -352,7 +352,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) { TextToken *firstToken = NULL, *lastToken = NULL; int textLen = 0; - int l = (int)wcslen(text); + int l = (int)mir_wstrlen(text); wchar_t* tokenBuffer = new wchar_t[l + 1]; for (int i = 0; i <= l;) { int newTokenType = TEXT; @@ -521,7 +521,7 @@ void TextToken::toString(CMStringW &str) if (match != NULL) { match += 2; wchar_t *match2 = wcsstr(match, L"&"); - int len = match2 != NULL ? match2 - match : (int)wcslen(match); + int len = match2 != NULL ? match2 - match : (int)mir_wstrlen(match); match = mir_wstrdup(match); match[len] = 0; int width = 0; diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index 77def5af4b..1655b06c95 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -32,8 +32,8 @@ const wchar_t *Utils::getBaseDir() wchar_t* Utils::toAbsolute(wchar_t* relative) { const wchar_t* bdir = getBaseDir(); - long len = (int)wcslen(bdir); - long tlen = len + (int)wcslen(relative); + long len = (int)mir_wstrlen(bdir); + long tlen = len + (int)mir_wstrlen(relative); wchar_t* result = (wchar_t*)mir_alloc(sizeof(wchar_t)*(tlen + 1)); if (result) { wcscpy(result, bdir); diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 6b1c50d224..75686cbd18 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -969,11 +969,11 @@ INT_PTR SetNewSong(WPARAM wParam,LPARAM lParam) if (lParam == LISTENINGTO_ANSI) { CharToWchar data((char *) wParam); - ((GenericPlayer *) players[GENERIC])->NewData(data, wcslen(data)); + ((GenericPlayer *) players[GENERIC])->NewData(data, mir_wstrlen(data)); } else { WCHAR *data = (WCHAR *) wParam; - ((GenericPlayer *) players[GENERIC])->NewData(data, wcslen(data)); + ((GenericPlayer *) players[GENERIC])->NewData(data, mir_wstrlen(data)); } return 0; diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index c8683feba1..50f213b5ad 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -761,7 +761,7 @@ void checkthread(void*) memset(msgFrom, 0, sizeof(msgFrom)); memset(msgSubject, 0, sizeof(msgSubject)); - if(wcslen(field_from_UNICODE) < 512 && wcslen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE) + if(mir_wstrlen(field_from_UNICODE) < 512 && mir_wstrlen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE) _tcsncpy_s(msgFrom, &(field_from_UNICODE[3]), wcscspn(field_from_UNICODE, L"/")-3 ); else _tcsncpy_s(msgFrom, field_from_UNICODE, _TRUNCATE); @@ -782,10 +782,10 @@ void checkthread(void*) //do not put private user data into log log_p(L"checkthread: MAIL INFO (sizes): date=[%S], from=[%d], to=[%d], cc=[%d], sub=[%d], attSize=[%d]" ,field_date - ,wcslen(field_from_UNICODE) - ,wcslen(field_to_UNICODE) - ,wcslen(field_copy_UNICODE) - ,wcslen(field_subject_UNICODE) + ,mir_wstrlen(field_from_UNICODE) + ,mir_wstrlen(field_to_UNICODE) + ,mir_wstrlen(field_copy_UNICODE) + ,mir_wstrlen(field_subject_UNICODE) ,attSize ); #endif diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp index b0984d3b66..bbe1819862 100644 --- a/plugins/MirFox/src/MirfoxMiranda.cpp +++ b/plugins/MirFox/src/MirfoxMiranda.cpp @@ -340,7 +340,7 @@ void CMirfoxMiranda::msgQueueThread(void* threadArg) strcpy_s(accountSzModuleName, mnSize, mirandaAccountsIter->szModuleName); actionThreadArgPtr->accountSzModuleName = accountSzModuleName; - std::size_t uasSize = wcslen(userActionSelection) + 1; + std::size_t uasSize = mir_wstrlen(userActionSelection) + 1; actionThreadArgPtr->userActionSelection = new wchar_t[uasSize]; memset(actionThreadArgPtr->userActionSelection, 0, uasSize * sizeof(wchar_t)); wcsncpy_s(actionThreadArgPtr->userActionSelection, uasSize, userActionSelection, uasSize - 1); @@ -368,7 +368,7 @@ void CMirfoxMiranda::msgQueueThread(void* threadArg) actionThreadArgPtr->accountSzModuleName = mirfoxDataPtr->getAccountSzModuleNameById(targetHandle); } - std::size_t uasSize = wcslen(userActionSelection) + 1; + std::size_t uasSize = mir_wstrlen(userActionSelection) + 1; actionThreadArgPtr->userActionSelection = new wchar_t[uasSize]; memset(actionThreadArgPtr->userActionSelection, 0, uasSize * sizeof(wchar_t)); wcsncpy_s(actionThreadArgPtr->userActionSelection, uasSize, userActionSelection, uasSize - 1); diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index b3078c0c8d..d8e1f8524e 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -111,12 +111,12 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) // yes, unicode wchar_t* msgw = (wchar_t *)&msg[msglen]; wchar_t *prefixw = mir_utf8decodeW(options.prefix); - int prefixlenw = (int)wcslen(prefixw); + int prefixlenw = (int)mir_wstrlen(prefixw); if (wcsncmp(msgw, prefixw, prefixlenw) == 0) { mir_free(prefixw); return 0; } - int msglenw = (int)wcslen(msgw); + int msglenw = (int)mir_wstrlen(msgw); char *prefix = mir_utf8decodeA(options.prefix); int prefixlen = (int)mir_strlen(prefix); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index ee37144fe8..aad7891cbb 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -854,7 +854,7 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM case VK_RETURN: TCHAR msg[2048]; GetWindowText(hwnd, msg, SIZEOF(msg)); - if (wcslen(msg) == 0) { + if (mir_wstrlen(msg) == 0) { DestroyWindow(hwnd); return 0; } diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index 1854484fad..75e177ab93 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -44,7 +44,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0); SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL); GetWindowText(hwnd, text, SIZEOF(text)); - memmove(text + start, text + end, sizeof(WCHAR) * (wcslen(text) + 1 - end)); + memmove(text + start, text + end, sizeof(WCHAR) * (mir_wstrlen(text) + 1 - end)); SetWindowText(hwnd, text); SendMessage(hwnd, EM_SETSEL, start, start); SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 52840bd307..ecb1b77b01 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -55,7 +55,7 @@ static TCHAR* GetIEViewSelection(SrmmWindowData *dat) static TCHAR* GetQuotedTextW(TCHAR *text) { - size_t i, j, l = wcslen(text); + size_t i, j, l = mir_wstrlen(text); int newLine = 1; int wasCR = 0; for (i = j = 0; i < l; i++) { diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 6b1e473fd8..8c5c4e020a 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -254,7 +254,7 @@ static void freeEvent(EventData *evt) static int AppendUnicodeOrAnsiiToBufferL(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const WCHAR *line, size_t maxLen, BOOL isAnsii) { if (maxLen == -1) - maxLen = wcslen(line); + maxLen = mir_wstrlen(line); const WCHAR *maxLine = line + maxLen; size_t lineLen = maxLen*9 + 8; @@ -503,7 +503,7 @@ static void AppendWithCustomLinks(EventData *evt, int style, char *&buffer, size } else { wText = evt->pszTextW; - len = (int)wcslen(evt->pszTextW); + len = (int)mir_wstrlen(evt->pszTextW); } for (size_t j = 0; j < len; j++) { int newtoken = 0; diff --git a/plugins/SendScreenshotPlus/src/mir_string.cpp b/plugins/SendScreenshotPlus/src/mir_string.cpp index 53d1b0763b..d22754bd89 100644 --- a/plugins/SendScreenshotPlus/src/mir_string.cpp +++ b/plugins/SendScreenshotPlus/src/mir_string.cpp @@ -54,8 +54,8 @@ void mir_wstradd(wchar_t* &pszDest, const wchar_t* pszSrc) if(!pszDest) pszDest = mir_wstrdup(pszSrc); else { - size_t lenDest = wcslen(pszDest); - size_t lenSrc = wcslen(pszSrc); + size_t lenDest = mir_wstrlen(pszDest); + size_t lenSrc = mir_wstrlen(pszSrc); size_t lenNew = lenDest + lenSrc + 1; pszDest = (wchar_t *) mir_realloc(pszDest, sizeof(wchar_t)*lenNew); diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index f74ca657aa..fb30a32607 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -495,7 +495,7 @@ LBL_SkipEnd: if (end != start) { ptrT szReplace; if (!isRoom && !isTopic && g_Settings.bAddColonToAutoComplete && start == 0) { - szReplace = (TCHAR*)mir_alloc((wcslen(pszName) + 4) * sizeof(TCHAR)); + szReplace = (TCHAR*)mir_alloc((mir_wstrlen(pszName) + 4) * sizeof(TCHAR)); wcscpy(szReplace, pszName); wcscat(szReplace, L": "); pszName = szReplace; diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index f8762db894..378b5a8869 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -1000,7 +1000,7 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename) return 0; sysPathName[MAX_PATH - 1] = 0; - if (wcslen(sysPathName) + wcslen(szFilename) >= MAX_PATH) + if (mir_wstrlen(sysPathName) + mir_wstrlen(szFilename) >= MAX_PATH) return 0; mir_wstrcat(sysPathName, szFilename); @@ -1187,7 +1187,7 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt) */ _s = TranslateTS(warnings[uId]); - if (wcslen(_s) < 3 || 0 == wcschr(_s, '|')) + if (mir_wstrlen(_s) < 3 || 0 == wcschr(_s, '|')) _s = TranslateTS(warnings[uId]); } } @@ -1195,7 +1195,7 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt) return -1; } - if ((wcslen(_s) > 3) && ((separator_pos = wcschr(_s, '|')) != 0)) { + if ((mir_wstrlen(_s) > 3) && ((separator_pos = wcschr(_s, '|')) != 0)) { if (uId >= 0) { mask = getMask(); val = ((__int64)1L) << uId; @@ -1203,7 +1203,7 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt) else mask = val = 0; if (0 == (mask & val) || dwFlags & CWF_NOALLOWHIDE) { - wchar_t *s = reinterpret_cast(mir_alloc((wcslen(_s) + 1) * 2)); + wchar_t *s = reinterpret_cast(mir_alloc((mir_wstrlen(_s) + 1) * 2)); wcscpy(s, _s); separator_pos = wcschr(s, '|'); diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 3d4942e84f..8eb7699f3a 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -136,7 +136,7 @@ unsigned int __fastcall hash_M2(const void * key, unsigned int len) unsigned int hashSettingW_M2(const char * key) { if (key == NULL) return 0; - const unsigned int len = (unsigned int)wcslen((const wchar_t*)key); + const unsigned int len = (unsigned int)mir_wstrlen((const wchar_t*)key); char* buf = (char*)alloca(len + 1); for (unsigned i = 0; i <= len ; ++i) buf[i] = key[i << 1]; @@ -153,7 +153,7 @@ unsigned int hashSetting_M2(const char * key) unsigned int hashSetting_M2(const wchar_t * key) { if (key == NULL) return 0; - const unsigned int len = (unsigned int)wcslen((const wchar_t*)key); + const unsigned int len = (unsigned int)mir_wstrlen((const wchar_t*)key); return hash_M2(key, len * sizeof(wchar_t)); } diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp index d68ba2cb07..a454bbdc9d 100644 --- a/plugins/UserInfoEx/src/mir_string.cpp +++ b/plugins/UserInfoEx/src/mir_string.cpp @@ -40,7 +40,7 @@ wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc) { size_t size = 2; if (pwszDest != NULL) - size += wcslen(pwszDest); //cSrc = 1 + 1 forNULL temination + size += mir_wstrlen(pwszDest); //cSrc = 1 + 1 forNULL temination wchar_t *pwszRet = (wchar_t *)mir_realloc(pwszDest, (sizeof(wchar_t) * size)); if (pwszRet == NULL) diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index abf04c0839..64fa4fa6d6 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -442,7 +442,7 @@ void TrimString(WCHAR *str) { size_t len, start; - len = wcslen(str); + len = mir_wstrlen(str); while(len && (unsigned char)str[len-1] <= ' ') str[--len] = 0; for(start=0; (unsigned char)str[start] <= ' ' && str[start]; start++); memmove(str, str+start, (len-start+1)*sizeof(WCHAR)); diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index f47db595de..a5e9c5737d 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -405,7 +405,7 @@ void wfree(char **Data) void wfree(WCHAR **Data) { - if (*Data && wcslen(*Data) > 0) + if (*Data && mir_wstrlen(*Data) > 0) mir_free(*Data); *Data = NULL; } diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index db7ce8166b..f240832bee 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -768,7 +768,7 @@ DWORD WriteStringToFileW(HANDLE File, WCHAR *Source) DWORD Length, WrittenBytes; WCHAR null = (WCHAR)0; - if ((Source == NULL) || !(Length = (DWORD)wcslen(Source))) + if ((Source == NULL) || !(Length = (DWORD)mir_wstrlen(Source))) { if (!WriteFile(File, &null, sizeof(WCHAR), &WrittenBytes, NULL)) { diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index d2bd20ef05..3de6b12064 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -33,9 +33,9 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM if (ActualAccount->BadConnectN.App != NULL) { WCHAR *Command; if (ActualAccount->BadConnectN.AppParam != NULL) - Command = new WCHAR[wcslen(ActualAccount->BadConnectN.App) + wcslen(ActualAccount->BadConnectN.AppParam) + 6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->BadConnectN.App) + mir_wstrlen(ActualAccount->BadConnectN.AppParam) + 6]; else - Command = new WCHAR[wcslen(ActualAccount->BadConnectN.App) + 6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->BadConnectN.App) + 6]; if (Command != NULL) { mir_wstrcpy(Command, L"\""); diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index ece3465f5f..e34fe308c5 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -555,7 +555,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, struct CMailNu Extracted = TRUE; if ((UnicodeHeader.From != NULL) && (UnicodeHeader.FromNick != NULL)) { - size_t size = wcslen(UnicodeHeader.From) + wcslen(UnicodeHeader.FromNick) + 4; + size_t size = mir_wstrlen(UnicodeHeader.From) + mir_wstrlen(UnicodeHeader.FromNick) + 4; FromStr = new WCHAR[size]; mir_sntprintf(FromStr, size, L"%s <%s>", UnicodeHeader.FromNick, UnicodeHeader.From); FromStrNew = TRUE; @@ -758,9 +758,9 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D { WCHAR *Command; if (ActualAccount->NewMailN.AppParam != NULL) - Command = new WCHAR[wcslen(ActualAccount->NewMailN.App) + wcslen(ActualAccount->NewMailN.AppParam) + 6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6]; else - Command = new WCHAR[wcslen(ActualAccount->NewMailN.App) + 6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6]; if (Command != NULL) { @@ -1383,11 +1383,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR ConvertCodedStringToUnicode(Header->value, &str2, MailParam->mail->MailData->CP, 1); if (!str2) { str2 = (WCHAR *)str_nul; }// the header value may be NULL if (!From) if (!_stricmp(Header->name, "From")) { - From = new WCHAR[wcslen(str2) + 1]; + From = new WCHAR[mir_wstrlen(str2) + 1]; wcscpy(From, str2); } if (!Subj) if (!_stricmp(Header->name, "Subject")) { - Subj = new WCHAR[wcslen(str2) + 1]; + Subj = new WCHAR[mir_wstrlen(str2) + 1]; wcscpy(Subj, str2); } //if (!hasBody) if (!mir_strcmp(Header->name,"Body")) hasBody = true; @@ -1488,7 +1488,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR ShowWindow(GetDlgItem(hDlg, IDC_SPLITTER), (MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED) ? SW_SHOW : SW_HIDE); ShowWindow(hEdit, (MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED) ? SW_SHOW : SW_HIDE); WCHAR *title = 0; - size_t size = (From ? wcslen(From) : 0) + (Subj ? wcslen(Subj) : 0) + 4; + size_t size = (From ? mir_wstrlen(From) : 0) + (Subj ? mir_wstrlen(Subj) : 0) + 4; title = new WCHAR[size]; if (From && Subj) mir_sntprintf(title, size, L"%s (%s)", Subj, From); @@ -1741,7 +1741,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_INSERTCOLUMNW, (WPARAM)2, (LPARAM)&lvc2); SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_INSERTCOLUMNW, (WPARAM)3, (LPARAM)&lvc3); - if ((ActualAccount->NewMailN.App != NULL) && (wcslen(ActualAccount->NewMailN.App))) + if ((ActualAccount->NewMailN.App != NULL) && (mir_wstrlen(ActualAccount->NewMailN.App))) EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), TRUE); else EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), FALSE); @@ -2084,9 +2084,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR { WCHAR *Command; if (ActualAccount->NewMailN.AppParam != NULL) - Command = new WCHAR[wcslen(ActualAccount->NewMailN.App) + wcslen(ActualAccount->NewMailN.AppParam) + 6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6]; else - Command = new WCHAR[wcslen(ActualAccount->NewMailN.App) + 6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6]; if (Command != NULL) { diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index 5b7d699558..e952e77256 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -119,7 +119,7 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...) va_end(vararg); EnterCriticalSection(&FileAccessCS); WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL); - WriteFile(File,str,(DWORD)wcslen(str)*sizeof(WCHAR),&Written,NULL); + WriteFile(File,str,(DWORD)mir_wstrlen(str)*sizeof(WCHAR),&Written,NULL); LeaveCriticalSection(&FileAccessCS); free(str); } diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp index 6ca2a0238b..320cda63ff 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -410,7 +410,7 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out) streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,NULL,0); if (*out != NULL) - outlen=wcslen(*out); + outlen=mir_wstrlen(*out); else outlen=0; temp=new WCHAR[streamlen+outlen+1]; @@ -452,7 +452,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) WCHAR *tempstore=0; if (!ConvertStringToUnicode(stream,cp,&tempstore))return; - size_t tempstoreLength = wcslen(tempstore); + size_t tempstoreLength = mir_wstrlen(tempstore); size_t outind = 0; while(*start != 0) { @@ -534,7 +534,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) } WCHAR *oneWord=0; if (ConvertStringToUnicode(DecodedResult,cp,&oneWord)) { - size_t len = wcslen(oneWord); + size_t len = mir_wstrlen(oneWord); memcpy(&tempstore[outind],oneWord,len*sizeof(WCHAR)); outind += len; } diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index 0c7449bf94..582db8d5a2 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -652,7 +652,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond) FailBackRaw: ConvertStringToUnicode(partData[i].body,partData[i].CodePage,&partData[i].wBody); } - resultSize += wcslen(partData[i].wBody); + resultSize += mir_wstrlen(partData[i].wBody); }// if (partData[i].body) resultSize += 100+4+3; //cr+nl+100+ 3*bullet } @@ -696,7 +696,7 @@ FailBackRaw: dest[destpos] = dest[destpos+1] = dest[destpos+2] = 0x2022; // bullet; destpos += 3; ConvertStringToUnicode(infoline,CP_ACP,&temp); - size_t wsize = wcslen(temp); + size_t wsize = mir_wstrlen(temp); wcscpy(&dest[destpos],temp); destpos += wsize; delete[] temp; @@ -704,7 +704,7 @@ FailBackRaw: } // if (i) if (partData[i].wBody) { - size_t wsize = wcslen(partData[i].wBody); + size_t wsize = mir_wstrlen(partData[i].wBody); wcscpy(&dest[destpos],partData[i].wBody); destpos += wsize; delete[] partData[i].wBody; diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 30e60b8625..f4bb745659 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -1065,13 +1065,13 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,SIZEOF(TextW)); if (NULL != ActualAccount->NewMailN.App) delete[] ActualAccount->NewMailN.App; - ActualAccount->NewMailN.App=new WCHAR[wcslen(TextW)+1]; + ActualAccount->NewMailN.App=new WCHAR[mir_wstrlen(TextW)+1]; wcscpy(ActualAccount->NewMailN.App,TextW); GetDlgItemTextW(hDlg,IDC_EDITAPPPARAM,TextW,SIZEOF(TextW)); if (NULL != ActualAccount->NewMailN.AppParam) delete[] ActualAccount->NewMailN.AppParam; - ActualAccount->NewMailN.AppParam=new WCHAR[wcslen(TextW)+1]; + ActualAccount->NewMailN.AppParam=new WCHAR[mir_wstrlen(TextW)+1]; wcscpy(ActualAccount->NewMailN.AppParam,TextW); ActualAccount->Server->Port=Port; diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 84a5915b4f..209e26ce5f 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -88,9 +88,9 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam) if (ActualAccount->NewMailN.App != NULL) { WCHAR *Command; if (ActualAccount->NewMailN.AppParam != NULL) - Command = new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App)+mir_wstrlen(ActualAccount->NewMailN.AppParam)+6]; else - Command = new WCHAR[wcslen(ActualAccount->NewMailN.App)+6]; + Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App)+6]; if (Command != NULL) { mir_wstrcpy(Command, L"\""); diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index c29cbeed70..78e2607abe 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -7,7 +7,7 @@ DWORD pop_start_x, pop_start_y; int global_mouse_in = 0; void trimW(wchar_t *str) { - int len = (int)wcslen(str), pos; + int len = (int)mir_wstrlen(str), pos; // trim whitespace (e.g. from OTR detection) for (pos = len - 1; pos >= 0; pos--) { if (str[pos] == L' ' || str[pos] == L'\t' || str[pos] == L'\r' || str[pos] == L'\n') str[pos] = 0; diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index f968d505a2..f694e17a27 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -10,7 +10,7 @@ void StripBBCodesInPlace(wchar_t *text) return; int read = 0, write = 0; - int len = (int)wcslen(text); + int len = (int)mir_wstrlen(text); while(read <= len) { // copy terminating null too while(read <= len && text[read] != L'[') { diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index f13cc4ee2d..5da8431f39 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -174,7 +174,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName if (dbv.type != DBVT_WCHAR) MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count); else { - int tmp = (int)wcslen(dbv.pwszVal); + int tmp = (int)mir_wstrlen(dbv.pwszVal); len = (tmp < count - 1) ? tmp : count - 1; wcsncpy(szResult, dbv.pwszVal, len); szResult[len] = L'\0'; @@ -184,7 +184,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName else { res = 1; if (szError) { - int tmp = (int)wcslen(szError); + int tmp = (int)mir_wstrlen(szError); len = (tmp < count - 1) ? tmp : count - 1; wcsncpy(szResult, szError, len); szResult[len] = L'\0'; diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index c63010341b..7f6d6f1a3e 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -804,7 +804,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) void wcs_htons(wchar_t * ch) { if (ch == NULL) return; - for(size_t i=0;itype = CNFT_ASCIIZ; if (ci->dwFlag & CNF_UNICODE) { - size_t len = wcslen(dbv.pwszVal) + wcslen(dbv2.pwszVal) + 2; + size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2; WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len); if (buf != NULL) wcscat(wcscat(wcscpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal); @@ -309,7 +309,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) ci->type = CNFT_ASCIIZ; if (ci->dwFlag & CNF_UNICODE) { - size_t len = wcslen(dbv.pwszVal) + wcslen(dbv2.pwszVal) + 2; + size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2; WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len); if (buf != NULL) wcscat(wcscat(wcscpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal); diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 79eb1fc6e1..885d6d81c1 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -202,7 +202,7 @@ wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce) return d; } static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return _wfopen(filename, mode); } -static inline size_t xstrlen(XMLCSTR c) { return wcslen(c); } +static inline size_t xstrlen(XMLCSTR c) { return mir_wstrlen(c); } static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return _wcsnicmp(c1, c2, l);} static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1, c2, l);} static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return _wcsicmp(c1, c2); } @@ -275,7 +275,7 @@ wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce) d[i] = 0; return d; } -int xstrlen(XMLCSTR c) { return wcslen(c); } +int xstrlen(XMLCSTR c) { return mir_wstrlen(c); } #ifdef sun // for CC #include -- cgit v1.2.3