From 5a17c9299e03bebf46169927abdeee34aaf8e854 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 22 May 2015 10:06:32 +0000 Subject: replace strlen to mir_strlen git-svn-id: http://svn.miranda-ng.org/main/trunk@13747 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddContactPlus/src/addcontact.cpp | 4 +- plugins/AvatarHistory/src/AvatarHistory.cpp | 2 +- plugins/BasicHistory/src/Scheduler.cpp | 2 +- plugins/Clist_modern/src/modern_utils.cpp | 4 +- plugins/Clist_nicer/src/wallpaper.cpp | 2 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 16 +-- plugins/CmdLine/src/utils.cpp | 6 +- plugins/ContactsPlus/src/utils.cpp | 2 +- plugins/CrashDumper/src/dumper.cpp | 2 +- plugins/CrashDumper/src/upload.cpp | 8 +- plugins/Db3x_mmap/src/dbcontacts.cpp | 2 +- plugins/Db3x_mmap/src/dbcrypt.cpp | 2 +- plugins/Db3x_mmap/src/dbmodulechain.cpp | 2 +- plugins/Db3x_mmap/src/dbsettings.cpp | 24 ++-- plugins/Db3x_mmap/src/dbtool/eventchain.cpp | 4 +- plugins/DbEditorPP/src/addeditsettingsdlg.cpp | 8 +- plugins/DbEditorPP/src/exportimport.cpp | 12 +- plugins/DbEditorPP/src/findwindow.cpp | 6 +- plugins/DbEditorPP/src/headers.h | 2 +- plugins/DbEditorPP/src/main.cpp | 8 +- plugins/DbEditorPP/src/settinglist.cpp | 2 +- plugins/DbEditorPP/src/watchedvars.cpp | 2 +- plugins/Dropbox/src/dropbox.cpp | 2 +- plugins/Dropbox/src/dropbox_services.cpp | 2 +- plugins/Dropbox/src/http_request.h | 2 +- plugins/Exchange/src/MirandaExchange.cpp | 2 +- plugins/Exchange/src/emails.cpp | 2 +- plugins/Exchange/src/utils.cpp | 2 +- plugins/ExternalAPI/delphi/m_folders.inc | 2 +- plugins/ExternalAPI/m_folders.h | 2 +- plugins/FTPFileYM/src/job_upload.cpp | 2 +- plugins/FTPFileYM/src/utils.cpp | 4 +- plugins/FavContacts/src/csocket.cpp | 2 +- plugins/FloatingContacts/src/bitmap_funcs.cpp | 2 +- plugins/FloatingContacts/src/filedrop.cpp | 8 +- plugins/Folders/src/utils.cpp | 14 +-- plugins/GmailNotifier/src/check.cpp | 6 +- plugins/HTTPServer/src/FileShareNode.cpp | 4 +- plugins/HTTPServer/src/GuiElements.cpp | 22 ++-- plugins/HTTPServer/src/HttpUser.cpp | 6 +- plugins/HTTPServer/src/IndexHTML.cpp | 2 +- plugins/HTTPServer/src/IndexXML.cpp | 14 +-- plugins/HTTPServer/src/MimeHandling.cpp | 6 +- plugins/HTTPServer/src/main.cpp | 10 +- plugins/HistoryStats/src/_strfunc.h | 2 +- plugins/IEHistory/src/dlgHandlers.cpp | 2 +- plugins/IEHistory/src/utils.cpp | 4 +- plugins/IEView/src/Template.cpp | 8 +- plugins/IEView/src/TemplateHTMLBuilder.cpp | 8 +- plugins/IEView/src/TextToken.cpp | 2 +- plugins/IEView/src/Utils.cpp | 2 +- plugins/Import/src/import.cpp | 2 +- plugins/KeyboardNotify/src/main.cpp | 2 +- plugins/LotusNotify/src/LotusNotify.cpp | 30 ++--- plugins/MenuItemEx/src/main.cpp | 4 +- plugins/MirOTR/src/dbfilter.cpp | 10 +- plugins/MirOTR/src/dialogs.cpp | 8 +- plugins/MirOTR/src/entities.cpp | 8 +- plugins/MirOTR/src/entities.h | 2 +- plugins/MirOTR/src/striphtml.cpp | 2 +- plugins/MirOTR/src/svcs_proto.cpp | 2 +- plugins/MirandaG15/src/CAppletManager.cpp | 8 +- plugins/MirandaG15/src/LCDFramework/misc.cpp | 2 +- plugins/Msg_Export/src/utils.cpp | 2 +- plugins/NewEventNotify/src/popup.cpp | 28 ++--- plugins/NewXstatusNotify/src/main.cpp | 4 +- plugins/NewXstatusNotify/src/xstatus.cpp | 2 +- plugins/New_GPG/src/main.cpp | 36 +++--- plugins/New_GPG/src/messages.cpp | 4 +- plugins/New_GPG/src/options.cpp | 10 +- plugins/New_GPG/src/utilities.cpp | 22 ++-- plugins/New_GPG/src/utilities.h | 10 +- plugins/NewsAggregator/Src/CheckFeed.cpp | 4 +- plugins/Non-IM Contact/src/contactinfo.cpp | 54 ++++---- plugins/Non-IM Contact/src/dialog.cpp | 6 +- plugins/Non-IM Contact/src/files.cpp | 24 ++-- plugins/Non-IM Contact/src/namereplacing.cpp | 136 ++++++++++----------- plugins/Non-IM Contact/src/timer.cpp | 2 +- plugins/NotesAndReminders/src/notes.cpp | 12 +- plugins/NotesAndReminders/src/reminders.cpp | 12 +- plugins/Nudge/src/main.cpp | 4 +- plugins/PasteIt/src/PasteToWeb.cpp | 2 +- plugins/Quotes/src/HTTPSession.cpp | 2 +- plugins/RecentContacts/src/RecentContacts.cpp | 4 +- plugins/RemovePersonalSettings/src/rps.cpp | 42 +++---- plugins/Scriver/src/msglog.cpp | 2 +- plugins/Scriver/src/utils.cpp | 4 +- plugins/SecureIM/src/commonheaders.cpp | 4 +- plugins/SecureIM/src/crypt_dll.cpp | 10 +- plugins/SecureIM/src/dbevent.cpp | 2 +- plugins/SecureIM/src/main.cpp | 2 +- plugins/SecureIM/src/mmi.cpp | 12 +- plugins/SecureIM/src/options.cpp | 10 +- plugins/SecureIM/src/splitmsg.cpp | 10 +- plugins/SecureIM/src/svcs_proto.cpp | 6 +- plugins/SecureIM/src/svcs_rsa.cpp | 2 +- plugins/SeenPlugin/src/options.cpp | 2 +- plugins/SendScreenshotPlus/src/CSend.cpp | 10 +- plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp | 2 +- plugins/SendScreenshotPlus/src/mir_string.cpp | 4 +- plugins/Sessions/Src/Utils.cpp | 8 +- plugins/ShellExt/src/shlcom.cpp | 2 +- plugins/ShellExt/src/shlext.cpp | 4 +- plugins/SimpleStatusMsg/src/main.cpp | 10 +- plugins/SimpleStatusMsg/src/msgbox.cpp | 2 +- plugins/SimpleStatusMsg/src/options.cpp | 8 +- plugins/SkypeStatusChange/src/main.cpp | 6 +- plugins/SmileyAdd/src/customsmiley.cpp | 2 +- plugins/SmileyAdd/src/download.cpp | 4 +- plugins/Spamotron/src/bayes.cpp | 24 ++-- plugins/Spamotron/src/spamotron.cpp | 10 +- plugins/Spamotron/src/utils.cpp | 6 +- plugins/SplashScreen/src/main.cpp | 4 +- .../StatusPlugins/AdvancedAutoAway/msgoptions.cpp | 2 +- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 2 +- plugins/StatusPlugins/StartupStatus/options.cpp | 24 ++-- .../StatusPlugins/StartupStatus/startupstatus.cpp | 2 +- plugins/StopSpamMod/src/utilities.cpp | 2 +- plugins/TabSRMM/src/contactcache.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 4 +- plugins/TabSRMM/src/utils.h | 2 +- plugins/TipperYM/src/subst.cpp | 4 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 4 +- plugins/TrafficCounter/src/TrafficCounter.cpp | 2 +- plugins/TrafficCounter/src/options.cpp | 2 +- plugins/UserInfoEx/src/commonheaders.cpp | 2 +- plugins/UserInfoEx/src/commonheaders.h | 2 +- .../src/ex_import/classExImContactBase.cpp | 4 +- .../src/ex_import/dlg_ExImOpenSaveFile.cpp | 2 +- plugins/UserInfoEx/src/ex_import/tinystr.cpp | 4 +- plugins/UserInfoEx/src/ex_import/tinystr.h | 6 +- plugins/UserInfoEx/src/ex_import/tinyxml.cpp | 2 +- plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp | 8 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 6 +- plugins/UserInfoEx/src/mir_string.cpp | 4 +- plugins/UserInfoEx/src/svc_email.cpp | 2 +- plugins/Utils/mir_buffer.h | 2 +- plugins/Variables/src/contact.cpp | 4 +- plugins/Variables/src/help.cpp | 6 +- plugins/Variables/src/parse_alias.cpp | 4 +- plugins/Variables/src/parse_inet.cpp | 18 +-- plugins/Variables/src/parse_miranda.cpp | 2 +- plugins/Variables/src/variables.cpp | 4 +- plugins/Watrack_MPD/src/main.cpp | 20 +-- plugins/Weather/src/weather_conv.cpp | 6 +- plugins/Weather/src/weather_data.cpp | 6 +- plugins/Weather/src/weather_ini.cpp | 6 +- plugins/Weather/src/weather_update.cpp | 2 +- plugins/WebView/src/webview_alerts.cpp | 20 +-- plugins/WebView/src/webview_cleanup.cpp | 22 ++-- plugins/WebView/src/webview_datawnd.cpp | 12 +- plugins/WebView/src/webview_getdata.cpp | 16 +-- plugins/WhenWasIt/src/services.cpp | 2 +- plugins/WhenWasIt/src/utils.cpp | 6 +- plugins/YAMN/src/account.cpp | 2 +- plugins/YAMN/src/browser/badconnect.cpp | 2 +- plugins/YAMN/src/browser/mailbrowser.cpp | 14 +-- plugins/YAMN/src/debug.cpp | 6 +- plugins/YAMN/src/mails/decode.cpp | 4 +- plugins/YAMN/src/mails/mails.cpp | 2 +- plugins/YAMN/src/mails/mime.cpp | 24 ++-- plugins/YAMN/src/proto/netlib.cpp | 2 +- plugins/YAMN/src/proto/pop3/pop3.cpp | 4 +- plugins/YAMN/src/proto/pop3/pop3opt.cpp | 16 +-- plugins/YARelay/src/main.cpp | 2 +- plugins/YahooGroups/src/services.cpp | 8 +- plugins/YahooGroups/src/utils.cpp | 6 +- 169 files changed, 645 insertions(+), 645 deletions(-) (limited to 'plugins') diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 5808b48347..7e79830a37 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -60,7 +60,7 @@ void AddContactDlgOpts(HWND hdlg, const char* szProto, BOOL bAuthOptsOnly = FALS char* szUniqueId = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (szUniqueId) { - size_t cbLen = strlen(szUniqueId) + 2; + size_t cbLen = mir_strlen(szUniqueId) + 2; TCHAR* pszUniqueId = (TCHAR*)mir_alloc(cbLen * sizeof(TCHAR)); mir_sntprintf(pszUniqueId, cbLen, _T("%S:"), szUniqueId); SetDlgItemText(hdlg, IDC_IDLABEL, pszUniqueId); @@ -76,7 +76,7 @@ void AddContactDlgOpts(HWND hdlg, const char* szProto, BOOL bAuthOptsOnly = FALS _ultoa(INT_MAX, buffer, 10); else _ultoa(ULONG_MAX, buffer, 10); - SendDlgItemMessage(hdlg, IDC_USERID, EM_LIMITTEXT, (WPARAM)strlen(buffer), 0); + SendDlgItemMessage(hdlg, IDC_USERID, EM_LIMITTEXT, (WPARAM)mir_strlen(buffer), 0); } else { SetWindowLongPtr(GetDlgItem(hdlg, IDC_USERID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_USERID), GWL_STYLE) & ~ES_NUMBER); diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 5280fc2064..50df90a8dd 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -218,7 +218,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) dbei.flags = DBEF_READ | DBEF_UTF; dbei.timestamp = (DWORD) time(NULL); dbei.eventType = EVENTTYPE_AVATAR_CHANGE; - dbei.cbBlob = (DWORD) strlen(blob) + 1; + dbei.cbBlob = (DWORD) mir_strlen(blob) + 1; dbei.pBlob = (PBYTE)(char*)blob; db_event_add(hContact, &dbei); } diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 364ba388f8..c44922fb91 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -1022,7 +1022,7 @@ bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::s } } - int sizeC = (int)strlen(bufF); + int sizeC = (int)mir_strlen(bufF); int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, NULL, 0); fileNameInZip.resize(sizeW); MultiByteToWideChar(cp, 0, bufF, sizeC, (wchar_t*)fileNameInZip.c_str(), sizeW); diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp index 1dbd55bb5d..ed0739042e 100644 --- a/plugins/Clist_modern/src/modern_utils.cpp +++ b/plugins/Clist_modern/src/modern_utils.cpp @@ -37,9 +37,9 @@ BOOL __cdecl mir_bool_tstrcmpi(const TCHAR *a, const TCHAR *b) return _tcsicmp(a, b) == 0; } -#ifdef strlen +#ifdef mir_strlen #undef mir_strcmp -#undef strlen +#undef mir_strlen #endif //copy len symbols from string - do not check is it null terminated or len is more then actual diff --git a/plugins/Clist_nicer/src/wallpaper.cpp b/plugins/Clist_nicer/src/wallpaper.cpp index 4bac032e35..c235094fda 100644 --- a/plugins/Clist_nicer/src/wallpaper.cpp +++ b/plugins/Clist_nicer/src/wallpaper.cpp @@ -41,7 +41,7 @@ void GetWallpaperPattern() if (hPattern) {DeleteObject(hPattern); hPattern=NULL;} SystemParametersInfo(SPI_GETDESKWALLPAPER,MAX_PATH,wpbuf,NULL); - if (strlen(wpbuf)>0) + if (mir_strlen(wpbuf)>0) { hPattern = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)wpbuf); } diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 6894f4c602..acf6932fbf 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -121,13 +121,13 @@ void HandleUnknownParameter(PCommand command, char *param, PReply reply) int ParseValueParam(char *param, void *&result) { - if (strlen(param) > 0) + if (mir_strlen(param) > 0) { switch (*param) { case 's': { - size_t len = strlen(param); //- 1 + 1 + size_t len = mir_strlen(param); //- 1 + 1 result = (char *) malloc(len * sizeof(char)); STRNCPY((char *) result, param + 1, len); ((char *) result)[len - 1] = 0; @@ -136,7 +136,7 @@ int ParseValueParam(char *param, void *&result) case 'w': { - size_t len = strlen(param); + size_t len = mir_strlen(param); result = (WCHAR *) malloc(len * sizeof(WCHAR)); char *buffer = (char *) malloc(len * sizeof(WCHAR)); STRNCPY(buffer, param + 1, len); @@ -819,9 +819,9 @@ void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PRepl void ParseMessage(char buffer[512], const char *message) { unsigned int j = 0; - for (unsigned int i = 0; i < strlen(message); ++i) { + for (unsigned int i = 0; i < mir_strlen(message); ++i) { char c = message[i]; - if (c == '\\' && i < (strlen(message) - 1) && message[i+1] == 'n') { + if (c == '\\' && i < (mir_strlen(message) - 1) && message[i+1] == 'n') { c = '\n'; i++; } @@ -897,7 +897,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re e.flags = DBEF_SENT; e.pBlob = (PBYTE) message; - e.cbBlob = (DWORD) strlen((char *) message) + 1; + e.cbBlob = (DWORD) mir_strlen((char *) message) + 1; STRNCPY(module, ack->szModule, sizeof(module)); e.szModule = module; @@ -1462,7 +1462,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r STRNCPY(reply->message, buffer, reply->cMessage); } - if (strlen(reply->message) > 4096) + if (mir_strlen(reply->message) > 4096) { SetEvent(heServerBufferFull); Sleep(750); //wait a few milliseconds for the event to be processed @@ -1539,7 +1539,7 @@ void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) STRNCPY(reply->message, buffer, reply->cMessage); } - if (strlen(reply->message) > (reply->cMessage / 2)) + if (mir_strlen(reply->message) > (reply->cMessage / 2)) { SetEvent(heServerBufferFull); diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index 9e20f665b5..f9918523c0 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -55,7 +55,7 @@ int Log(char *format, ...) } va_end(vararg); - if (str[strlen(str) - 1] != '\n') + if (str[mir_strlen(str) - 1] != '\n') { strcat(str, "\n"); } @@ -132,7 +132,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName if (db_get(hContact, szModule, szSettingName, &dbv) == 0) { res = 0; - size_t tmp = strlen(dbv.pszVal); + size_t tmp = mir_strlen(dbv.pszVal); len = (tmp < size - 1) ? tmp : size - 1; strncpy(szResult, dbv.pszVal, len); szResult[len] = '\0'; @@ -142,7 +142,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 1; if (szError) { - size_t tmp = strlen(szError); + size_t tmp = mir_strlen(szError); len = (tmp < size - 1) ? tmp : size - 1; strncpy(szResult, szError, len); szResult[len] = '\0'; diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index c6a9b6ed87..1b3c436a2d 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -27,7 +27,7 @@ size_t __fastcall strlennull(const char *string) { if (string) - return strlen(string); + return mir_strlen(string); return 0; } diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 9eea197517..5b7a879e02 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -49,7 +49,7 @@ void WriteUtfFile(HANDLE hDumpFile, char* bufu) static const unsigned char bytemark[] = { 0xEF, 0xBB, 0xBF }; WriteFile(hDumpFile, bytemark, 3, &bytes, NULL); - WriteFile(hDumpFile, bufu, (DWORD)strlen(bufu), &bytes, NULL); + WriteFile(hDumpFile, bufu, (DWORD)mir_strlen(bufu), &bytes, NULL); } diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 3422fee56a..2413b92367 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -51,7 +51,7 @@ void GetLoginStr(char* user, size_t szuser, char* pass) mir_md5_state_t context; mir_md5_init(&context); - mir_md5_append(&context, (BYTE*)dbv.pszVal, (int)strlen(dbv.pszVal)); + mir_md5_append(&context, (BYTE*)dbv.pszVal, (int)mir_strlen(dbv.pszVal)); mir_md5_finish(&context, hash); arrayToHex(hash, sizeof(hash), pass); @@ -118,7 +118,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) nlhr.headers[5].szValue = auth; nlhr.pData = szReq->buf; - nlhr.dataLength = (int)strlen(szReq->buf); + nlhr.dataLength = (int)mir_strlen(szReq->buf); while (result == 0xBADBAD) { // download the page @@ -164,11 +164,11 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) const char* szPref = strstr(szUrl, "://"); szPref = szPref ? szPref + 3 : szUrl; szPath = strchr(szPref, '/'); - rlen = szPath != NULL ? szPath - szUrl : strlen(szUrl); + rlen = szPath != NULL ? szPath - szUrl : mir_strlen(szUrl); } szRedirUrl = (char*)mir_realloc(szRedirUrl, - rlen + strlen(nlhrReply->headers[i].szValue) * 3 + 1); + rlen + mir_strlen(nlhrReply->headers[i].szValue) * 3 + 1); strncpy(szRedirUrl, szUrl, rlen); strcpy(szRedirUrl + rlen, nlhrReply->headers[i].szValue); diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index b1c842448a..7b93cd2c4a 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -34,7 +34,7 @@ int CDb3Mmap::CheckProto(DBCachedContact *cc, const char *proto) if (GetContactSettingStatic(cc->contactID, "Protocol", "p", &dbv) != 0 || (dbv.type != DBVT_ASCIIZ)) return 0; - cc->szProto = m_cache->GetCachedSetting(NULL, protobuf, 0, (int)strlen(protobuf)); + cc->szProto = m_cache->GetCachedSetting(NULL, protobuf, 0, (int)mir_strlen(protobuf)); } return !strcmp(cc->szProto, proto); diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 62fdebfb78..fdff3ce5ec 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -149,7 +149,7 @@ int CDb3Mmap::InitCrypt() DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" }; dbcws.value.type = DBVT_BLOB; dbcws.value.pbVal = (PBYTE)pProvider->pszName; - dbcws.value.cpbVal = (int)strlen(pProvider->pszName) + 1; + dbcws.value.cpbVal = (int)mir_strlen(pProvider->pszName) + 1; WriteContactSetting(NULL, &dbcws); } else { diff --git a/plugins/Db3x_mmap/src/dbmodulechain.cpp b/plugins/Db3x_mmap/src/dbmodulechain.cpp index ff0b89f704..db5e15ebed 100644 --- a/plugins/Db3x_mmap/src/dbmodulechain.cpp +++ b/plugins/Db3x_mmap/src/dbmodulechain.cpp @@ -86,7 +86,7 @@ DWORD CDb3Mmap::GetModuleNameOfs(const char *szName) if (m_bReadOnly) return 0; - int nameLen = (int)strlen(szName); + int nameLen = (int)mir_strlen(szName); // need to create the module name DWORD ofsNew = CreateNewSpace(nameLen + offsetof(struct DBModuleName, name)); diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index 67bb0d72a2..bf8c494c60 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -62,8 +62,8 @@ int CDb3Mmap::GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCST return 1; // the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name - int settingNameLen = (int)strlen(szSetting); - int moduleNameLen = (int)strlen(szModule); + int settingNameLen = (int)mir_strlen(szSetting); + int moduleNameLen = (int)mir_strlen(szModule); if (settingNameLen > 0xFE) { #ifdef _DEBUG OutputDebugStringA("GetContactSettingWorker() got a > 255 setting name length. \n"); @@ -92,7 +92,7 @@ LBL_Seek: if (isStatic) { int cbLen = 0; if (pCachedValue->pszVal != NULL) - cbLen = (int)strlen(pCachedValue->pszVal); + cbLen = (int)mir_strlen(pCachedValue->pszVal); cbOrigLen--; dbv->pszVal = cbOrigPtr; @@ -103,7 +103,7 @@ LBL_Seek: dbv->cchVal = cbLen; } else { - dbv->pszVal = (char*)mir_alloc(strlen(pCachedValue->pszVal) + 1); + dbv->pszVal = (char*)mir_alloc(mir_strlen(pCachedValue->pszVal) + 1); strcpy(dbv->pszVal, pCachedValue->pszVal); } } @@ -237,7 +237,7 @@ LBL_Seek: if (cc && cc->IsMeta() && ValidLookupName(szModule, szSetting)) { if (contactID = db_mc_getDefault(contactID)) { if (szModule = GetContactProto(contactID)) { - moduleNameLen = (int)strlen(szModule); + moduleNameLen = (int)mir_strlen(szModule); goto LBL_Seek; } } @@ -364,7 +364,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::FreeVariant(DBVARIANT *dbv) STDMETHODIMP_(BOOL) CDb3Mmap::SetSettingResident(BOOL bIsResident, const char *pszSettingName) { - char *szSetting = m_cache->GetCachedSetting(NULL, pszSettingName, 0, (int)strlen(pszSettingName)); + char *szSetting = m_cache->GetCachedSetting(NULL, pszSettingName, 0, (int)mir_strlen(pszSettingName)); szSetting[-1] = (char)bIsResident; mir_cslock lck(m_csDbAccess); @@ -385,8 +385,8 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW return 1; // the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name - int settingNameLen = (int)strlen(dbcws->szSetting); - int moduleNameLen = (int)strlen(dbcws->szModule); + int settingNameLen = (int)mir_strlen(dbcws->szSetting); + int moduleNameLen = (int)mir_strlen(dbcws->szModule); if (settingNameLen > 0xFE) { #ifdef _DEBUG OutputDebugStringA("WriteContactSetting() got a > 255 setting name length. \n"); @@ -408,7 +408,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW if (val == NULL) return 1; - dbcwNotif.value.pszVal = (char*)alloca(strlen(val) + 1); + dbcwNotif.value.pszVal = (char*)alloca(mir_strlen(val) + 1); strcpy(dbcwNotif.value.pszVal, val); mir_free(val); dbcwNotif.value.type = DBVT_UTF8; @@ -432,7 +432,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW LBL_WriteString: if (dbcwWork.value.pszVal == NULL) return 1; - dbcwWork.value.cchVal = (WORD)strlen(dbcwWork.value.pszVal); + dbcwWork.value.cchVal = (WORD)mir_strlen(dbcwWork.value.pszVal); if (bIsEncrypted) { size_t len; BYTE *pResult = m_crypto->encodeString(dbcwWork.value.pszVal, &len); @@ -706,8 +706,8 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteContactSetting(MCONTACT contactID, LPCSTR sz return 1; // the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name - int settingNameLen = (int)strlen(szSetting); - int moduleNameLen = (int)strlen(szModule); + int settingNameLen = (int)mir_strlen(szSetting); + int moduleNameLen = (int)mir_strlen(szModule); if (settingNameLen > 0xFE) { #ifdef _DEBUG OutputDebugStringA("DeleteContactSetting() got a > 255 setting name length. \n"); diff --git a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp index ce0162f7d5..16cbb2d7dc 100644 --- a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp @@ -38,7 +38,7 @@ static DBEvent* dbePrevEvent = NULL; void CDb3Mmap::ConvertOldEvent(DBEvent*& dbei) { - int msglen = (int)strlen((char*)dbei->blob) + 1, msglenW = 0; + int msglen = (int)mir_strlen((char*)dbei->blob) + 1, msglenW = 0; if (msglen != (int)dbei->cbBlob) { int count = ((dbei->cbBlob - msglen) / sizeof(WCHAR)); WCHAR* p = (WCHAR*)&dbei->blob[msglen]; @@ -59,7 +59,7 @@ void CDb3Mmap::ConvertOldEvent(DBEvent*& dbei) if (utf8str == NULL) return; - dbei->cbBlob = (DWORD)strlen(utf8str) + 1; + dbei->cbBlob = (DWORD)mir_strlen(utf8str) + 1; dbei->flags |= DBEF_UTF; if (offsetof(DBEvent, blob) + dbei->cbBlob > memsize) { memsize = offsetof(DBEvent, blob) + dbei->cbBlob; diff --git a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp index f17a97b740..5eff743b33 100644 --- a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp +++ b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp @@ -52,12 +52,12 @@ BOOL convertSetting(MCONTACT hContact, char* module, char* setting, int toType) case DBVT_ASCIIZ: if (toType == 4) // convert to UNICODE { - int len = (int)strlen(dbv.pszVal) + 1; + int len = (int)mir_strlen(dbv.pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len); Result = !db_set_ws(hContact, module, setting, wc); } - else if (strlen(dbv.pszVal) < 11 && toType != 3) { + else if (mir_strlen(dbv.pszVal) < 11 && toType != 3) { int val = atoi(dbv.pszVal); if (val == 0 && dbv.pszVal[0] != '0') break; @@ -68,7 +68,7 @@ BOOL convertSetting(MCONTACT hContact, char* module, char* setting, int toType) case DBVT_UTF8: if (toType == 3) { // convert to ANSI - int len = (int)strlen(dbv.pszVal) + 1; + int len = (int)mir_strlen(dbv.pszVal) + 1; char *sz = (char*)_alloca(len * 3); WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); @@ -199,7 +199,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l else { char *tmp = (((struct DBsetting*)lParam)->dbv.pszVal); - int length = (int)strlen(tmp) + 1; + int length = (int)mir_strlen(tmp) + 1; WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, tmp, -1, wc, length); SetDlgItemTextW(hwnd, IDC_STRING, wc); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 3537a3a04e..7f594a4eb5 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -295,16 +295,16 @@ void importSettings(MCONTACT hContact, char *importstring) continue; } - if (!strncmp(&importstring[i], "SETTINGS:", strlen("SETTINGS:"))) { + if (!strncmp(&importstring[i], "SETTINGS:", mir_strlen("SETTINGS:"))) { importstring = strtok(NULL, "\n"); continue; } - if (!strncmp(&importstring[i], "CONTACT:", strlen("CONTACT:"))) { + if (!strncmp(&importstring[i], "CONTACT:", mir_strlen("CONTACT:"))) { hContact = INVALID_CONTACT_ID; - i = i + (int)strlen("CONTACT:"); - int len = (int)strlen(&importstring[i]); + i = i + (int)mir_strlen("CONTACT:"); + int len = (int)mir_strlen(&importstring[i]); if (len > 10) { char uid[256] = "", szUID[256] = "", szProto[512] = ""; @@ -424,7 +424,7 @@ void importSettings(MCONTACT hContact, char *importstring) break; case 'n': case 'N': - WriteBlobFromString(hContact, module, setting, (end + 2), (int)strlen((end + 2))); + WriteBlobFromString(hContact, module, setting, (end + 2), (int)mir_strlen((end + 2))); break; } } @@ -565,7 +565,7 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) while (szFileNames[index]) { strcpy(szFile, szPath); strcat(szFile, &szFileNames[index]); - index += (int)strlen(&szFileNames[index]) + 1; + index += (int)mir_strlen(&szFileNames[index]) + 1; HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile != INVALID_HANDLE_VALUE) { diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index d49c185cc8..0762aeec5b 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -234,8 +234,8 @@ char* multiReplace(const char* value, const char *find, const char *replace, int { char *head, *temp, *string; - int len = (int)strlen(find); - int replen = (int)strlen(replace); + int len = (int)mir_strlen(find); + int replen = (int)mir_strlen(replace); // only should be 1 '=' sign there... if (head = (char*)(cs ? strstr(value, find) : StrStrI(value, find))) { @@ -244,7 +244,7 @@ char* multiReplace(const char* value, const char *find, const char *replace, int temp[0] = '\0'; while (head) { - temp = (char*)mir_realloc(temp, strlen(temp) + strlen(string) + replen + 1); + temp = (char*)mir_realloc(temp, mir_strlen(temp) + mir_strlen(string) + replen + 1); if (!temp) mir_tstrdup(value); strncat(temp, string, (head - string)); diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 4e428e0940..6501ff5165 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -75,7 +75,7 @@ extern MCONTACT hRestore; #define WM_FINDITEM (WM_USER + 1) // onyl for the main window, wparam is ItemIfno* lparam is 0 -#define mir_strlen(ptr) ((ptr == NULL) ? 0 : (int)strlen(ptr)) +#define mir_strlen(ptr) ((ptr == NULL) ? 0 : (int)mir_strlen(ptr)) #define mir_strncpy(dst, src, len) strncpy(dst, src, len)[len - 1] = 0; #define mir_strcmp(ptr1, ptr2) ((ptr1 && ptr2) ? strcmp(ptr1, ptr2) : 1) // (ptr1||ptr2) diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 0d0902f896..78c640a78e 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -325,7 +325,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha _itoa(dbv.wVal, Value, 10); break; case DBVT_UTF8: - int len = (int)strlen(dbv.pszVal) + 1; + int len = (int)mir_strlen(dbv.pszVal) + 1; char *sz = (char *)_alloca(len * 3); WCHAR *wc = (WCHAR *)_alloca(len * sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); @@ -355,14 +355,14 @@ int GetValueW(MCONTACT hContact, const char *szModule, const char *szSetting, WC if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) { switch (dbv.type) { case DBVT_UTF8: - len = (int)strlen(dbv.pszVal) + 1; + len = (int)mir_strlen(dbv.pszVal) + 1; wc = (WCHAR *)_alloca(length * sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); wcsncpy((WCHAR *)Value, wc, length); break; case DBVT_ASCIIZ: - len = (int)strlen(dbv.pszVal) + 1; + len = (int)mir_strlen(dbv.pszVal) + 1; wc = (WCHAR *)_alloca(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len); wcsncpy((WCHAR *)Value, wc, length); @@ -478,7 +478,7 @@ WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode) if (unicode) len = (int)wcslen(res); else - len = (int)strlen((char *)res); + len = (int)mir_strlen((char *)res); } else res[0] = 0; diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index ff49c2eb1e..f9f96e426a 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -185,7 +185,7 @@ void additem(HWND hwnd2Settings, MCONTACT hContact, char* module, char* setting, lvi.iImage = 5; ListView_SetItem(hwnd2Settings, &lvi); - int length = (int)strlen(dbv.pszVal) + 1; + int length = (int)mir_strlen(dbv.pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, length); ListView_SetItemTextW(hwnd2Settings, index, 1, wc); diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index d5a6ce476a..edcf5f4a30 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -125,7 +125,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam) break; case DBVT_UTF8: - int length = (int)strlen(dbv->pszVal) + 1; + int length = (int)mir_strlen(dbv->pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv->pszVal, -1, wc, length); ListView_SetItemTextW(hwnd2list, index, 4, wc); diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 9ef7f27a64..3575867b21 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -103,7 +103,7 @@ void CDropbox::RequestAccountInfo() ptrW isocodeW(json_as_string(node)); ptrA isocode(mir_u2a(isocodeW)); - if (!strlen(isocode)) + if (!mir_strlen(isocode)) db_unset(hContact, MODULE, "Country"); else { diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 66e5c14b98..cdce53b1fd 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -214,7 +214,7 @@ INT_PTR CDropbox::ProtoReceiveMessage(WPARAM, LPARAM lParam) dbei.szModule = MODULE; dbei.timestamp = time(NULL); dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (int)strlen(message); + dbei.cbBlob = (int)mir_strlen(message); dbei.pBlob = (PBYTE)message; db_event_add(pccsd->hContact, &dbei); diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h index 0cb769f609..2d2b8d130d 100644 --- a/plugins/Dropbox/src/http_request.h +++ b/plugins/Dropbox/src/http_request.h @@ -74,7 +74,7 @@ protected: szLogin, szPassword); - char *ePair = (char *)mir_base64_encode((BYTE*)cPair, (UINT)strlen(cPair)); + char *ePair = (char *)mir_base64_encode((BYTE*)cPair, (UINT)mir_strlen(cPair)); char value[128]; mir_snprintf( diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 0eebaae966..6d9f455f35 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -130,7 +130,7 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) } if (NULL != szEntryID) { - m_nSizeEntryID = (UINT)strlen( szEntryID ) +1; + m_nSizeEntryID = (UINT)mir_strlen( szEntryID ) +1; m_szEntryID = new char[m_nSizeEntryID]; memset(m_szEntryID, 0, m_nSizeEntryID * sizeof(char)); strcpy(m_szEntryID, szEntryID ); diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 30a2d1fdc0..23be8a9359 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -163,7 +163,7 @@ int CExchangeServer::IsServerAvailable() // if connected then close smtp connection by sending a quit message bAvailable = 1; char message[] = "quit\n"; - send(sServer, message, (int)strlen(message), 0); + send(sServer, message, (int)mir_strlen(message), 0); } res = closesocket(sServer); //close the socket return bAvailable; diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index d973492787..c580d67925 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -56,7 +56,7 @@ int Log(char*, ...) } va_end(vararg); - if (str[strlen(str) - 1] != '\n') + if (str[mir_strlen(str) - 1] != '\n') { strcat(str, "\n"); } diff --git a/plugins/ExternalAPI/delphi/m_folders.inc b/plugins/ExternalAPI/delphi/m_folders.inc index d1f555d3ae..a0bb09ba19 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 strlen() or wcslen() to get the length of the string. + it will either call mir_strlen() or wcslen() 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 f6f00445e6..ae4930313b 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 strlen() or wcslen() to get the length of the string. + it will either call mir_strlen() or wcslen() 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/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index 0171f8ae8d..d1ec1aba1f 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -88,7 +88,7 @@ void UploadJob::autoSend() dbei.flags = DBEF_SENT; dbei.szModule = szProto; dbei.timestamp = (DWORD)time(NULL); - dbei.cbBlob = (DWORD)strlen(this->szFileLink) + 1; + dbei.cbBlob = (DWORD)mir_strlen(this->szFileLink) + 1; dbei.pBlob = (PBYTE)this->szFileLink; db_event_add(this->hContact, &dbei); CallContactService(this->hContact, PSS_MESSAGE, 0, (LPARAM)this->szFileLink); diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index ed31daf5ff..ca8f7d3b04 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -95,7 +95,7 @@ const char to_chars[] = "abvgdeezziiklmnoprstufhccwwqyqeuaABVGDEEZZIIKLMNOPRSTUF char* Utils::makeSafeString(TCHAR *input, char *output) { char *buff = mir_t2a(input); - size_t length = strlen(buff); + size_t length = mir_strlen(buff); for (UINT i = 0; i < length; i++) { @@ -227,7 +227,7 @@ bool Utils::setFileNameDlgA(char *nameBuff) void Utils::createFileDownloadLink(char *szUrl, char *fileName, char *buff, int buffSize) { - if (szUrl[strlen(szUrl) - 1] == '/') + if (szUrl[mir_strlen(szUrl) - 1] == '/') mir_snprintf(buff, buffSize, "%s%s", szUrl, fileName); else mir_snprintf(buff, buffSize, "%s/%s", szUrl, fileName); diff --git a/plugins/FavContacts/src/csocket.cpp b/plugins/FavContacts/src/csocket.cpp index 0737d8e734..a101e65352 100644 --- a/plugins/FavContacts/src/csocket.cpp +++ b/plugins/FavContacts/src/csocket.cpp @@ -10,7 +10,7 @@ int CSocket::Recv(char *buf, int count) int CSocket::Send(char *buf, int count) { if (count < 0) - count = (int)strlen(buf); + count = (int)mir_strlen(buf); return send(m_socket, buf, count, 0); } diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index c181841a13..98d21fa935 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -1042,7 +1042,7 @@ bool MyBitmap::loadFromFile(const char *fn, const char *fnAlpha) return loadFromFile_gradient(fn, fnAlpha); char ext[5]; - memcpy(ext, fn + (strlen(fn) - 4), 5); + memcpy(ext, fn + (mir_strlen(fn) - 4), 5); if (!mir_strcmpi(ext, ".png")) return loadFromFile_png(fn, fnAlpha); diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index 7a18009333..ff1cb937e9 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -225,7 +225,7 @@ static int CountFiles( char *szItem ) if ( NULL != strstr( szItem, "*.*" )) { - size_t offset = strlen( szDirName ) - 3; + size_t offset = mir_strlen( szDirName ) - 3; mir_snprintf(szDirName + offset, SIZEOF( szDirName) - offset, "%s\0", fd.cFileName); } @@ -267,7 +267,7 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) if ( NULL != strstr( szItem, "*.*" )) { - size_t offset = strlen( szDirName ) - 3; + size_t offset = mir_strlen( szDirName ) - 3; mir_snprintf(szDirName + offset, SIZEOF( szDirName) - offset, "%s\0", fd.cFileName); } @@ -281,14 +281,14 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) } else { - size_t nSize = sizeof(char) * ( strlen( szItem ) + strlen( fd.cFileName ) + sizeof( char )); + size_t nSize = sizeof(char) * ( mir_strlen( szItem ) + mir_strlen( fd.cFileName ) + sizeof( char )); char *szFile = (char*) malloc( nSize ) ; strncpy( szFile, szItem, nSize - 1); if ( NULL != strstr( szFile, "*.*" )) { - szFile[ strlen( szFile ) - 3 ] = '\0'; + szFile[ mir_strlen( szFile ) - 3 ] = '\0'; strncat(szFile, fd.cFileName, nSize - mir_strlen(szFile)); } diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 522866fd10..6ec62a1599 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -38,7 +38,7 @@ wchar_t *StrCopy(wchar_t *source, size_t index, const wchar_t *what, size_t coun char *StrDelete(char *source, size_t index, size_t count) { - size_t len = strlen(source); + size_t len = mir_strlen(source); size_t i; count = (count + index > len) ? len - index : count; for (i = index; i + count <= len; i++) @@ -59,8 +59,8 @@ wchar_t *StrDelete(wchar_t *source, size_t index, size_t count) char *StrInsert(char *source, size_t index, const char *what) { - size_t whatLen = strlen(what); - size_t sourceLen = strlen(source); + size_t whatLen = mir_strlen(what); + size_t sourceLen = mir_strlen(source); size_t i; for (i = sourceLen; i >= index; i--) source[i + whatLen] = source[i]; @@ -87,8 +87,8 @@ wchar_t *StrInsert(wchar_t *source, size_t index, const wchar_t *what) char *StrReplace(char *source, const char *what, const char *withWhat) { - size_t whatLen = strlen(what); - size_t withWhatLen = strlen(withWhat); + size_t whatLen = mir_strlen(what); + size_t withWhatLen = mir_strlen(withWhat); char *pos; while ((pos = strstr(source, what))) { @@ -127,12 +127,12 @@ wchar_t *StrReplace(wchar_t *source, const wchar_t *what, const wchar_t *withWha char *StrTrim(char *szText, const char *szTrimChars) { - size_t i = strlen(szText) - 1; + size_t i = mir_strlen(szText) - 1; while (strchr(szTrimChars, szText[i])) szText[i--] = '\0'; i = 0; - while ((i < strlen(szText)) && (strchr(szTrimChars, szText[i]))) + while ((i < mir_strlen(szText)) && (strchr(szTrimChars, szText[i]))) i++; if (i) diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp index 91d475e87c..dc5e8f8739 100644 --- a/plugins/GmailNotifier/src/check.cpp +++ b/plugins/GmailNotifier/src/check.cpp @@ -69,7 +69,7 @@ void CheckMailInbox(Account *curAcc) *tail = '\0'; mir_strcat(requestBuffer, "&password="); mir_strcat(requestBuffer, curAcc->pass); - if (!HttpSendRequestA(hHTTPRequest, contentType, (int)strlen(contentType) + 1, requestBuffer, (int)strlen(requestBuffer) + 1)) { + if (!HttpSendRequestA(hHTTPRequest, contentType, (int)mir_strlen(contentType) + 1, requestBuffer, (int)mir_strlen(requestBuffer) + 1)) { mir_strcpy(curAcc->results.content, Translate("Can't send account data!")); goto error_handle; } @@ -92,8 +92,8 @@ void CheckMailInbox(Account *curAcc) else mir_strcpy(str, "/mail/feed/atom"); hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("GET"), _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0); - InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)strlen(curAcc->name) + 1); - InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)strlen(curAcc->pass) + 1); + InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)mir_strlen(curAcc->name) + 1); + InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)mir_strlen(curAcc->pass) + 1); if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) { mir_strcat(curAcc->results.content, Translate("Can't get RSS feed!")); goto error_handle; diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index 5751dd60e2..3f344a35cf 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -207,11 +207,11 @@ bool CLFileShareNode::bSetPaths(char * pszSrvPath, char * pszRealPath) { delete [] st.pszSrvPath; delete [] st.pszRealPath; - st.dwMaxSrvPath = (int)strlen(pszSrvPath) + 1; + st.dwMaxSrvPath = (int)mir_strlen(pszSrvPath) + 1; st.pszSrvPath = new char[ st.dwMaxSrvPath ]; strcpy(st.pszSrvPath, pszSrvPath); - int nRealLen = (int)strlen(pszRealPath); + int nRealLen = (int)mir_strlen(pszRealPath); if (nRealLen <= 2 || !(pszRealPath[1] == ':' || (pszRealPath[0] == '\\' && pszRealPath[1] == '\\'))) { // Relative path diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 593b5aa0fd..f4ccb99546 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -63,7 +63,7 @@ string sPageKeyword = szDefaultPageKeyword; void ReplaceAll(string &sSrc, const char * pszReplace, const string &sNew) { string::size_type nCur = 0; - int nRepalceLen = (int)strlen(pszReplace); + int nRepalceLen = (int)mir_strlen(pszReplace); while ((nCur = sSrc.find(pszReplace, nCur)) != sSrc.npos) { sSrc.replace(nCur, nRepalceLen, sNew); nCur += sNew.size(); @@ -164,7 +164,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) { if (pszIp == NULL) pszIp = nlreply->pData; else - pszIp += strlen(szPattern); + pszIp += mir_strlen(szPattern); while ((*pszIp < '0' || *pszIp > '9') && *pszIp) pszIp++; @@ -291,7 +291,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( // a file was selected // only reenable windows / set default values when a folder was selected before - if (pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] == '/') { + if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] == '/') { pNotify->lpOFN->Flags |= OFN_FILEMUSTEXIST; EnableWindow(hFileName, TRUE); EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), TRUE); @@ -319,9 +319,9 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( if (pszTmp != NULL) *pszTmp = '\0'; - memmove(&szSelection[1], pszFolder, strlen(pszFolder) + 1); + memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1); szSelection[0] = '/'; - if (szSelection[strlen(szSelection)-1] != '/') + if (szSelection[mir_strlen(szSelection)-1] != '/') strcat(szSelection, "/"); // only write to IDC_SHARE_NAME when a file / other folder was selected before @@ -352,11 +352,11 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( char* pszTmp = strstr(pstShare->pszRealPath, pszShareDirStr); if (pszTmp) { *pszTmp = '\0'; - if (pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] != '/') + if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] != '/') strcat(pstShare->pszSrvPath, "/"); } else { - if (pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] == '/') - pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] = '\0'; + if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] == '/') + pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] = '\0'; } BOOL bTranslated = false; @@ -369,7 +369,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( //if( ! (pstShare->dwAllowedIP & pstShare->dwAllowedMask) - if (!bTranslated || (strlen(pstShare->pszSrvPath) <= 0)) { + if (!bTranslated || (mir_strlen(pstShare->pszSrvPath) <= 0)) { SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 1); return true; } @@ -442,7 +442,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { ofn.nMaxFile = pstNewShare->dwMaxRealPath; char szInitialDir[MAX_PATH]; - if (ofn.lpstrFile[strlen(ofn.lpstrFile)-1] == '\\') { + if (ofn.lpstrFile[mir_strlen(ofn.lpstrFile)-1] == '\\') { ofn.lpstrInitialDir = szInitialDir; strcpy(szInitialDir, ofn.lpstrFile); *ofn.lpstrFile = '\0'; @@ -476,7 +476,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { // terminate it with \0 append to realpath and add the share char* pszFileNamePos = pstNewShare->pszSrvPath; char* szRealDirectoryEnd = - &pstNewShare->pszRealPath[strlen(pstNewShare->pszRealPath)]; + &pstNewShare->pszRealPath[mir_strlen(pstNewShare->pszRealPath)]; *szRealDirectoryEnd = '\\'; szRealDirectoryEnd++; diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index 6acffb37ff..03e6b50c53 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -183,7 +183,7 @@ bool CLHttpUser::bReadGetParameters(char * pszRequest) { pszRequest[0] = 0; pszRequest++; for (int nCur = 0; nCur < eLastParam ; nCur++) { - int nLen = (int)strlen(szParmStr[nCur]); + int nLen = (int)mir_strlen(szParmStr[nCur]); if (strncmp(pszRequest, szParmStr[nCur], nLen) == 0) { if (apszParam[nCur]) { bRet = false; @@ -429,7 +429,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - if (pszSrvPath[strlen(pszSrvPath)-1] != '/') { + if (pszSrvPath[mir_strlen(pszSrvPath)-1] != '/') { strmcat(pszRealPath, "\\", MAX_PATH); strmcat(pszSrvPath, "/", MAX_PATH); } @@ -457,7 +457,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { while (pszTmp = strchr(pszTmp, '/')) * pszTmp = '~'; } - pszRealPath[strlen(pszRealPath) - 10] = '\0'; + pszRealPath[mir_strlen(pszRealPath) - 10] = '\0'; // detecting browser function removed // every browser should support it by now diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index fed678827d..222e24b332 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -233,7 +233,7 @@ bool LoadIndexHTMLTemplate() { //LogEvent("Template", szDestBuf); - szIndexHTMLTemplate = new char[strlen(szDestBuf)+1]; + szIndexHTMLTemplate = new char[mir_strlen(szDestBuf)+1]; strcpy(szIndexHTMLTemplate, szDestBuf); } diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 0e98cd8cca..99526c5d79 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -36,7 +36,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, do { strcpy(szBuffer + (pszSign - pszSrc), pszNew); - strcpy(szBuffer + (pszSign - pszSrc) + strlen(pszNew), pszSign + 1); + strcpy(szBuffer + (pszSign - pszSrc) + mir_strlen(pszNew), pszSign + 1); *pszSign = ' '; } while (pszSign = strchr(pszSrc, pszReplace)); @@ -116,7 +116,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, strncpy(szBuffer, "index.xsl", BUFFER_SIZE); } - WriteFile(hFile, szBuffer, (DWORD)strlen(szBuffer), &dwBytesWritten, NULL); + WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL); WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, NULL); @@ -180,16 +180,16 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, // Add other shared files & directories for (CLFileShareNode * pclCur = pclFirstNode; pclCur ; pclCur = pclCur->pclNext) { if (!((pclCur->st.dwAllowedIP ^ dwRemoteIP) & pclCur->st.dwAllowedMask) && // hide inaccessible shares - (size_t)(pclCur->nGetSrvPathLen()) > strlen(pszSrvPath) && + (size_t)(pclCur->nGetSrvPathLen()) > mir_strlen(pszSrvPath) && !strstr(pclCur->st.pszRealPath, "\\@") && - !strncmp(pclCur->st.pszSrvPath, pszSrvPath, strlen(pszSrvPath))) { + !strncmp(pclCur->st.pszSrvPath, pszSrvPath, mir_strlen(pszSrvPath))) { pszBuffer = szBuffer; - strcpy(szFileName, &pclCur->st.pszSrvPath[strlen(pszSrvPath)]); + strcpy(szFileName, &pclCur->st.pszSrvPath[mir_strlen(pszSrvPath)]); ReplaceSign(szFileName, MAX_PATH, '&', "&"); if (pclCur->bIsDirectory()) { - szFileName[strlen(szFileName)-1] = '\0'; + szFileName[mir_strlen(szFileName)-1] = '\0'; if (!strchr(szFileName, '/')) { // only one level deeper pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n", szFileName); @@ -199,7 +199,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, } } else { if (!strchr(szFileName, '/') && // only one level deeper - strncmp(pszRealPath, pclCur->st.pszRealPath, strlen(pszRealPath))) { // no duplicates + strncmp(pszRealPath, pclCur->st.pszRealPath, mir_strlen(pszRealPath))) { // no duplicates pszExt = strrchr(szFileName, '.'); if (pszExt != NULL) { diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp index 9656753056..45fead8013 100644 --- a/plugins/HTTPServer/src/MimeHandling.cpp +++ b/plugins/HTTPServer/src/MimeHandling.cpp @@ -31,7 +31,7 @@ int bInitMimeHandling() { *tok = '\0'; } /* remove trailing \n */ - int lenght = (int)strlen(line); + int lenght = (int)mir_strlen(line); if (lenght > 0 && line[lenght - 1] == '\n') line[lenght - 1] = '\0'; @@ -39,7 +39,7 @@ int bInitMimeHandling() { tok = (char*)strtok(line, " \t"); /*create and fill a cell*/ pDBCell = (ContentType*)malloc(sizeof(ContentType)); - pDBCell->mimeType = (char*)malloc(strlen(tok) + 1); + pDBCell->mimeType = (char*)malloc(mir_strlen(tok) + 1); strcpy(pDBCell->mimeType, tok); pDBCell->extList = NULL; pDBCell->next = NULL; @@ -48,7 +48,7 @@ int bInitMimeHandling() { while (tok != NULL) { /*create and fill a cell*/ pExtCell = (ExtensionListCell*)malloc(sizeof(ExtensionListCell)); - pExtCell->ext = (char*)malloc(strlen(tok) + 1); + pExtCell->ext = (char*)malloc(mir_strlen(tok) + 1); strcpy(pExtCell->ext, tok); pExtCell->next = NULL; /*link*/ diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 0dab60b744..029bc234ba 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -129,7 +129,7 @@ bool bOpenLogFile() { bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) { if (nLen < 0) - nLen = (int)strlen(pszSrc); + nLen = (int)mir_strlen(pszSrc); DWORD dwBytesWritten; return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen); } @@ -166,7 +166,7 @@ void LogEvent(const TCHAR * pszTitle, const char * pszLog) { time(&now); int nLen = (int)strftime(szTmp, sizeof(szTmp), "%d-%m-%Y %H:%M:%S -- ", localtime(&now)); - int nLogLen = (int)strlen(pszLog); + int nLogLen = (int)mir_strlen(pszLog); while (nLogLen > 0 && (pszLog[nLogLen-1] == '\r' || pszLog[nLogLen-1] == '\n')) nLogLen--; @@ -406,7 +406,7 @@ static INT_PTR nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { return 1002; CLFileShareListAccess clCritSection; - bool bIsDirectory = (pclNew->pszSrvPath[strlen(pclNew->pszSrvPath)-1] == '/'); + bool bIsDirectory = (pclNew->pszSrvPath[mir_strlen(pclNew->pszSrvPath)-1] == '/'); CLFileShareNode **pclPrev = &pclFirstNode; CLFileShareNode * pclCur = pclFirstNode; @@ -487,7 +487,7 @@ static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) { CLFileShareNode * pclCur = pclFirstNode; while (pclCur) { if (strcmp(pclCur->st.pszSrvPath, pclShare->pszSrvPath) == 0) { - if (pclShare->dwMaxRealPath <= strlen(pclCur->st.pszRealPath) + 1) + if (pclShare->dwMaxRealPath <= mir_strlen(pclCur->st.pszRealPath) + 1) return 1003; strcpy(pclShare->pszRealPath, pclCur->st.pszRealPath); pclShare->dwAllowedIP = pclCur->st.dwAllowedIP; @@ -908,7 +908,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { return 1; } - nPluginPathLen = (int)strlen(szPluginPath); + nPluginPathLen = (int)mir_strlen(szPluginPath); sLogFilePath = szPluginPath; sLogFilePath += "HTTPServer.log"; diff --git a/plugins/HistoryStats/src/_strfunc.h b/plugins/HistoryStats/src/_strfunc.h index b65c6a7384..0726c50698 100644 --- a/plugins/HistoryStats/src/_strfunc.h +++ b/plugins/HistoryStats/src/_strfunc.h @@ -18,7 +18,7 @@ namespace ext static int coll(const char* string1, const char* string2) { return strcoll(string1, string2); } static int icoll(const char* string1, const char* string2) { return _stricoll(string1, string2); } static const char* str(const char* string, const char* strSearch) { return strstr(string, strSearch); } - static size_t len(const char* string) { return strlen(string); } + static size_t len(const char* string) { return mir_strlen(string); } static size_t ftime(char* strDest, size_t maxsize, const char* format, const struct tm* timeptr) { return strftime(strDest, maxsize, format, timeptr); } static int sprintf(char* buffer, const char* format, ...) { va_list args; va_start(args, format); return vsprintf(buffer, format, args); } }; diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 9eabc49d2b..0f4f1ab8cd 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -138,7 +138,7 @@ void FillIEViewInfo(IEVIEWEVENTDATA *fillData, DBEVENTINFO dbInfo, PBYTE blob) fillData->bIsMe = (dbInfo.flags & DBEF_SENT); fillData->dwFlags = (dbInfo.flags & DBEF_SENT) ? IEEDF_SENT : 0; fillData->time = dbInfo.timestamp; - size_t len = strlen((char *)blob) + 1; + size_t len = mir_strlen((char *)blob) + 1; PBYTE pos; fillData->pszText = (char *)blob; diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index ac628ec957..1e77aac420 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -47,7 +47,7 @@ int Log(char *format, ...) } va_end(vararg); - if (str[strlen(str) - 1] != '\n') + if (str[mir_strlen(str) - 1] != '\n') { strcat(str, "\n"); } @@ -248,7 +248,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat { #ifdef _UNICODE wchar_t TEMP[2048]; - size_t size = strlen((char *)dbEvent.pBlob) + 1; + size_t size = mir_strlen((char *)dbEvent.pBlob) + 1; if (size < dbEvent.cbBlob) { search = (wchar_t *)&dbEvent.pBlob[size]; diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp index fbf87fc871..d405277f28 100644 --- a/plugins/IEView/src/Template.cpp +++ b/plugins/IEView/src/Template.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TokenDef::TokenDef(const char *tokenString) { this->tokenString = tokenString; - this->tokenLen = (int)strlen(tokenString); + this->tokenLen = (int)mir_strlen(tokenString); this->token = 0; this->escape = 0; } @@ -33,7 +33,7 @@ TokenDef::TokenDef(const char *tokenString, int token, int escape) { this->tokenString = tokenString; this->token = token; - this->tokenLen = (int)strlen(tokenString); + this->tokenLen = (int)mir_strlen(tokenString); this->escape = escape; } @@ -170,7 +170,7 @@ void Template::tokenize() Token *lastToken = NULL; int lastTokenType = Token::PLAIN; int lastTokenEscape = 0; - int l = (int)strlen(str); + int l = (int)mir_strlen(str); for (int i = 0, lastTokenStart = 0; i <= l;) { Token *newToken; int newTokenType = 0, newTokenSize = 0, newTokenEscape = 0; @@ -339,7 +339,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, { char lastTemplate[1024], tmp2[1024]; unsigned int i = 0; - if (filename == NULL || strlen(filename) == 0) + if (filename == NULL || mir_strlen(filename) == 0) return NULL; FILE *fh = fopen(filename, "rt"); diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 09d042683c..d2267fdbba 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -177,7 +177,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr strcpy(tempBase, "file://"); strncat(tempBase, tmpm->getFilename(), SIZEOF(tempBase) - mir_strlen(tempBase)); - char *pathrun = tempBase + strlen(tempBase); + char *pathrun = tempBase + mir_strlen(tempBase); while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > tempBase)) pathrun--; pathrun++; @@ -215,7 +215,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr szAvatarOut = mir_strdup(szNoAvatar); if (!db_get(event->hContact, "CList", "StatusMsg", &dbv)) { - if (strlen(dbv.pszVal) > 0) + if (mir_strlen(dbv.pszVal) > 0) szStatusMsg = mir_utf8encode(dbv.pszVal); db_free(&dbv); } @@ -348,7 +348,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, if (tmpm != NULL) { strcpy(tempBase, "file://"); strcat(tempBase, tmpm->getFilename()); - char* pathrun = tempBase + strlen(tempBase); + char* pathrun = tempBase + mir_strlen(tempBase); while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > tempBase)) pathrun--; pathrun++; *pathrun = '\0'; @@ -393,7 +393,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, if (event->hContact != NULL) { if (!db_get(event->hContact, "CList", "StatusMsg", &dbv)) { - if (strlen(dbv.pszVal) > 0) + if (mir_strlen(dbv.pszVal) > 0) szStatusMsg = mir_utf8encode(dbv.pszVal); db_free(&dbv); } diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index 14c8b2500b..e44dc5e35b 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -309,7 +309,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons int last_pos = 0; if (spRes != NULL) { for (int i = 0; i < (int)sp.numSmileys; i++) { - if (spRes[i].filepath != NULL && strlen((char *)spRes[i].filepath) > 0) { + if (spRes[i].filepath != NULL && mir_strlen((char *)spRes[i].filepath) > 0) { if ((int)spRes[i].startChar - last_pos > 0) { TextToken *newToken = new TextToken(TEXT, text + last_pos, spRes[i].startChar - last_pos); if (lastToken == NULL) diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index 76a3488d90..77def5af4b 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -92,7 +92,7 @@ char *Utils::escapeString(const char *a) if (a == NULL) return NULL; - int i, l, len = (int)strlen(a); + int i, l, len = (int)mir_strlen(a); for (i = l = 0; i < len; i++, l++) { if (a[i] == '\\' || a[i] == '\n' || a[i] == '\r' || a[i] == '\"' || a[i] == '\'' || a[i] == '\b' || a[i] == '\t' || a[i] == '\f') { diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index c9ca158b54..b761b3ae90 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -373,7 +373,7 @@ static INT_PTR CALLBACK AccountsMatcherProc(HWND hwndDlg, UINT uMsg, WPARAM wPar static char* newStr(const char *s) { - return (s == NULL) ? NULL : strcpy(new char[strlen(s) + 1], s); + return (s == NULL) ? NULL : strcpy(new char[mir_strlen(s) + 1], s); } static bool FindDestAccount(const char *szProto) diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 1db3b1f8e8..8a9b7c36b8 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -662,7 +662,7 @@ void createProtocolList(void) for (int i=0; i < ProtoList.protoCount; i++) { ProtoList.protoInfo[i].xstatus.count = 0; ProtoList.protoInfo[i].xstatus.enabled = NULL; - ProtoList.protoInfo[i].szProto = (char *)malloc(strlen(proto[i]->szModuleName) + 1); + ProtoList.protoInfo[i].szProto = (char *)malloc(mir_strlen(proto[i]->szModuleName) + 1); if (!ProtoList.protoInfo[i].szProto) { ProtoList.protoInfo[i].enabled = FALSE; ProtoList.protoInfo[i].visible = FALSE; diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index ffd8258266..90470b4a8b 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -118,9 +118,9 @@ STATUS LNPUBLIC __stdcall EMCallBack (EMRECORD * pData) retPassword = VARARG_GET (pArgs, char *); fileName = VARARG_GET (pArgs, char *); ownerName = VARARG_GET (pArgs, char *); - strncpy(retPassword, settingPassword, strlen(settingPassword)); //set our password - retPassword[strlen(settingPassword)]='\0'; - *retLength = (DWORD)strlen(retPassword);//and his length + strncpy(retPassword, settingPassword, mir_strlen(settingPassword)); //set our password + retPassword[mir_strlen(settingPassword)]='\0'; + *retLength = (DWORD)mir_strlen(retPassword);//and his length return ERR_BSAFE_EXTERNAL_PASSWORD; } @@ -234,7 +234,7 @@ void init_pluginname() HANDLE hFind = FindFirstFileA(text, &ffd); if(hFind != INVALID_HANDLE_VALUE) { - strncpy_s(text, SIZEOF(text), ffd.cFileName, strlen(ffd.cFileName)); + strncpy_s(text, SIZEOF(text), ffd.cFileName, mir_strlen(ffd.cFileName)); FindClose(hFind); } // Check if we have relative or full path @@ -246,13 +246,13 @@ void init_pluginname() if(q = strrchr(p, '.')) { *q = '\0'; } - if((q = strstr(p, "debug")) && strlen(q) == 5) { + if((q = strstr(p, "debug")) && mir_strlen(q) == 5) { *q = '\0'; } // copy to static variable - strncpy_s(PLUGINNAME, SIZEOF(PLUGINNAME), p, strlen(p)); - assert(strlen(PLUGINNAME)>0); + strncpy_s(PLUGINNAME, SIZEOF(PLUGINNAME), p, mir_strlen(p)); + assert(mir_strlen(PLUGINNAME)>0); } @@ -271,7 +271,7 @@ BOOL strrep(char *src, char *needle, char *newstring) strncpy_s(begining, _countof(begining), src, pos); begining[pos]='\0'; - pos = pos+(int)strlen(needle); + pos = pos+(int)mir_strlen(needle); strncpy_s(tail, _countof(tail), src+pos, SIZEOF(tail)); begining[pos]='\0'; @@ -329,7 +329,7 @@ void Click(HWND hWnd,BOOL execute) if(settingNewest && (pid->id > settingNewestID) ){ db_set_dw(NULL, PLUGINNAME, "LNNewestID", settingNewestID=pid->id); } - if(execute && settingCommand && strlen(settingCommand)>0 ) { + if(execute && settingCommand && mir_strlen(settingCommand)>0 ) { char tmpcommand[2*MAX_SETTING_STR]; char tmpparameters[2*MAX_SETTING_STR]; strncpy_s(tmpcommand, SIZEOF(tmpcommand), settingCommand, SIZEOF(tmpcommand)); @@ -399,7 +399,7 @@ BOOL checkNotesIniFile(BOOL bInfo) char tmp[MAXENVVALUE+1], tmp1[MAXENVVALUE+1]; (OSGetEnvironmentString1) ("EXTMGR_ADDINS", tmp, MAXENVVALUE);//get current setting strncpy_s(tmp1,_countof(tmp1),tmp,sizeof(tmp1));//copy temporary - assert(strlen(tmp1)>0); + assert(mir_strlen(tmp1)>0); char* PLUGINNAME_lower = _strlwr(mir_strdup(PLUGINNAME)); @@ -427,11 +427,11 @@ BOOL checkNotesIniFile(BOOL bInfo) if(settingIniAnswer == 1) { - if(strlen(tmp) > 0) { + if(mir_strlen(tmp) > 0) { strcat_s(tmp, SIZEOF(tmp), ","); strcat_s(tmp, SIZEOF(tmp), PLUGINNAME_lower); //add our plugin to extensions } else { - strncpy_s(tmp, SIZEOF(tmp), PLUGINNAME_lower, strlen(PLUGINNAME_lower)); //set our plugin as extension + strncpy_s(tmp, SIZEOF(tmp), PLUGINNAME_lower, mir_strlen(PLUGINNAME_lower)); //set our plugin as extension } (OSSetEnvironmentVariable1) ("EXTMGR_ADDINS", tmp); //set notes.ini entry @@ -485,7 +485,7 @@ void showMsg(TCHAR* sender,TCHAR* text, DWORD id, char *strUID) ppd.iSeconds=settingInterval1; //Now the "additional" data. mpd->id = id; - strncpy_s(mpd->strNote, SIZEOF(mpd->strNote), strUID, strlen(strUID)); + strncpy_s(mpd->strNote, SIZEOF(mpd->strNote), strUID, mir_strlen(strUID)); //mpd->newStatus = ID_STATUS_ONLINE; //Now that the plugin data has been filled, we add it to the PopUpData. @@ -527,7 +527,7 @@ void ErMsgByLotusCode(STATUS erno) WORD text_len; text_len = (OSLoadString1)(NULLHANDLE, erno, error_text_LMBCS, sizeof(error_text_LMBCS)-1); - (OSTranslate1)(OS_TRANSLATE_LMBCS_TO_UNICODE, error_text_LMBCS, (WORD)strlen(error_text_LMBCS), error_text_UNICODEatCHAR, sizeof(error_text_UNICODEatCHAR)-1); + (OSTranslate1)(OS_TRANSLATE_LMBCS_TO_UNICODE, error_text_LMBCS, (WORD)mir_strlen(error_text_LMBCS), error_text_UNICODEatCHAR, sizeof(error_text_UNICODEatCHAR)-1); memcpy(error_text_UNICODE, error_text_UNICODEatCHAR, sizeof(error_text_UNICODE)); ErMsgW(error_text_UNICODE); @@ -643,7 +643,7 @@ void checkthread(void*) log_p(L"checkthread: Username: %S", UserName); /* Get the unread list */ - if(error = (NSFDbGetUnreadNoteTable1) (db_handle,UserName,(WORD) strlen(UserName),TRUE,&hTable)) { + if(error = (NSFDbGetUnreadNoteTable1) (db_handle,UserName,(WORD) mir_strlen(UserName),TRUE,&hTable)) { goto errorblock0; } log(L"checkthread: Unread Table got"); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 967276ae1c..0d30f8bf24 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -305,7 +305,7 @@ int StatusMsgExists(MCONTACT hContact) LPSTR msg = db_get_sa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par); if (msg) { - if (strlen(msg)) + if (mir_strlen(msg)) ret |= statusMsg[i].flag; mir_free(msg); } @@ -508,7 +508,7 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) GetID(hContact, szProto, (LPSTR)&szID, SIZEOF(szID)); if (szID[0]) { if (bShowID) { - if (bTrimID && (strlen(szID) > MAX_IDLEN)) { + if (bTrimID && (mir_strlen(szID) > MAX_IDLEN)) { szID[MAX_IDLEN - 2] = szID[MAX_IDLEN - 1] = szID[MAX_IDLEN] = '.'; szID[MAX_IDLEN + 1] = 0; } diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index efc6b04ef0..676de8c404 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -77,7 +77,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) char *msg = (char *)dbei->pBlob; char *newmsg = 0; DWORD alloclen = 0; - DWORD msglen = (DWORD)strlen(msg); + DWORD msglen = (DWORD)mir_strlen(msg); if (dbei->flags & DBEF_UTF) { int prefixlen = (int)strnlen(options.prefix, 64); if (strncmp(msg, options.prefix, prefixlen) == 0) return 0; @@ -119,7 +119,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) int msglenw = (int)wcslen(msgw); char *prefix = mir_utf8decodeA(options.prefix); - int prefixlen = (int)strlen(prefix); + int prefixlen = (int)mir_strlen(prefix); alloclen = (msglen+prefixlen+1)* sizeof(char) + (msglenw + prefixlenw +1) * sizeof(wchar_t); // get additional data @@ -144,7 +144,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) } else { char *prefix = mir_utf8decodeA(options.prefix); - int prefixlen = (int)strlen(prefix); + int prefixlen = (int)mir_strlen(prefix); if (strncmp(msg, prefix, prefixlen) == 0) { mir_free(prefix); return 0; @@ -186,8 +186,8 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) static char* prefixutf = mir_utf8encodeT(TranslateT(LANG_INLINE_PREFIX)); static char* prefix = Translate(LANG_INLINE_PREFIX); - static DWORD lenutf = (DWORD)strlen(prefixutf); - static DWORD len = (DWORD)strlen(prefix); + static DWORD lenutf = (DWORD)mir_strlen(prefixutf); + static DWORD len = (DWORD)mir_strlen(prefix); DBEVENTINFO info = { sizeof(info) }; info.cbBlob = lenutf*2; diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index c4ad4b9f63..f724c5a371 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -280,7 +280,7 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char *ans = mir_utf8encodeT(answer); delete[] answer; - otr_continue_smp(context, (const unsigned char *)ans, strlen(ans)); + otr_continue_smp(context, (const unsigned char *)ans, mir_strlen(ans)); mir_free(ans); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL); DestroyWindow(hwndDlg); @@ -439,7 +439,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA delete answer; SMPInitUpdateDialog(context, false); - otr_start_smp(context, quest, (const unsigned char*)ans, strlen(ans)); + otr_start_smp(context, quest, (const unsigned char*)ans, mir_strlen(ans)); mir_free(quest); mir_free(ans); } @@ -457,7 +457,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA delete[] answer; SMPInitUpdateDialog(context, false); - otr_start_smp(context, NULL, (const unsigned char*)ans, strlen(ans)); + otr_start_smp(context, NULL, (const unsigned char*)ans, mir_strlen(ans)); mir_free(ans); } @@ -613,7 +613,7 @@ void SMPDialogReply(ConnContext *context, const char* question){ ShowError(_T("SMP requires user password (NOT IMPL YET)")); otr_abort_smp(context); */ - //otr_continue_smp(context, pass, strlen(pass)); + //otr_continue_smp(context, pass, mir_strlen(pass)); } unsigned int CALLBACK verify_context_thread(void *param); diff --git a/plugins/MirOTR/src/entities.cpp b/plugins/MirOTR/src/entities.cpp index 084c05b2d0..87cc198eaa 100644 --- a/plugins/MirOTR/src/entities.cpp +++ b/plugins/MirOTR/src/entities.cpp @@ -268,7 +268,7 @@ static const char *named_entities[][2] = static int cmp(const void *key, const void *element) { return strncmp((const char *)key, *(const char **)element, - strlen(*(const char **)element)); + mir_strlen(*(const char **)element)); } static const char *get_named_entity(const char *name) @@ -346,7 +346,7 @@ static _Bool parse_entity(const char *current, char **to, const char *entity = get_named_entity(¤t[1]); if(entity) { - size_t len = strlen(entity); + size_t len = mir_strlen(entity); memcpy(*to, entity, len); *to += len; @@ -367,7 +367,7 @@ size_t decode_html_entities_utf8(char *dest, const char *src, size_t len) const char *from = src; const char *current; - if (!len) len = strlen(src); + if (!len) len = mir_strlen(src); size_t remain = len; while((current = (const char*)memchr(from, '&', len-(from-src)))) { @@ -417,7 +417,7 @@ char * encode_html_entities_utf8(const char *src) { } pos = strpbrk(start, "&<>\"\r"); } - if (strlen(start)) buf.append(start); + if (mir_strlen(start)) buf.append(start); pos = mir_strdup(buf.c_str()); buf.clear(); return (char*)pos; diff --git a/plugins/MirOTR/src/entities.h b/plugins/MirOTR/src/entities.h index 0d3cc1b822..a29f21ef22 100644 --- a/plugins/MirOTR/src/entities.h +++ b/plugins/MirOTR/src/entities.h @@ -11,7 +11,7 @@ extern size_t decode_html_entities_utf8(char *dest, const char *src, size_t len) the entities in-place otherwise, the output will be placed in `dest`, which should point - to a buffer big enough to hold `strlen(src) + 1` characters, while + to a buffer big enough to hold `mir_strlen(src) + 1` characters, while `src` remains unchanged if `len` is given, `dest` must be at least big enough to hold `len + 1` characters. diff --git a/plugins/MirOTR/src/striphtml.cpp b/plugins/MirOTR/src/striphtml.cpp index 4a3c3759ff..a7d84b69c4 100644 --- a/plugins/MirOTR/src/striphtml.cpp +++ b/plugins/MirOTR/src/striphtml.cpp @@ -94,7 +94,7 @@ char * striphtml(char *html) { STRIPHTML_DATA data; ekhtml_string_t ekstring; - ekstring.len = strlen(html); + ekstring.len = mir_strlen(html); ekstring.str = html; data.buffer.clear(); diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp index 22b428145e..dcce57fc22 100644 --- a/plugins/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/src/svcs_proto.cpp @@ -137,7 +137,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) msg_free = mir_free; } if (options.prefix_messages) { - size_t len = (strlen(options.prefix)+strlen(newmessage)+1)*sizeof(char); + size_t len = (mir_strlen(options.prefix)+mir_strlen(newmessage)+1)*sizeof(char); char* tmp = (char*)mir_alloc( len ); strcpy(tmp, options.prefix); strcat(tmp, newmessage); diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 7774c21448..c42196e8fa 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -811,7 +811,7 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage { char* szMsgUtf = mir_utf8encodeW(strMessage.c_str()); - pJob->iBufferSize = (int)strlen(szMsgUtf)+1; + pJob->iBufferSize = (int)mir_strlen(szMsgUtf)+1; pJob->pcBuffer = (char *)malloc(pJob->iBufferSize); pJob->dwFlags = 0; @@ -900,7 +900,7 @@ bool CAppletManager::TranslateDBEvent(CEvent *pEvent, WPARAM hContact, LPARAM hd switch(dbevent.eventType) { case EVENTTYPE_MESSAGE: - msglen = (int)strlen((char *) dbevent.pBlob) + 1; + msglen = (int)mir_strlen((char *) dbevent.pBlob) + 1; if (dbevent.flags & DBEF_UTF) { pEvent->strValue = Utf8_Decode((char*)dbevent.pBlob); } else if ((int) dbevent.cbBlob == msglen*3){ @@ -1751,14 +1751,14 @@ int CAppletManager::HookSettingChanged(WPARAM hContact,LPARAM lParam) if(!mir_strcmp(dbcws->szSetting,"Nick")) { if (!db_get_ts(Event.hContact, "CList", "MyHandle", &dbv)) { // handle found, ignore this event - if(dbv.pszVal && strlen(dbv.pszVal)>0) + if(dbv.pszVal && mir_strlen(dbv.pszVal)>0) return 0; } db_free(&dbv); } Event.eType = EVENT_CONTACT_NICK; - if(dbcws->value.type != DBVT_DELETED && dbcws->value.pszVal && strlen(dbcws->value.pszVal)>0) { + if(dbcws->value.type != DBVT_DELETED && dbcws->value.pszVal && mir_strlen(dbcws->value.pszVal)>0) { if(dbcws->value.type == DBVT_UTF8) Event.strValue = Utf8_Decode(dbcws->value.pszVal); else diff --git a/plugins/MirandaG15/src/LCDFramework/misc.cpp b/plugins/MirandaG15/src/LCDFramework/misc.cpp index eb9f2edcf8..c553124893 100644 --- a/plugins/MirandaG15/src/LCDFramework/misc.cpp +++ b/plugins/MirandaG15/src/LCDFramework/misc.cpp @@ -120,7 +120,7 @@ tstring Utf8_Decode(const char *str) if (str == NULL) return strRes; - len = strlen(str); + len = mir_strlen(str); if ((wszTemp = (WCHAR *) malloc(sizeof(TCHAR) * (len + 2))) == NULL) return strRes; diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index b3a012d1c3..7f38c49e5a 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1173,7 +1173,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) bool bConvertedToUtf8 = false; if (bWriteUTF8Format )// Write UTF-8 format in file ? { - int nAnsiLen = strlen((char *) dbei.pBlob)+1; + int nAnsiLen = mir_strlen((char *) dbei.pBlob)+1; if (nAnsiLen < (int)dbei.cbBlob ) { // Message is also encoded in unicode UTF-16/UCS-2, little endian. diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index d1ba1b60c2..ad88f82562 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -195,7 +195,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) // url if (dbei->pBlob) comment2 = mir_a2t((char *)dbei->pBlob); // comment - if (dbei->pBlob) comment1 = mir_a2t((char *)dbei->pBlob + strlen((char *)dbei->pBlob) + 1); + if (dbei->pBlob) comment1 = mir_a2t((char *)dbei->pBlob + mir_strlen((char *)dbei->pBlob) + 1); commentFix = POPUP_COMMENT_URL; break; @@ -204,7 +204,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) char *p = (char*)dbei->pBlob + sizeof(DWORD); // filenames comment2 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p); - p += strlen(p) + 1; + p += mir_strlen(p) + 1; // description comment1 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p); } @@ -224,9 +224,9 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) for (nContacts = 1; ; nContacts++) { // Nick - pcBlob += strlen(pcBlob) + 1; + pcBlob += mir_strlen(pcBlob) + 1; // UIN - pcBlob += strlen(pcBlob) + 1; + pcBlob += mir_strlen(pcBlob) + 1; // check for end of contacts if (pcBlob >= pcEnd) break; @@ -250,18 +250,18 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) TCHAR szBuf[2048]; TCHAR* szNick = NULL; char *pszNick = (char *)dbei->pBlob + 8; - char *pszFirst = pszNick + strlen(pszNick) + 1; - char *pszLast = pszFirst + strlen(pszFirst) + 1; - char *pszEmail = pszLast + strlen(pszLast) + 1; + char *pszFirst = pszNick + mir_strlen(pszNick) + 1; + char *pszLast = pszFirst + mir_strlen(pszFirst) + 1; + char *pszEmail = pszLast + mir_strlen(pszLast) + 1; mir_snprintf(szUin, SIZEOF(szUin), "%d", *((DWORD*)dbei->pBlob)); - if (strlen(pszNick) > 0) { + if (mir_strlen(pszNick) > 0) { if (dbei->flags & DBEF_UTF) szNick = mir_utf8decodeT(pszNick); else szNick = mir_a2t(pszNick); } - else if (strlen(pszEmail) > 0) { + else if (mir_strlen(pszEmail) > 0) { if (dbei->flags & DBEF_UTF) szNick = mir_utf8decodeT(pszEmail); else @@ -286,18 +286,18 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) TCHAR szBuf[2048]; TCHAR* szNick = NULL; char *pszNick = (char *)dbei->pBlob + 8; - char *pszFirst = pszNick + strlen(pszNick) + 1; - char *pszLast = pszFirst + strlen(pszFirst) + 1; - char *pszEmail = pszLast + strlen(pszLast) + 1; + char *pszFirst = pszNick + mir_strlen(pszNick) + 1; + char *pszLast = pszFirst + mir_strlen(pszFirst) + 1; + char *pszEmail = pszLast + mir_strlen(pszLast) + 1; mir_snprintf(szUin, SIZEOF(szUin), "%d", *((DWORD*)dbei->pBlob)); - if (strlen(pszNick) > 0) { + if (mir_strlen(pszNick) > 0) { if (dbei->flags & DBEF_UTF) szNick = mir_utf8decodeT(pszNick); else szNick = mir_a2t(pszNick); } - else if (strlen(pszEmail) > 0) { + else if (mir_strlen(pszEmail) > 0) { if (dbei->flags & DBEF_UTF) szNick = mir_utf8decodeT(pszEmail); else diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 20c895628f..f333ab12d0 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -268,7 +268,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const TCHAR *tmplt) DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); - dbei.cbBlob = (DWORD)strlen(blob) + 1; + dbei.cbBlob = (DWORD)mir_strlen(blob) + 1; dbei.pBlob = (PBYTE)blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; @@ -357,7 +357,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); - dbei.cbBlob = (DWORD)strlen(blob) + 1; + dbei.cbBlob = (DWORD)mir_strlen(blob) + 1; dbei.pBlob = (PBYTE)blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 954623bd94..fc5ce104c3 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -298,7 +298,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); - dbei.cbBlob = (DWORD)strlen(blob) + 1; + dbei.cbBlob = (DWORD)mir_strlen(blob) + 1; dbei.pBlob = (PBYTE)(char*)blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 0437587688..ed3737b847 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -142,7 +142,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR creation_date = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); p2 = out.find("[", p2); p2 = out.find("expires:", p2); - p2 += strlen("expires:"); + p2 += mir_strlen("expires:"); if(p2 != std::string::npos) { p2++; @@ -270,7 +270,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR string keyinfo = Translate("key ID"); keyinfo += ": "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + keyinfo += (mir_strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } @@ -468,7 +468,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR if(result == pxNotFound) break; string::size_type s = out.find("Key fingerprint = "); - s += strlen("Key fingerprint = "); + s += mir_strlen("Key fingerprint = "); string::size_type s2 = out.find("\n", s); TCHAR *fp = NULL; { @@ -655,7 +655,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR string keyinfo = Translate("key ID"); keyinfo += ": "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + keyinfo += (mir_strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } @@ -666,7 +666,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR std::string acc_str= buf; acc_str += "_KeyID"; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, acc_str.c_str(), ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + keyinfo += (mir_strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } @@ -913,7 +913,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { - p1 += strlen("(GnuPG) "); + p1 += mir_strlen("(GnuPG) "); if(out[p1] != '1') bad_version = true; } @@ -974,7 +974,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, char* p_path = NULL; if(StriStr(atmp, mir_path)) { - p_path = atmp + strlen(mir_path); + p_path = atmp + mir_strlen(mir_path); tmp = mir_a2t(p_path); SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); } @@ -992,7 +992,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, char* p_path = NULL; if(StriStr(atmp, mir_path)) { - p_path = atmp + strlen(mir_path); + p_path = atmp + mir_strlen(mir_path); tmp = mir_a2t(p_path); SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); } @@ -1038,7 +1038,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { - p1 += strlen("(GnuPG) "); + p1 += mir_strlen("(GnuPG) "); if(out[p1] != '1') bad_version = true; } @@ -1116,7 +1116,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { - p1 += strlen("(GnuPG) "); + p1 += mir_strlen("(GnuPG) "); if(out[p1] != '1') bad_version = true; } @@ -1747,7 +1747,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar p2 = p3; p2--; p3++; - p3+=strlen("expires: "); + p3+=mir_strlen("expires: "); string::size_type p4 = out.find("]", p3); tmp = mir_wstrdup(toUTF16(out.substr(p3,p4-p3)).c_str()); ListView_SetItemText(hwndList, iRow, 4, tmp); @@ -1759,7 +1759,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar ListView_SetItemText(hwndList, iRow, 3, tmp); mir_free(tmp); p = out.find("uid ", p); - p+= strlen("uid "); + p+= mir_strlen("uid "); p2 = out.find("\n", p); p3 = out.substr(p, p2-p).find("<"); if(p3 != string::npos) @@ -1833,7 +1833,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar p2 = out.find("-----END PGP PUBLIC KEY BLOCK-----", p1); if(p2 != std::string::npos) { - p2 += strlen("-----END PGP PUBLIC KEY BLOCK-----"); + p2 += mir_strlen("-----END PGP PUBLIC KEY BLOCK-----"); out = out.substr(p1, p2-p1); TCHAR *tmp = mir_a2t(out.c_str()); SetWindowText(hPubKeyEdit, tmp); @@ -2121,7 +2121,7 @@ void InitCheck() if((p != std::string::npos) && (p < p2)) { p = out.find("expires:", p); - p += strlen("expires:"); + p += mir_strlen("expires:"); p++; p2 = out.find("]", p); TCHAR *expire_date = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); @@ -2188,7 +2188,7 @@ void InitCheck() if((p != std::string::npos) && (p < p2)) { p = out.find("expires:", p); - p += strlen("expires:"); + p += mir_strlen("expires:"); p++; p2 = out.find("]", p); TCHAR *expire_date = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); @@ -2341,7 +2341,7 @@ void ImportKey() if(hcnt) { char *tmp = NULL; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(hcnt, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s = output.find("“", s2); @@ -2413,7 +2413,7 @@ void ImportKey() else { char *tmp = NULL; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s = output.find("“", s2); @@ -2483,7 +2483,7 @@ void ImportKey() else { char *tmp = NULL; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s = output.find("“", s2); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 70a4b0c450..b29af2b1d4 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -187,7 +187,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags { //save inkey id string::size_type s = out.find(" encrypted with "); s = out.find(" ID ", s); - s += strlen(" ID "); + s += mir_strlen(" ID "); string::size_type s2 = out.find(",",s); db_set_s(db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } @@ -420,7 +420,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) } { char *tmp = NULL; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(ccs->hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s2+=2; diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index ee4a83d942..80b49f59c7 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -175,7 +175,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP string keyinfo = Translate("Default private key ID"); keyinfo += ": "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + keyinfo += (mir_strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_CURRENT_KEY, keyinfo.c_str()); } @@ -507,7 +507,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { - p1 += strlen("(GnuPG) "); + p1 += mir_strlen("(GnuPG) "); if(out[p1] != '1') bad_version = true; } @@ -527,7 +527,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, char* p_path = NULL; if(StriStr(atmp, mir_path)) { - p_path = atmp + strlen(mir_path); + p_path = atmp + mir_strlen(mir_path); tmp = mir_a2t(p_path); SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); } @@ -545,7 +545,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, char* p_path = NULL; if(StriStr(atmp, mir_path)) { - p_path = atmp + strlen(mir_path); + p_path = atmp + mir_strlen(mir_path); tmp = mir_a2t(p_path); SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); } @@ -961,7 +961,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam break; } char *tmp2; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1)*sizeof(char)); strcpy(tmp2, output.substr(s,s2-s).c_str()); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index b4078f24ac..63ece6aab0 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -348,7 +348,7 @@ int onProtoAck(WPARAM w, LPARAM l) { // password TCHAR *pass = NULL; char *keyid = UniGetContactSettingUtf(ack->hContact, szGPGModuleName, "KeyID", ""); - if(strlen(keyid) > 0) + if(mir_strlen(keyid) > 0) { string dbsetting = "szKey_"; dbsetting += keyid; @@ -397,7 +397,7 @@ int onProtoAck(WPARAM w, LPARAM l) { //save inkey id string::size_type s = out.find(" encrypted with "); s = out.find(" ID ", s); - s += strlen(" ID "); + s += mir_strlen(" ID "); string::size_type s2 = out.find(",",s); if(db_mc_isMeta(ack->hContact)) db_set_s(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); @@ -641,7 +641,7 @@ void HistoryLog(MCONTACT hContact, db_event evt) Event.timestamp = (DWORD)time(NULL); else Event.timestamp = evt.timestamp; - Event.cbBlob = (DWORD)strlen((char*)evt.pBlob)+1; + Event.cbBlob = (DWORD)mir_strlen((char*)evt.pBlob)+1; Event.pBlob = (PBYTE)_strdup((char*)evt.pBlob); db_event_add(hContact, &Event); } @@ -997,7 +997,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi if(out.find("key ID ") != string::npos) { //need to get hcontact here, i can get jid from hxml, and get handle from jid, maybe exists better way ? - string::size_type p1 = out.find("key ID ") + strlen("key ID "); + string::size_type p1 = out.find("key ID ") + mir_strlen("key ID "); string::size_type p2 = out.find("\n", p1); if(p1 != string::npos && p2 != string::npos) { @@ -1187,7 +1187,7 @@ bool isGPGValid() return is_valid && gpg_exists; } -#define NEWTSTR_MALLOC(A) (A==NULL)?NULL:strcpy((char*)mir_alloc(sizeof(char)*(strlen(A)+1)),A) +#define NEWTSTR_MALLOC(A) (A==NULL)?NULL:strcpy((char*)mir_alloc(sizeof(char)*(mir_strlen(A)+1)),A) const bool StriStr(const char *str, const char *substr) { @@ -1195,8 +1195,8 @@ const bool StriStr(const char *str, const char *substr) char *str_up = NEWTSTR_MALLOC(str); char *substr_up = NEWTSTR_MALLOC(substr); - CharUpperBuffA(str_up, (DWORD)strlen(str_up)); - CharUpperBuffA(substr_up, (DWORD)strlen(substr_up)); + CharUpperBuffA(str_up, (DWORD)mir_strlen(str_up)); + CharUpperBuffA(substr_up, (DWORD)mir_strlen(substr_up)); if(strstr (str_up, substr_up)) i = true; @@ -1508,7 +1508,7 @@ void ExportGpGKeysFunc(int type) std::string::size_type p1 = key.find("-----BEGIN PGP PUBLIC KEY BLOCK-----"); if(p1 == std::string::npos) continue; - p1 += strlen("-----BEGIN PGP PUBLIC KEY BLOCK-----"); + p1 += mir_strlen("-----BEGIN PGP PUBLIC KEY BLOCK-----"); p1 ++; id += '\n'; key.insert(p1, id); @@ -1589,10 +1589,10 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) { std::string::size_type p1 = 0, p2 = 0; p1 = key.find("Comment: login "); - p1 += strlen("Comment: login "); + p1 += mir_strlen("Comment: login "); p2 = key.find(" contact_id "); login = key.substr(p1, p2-p1); - p2 += strlen(" contact_id "); + p2 += mir_strlen(" contact_id "); p1 = key.find("\n", p2); contact_id = key.substr(p2, p1-p2); p1 = key.find("Comment: login "); @@ -1779,7 +1779,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) break; } char *tmp2; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1) * sizeof(char)); strcpy(tmp2, output.substr(s,s2-s).c_str()); diff --git a/plugins/New_GPG/src/utilities.h b/plugins/New_GPG/src/utilities.h index 32a99ea716..2042864468 100644 --- a/plugins/New_GPG/src/utilities.h +++ b/plugins/New_GPG/src/utilities.h @@ -51,12 +51,12 @@ public: timestamp = time(0); szModule = 0; cbSize = 0; - cbBlob = DWORD(strlen(msg)+1); + cbBlob = DWORD(mir_strlen(msg)+1); pBlob = (PBYTE)msg; } db_event(char* msg, DWORD time) { - cbBlob = DWORD(strlen(msg)+1); + cbBlob = DWORD(mir_strlen(msg)+1); pBlob = (PBYTE)msg; eventType = EVENTTYPE_MESSAGE; flags = 0; @@ -66,7 +66,7 @@ public: } db_event(char* msg, DWORD time, int type) { - cbBlob = DWORD(strlen(msg)+1); + cbBlob = DWORD(mir_strlen(msg)+1); pBlob = (PBYTE)msg; if(type) eventType = type; @@ -79,7 +79,7 @@ public: } db_event(char* msg, int type) { - cbBlob = DWORD(strlen(msg)+1); + cbBlob = DWORD(mir_strlen(msg)+1); pBlob = (PBYTE)msg; flags = 0; if(type) @@ -92,7 +92,7 @@ public: } db_event(char* msg, DWORD time, int type, DWORD _flags) { - cbBlob = DWORD(strlen(msg)+1); + cbBlob = DWORD(mir_strlen(msg)+1); pBlob = (PBYTE)msg; if(type) eventType = type; diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 3f2c96b7b5..35cdab14fa 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -124,7 +124,7 @@ static void XmlToMsg(MCONTACT hContact, CMString &title, CMString &link, CMStrin bool MesExist = false; ptrA pszTemp(mir_utf8encodeT(message)); - DWORD cbMemoLen = 10000, cbOrigLen = (DWORD)strlen(pszTemp); + DWORD cbMemoLen = 10000, cbOrigLen = (DWORD)mir_strlen(pszTemp); BYTE *pbBuffer = (BYTE*)mir_alloc(cbMemoLen); for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { olddbei.cbBlob = db_event_getBlobSize(hDbEvent); @@ -137,7 +137,7 @@ static void XmlToMsg(MCONTACT hContact, CMString &title, CMString &link, CMStrin if (stamp > 0 && olddbei.timestamp < (DWORD)stamp) break; - if ((DWORD)strlen((char*)olddbei.pBlob) == cbOrigLen && !mir_strcmp((char*)olddbei.pBlob, pszTemp)) { + if ((DWORD)mir_strlen((char*)olddbei.pBlob) == cbOrigLen && !mir_strcmp((char*)olddbei.pBlob, pszTemp)) { MesExist = true; break; } diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index eaac4b706b..f6d23ee084 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -275,9 +275,9 @@ char* copyReplaceString(char* oldStr, char* newStr, char* findStr, char* replace int i = 0; while (oldStr[i] != '\0') { // msg(&oldStr[i],""); - if (!strncmp(&oldStr[i], findStr, strlen(findStr))) { + if (!strncmp(&oldStr[i], findStr, mir_strlen(findStr))) { strcat(newStr, replaceWithStr); - i += (int)strlen(findStr); + i += (int)mir_strlen(findStr); } else { strncat(newStr, &oldStr[i], 1); @@ -498,37 +498,37 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) continue; if (!strcmp(line, "[Non-IM Contact]\r\n")) contactDone = 0; - else if (!strncmp(line, "Name=", strlen("Name="))) { - i = (int)strlen("Name="); j = 0; + else if (!strncmp(line, "Name=", mir_strlen("Name="))) { + i = (int)mir_strlen("Name="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { name[j] = line[i++]; name[++j] = '\0'; } contactDone = 1; } - else if (!strncmp(line, "ProgramString=", strlen("ProgramString="))) { - i = (int)strlen("ProgramString="); j = 0; + else if (!strncmp(line, "ProgramString=", mir_strlen("ProgramString="))) { + i = (int)mir_strlen("ProgramString="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { program[j] = line[i++]; program[++j] = '\0'; } } - else if (!strncmp(line, "ProgramParamString=", strlen("ProgramParamString="))) { - i = (int)strlen("ProgramParamString="); j = 0; + else if (!strncmp(line, "ProgramParamString=", mir_strlen("ProgramParamString="))) { + i = (int)mir_strlen("ProgramParamString="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { programparam[j] = line[i++]; programparam[++j] = '\0'; } } - else if (!strncmp(line, "Group=", strlen("Group="))) { - i = (int)strlen("Group="); j = 0; + else if (!strncmp(line, "Group=", mir_strlen("Group="))) { + i = (int)mir_strlen("Group="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { group[j] = line[i++]; group[++j] = '\0'; } } - else if (!strncmp(line, "ToolTip=", strlen("ToolTip="))) { - i = (int)strlen("ToolTip="); + else if (!strncmp(line, "ToolTip=", mir_strlen("ToolTip="))) { + i = (int)mir_strlen("ToolTip="); strcpy(tooltip, &line[i]); fgets(line, 2000, file); while (!strstr(line, "\r\n")) { @@ -538,47 +538,47 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) // the line that has the strncat(tooltip, line, SIZEOF(tooltip) - mir_strlen(tooltip)); } - else if (!strncmp(line, "Icon=", strlen("Icon="))) { - i = (int)strlen("Icon="); + else if (!strncmp(line, "Icon=", mir_strlen("Icon="))) { + i = (int)mir_strlen("Icon="); sscanf(&line[i], "%d", &icon); } - else if (!strncmp(line, "UseTimer=", strlen("UseTimer="))) { - i = (int)strlen("UseTimer="); + else if (!strncmp(line, "UseTimer=", mir_strlen("UseTimer="))) { + i = (int)mir_strlen("UseTimer="); sscanf(&line[i], "%d", &usetimer); } - else if (!strncmp(line, "Timer=", strlen("Timer="))) { - i = (int)strlen("Timer="); + else if (!strncmp(line, "Timer=", mir_strlen("Timer="))) { + i = (int)mir_strlen("Timer="); sscanf(&line[i], "%d", &timer); } - else if (!strncmp(line, "Minutes=", strlen("Minutes="))) { - i = (int)strlen("Minutes="); + else if (!strncmp(line, "Minutes=", mir_strlen("Minutes="))) { + i = (int)mir_strlen("Minutes="); sscanf(&line[i], "%d", &minutes); } else if (contactDone && !strcmp(line, "[/Non-IM Contact]\r\n")) { if (!name) continue; - size_t size = strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1; + size_t size = mir_strlen(name) + mir_strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1; char *msg = (char*)malloc(size); mir_snprintf(msg, size, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name); if (program) { - msg = (char*)realloc(msg, strlen(msg) + strlen(program) + strlen("Program: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(program) + mir_strlen("Program: \r\n") + 1); strcat(msg, "Program: "); strcat(msg, program); strcat(msg, "\r\n"); } if (programparam) { - msg = (char*)realloc(msg, strlen(msg) + strlen(programparam) + strlen("Program Parameters: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(programparam) + mir_strlen("Program Parameters: \r\n") + 1); strcat(msg, "Program Parameters: "); strcat(msg, programparam); strcat(msg, "\r\n"); } if (tooltip) { - msg = (char*)realloc(msg, strlen(msg) + strlen(tooltip) + strlen("ToolTip: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tooltip) + mir_strlen("ToolTip: \r\n") + 1); strcat(msg, "ToolTip: "); strcat(msg, tooltip); strcat(msg, "\r\n"); } if (group) { - msg = (char*)realloc(msg, strlen(msg) + strlen(group) + strlen("Group: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(group) + mir_strlen("Group: \r\n") + 1); strcat(msg, "Group: "); strcat(msg, group); strcat(msg, "\r\n"); @@ -607,7 +607,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) free(msg); continue; } - char *msgtemp = (char*)realloc(msg, strlen(msg) + strlen(tmp) + 1); + char *msgtemp = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tmp) + 1); if (msgtemp) { msg = msgtemp; strcat(msg, tmp); @@ -619,7 +619,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) strcpy(tmp2, "Minutes"); else strcpy(tmp2, "Seconds"); mir_snprintf(tmp, SIZEOF(tmp), "UseTimer: Yes\r\nTimer: %d %s", timer, tmp2); - char *msgtemp = (char*)realloc(msg, strlen(msg) + strlen(tmp) + 1); + char *msgtemp = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tmp) + 1); if (msgtemp) { msg = msgtemp; strcat(msg, tmp); diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index 0702d63a6c..d41cb61fed 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -137,9 +137,9 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP int i = 0, j; if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) { GetDlgItemTextA(hwnd, IDC_STRING, tmp, SIZEOF(tmp)); - if (tmp[strlen(tmp) - 1] == '(') { + if (tmp[mir_strlen(tmp) - 1] == '(') { for (i = 0; i < VARS; i++) { - if (!strcmp(braceList[i].var, &tmp[strlen(tmp) - strlen(braceList[i].var)])) { + if (!strcmp(braceList[i].var, &tmp[mir_strlen(tmp) - mir_strlen(braceList[i].var)])) { for (j = 0; j < MAX_BRACES; j++) { if (!braceOrder[j]) { braceOrder[j] = i; @@ -153,7 +153,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP } } } - else if (tmp[strlen(tmp) - 1] == ')') { + else if (tmp[mir_strlen(tmp) - 1] == ')') { for (j = 0; j < MAX_BRACES; j++) { if (!braceOrder[j]) { EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j - 1]].idCtrl), 0); diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index 1c183c482d..d91012ab1c 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -110,7 +110,7 @@ void readFile(HWND hwnd) return; } - if (!strncmp("http://", szFileName, strlen("http://")) || !strncmp("https://", szFileName, strlen("https://"))) + if (!strncmp("http://", szFileName, mir_strlen("http://")) || !strncmp("https://", szFileName, mir_strlen("https://"))) mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber); FILE *filen = fopen(szFileName, "r"); @@ -122,17 +122,17 @@ void readFile(HWND hwnd) SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0); while (lineNumber < (MAXLINES) && (fgets(temp, MAX_STRING_LENGTH, filen))) { if (temp[0] == '\t') temp[0] = ' '; - if (temp[strlen(temp) - 1] == '\n' && temp[strlen(temp) - 2] == '\r') - temp[strlen(temp) - 2] = '\0'; - else if (temp[strlen(temp) - 1] == '\n') - temp[strlen(temp) - 1] = '\0'; - else temp[strlen(temp)] = '\0'; + if (temp[mir_strlen(temp) - 1] == '\n' && temp[mir_strlen(temp) - 2] == '\r') + temp[mir_strlen(temp) - 2] = '\0'; + else if (temp[mir_strlen(temp) - 1] == '\n') + temp[mir_strlen(temp) - 1] = '\0'; + else temp[mir_strlen(temp)] = '\0'; mir_snprintf(temp1, SIZEOF(temp1), Translate("line(%-3d) = | %s"), lineNumber, temp); SendDlgItemMessageA(hwnd, IDC_FILE_CONTENTS, LB_ADDSTRING, 0, (LPARAM)temp1); lineNumber++; fileLength++; - if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5))) - SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)), 0); + if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5))) + SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)), 0); } fclose(filen); } @@ -150,7 +150,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(fn, SIZEOF(fn), "fn%d", i); SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0); if (db_get_static(NULL, MODNAME, fn, string, SIZEOF(string))) { - if ((!strncmp("http://", string, strlen("http://"))) || (!strncmp("https://", string, strlen("https://")))) { + if ((!strncmp("http://", string, mir_strlen("http://"))) || (!strncmp("https://", string, mir_strlen("https://")))) { SetDlgItemTextA(hwnd, IDC_URL, string); mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i); SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10)); @@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10)); mir_snprintf(fn, SIZEOF(fn), "fn%d", index); if (db_get_static(NULL, MODNAME, fn, tmp, SIZEOF(tmp))) { - if (!strncmp("http://", tmp, strlen("http://")) || !strncmp("https://", tmp, strlen("https://"))) { + if (!strncmp("http://", tmp, mir_strlen("http://")) || !strncmp("https://", tmp, mir_strlen("https://"))) { SetDlgItemTextA(hwnd, IDC_URL, tmp); mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", index); SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10)); @@ -296,7 +296,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) else timer = 60; if (db_get_static(NULL, MODNAME, fn, string, SIZEOF(string))) - if (!strncmp("http://", string, strlen("http://")) || !strncmp("https://", string, strlen("https://"))) { + if (!strncmp("http://", string, mir_strlen("http://")) || !strncmp("https://", string, mir_strlen("https://"))) { mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i); db_set_w(NULL, MODNAME, fn, (WORD)timer); } @@ -318,7 +318,7 @@ char* getMimDir(char* file) *p1 = '\0'; if (file[0] == '\\') - file[strlen(file) - 1] = '\0'; + file[mir_strlen(file) - 1] = '\0'; return file; } diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index e45120f8a7..edfa7dd539 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -24,11 +24,11 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) // free this array before stringReplacer() returns int i; for (i = 0; fgets(temp, MAX_STRING_LENGTH - 1, file); i++) { - if (temp[strlen(temp) - 1] == '\n') - temp[strlen(temp) - 1] = '\0'; - else temp[strlen(temp)] = '\0'; + if (temp[mir_strlen(temp) - 1] == '\n') + temp[mir_strlen(temp) - 1] = '\0'; + else temp[mir_strlen(temp)] = '\0'; - FileContents[i] = (char*)malloc(strlen(temp) + 1); + FileContents[i] = (char*)malloc(mir_strlen(temp) + 1); if (FileContents[i] == NULL) break; strcpy(FileContents[i], temp); } @@ -49,18 +49,18 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in strncpy(OpenDivider, "(\"", sizeof(OpenDivider)); strncpy(CloseDivider, "\")", sizeof(CloseDivider)); /* get the word we r looking for */ - if (!strncmp(string, OpenDivider, strlen(OpenDivider))) { - for (i = 2; strncmp(&string[i], CloseDivider, strlen(CloseDivider)); i++) { + if (!strncmp(string, OpenDivider, mir_strlen(OpenDivider))) { + for (i = 2; strncmp(&string[i], CloseDivider, mir_strlen(CloseDivider)); i++) { word[j] = string[i]; word[++j] = '\0'; } } i = 0; - *lengthOfWord = (int)(strlen(word) + strlen(CloseDivider) + strlen(OpenDivider)); + *lengthOfWord = (int)(mir_strlen(word) + mir_strlen(CloseDivider) + mir_strlen(OpenDivider)); /* find the word in the line */ - while (i < (strlen(line) - strlen(word))) { - if (!strncmp(&line[i], word, strlen(word))) { - if (!flag) return i + (int)strlen(word); /* the next char after the word */ + while (i < (mir_strlen(line) - mir_strlen(word))) { + if (!strncmp(&line[i], word, mir_strlen(word))) { + if (!flag) return i + (int)mir_strlen(word); /* the next char after the word */ else return i; /* the char before the word */ } i++; @@ -79,16 +79,16 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star // check if its a number if (i != -1) { - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)) - 1; + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)) - 1; return i; } // lastline - if (!strncmp(&string[*positionInOldString], "lastline(", strlen("lastline("))) { - *positionInOldString += (int)strlen("lastline("); + if (!strncmp(&string[*positionInOldString], "lastline(", mir_strlen("lastline("))) { + *positionInOldString += (int)mir_strlen("lastline("); i = getNumber(&string[*positionInOldString]); if (i != -1) { - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)); + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)); return linesInFile - (i + 1); } @@ -114,14 +114,14 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star } i = -1; } - *positionInOldString += (int)(strlen(string2Find) + strlen("\"\")")); + *positionInOldString += (int)(mir_strlen(string2Find) + mir_strlen("\"\")")); if (i == -1) return i; // allow for a +- after the word to go up or down lines if (string[*positionInOldString] == '+') { *positionInOldString += 1; j = getNumber(&string[*positionInOldString]); if (j != -1) { - *positionInOldString += (int)strlen(_itoa(j, tmp, 10)) - 2; + *positionInOldString += (int)mir_strlen(_itoa(j, tmp, 10)) - 2; return i + j; } } @@ -129,7 +129,7 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star *positionInOldString += 1; j = getNumber(&string[*positionInOldString]); if (j != -1) { - *positionInOldString += (int)strlen(_itoa(j, tmp, 10)) - 2; + *positionInOldString += (int)mir_strlen(_itoa(j, tmp, 10)) - 2; return i - j; } } @@ -147,7 +147,7 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star int i = getNumber(&string[*positionInOldString]); // check if its a number if (i != -1) { - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)) - 1; + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)) - 1; return i; } @@ -161,22 +161,22 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star string2Find[++j] = '\0'; } // find the word - for (j = 0; j < strlen(FileContents[startLine]); j++) - if (!strncmp(&FileContents[startLine][j], string2Find, strlen(string2Find))) + for (j = 0; j < mir_strlen(FileContents[startLine]); j++) + if (!strncmp(&FileContents[startLine][j], string2Find, mir_strlen(string2Find))) break; - if (j == strlen(FileContents[startLine])) + if (j == mir_strlen(FileContents[startLine])) return -1; - *positionInOldString += (int)strlen(string2Find) + 1; - return (startEnd) ? j : j + (int)strlen(string2Find); + *positionInOldString += (int)mir_strlen(string2Find) + 1; + return (startEnd) ? j : j + (int)mir_strlen(string2Find); } // csv( - if (!strncmp(&string[*positionInOldString], "csv(", strlen("csv("))) { + if (!strncmp(&string[*positionInOldString], "csv(", mir_strlen("csv("))) { char seperator; int j = 0, k = startChar; - *positionInOldString += (int)strlen("csv("); + *positionInOldString += (int)mir_strlen("csv("); if (!strncmp(&string[*positionInOldString], "tab", 3)) { *positionInOldString += 3; seperator = '\t'; @@ -191,7 +191,7 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star } i = getNumber(&string[*positionInOldString]); if (i == -1) return -1; - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)); + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)); while (j < i) { if (FileContents[startLine][k] == '\0') break; if (FileContents[startLine][k] == seperator) @@ -207,17 +207,17 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star void checkStringForcompare(char *str) { if (!strstr(str, "compare(\"")) return; - char *A, *B, *X, *Y, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *B, *X, *Y, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "compare(\"", strlen("compare(\""))) { - i += (int)strlen("compare(\""); + if (!strncmp(&str[i], "compare(\"", mir_strlen("compare(\""))) { + i += (int)mir_strlen("compare(\""); A = strtok(©OfStr[i], "\",\""); B = strtok(NULL, "\",\""); X = strtok(NULL, "\",\""); Y = strtok(NULL, ",\")"); - j = Y - ©OfStr[i] + (int)strlen(Y) + 1; + j = Y - ©OfStr[i] + (int)mir_strlen(Y) + 1; if (A && B && X && Y) { if (!strcmp(A, B)) strcat(newStr, X); @@ -237,15 +237,15 @@ void checkStringForcompare(char *str) void checkStringForSave(MCONTACT hContact, char* str) { if (!strstr(str, "save(\"")) return; - char *A, *B, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *B, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "save(\"", strlen("save(\""))) { - i += (int)strlen("save(\""); + if (!strncmp(&str[i], "save(\"", mir_strlen("save(\""))) { + i += (int)mir_strlen("save(\""); A = strtok(©OfStr[i], "\",\""); B = strtok(NULL, ",\")"); - j = B - ©OfStr[i] + (int)strlen(B) + 1; + j = B - ©OfStr[i] + (int)mir_strlen(B) + 1; if (A && B) db_set_s(hContact, MODNAME, A, B); @@ -263,14 +263,14 @@ void checkStringForSave(MCONTACT hContact, char* str) void checkStringForLoad(MCONTACT hContact, char* str) { if (!strstr(str, "load(\"")) return; - char *A, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "load(\"", strlen("load(\""))) { - i += (int)strlen("load(\""); + if (!strncmp(&str[i], "load(\"", mir_strlen("load(\""))) { + i += (int)mir_strlen("load(\""); A = strtok(©OfStr[i], "\")"); - j = A - ©OfStr[i] + (int)strlen(A) + 1; + j = A - ©OfStr[i] + (int)mir_strlen(A) + 1; if (A) { DBVARIANT dbv; if (!db_get_s(hContact, MODNAME, A, &dbv)) { @@ -292,17 +292,17 @@ void checkStringForLoad(MCONTACT hContact, char* str) void checkStringForSaveN(char* str) { if (!strstr(str, "saveN(\"")) return; - char *A, *B, *C, *D, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *B, *C, *D, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "saveN(\"", strlen("saveN(\""))) { - i += (int)strlen("saveN(\""); + if (!strncmp(&str[i], "saveN(\"", mir_strlen("saveN(\""))) { + i += (int)mir_strlen("saveN(\""); A = strtok(©OfStr[i], "\",\""); B = strtok(NULL, ",\""); C = strtok(NULL, ",\""); D = strtok(NULL, ",\")"); - j = D - ©OfStr[i] + (int)strlen(D) + 1; + j = D - ©OfStr[i] + (int)mir_strlen(D) + 1; if (A && B && C && D) { switch (D[0]) { case '0': @@ -337,16 +337,16 @@ void checkStringForSaveN(char* str) void checkStringForLoadN(char* str) { if (!strstr(str, "loadN(\"")) return; - char *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str), temp[32]; - unsigned int i, j = 0, s = (int)strlen(str); + char *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str), temp[32]; + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "loadN(\"", strlen("loadN(\""))) { - i += (int)strlen("loadN(\""); + if (!strncmp(&str[i], "loadN(\"", mir_strlen("loadN(\""))) { + i += (int)mir_strlen("loadN(\""); char *A = strtok(©OfStr[i], "\",\""); char *B = strtok(NULL, ",\")"); if (A && B) { - j = B - ©OfStr[i] + (int)strlen(B) + 1; + j = B - ©OfStr[i] + (int)mir_strlen(B) + 1; DBVARIANT dbv; if (!db_get(NULL, A, B, &dbv)) { switch (dbv.type) { @@ -401,7 +401,7 @@ BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString) int lastChecked(char *newStr, const char *str) { char *szPattern = "lastchecked(file("; - size_t cbPattern = strlen(szPattern); + size_t cbPattern = mir_strlen(szPattern); if (!strncmp(str, szPattern, cbPattern)) { int file; @@ -427,7 +427,7 @@ int lastChecked(char *newStr, const char *str) CloseHandle(hFile); strcat(newStr, tszFileName); mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s%d))", szPattern, file); - return (int)strlen(tszFileName); + return (int)mir_strlen(tszFileName); } CloseHandle(hFile); } @@ -458,10 +458,10 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) strncpy(newString, "", sizeof(newString)); strncpy(var_file, "file(", sizeof(var_file)); - while ((positionInOldString < (int)strlen(oldString)) && (oldString[positionInOldString] != '\0')) { + while ((positionInOldString < (int)mir_strlen(oldString)) && (oldString[positionInOldString] != '\0')) { // load the file... must be first - if (!strncmp(&oldString[positionInOldString], var_file, strlen(var_file))) { - positionInOldString += (int)strlen(var_file); + if (!strncmp(&oldString[positionInOldString], var_file, mir_strlen(var_file))) { + positionInOldString += (int)mir_strlen(var_file); // check if its a number tempInt = getNumber(&oldString[positionInOldString]); if (tempInt == -1) { @@ -473,11 +473,11 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) linesInFile = readFileIntoArray(tempInt, fileContents); if (linesInFile == 0) return ERROR_NO_FILE; - positionInOldString += (int)strlen(_itoa(tempInt, tempString, 10)) + 1; // +1 for the closing ) + positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1; // +1 for the closing ) // wholeline() - if (!strncmp(&oldString[positionInOldString], "wholeline(line(", strlen("wholeline(line("))) { - positionInOldString += (int)strlen("wholeline(line("); + if (!strncmp(&oldString[positionInOldString], "wholeline(line(", mir_strlen("wholeline(line("))) { + positionInOldString += (int)mir_strlen("wholeline(line("); tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString); if (tempInt == -1 || !fileContents[tempInt]) return ERROR_NO_LINE_AFTER_VAR_F; @@ -485,8 +485,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) positionInOldString += 3; // add 2 for the )) for wholeline(line()) } - if (!strncmp(&oldString[positionInOldString], "start(", strlen("start("))) { - positionInOldString += (int)strlen("start(line("); + if (!strncmp(&oldString[positionInOldString], "start(", mir_strlen("start("))) { + positionInOldString += (int)mir_strlen("start(line("); tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString); if (tempInt == -1 || !fileContents[tempInt]) return ERROR_NO_LINE_AFTER_VAR_F; @@ -494,7 +494,7 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) positionInOldString += 2; startLine = tempInt; if (!endChar) - endChar = (int)strlen(fileContents[startLine]); + endChar = (int)mir_strlen(fileContents[startLine]); tempInt = findChar(fileContents, oldString, linesInFile, startLine, &positionInOldString, startChar, 0); if (tempInt == -1) return ERROR_NO_LINE_AFTER_VAR_F; @@ -502,8 +502,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) } positionInOldString += 2; // add 2 for the )) for start(line()) } - if (!strncmp(&oldString[positionInOldString], "end(", strlen("end("))) { - positionInOldString += (int)strlen("end(line("); + if (!strncmp(&oldString[positionInOldString], "end(", mir_strlen("end("))) { + positionInOldString += (int)mir_strlen("end(line("); tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString); if (tempInt == -1 || !fileContents[tempInt]) return ERROR_NO_LINE_AFTER_VAR_F; @@ -539,8 +539,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) } } // filename() - else if (!strncmp(&oldString[positionInOldString], "filename(", strlen("filename("))) { - positionInOldString += (int)strlen("filename("); + else if (!strncmp(&oldString[positionInOldString], "filename(", mir_strlen("filename("))) { + positionInOldString += (int)mir_strlen("filename("); tempInt = getNumber(&oldString[positionInOldString]); if (tempInt == -1) { return ERROR_NO_FILE; @@ -550,11 +550,11 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) if (db_get_static(NULL, MODNAME, tempString, tempString, SIZEOF(tempString))) strcat(newString, tempString); else return ERROR_NO_FILE; - positionInOldString += (int)strlen(_itoa(tempInt, tempString, 10)) + 1; + positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1; } } // lastchecked(file(X)) - else if (!strncmp(&oldString[positionInOldString], "lastchecked(file(", strlen("lastchecked(file("))) { + else if (!strncmp(&oldString[positionInOldString], "lastchecked(file(", mir_strlen("lastchecked(file("))) { positionInOldString += lastChecked(newString, &oldString[positionInOldString]); } else { diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index 9d81dbd70b..a3195ecad3 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -27,7 +27,7 @@ void timerFunc(void *di) if (!db_get_static(NULL, MODNAME, fn, text, SIZEOF(text))) break; - if (!strncmp("http://", text, strlen("http://")) || !strncmp("https://", text, strlen("https://"))) { + if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) { mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i); int timer = db_get_w(NULL, MODNAME, fn, 60); if (timer && !(timerCount % timer)) { diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 1f8ec9d354..a88a04bb8a 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -155,7 +155,7 @@ static void InitNoteTitle(STICKYNOTE *TSN) // append time if requested if (g_NoteTitleTime) { - int n = (int)strlen(TempStr); + int n = (int)mir_strlen(TempStr); TempStr[n++] = ' '; TempStr[n] = 0; @@ -478,7 +478,7 @@ void LoadNotes(BOOL bIsStartup) break; case DATATAG_TITLE: - if (strlen(TVal) > MAX_TITLE_LEN) + if (mir_strlen(TVal) > MAX_TITLE_LEN) TVal[MAX_TITLE_LEN] = 0; note.title = _strdup(TVal); note.CustomTitle = TRUE; @@ -612,7 +612,7 @@ void LoadNotes(BOOL bIsStartup) if ( strchr(ID, '-') ) { // validate format (otherwise create new) - if (strlen(ID) < 19 || ID[2] != '-' || ID[5] != '-' || ID[10] != ' ' || ID[13] != ':' || ID[16] != ':') + if (mir_strlen(ID) < 19 || ID[2] != '-' || ID[5] != '-' || ID[10] != ' ' || ID[13] != ':' || ID[16] != ':') { ID = NULL; } @@ -1103,7 +1103,7 @@ static BOOL GetClipboardText_Title(char *pOut, int size) while (*buffer && isspace(*buffer)) buffer++; - size_t n = strlen(buffer); + size_t n = mir_strlen(buffer); if (n >= size) n = size-1; memcpy(pOut, buffer, n); @@ -1116,7 +1116,7 @@ static BOOL GetClipboardText_Title(char *pOut, int size) if (*p == '\r' || *p == '\n') { *p = 0; - n = strlen(pOut); + n = mir_strlen(pOut); break; } else if (*p == '\t') @@ -1736,7 +1736,7 @@ char* GetPreviewString(const char *lpsz) while ( iswspace(*lpsz) ) lpsz++; - l = (int)strlen(lpsz); + l = (int)mir_strlen(lpsz); if (!l) return ""; diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 5b9fd20897..ae631dba26 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -238,7 +238,7 @@ void JustSaveReminders(void) for (TTE = RemindersList, I = 0; TTE; TTE = (TREEELEMENT*)TTE->next, I++) { pReminder = (REMINDERDATA*)TTE->ptrdata; - if (pReminder->Reminder && strlen(pReminder->Reminder)) + if (pReminder->Reminder && mir_strlen(pReminder->Reminder)) tmpReminder = pReminder->Reminder; else tmpReminder = NULL; @@ -246,7 +246,7 @@ void JustSaveReminders(void) if (!tmpReminder) tmpReminder = ""; - Value = (char*)malloc(strlen(tmpReminder) + 512); + Value = (char*)malloc(mir_strlen(tmpReminder) + 512); if (!Value) continue; @@ -571,7 +571,7 @@ void GetTriggerTimeString(const ULARGE_INTEGER *When, char *s, UINT strSize, BOO if ( GetDateFormat(lc, DATE_LONGDATE, &tm, NULL, s, strSize)) { // append time - int n = (int)strlen(s); + int n = (int)mir_strlen(s); s[n++] = ' '; s[n] = 0; @@ -2622,13 +2622,13 @@ void Send(char *user, char *host, char *Msg, char *server) sockaddr.sin_port = htons(port); sockaddr.sin_family = AF_INET; if(connect(S,(SOCKADDR*)&sockaddr,sizeof(sockaddr)) == SOCKET_ERROR) return; - ch = (char*)malloc(strlen(user) + strlen(host) + 16); + ch = (char*)malloc(mir_strlen(user) + mir_strlen(host) + 16); ch = (char*)realloc(ch,sprintf(ch,"rcpt to:%s@%s\r\n",user,host)); //!!!!!!!!!! WS_Send(S,"mail from: \r\n",13); - WS_Send(S,ch,(int)strlen(ch)); + WS_Send(S,ch,(int)mir_strlen(ch)); WS_Send(S,"data\r\n",6); WS_Send(S,"From:\r\n\r\n",14); - WS_Send(S,Msg,(int)strlen(Msg)); + WS_Send(S,Msg,(int)mir_strlen(Msg)); WS_Send(S,"\r\n.\r\n",5); WS_Send(S,"quit\r\n",6); SAFE_FREE((void**)&ch); diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index a29faf36c1..c982d21336 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -483,7 +483,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact) dbei.flags = DBEF_SENT | DBEF_UTF; dbei.timestamp = (DWORD)time(NULL); dbei.eventType = 1; - dbei.cbBlob = (DWORD)strlen(buff) + 1; + dbei.cbBlob = (DWORD)mir_strlen(buff) + 1; dbei.pBlob = (PBYTE)buff; db_event_add(hContact, &dbei); mir_free(buff); @@ -498,7 +498,7 @@ void Nudge_ShowStatus(CNudgeElement *n, MCONTACT hContact, DWORD timestamp) dbei.eventType = 1; dbei.flags = DBEF_UTF; dbei.timestamp = timestamp; - dbei.cbBlob = (DWORD)strlen(buff) + 1; + dbei.cbBlob = (DWORD)mir_strlen(buff) + 1; dbei.pBlob = (PBYTE)buff; db_event_add(hContact, &dbei); mir_free(buff); diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index b674d55173..755285c8ca 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -281,7 +281,7 @@ void PasteToWeb::FromClipboard() if (obj != NULL) { LPCSTR cStr = (LPCSTR)GlobalLock(obj); - if (strlen(cStr) > str.length()) + if (mir_strlen(cStr) > str.length()) { str = L""; LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP); diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index 3cf0c407b7..7c4e3f92b9 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -134,7 +134,7 @@ namespace std::string s = quotes_t2a(rsURL.c_str()); const char* psz = s.c_str();//T2CA(rsURL.c_str()); - m_aURL.insert(m_aURL.begin(), psz, psz + strlen(psz) + 1); + m_aURL.insert(m_aURL.begin(), psz, psz + mir_strlen(psz) + 1); return true; } diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 7a59f49016..4c0aab827c 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -146,7 +146,7 @@ BOOL ShowListMainDlgProc_OpenContactMenu(HWND hDlg, HWND hList, int item, LASTUC void wSetData(char **Data, const char *Value) { if (Value[0] != 0) { - char *newData = (char*)mir_alloc(strlen(Value)+3); + char *newData = (char*)mir_alloc(mir_strlen(Value)+3); strcpy(newData, Value); *Data = newData; } @@ -155,7 +155,7 @@ void wSetData(char **Data, const char *Value) void wfree(char **Data) { - if (*Data && strlen(*Data) > 0) mir_free(*Data); + if (*Data && mir_strlen(*Data) > 0) mir_free(*Data); *Data = NULL; } diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index 692b559908..cc646f791c 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -148,7 +148,7 @@ extern "C" int __declspec(dllexport) Load() strcpy(gIniFile, gMirandaDir); // Store last pos - strTmp = &gIniFile[strlen(gIniFile)]; + strTmp = &gIniFile[mir_strlen(gIniFile)]; // Lets try fist name strcpy(strTmp, INI_FILE_NAME); @@ -269,7 +269,7 @@ void RemoveProtocolSettings(const char * protocolName) while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -282,7 +282,7 @@ void RemoveProtocolSettings(const char * protocolName) DeleteSettingEx(protocolName, name); // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } @@ -296,7 +296,7 @@ void RemoveProtocolSettings(const char * protocolName) while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -311,7 +311,7 @@ void RemoveProtocolSettings(const char * protocolName) } // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } } @@ -349,7 +349,7 @@ void RemoveSettings() while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -362,7 +362,7 @@ void RemoveSettings() RemoveProtocolSettings(name); // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } } @@ -377,7 +377,7 @@ void RemoveSettings() while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -390,7 +390,7 @@ void RemoveSettings() DeleteSetting(name); // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } } @@ -407,7 +407,7 @@ void ExecuteServices() while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -421,7 +421,7 @@ void ExecuteServices() CallService(name,0,0); // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } } @@ -461,7 +461,7 @@ void RemoveDirectories() while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -476,7 +476,7 @@ void RemoveDirectories() } // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } } @@ -493,7 +493,7 @@ void DisablePlugins() while(name[0] != '\0') { value = strchr(name, '='); if (value == NULL) - value = &name[strlen(name)]; + value = &name[mir_strlen(name)]; // Has " ? if (*name == '"' && *(value-1) == '"') { @@ -511,7 +511,7 @@ void DisablePlugins() } // Get next one - name = value + strlen(value) + 1; + name = value + mir_strlen(value) + 1; } } } @@ -562,7 +562,7 @@ void DeleteFileOrFolder(const char *name) } else { strcat(tmp, "\\"); - strTmp = &tmp[strlen(tmp)]; + strTmp = &tmp[mir_strlen(tmp)]; } do { @@ -624,7 +624,7 @@ typedef struct { int EnumProc(const char *szName, LPARAM lParam) { DeleteModuleStruct *dms = (DeleteModuleStruct *) lParam; - size_t len = strlen(szName); + size_t len = mir_strlen(szName); if (dms->filter != NULL && dms->lenFilterMinusOne > 0) { if (len >= dms->lenFilterMinusOne) { @@ -660,7 +660,7 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) if (szModule == NULL) return; - lenModule = strlen(szModule); + lenModule = mir_strlen(szModule); if (szModule[0] == '*' || szModule[lenModule-1] == '*') { DeleteModuleStruct dms; memset(&dms, 0, sizeof(dms)); @@ -676,11 +676,11 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) DeleteSettingEx(szModule, szSetting); // Get next one - szModule += strlen(szModule) + 1; + szModule += mir_strlen(szModule) + 1; } } else { - size_t lenSetting = szSetting == NULL ? 0 : strlen(szSetting); + size_t lenSetting = szSetting == NULL ? 0 : mir_strlen(szSetting); if (szSetting == NULL || szSetting[0] == '*' || szSetting[lenSetting-1] == '*') { DeleteModuleStruct dms; DBCONTACTENUMSETTINGS dbces; @@ -703,7 +703,7 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) db_unset(NULL, szModule, szSetting); // Get next one - szSetting += strlen(szSetting) + 1; + szSetting += mir_strlen(szSetting) + 1; } } else { diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 7f87d454f8..7416a33df7 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -498,7 +498,7 @@ static void AppendWithCustomLinks(EventData *evt, int style, char *&buffer, size int lasttoken = 0; size_t len, laststart = 0; if (isAnsii) { - len = strlen(evt->pszText); + len = mir_strlen(evt->pszText); wText = mir_a2u(evt->pszText); } else { diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 7fc1faa605..afb697e2fc 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -32,7 +32,7 @@ wchar_t *a2w(const char *src, int len) wchar_t *wline; int i; if (len < 0) { - len = (int)strlen(src); + len = (int)mir_strlen(src); } wline = (wchar_t*)mir_alloc(2 * (len + 1)); for (i = 0; i < len; i++) { @@ -363,7 +363,7 @@ char to_hex(char code) /* IMPORTANT: be sure to free() the returned string after use */ char *url_encode(char *str) { - char *pstr = str, *buf = (char*)mir_alloc(strlen(str) * 3 + 1), *pbuf = buf; + char *pstr = str, *buf = (char*)mir_alloc(mir_strlen(str) * 3 + 1), *pbuf = buf; while (*pstr) { if ((48 <= *pstr && *pstr <= 57) ||//0-9 (65 <= *pstr && *pstr <= 90) ||//ABC...XYZ diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index da32c4b8d6..eca5257814 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -26,7 +26,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s { char *val = db_get_sa(hContact, szModule, szSetting); if (!val) return NULL; - size_t len = strlen(val) + 64; + size_t len = mir_strlen(val) + 64; char *buf = (LPSTR)mir_alloc(len); strncpy(buf, val, len); mir_free(val); return buf; @@ -34,7 +34,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s int myDBWriteStringEncode(MCONTACT hContact, const char *szModule, const char *szSetting, const char *val) { - int len = (int)strlen(val) + 64; + int len = (int)mir_strlen(val) + 64; char *buf = (LPSTR)alloca(len); strncpy(buf, val, len); int ret = db_set_s(hContact, szModule, szSetting, buf); diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index a40b6c4974..162b6090ab 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -28,8 +28,8 @@ LPSTR InitKeyA(pUinKey ptr, int features) else keysig = (LPSTR)SIG_KEY3; - int slen = (int)strlen(keysig); - int tlen = (int)strlen(pub_text); + int slen = (int)mir_strlen(keysig); + int tlen = (int)mir_strlen(pub_text); LPSTR keyToSend = (LPSTR)mir_alloc(slen + tlen + 1); @@ -106,8 +106,8 @@ LPSTR encrypt(pUinKey ptr, LPCSTR szEncMsg) { LPSTR szSig = (LPSTR)(ptr->offlineKey ? SIG_ENOF : SIG_ENON); - int slen = (int)strlen(szSig); - int clen = (int)strlen(szEncMsg); + int slen = (int)mir_strlen(szSig); + int clen = (int)mir_strlen(szEncMsg); LPSTR szMsg = (LPSTR)mir_alloc(clen + slen + 1); memcpy(szMsg, szSig, slen); @@ -151,7 +151,7 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) } else { ptr->decoded = true; - int olen = (int)strlen(szOldMsg) + 1; + int olen = (int)mir_strlen(szOldMsg) + 1; szNewMsg = (LPSTR)mir_alloc(olen); memcpy(szNewMsg, szOldMsg, olen); } diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index ae51a29c6a..1d561307e4 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -7,7 +7,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText) dbei.flags = DBEF_SENT | DBEF_READ; dbei.timestamp = time(NULL); dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (int)strlen(szText) + 1; + dbei.cbBlob = (int)mir_strlen(szText) + 1; dbei.pBlob = (PBYTE)szText; db_event_add(0, &dbei); } diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 470ffa12de..6d3362a52a 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -311,7 +311,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) char temp[MAX_PATH]; GetTempPath(sizeof(temp), temp); GetLongPathName(temp, TEMP, sizeof(TEMP)); - TEMP_SIZE = (int)strlen(TEMP); + TEMP_SIZE = (int)mir_strlen(TEMP); if (TEMP[TEMP_SIZE - 1] == '\\') { TEMP_SIZE--; TEMP[TEMP_SIZE] = '\0'; diff --git a/plugins/SecureIM/src/mmi.cpp b/plugins/SecureIM/src/mmi.cpp index e75a076472..90b44148ed 100644 --- a/plugins/SecureIM/src/mmi.cpp +++ b/plugins/SecureIM/src/mmi.cpp @@ -23,8 +23,8 @@ void operator delete[](void *p) // ANSIzUCS2z + ANSIzUCS2z = ANSIzUCS2z char* m_wwstrcat(LPCSTR strA, LPCSTR strB) { - int lenA = (int)strlen(strA); - int lenB = (int)strlen(strB); + int lenA = (int)mir_strlen(strA); + int lenB = (int)mir_strlen(strB); LPSTR str = (LPSTR)mir_alloc((lenA + lenB + 1)*(sizeof(WCHAR) + 1)); memcpy(str, strA, lenA); memcpy(str + lenA, strB, lenB + 1); @@ -36,7 +36,7 @@ char* m_wwstrcat(LPCSTR strA, LPCSTR strB) // ANSIz + ANSIzUCS2z = ANSIzUCS2z char* m_awstrcat(LPCSTR strA, LPCSTR strB) { - int lenA = (int)strlen(strA); + int lenA = (int)mir_strlen(strA); LPSTR tmpA = (LPSTR)mir_alloc((lenA + 1)*(sizeof(WCHAR) + 1)); strcpy(tmpA, strA); MultiByteToWideChar(CP_ACP, 0, strA, -1, (LPWSTR)(tmpA + lenA + 1), (lenA + 1)*sizeof(WCHAR)); @@ -48,8 +48,8 @@ char* m_awstrcat(LPCSTR strA, LPCSTR strB) // ANSIz + ANSIz = ANSIzUCS2z char* m_aastrcat(LPCSTR strA, LPCSTR strB) { - int lenA = (int)strlen(strA); - int lenB = (int)strlen(strB); + int lenA = (int)mir_strlen(strA); + int lenB = (int)mir_strlen(strB); LPSTR str = (LPSTR)mir_alloc((lenA + lenB + 1)*(sizeof(WCHAR) + 1)); strcpy(str, strA); strcat(str, strB); @@ -63,7 +63,7 @@ LPSTR m_string = NULL; char* m_ustrcat(LPCSTR strA, LPCSTR strB) { SAFE_FREE(m_string); - m_string = (LPSTR)mir_alloc(strlen(strA) + strlen(strB) + 1); + m_string = (LPSTR)mir_alloc(mir_strlen(strA) + mir_strlen(strB) + 1); strcpy(m_string, strA); strcat(m_string, strB); return m_string; } diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 8e98b92d8b..9db60844c2 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1606,14 +1606,14 @@ LPSTR LoadKeys(LPCSTR file, BOOL priv) LPSTR keys = (LPSTR)mir_alloc(flen + 1); int i = 0; BOOL b = false; while (fgets(keys + i, 128, f)) { - if (!b && strncmp(keys + i, beg, strlen(beg)) == 0) + if (!b && strncmp(keys + i, beg, mir_strlen(beg)) == 0) b = true; - else if (b && strncmp(keys + i, end, strlen(end)) == 0) { - i += (int)strlen(keys + i); + else if (b && strncmp(keys + i, end, mir_strlen(end)) == 0) { + i += (int)mir_strlen(keys + i); b = false; } if (b) - i += (int)strlen(keys + i); + i += (int)mir_strlen(keys + i); } *(keys + i) = '\0'; fclose(f); @@ -1642,7 +1642,7 @@ BOOL SaveExportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) FILE *f = _tfopen(szFile, _T("wb")); if (!f) return FALSE; - fwrite(key, strlen(key), 1, f); + fwrite(key, mir_strlen(key), 1, f); fclose(f); return TRUE; diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index 64e1577ad9..c58cfab9e3 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -5,7 +5,7 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) { Sent_NetLog("split: msg: -----\n%s\n-----\n", szMsg); - size_t len = strlen(szMsg); + size_t len = mir_strlen(szMsg); LPSTR out = (LPSTR)mir_alloc(len * 2); LPSTR buf = out; @@ -58,7 +58,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) pm->message = new LPSTR[part_all]; memset(pm->message, 0, sizeof(LPSTR)*part_all); } - pm->message[part_num] = new char[strlen(szMsg)]; + pm->message[part_num] = new char[mir_strlen(szMsg)]; strcpy(pm->message[part_num], szMsg + 8); Sent_NetLog("combine: save part: %s", pm->message[part_num]); @@ -66,7 +66,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) int len = 0, i; for (i = 0; i < part_all; i++) { if (pm->message[i] == NULL) break; - len += (int)strlen(pm->message[i]); + len += (int)mir_strlen(pm->message[i]); } if (i == part_all) { // combine message SAFE_FREE(ptr->tmp); @@ -93,14 +93,14 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) // îòïðàâëÿåò ñîîáùåíèå, åñëè íàäî òî ðàçáèâàåò íà ÷àñòè int splitMessageSend(pUinKey ptr, LPSTR szMsg) { - int len = (int)strlen(szMsg); + int len = (int)mir_strlen(szMsg); int par = (getContactStatus(ptr->hContact) == ID_STATUS_OFFLINE) ? ptr->proto->split_off : ptr->proto->split_on; if (par && len > par) { int ret; LPSTR msg = splitMsg(szMsg, par); LPSTR buf = msg; while (*buf) { - len = (int)strlen(buf); + len = (int)mir_strlen(buf); LPSTR tmp = mir_strdup(buf); ret = CallContactService(ptr->hContact, PSS_MESSAGE, (WPARAM)PREF_METANODB, (LPARAM)tmp); mir_free(tmp); diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index fb39f770d2..756a2dbf0f 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -110,7 +110,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (ssig == SiG_NONE && ptr->msgSplitted) { Sent_NetLog("onRecvMsg: combine untagged splitted message"); - LPSTR tmp = (LPSTR)mir_alloc(strlen(ptr->msgSplitted) + strlen(szEncMsg) + 1); + LPSTR tmp = (LPSTR)mir_alloc(mir_strlen(ptr->msgSplitted) + mir_strlen(szEncMsg) + 1); strcpy(tmp, ptr->msgSplitted); strcat(tmp, szEncMsg); mir_free(ptr->msgSplitted); @@ -224,7 +224,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) // reinit key exchange user has send an encrypted message and i have no key cpp_reset_context(ptr->cntx); - ptrA reSend((LPSTR)mir_alloc(strlen(szEncMsg) + LEN_RSND)); + ptrA reSend((LPSTR)mir_alloc(mir_strlen(szEncMsg) + LEN_RSND)); strcpy(reSend, SIG_RSND); // copy resend sig strcat(reSend, szEncMsg); // add mess @@ -772,7 +772,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) if (!name) name = file[i]; else name++; - int size = TEMP_SIZE + (int)strlen(name) + 20; + int size = TEMP_SIZE + (int)mir_strlen(name) + 20; char *file_out = (char *)mir_alloc(size); mir_snprintf(file_out, size, "%s\\%s.AESHELL(%d)", TEMP, name, file_idx++); diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index b4ca73fb1f..9f59e6d3ba 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -16,7 +16,7 @@ int __cdecl rsa_inject(HANDLE context, LPCSTR msg) Sent_NetLog("rsa_inject: '%s'", msg); - int len = (int)strlen(msg) + 1; + int len = (int)mir_strlen(msg) + 1; LPSTR buf = (LPSTR)mir_alloc(LEN_SECU + len); memcpy(buf, SIG_SECU, LEN_SECU); memcpy(buf + LEN_SECU, msg, len); diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 2564337948..1c010e02c8 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -377,7 +377,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM TreeView_GetItem(hwndTreeView, &tvItem); protocol = (char*)tvItem.lParam; if ((BOOL)(tvItem.state >> 12) - 1) { - size += (int)strlen(protocol) + 2; + size += (int)mir_strlen(protocol) + 2; if (!watchedProtocols.IsEmpty()) watchedProtocols.AppendChar(' '); watchedProtocols.Append(protocol); diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index bf0d97769d..e86b3ebd4d 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -454,7 +454,7 @@ void CSend::Exit(unsigned int Result) { const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* endTag) { char* begin=strstr(str,startTag); if(!begin) return NULL; - begin+=strlen(startTag)-1; + begin+=mir_strlen(startTag)-1; for(; *begin!='>' && *begin; ++begin); if(*begin){ char* end=strstr(++begin,endTag); @@ -673,15 +673,15 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr,int requestType,char* url,HTTP memset(dataPos,'-',2); dataPos+=2; memcpy(dataPos,boundary,sizeof(boundary)); dataPos+=sizeof(boundary); memcpy(dataPos,"\r\nContent-Disposition: form-data; name=\"",40); dataPos+=40; - size_t namelen=strlen(iter->name), valuelen; + size_t namelen=mir_strlen(iter->name), valuelen; if(!(iter->flags&HTTPFF_INT)) - valuelen=strlen(iter->value_str); + valuelen=mir_strlen(iter->value_str); if(iter->flags&HTTPFF_FILE){ const char* filename =strrchr(iter->value_str,'\\'); if(!filename) filename =strrchr(iter->value_str,'/'); if(!filename) filename =iter->value_str; else ++filename; - valuelen=strlen(filename); + valuelen=mir_strlen(filename); HTTPFormAppendData(nlhr,&dataMax,&dataPos,NULL,namelen+13+valuelen+17); memcpy(dataPos,iter->name,namelen); dataPos+=namelen; memcpy(dataPos,"\"; filename=\"",13); dataPos+=13; @@ -702,7 +702,7 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr,int requestType,char* url,HTTP else if(!strcmp(fileext,".tif") || !strcmp(fileext,".tiff")) mime="image/tiff"; } - HTTPFormAppendData(nlhr,&dataMax,&dataPos,mime,strlen(mime)); + HTTPFormAppendData(nlhr,&dataMax,&dataPos,mime,mir_strlen(mime)); HTTPFormAppendData(nlhr,&dataMax,&dataPos,"\r\n\r\n",4); /// add file content size_t filesize=0; diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index 115e777154..8c7aa8e51b 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -58,7 +58,7 @@ int CSendFTPFile::Send() ********************************************************************************************/ mir_free(m_pszFileName); m_pszFileName = GetFileNameA(m_pszFile); - size_t size = sizeof(char)*(strlen(m_pszFileName)+2); + size_t size = sizeof(char)*(mir_strlen(m_pszFileName)+2); m_pszFileName = (char*)mir_realloc(m_pszFileName, size); m_pszFileName[size-1] = NULL; diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp index 830ce71454..5f563b8005 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp @@ -72,7 +72,7 @@ void CSendHost_Imgur::SendThread(void* obj) mir_free(self->m_URL), self->m_URL=mir_strdup(buf); char* ext=strrchr(self->m_URL,'.'); if(ext){ - size_t thumblen=strlen(self->m_URL)+2; + size_t thumblen=mir_strlen(self->m_URL)+2; mir_free(self->m_URLthumb), self->m_URLthumb=(char*)mir_alloc(thumblen); thumblen=ext-self->m_URL; memcpy(self->m_URLthumb,self->m_URL,thumblen); diff --git a/plugins/SendScreenshotPlus/src/mir_string.cpp b/plugins/SendScreenshotPlus/src/mir_string.cpp index 59d5f7477b..f0c2414085 100644 --- a/plugins/SendScreenshotPlus/src/mir_string.cpp +++ b/plugins/SendScreenshotPlus/src/mir_string.cpp @@ -36,8 +36,8 @@ void mir_stradd(char* &pszDest, const char* pszSrc) if(!pszDest) pszDest = mir_strdup(pszSrc); else { - size_t lenDest = strlen(pszDest); - size_t lenSrc = strlen(pszSrc); + size_t lenDest = mir_strlen(pszDest); + size_t lenSrc = mir_strlen(pszSrc); size_t lenNew = lenDest + lenSrc + 1; pszDest = (char *) mir_realloc(pszDest, sizeof(char)* lenNew); diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 8101b7272b..7a15a7131d 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -42,7 +42,7 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsMarks")); if (szValue) { char *pszBuffer; - if (strlen(szValue) < g_ses_count) { + if (mir_strlen(szValue) < g_ses_count) { pszBuffer = (char*)mir_alloc(g_ses_count + 1); memset(pszBuffer, 0, (g_ses_count + 1)); strcpy(pszBuffer, szValue); @@ -132,7 +132,7 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) if (mode == 0) { ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsMarks")); if (szValue) { - int len = (int)strlen(szValue); + int len = (int)mir_strlen(szValue); if (!len) len = 20; @@ -157,14 +157,14 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsOrder")); if (szValue) { char *pszBuffer; - if (strlen(szValue) < (g_ses_count * 2)) { + if (mir_strlen(szValue) < (g_ses_count * 2)) { pszBuffer = (char*)mir_alloc((g_ses_count * 2) + 1); memset(pszBuffer, 0, ((g_ses_count * 2) + 1)); strcpy(pszBuffer, szValue); } else pszBuffer = mir_strdup(szValue); - int len = (int)strlen(pszBuffer); + int len = (int)mir_strlen(pszBuffer); len = (len == 0) ? 20 : len + 2; char *temp = (char*)_alloca(len + 1); mir_snprintf(temp, len + 1, "%02u%s", ordernum, szValue); diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index a4442d1460..5f77e9b231 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -95,7 +95,7 @@ BOOL AddToList(TAddArgList& args) szThis = args.szFile; args.szFile = szBuf; int cchThis = args.cch; - args.cch = (int)strlen(szBuf) + 1; + args.cch = (int)mir_strlen(szBuf) + 1; // recurse BOOL Result = AddToList(args); // restore diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index 977232ba19..7b30f1bb73 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -443,7 +443,7 @@ static void BuildMenus(TEnumData *lParam) psd->szProfile = "MRU"; psd->fTypes = dtGroup; // the IPC string pointer wont be around forever, must make a copy - psd->cch = (int)strlen(lParam->ipch->MRUMenuName); + psd->cch = (int)mir_strlen(lParam->ipch->MRUMenuName); psd->szText = (LPSTR)HeapAlloc(hDllHeap, 0, psd->cch + 1); lstrcpynA(psd->szText, lParam->ipch->MRUMenuName, sizeof(lParam->ipch->MRUMenuName) - 1); @@ -480,7 +480,7 @@ static void BuildMenus(TEnumData *lParam) RemoveCheckmarkSpace(hGroupMenu); psd = (TMenuDrawInfo*)HeapAlloc(hDllHeap, 0, sizeof(TMenuDrawInfo)); - psd->cch = (int)strlen(lParam->ipch->MirandaName); + psd->cch = (int)mir_strlen(lParam->ipch->MirandaName); psd->szText = (LPSTR)HeapAlloc(hDllHeap, 0, psd->cch + 1); lstrcpynA(psd->szText, lParam->ipch->MirandaName, sizeof(lParam->ipch->MirandaName) - 1); // there may not be a profile name diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index dba1c45e3a..c59d2184e4 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -70,21 +70,21 @@ void log2file(const char *fmt, ...) SetFilePointer(hFile, 0, 0, FILE_END); strncpy(szText, "[\0", SIZEOF(szText)); - WriteFile(hFile, szText, (DWORD)strlen(szText), &dwBytesWritten, NULL); + WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, szText, SIZEOF(szText)); - WriteFile(hFile, szText, (DWORD)strlen(szText), &dwBytesWritten, NULL); + WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); strncpy(szText, "] \0", SIZEOF(szText)); va_start(va, fmt); - mir_vsnprintf(szText + strlen(szText), SIZEOF(szText) - strlen(szText), fmt, va); + mir_vsnprintf(szText + mir_strlen(szText), SIZEOF(szText) - mir_strlen(szText), fmt, va); va_end(va); - WriteFile(hFile, szText, (DWORD)strlen(szText), &dwBytesWritten, NULL); + WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); strncpy(szText, "\n\0", SIZEOF(szText)); - WriteFile(hFile, szText, (DWORD)strlen(szText), &dwBytesWritten, NULL); + WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); CloseHandle(hFile); } diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index ade1d75271..a601350247 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -720,7 +720,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) mir_snprintf(setting, SIZEOF(setting), "LastMsg"); if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv)) { - if (dbv.pszVal && strlen(dbv.pszVal)) { + if (dbv.pszVal && mir_strlen(dbv.pszVal)) { if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2)) { if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal)) { SetDlgItemText(hwndDlg, IDC_EDIT1, dbv2.ptszVal); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 002390a220..deb034e440 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -451,7 +451,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { if (dbv.pszVal) { - if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal)) + if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && mir_strlen(dbv.pszVal)) { if ((dbv2.ptszVal) && (mir_tstrlen(dbv2.ptszVal))) SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal); @@ -606,7 +606,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { if (dbv.pszVal) { - if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal)) + if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && mir_strlen(dbv.pszVal)) { if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal)) SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal); @@ -706,7 +706,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { if (dbv.pszVal) { - if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal)) + if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && mir_strlen(dbv.pszVal)) { if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal)) SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal); @@ -820,7 +820,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { if (dbv.pszVal) { - if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal)) + if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && mir_strlen(dbv.pszVal)) { if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal)) SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal); diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp index 3eef23543d..369d7b5e03 100644 --- a/plugins/SkypeStatusChange/src/main.cpp +++ b/plugins/SkypeStatusChange/src/main.cpp @@ -75,7 +75,7 @@ public: void Module(const char* val) { if (val) - strncpy_s(m_szModule,val,strlen(val)); + strncpy_s(m_szModule,val,mir_strlen(val)); else m_szModule[0] = '\0'; } @@ -180,7 +180,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) const char szSkypeCmdSetStatus[] = "SET USERSTATUS "; ::strncpy_s(szSkypeCmd,szSkypeCmdSetStatus,sizeof(szSkypeCmdSetStatus)/sizeof(szSkypeCmdSetStatus[0])); ::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, SIZEOF(szSkypeCmd) - mir_strlen(szSkypeCmd)); - DWORD cLength = static_cast(strlen(szSkypeCmd)); + DWORD cLength = static_cast(mir_strlen(szSkypeCmd)); COPYDATASTRUCT oCopyData; oCopyData.dwData=0; @@ -204,7 +204,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) ::strncat_s(szSkypeCmd, pMsg, SIZEOF(szSkypeCmd) - mir_strlen(szSkypeCmd)); mir_free(pMsg); - DWORD cLength = static_cast(strlen(szSkypeCmd)); + DWORD cLength = static_cast(mir_strlen(szSkypeCmd)); oCopyData.dwData=0; oCopyData.lpData = szSkypeCmd; diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index 298fae1a2f..894545ed74 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -71,7 +71,7 @@ bool SmileyCType::CreateTriggerText(char* text) { UrlDecode(text); - int len = (int)strlen(text); + int len = (int)mir_strlen(text); if (len == 0) return false; unsigned reslen; diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 8ccde91d0b..0d39bbac4b 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -93,10 +93,10 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl) const char* szPref = strstr(szUrl, "://"); szPref = szPref ? szPref + 3 : szUrl; szPath = strchr(szPref, '/'); - rlen = szPath != NULL ? szPath - szUrl : strlen(szUrl); + rlen = szPath != NULL ? szPath - szUrl : mir_strlen(szUrl); } - szRedirUrl = (char*)mir_realloc(szRedirUrl, rlen + strlen(nlhrReply->headers[i].szValue)*3 + 1); + szRedirUrl = (char*)mir_realloc(szRedirUrl, rlen + mir_strlen(nlhrReply->headers[i].szValue)*3 + 1); strncpy(szRedirUrl, szUrl, rlen); strcpy(szRedirUrl+rlen, nlhrReply->headers[i].szValue); diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index d7b7518182..b1d8720b02 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -16,8 +16,8 @@ int CheckBayes() char bayesdb_tmp[MAX_PATH]; char* tmp = Utils_ReplaceVars("%miranda_userdata%"); - if (tmp[strlen(tmp)-1] == '\\') - tmp[strlen(tmp)-1] = 0; + if (tmp[mir_strlen(tmp)-1] == '\\') + tmp[mir_strlen(tmp)-1] = 0; mir_snprintf(bayesdb_tmp, SIZEOF(bayesdb_tmp), "%s\\%s", tmp, BAYESDB_PATH); mir_free(tmp); @@ -49,8 +49,8 @@ int OpenBayes() } else { tmp = Utils_ReplaceVars("%miranda_userdata%"); - if (tmp[strlen(tmp)-1] == '\\') - tmp[strlen(tmp)-1] = 0; + if (tmp[mir_strlen(tmp)-1] == '\\') + tmp[mir_strlen(tmp)-1] = 0; strcpy(bayesdb_fullpath, tmp); strcat(bayesdb_fullpath, "\\"BAYESDB_PATH); mir_free(tmp); @@ -81,8 +81,8 @@ int OpenBayes() #ifdef _DEBUG tmp = Utils_ReplaceVars("%miranda_userdata%"); - if (tmp[strlen(tmp)-1] == '\\') - tmp[strlen(tmp)-1] = 0; + if (tmp[mir_strlen(tmp)-1] == '\\') + tmp[mir_strlen(tmp)-1] = 0; mir_snprintf(bayesdb_fullpath, SIZEOF(bayesdb_fullpath), "%s\\%s\\%s", tmp, BAYESDB_PATH, BAYESDBG_FILENAME); mir_free(tmp); bayesdb_fullpath_utf8 = mir_utf8encode(bayesdb_fullpath); @@ -99,7 +99,7 @@ int OpenBayes() char *tokenhash(const char *token, BYTE *digest) { - mir_md5_hash((BYTE *)token, (int)strlen(token), digest); + mir_md5_hash((BYTE *)token, (int)mir_strlen(token), digest); return (char*)digest; } @@ -140,13 +140,13 @@ BOOL is_token_valid(char *token) { unsigned int i; // skip digits only tokens - for (i = 0; i < strlen(token); i++) { + for (i = 0; i < mir_strlen(token); i++) { if ((unsigned char)token[i] >= 48 && (unsigned char)token[i] <= 57) return FALSE; } // skip 1- and 2-character tokens - if (strlen(token) < 3) + if (mir_strlen(token) < 3) return FALSE; // skip "www", "com", "org", etc. @@ -239,7 +239,7 @@ void queue_message(MCONTACT hContact, DWORD msgtime, TCHAR *message) sqlite3_bind_int(stmt, 1, (DWORD)hContact); sqlite3_bind_int(stmt, 2, msgtime); tmp = mir_u2a(message); - sqlite3_bind_text(stmt, 3, tmp, (int)strlen(tmp), NULL); + sqlite3_bind_text(stmt, 3, tmp, (int)mir_strlen(tmp), NULL); sqlite3_step(stmt); mir_free(tmp); sqlite3_finalize(stmt); @@ -353,7 +353,7 @@ void learn(int type, TCHAR *msg) #ifdef _DEBUG sqlite3_prepare_v2(bayesdbg, sql_select, -1, &stmtdbg, NULL); - sqlite3_bind_text(stmtdbg, 1, tok, (int)strlen(tok), NULL); + sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), NULL); if (SQLITE_ROW == sqlite3_step(stmtdbg)) { sqlite3_finalize(stmtdbg); sqlite3_prepare_v2(bayesdbg, sql_update, -1, &stmtdbg, NULL); @@ -361,7 +361,7 @@ void learn(int type, TCHAR *msg) sqlite3_finalize(stmtdbg); sqlite3_prepare_v2(bayesdbg, sql_insert, -1, &stmtdbg, NULL); } - sqlite3_bind_text(stmtdbg, 1, tok, (int)strlen(tok), SQLITE_STATIC); + sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), SQLITE_STATIC); sqlite3_step(stmtdbg); sqlite3_finalize(stmtdbg); #endif diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 4ce453a710..f37ae252db 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -135,7 +135,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) } else if (dbei->eventType == EVENTTYPE_AUTHREQUEST) { msgblob = (char *)(dbei->pBlob + sizeof(DWORD) + sizeof(HANDLE)); for(a=4;a>0;a--) - msgblob += strlen(msgblob)+1; + msgblob += mir_strlen(msgblob)+1; } if (dbei->flags & DBEF_UTF) @@ -464,7 +464,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) } else { if (_getOptB("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval)) { DBVARIANT _dbv; - DWORD dbei_size = 3*sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)strlen(dbei->szModule)+1; + DWORD dbei_size = 3*sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule)+1; PBYTE eventdata = (PBYTE)malloc(dbei_size); PBYTE pos = eventdata; if (eventdata != NULL && dbei->cbBlob > 0) { @@ -478,9 +478,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) memcpy(pos, &dbei->eventType, sizeof(WORD)); memcpy(pos+sizeof(WORD), &dbei->flags, sizeof(DWORD)); memcpy(pos+sizeof(WORD)+sizeof(DWORD), &dbei->timestamp, sizeof(DWORD)); - memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2, dbei->szModule, strlen(dbei->szModule)+1); - memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2+strlen(dbei->szModule)+1, &dbei->cbBlob, sizeof(DWORD)); - memcpy(pos+sizeof(WORD)+sizeof(DWORD)*3+strlen(dbei->szModule)+1, dbei->pBlob, dbei->cbBlob); + memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2, dbei->szModule, mir_strlen(dbei->szModule)+1); + memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2+mir_strlen(dbei->szModule)+1, &dbei->cbBlob, sizeof(DWORD)); + memcpy(pos+sizeof(WORD)+sizeof(DWORD)*3+mir_strlen(dbei->szModule)+1, dbei->pBlob, dbei->cbBlob); db_set_blob(hContact, PLUGIN_NAME, "LastMsgEvents", eventdata, (pos - eventdata) + dbei_size); free(eventdata); } diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 22ca8df42b..81d1493fa7 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -454,7 +454,7 @@ int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage) } return 0; } -#define DOT(a) (a[strlen(a)-1] == 46) ? "" : "." +#define DOT(a) (a[mir_strlen(a)-1] == 46) ? "" : "." int LogToSystemHistory(char *message, char *origmessage) { char msg[MAX_BUFFER_LENGTH]; @@ -497,9 +497,9 @@ void MarkUnread(MCONTACT hContact) memcpy(&_dbei.flags, pos, sizeof(DWORD)); pos += sizeof(DWORD); memcpy(&_dbei.timestamp, pos, sizeof(DWORD)); pos += sizeof(DWORD); - _dbei.szModule = (char*)malloc(strlen((const char*)pos)+1); + _dbei.szModule = (char*)malloc(mir_strlen((const char*)pos)+1); strcpy(_dbei.szModule, (const char*)pos); - pos += strlen((const char*)pos)+1; + pos += mir_strlen((const char*)pos)+1; memcpy(&_dbei.cbBlob, pos, sizeof(DWORD)); pos += sizeof(DWORD); _dbei.pBlob = (PBYTE)malloc(_dbei.cbBlob); diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index e8793501f4..6f1dbf8546 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -193,8 +193,8 @@ void SplashMain() #ifdef _DEBUG logMessage(_T("Found file"), ffd.cFileName); #endif - //files = new char[strlen(ffd.cFileName)]; - //files[filescount] = new char[strlen(ffd.cFileName)]; + //files = new char[mir_strlen(ffd.cFileName)]; + //files[filescount] = new char[mir_strlen(ffd.cFileName)]; TCHAR ext[5]; wmemcpy(ext, ffd.cFileName + (mir_tstrlen(ffd.cFileName) - 4), 5); diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index f97af44c44..24fdfe117a 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -78,7 +78,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv; if ( !db_get(NULL, MODULENAME, StatusModeToDbSetting(statusModeList[i],SETTING_STATUSMSG), &dbv)) { - settings[count]->msg = ( char* )malloc(strlen(dbv.pszVal) + 1); + settings[count]->msg = ( char* )malloc(mir_strlen(dbv.pszVal) + 1); strcpy(settings[count]->msg, dbv.pszVal); db_free(&dbv); } diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 10f36e80da..8551cf26fa 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -931,7 +931,7 @@ 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 && strlen(ps[i]->szName) > 0) { + if (_tcslen(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); diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 159bb8182c..19200e5f9d 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -79,27 +79,27 @@ static char* GetCMDLArguments(TSettingsList& protoSettings) return NULL; char *cmdl, *pnt; - pnt = cmdl = ( char* )malloc(strlen(protoSettings[0].szName) + strlen(GetStatusDesc(protoSettings[0].status)) + 4); + pnt = cmdl = ( char* )malloc(mir_strlen(protoSettings[0].szName) + mir_strlen(GetStatusDesc(protoSettings[0].status)) + 4); for (int i=0; i < protoSettings.getCount(); i++ ) { *pnt++ = '/'; strcpy(pnt, protoSettings[i].szName); - pnt += strlen(protoSettings[i].szName); + pnt += mir_strlen(protoSettings[i].szName); *pnt++ = '='; strcpy(pnt, GetStatusDesc(protoSettings[i].status)); - pnt += strlen(GetStatusDesc(protoSettings[i].status)); + pnt += mir_strlen(GetStatusDesc(protoSettings[i].status)); if (i != protoSettings.getCount()-1) { *pnt++ = ' '; *pnt++ = '\0'; - cmdl = ( char* )realloc(cmdl, strlen(cmdl) + strlen(protoSettings[i+1].szName) + strlen(GetStatusDesc(protoSettings[i+1].status)) + 4); - pnt = cmdl + strlen(cmdl); + cmdl = ( char* )realloc(cmdl, mir_strlen(cmdl) + mir_strlen(protoSettings[i+1].szName) + mir_strlen(GetStatusDesc(protoSettings[i+1].status)) + 4); + pnt = cmdl + mir_strlen(cmdl); } } if ( db_get_b( NULL, MODULENAME, SETTING_SHOWDIALOG, FALSE ) == TRUE ) { *pnt++ = ' '; *pnt++ = '\0'; - cmdl = ( char* )realloc(cmdl, strlen(cmdl) + 12); - pnt = cmdl + strlen(cmdl); + cmdl = ( char* )realloc(cmdl, mir_strlen(cmdl) + 12); + pnt = cmdl + mir_strlen(cmdl); strcpy(pnt, "/showdialog"); pnt += 11; *pnt = '\0'; @@ -113,12 +113,12 @@ static char* GetCMDL(TSettingsList& protoSettings) char path[MAX_PATH]; GetModuleFileNameA(NULL, path, MAX_PATH); - char* cmdl = ( char* )malloc(strlen(path) + 4); - mir_snprintf(cmdl, strlen(path) + 4, "\"%s\" ", path); + char* cmdl = ( char* )malloc(mir_strlen(path) + 4); + mir_snprintf(cmdl, mir_strlen(path) + 4, "\"%s\" ", path); char* args = GetCMDLArguments(protoSettings); if ( args ) { - cmdl = ( char* )realloc(cmdl, strlen(cmdl) + strlen(args) + 1); + cmdl = ( char* )realloc(cmdl, mir_strlen(cmdl) + mir_strlen(args) + 1); strcat(cmdl, args); free(args); } @@ -924,7 +924,7 @@ static int ClearDatabase(char* filter) dbces.pfnEnumProc = DeleteSetting; CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces); for (i=0; i < settingCount; i++) { - if ((filter == NULL) || (!strncmp(filter, settings[i], strlen(filter)))) + if ((filter == NULL) || (!strncmp(filter, settings[i], mir_strlen(filter)))) db_unset(NULL, MODULENAME, settings[i]); free(settings[i]); } @@ -945,7 +945,7 @@ static int CountSettings(const char *szSetting,LPARAM lParam) static int DeleteSetting(const char *szSetting,LPARAM lParam) { char** settings = (char**)*(char ***)lParam; - settings[settingIndex] = ( char* )malloc(strlen(szSetting)+1); + settings[settingIndex] = ( char* )malloc(mir_strlen(szSetting)+1); strcpy(settings[settingIndex], szSetting); settingIndex += 1; diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index 2c2e8c9343..845c8c30b2 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -84,7 +84,7 @@ static BYTE showDialogOnStartup = 0; static PROTOCOLSETTINGEX* IsValidProtocol(TSettingsList& protoSettings, char* protoName) { for (int i = 0; i < protoSettings.getCount(); i++) - if (!strncmp(protoSettings[i].szName, protoName, strlen(protoSettings[i].szName))) + if (!strncmp(protoSettings[i].szName, protoName, mir_strlen(protoSettings[i].szName))) return &protoSettings[i]; return NULL; diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index d1be25ef01..4e56ea72ef 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -365,7 +365,7 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags) Event.eventType = event_type; Event.flags = flags | DBEF_UTF; Event.timestamp = (DWORD)time(NULL); - Event.cbBlob = (DWORD)strlen(data)+1; + Event.cbBlob = (DWORD)mir_strlen(data)+1; Event.pBlob = (PBYTE)_strdup(data); db_event_add(hContact, &Event); } diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 99f52c3f17..12c2b064dd 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -289,7 +289,7 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM) szFromStream = ::Message_GetFromStream(GetDlgItem(m_hwnd, IDC_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII); if (szFromStream != NULL) { - iLength = iStreamLength = (strlen(szFromStream) + 1); + iLength = iStreamLength = (mir_strlen(szFromStream) + 1); if (iLength > 0 && m_history != NULL) { // XXX: iLength > 1 ? if ((m_iHistoryTop == m_iHistorySize) && oldTop == 0) { // shift the stack down... diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index ba31f8a055..ddd0fe2350 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -165,7 +165,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP { CLISTEVENT *cli = (CLISTEVENT *)CallService(MS_CLIST_GETEVENT, (WPARAM)INVALID_HANDLE_VALUE, 0); if (cli != NULL) { - if (strncmp(cli->pszService, "SRMsg/TypingMessage", strlen(cli->pszService))) { + if (strncmp(cli->pszService, "SRMsg/TypingMessage", mir_strlen(cli->pszService))) { CallService(cli->pszService, 0, (LPARAM)cli); break; } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 81ae18d9a8..d4c9949748 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2668,7 +2668,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int flags = 0; char *utfResult = mir_utf8encodeT(decoded); - size_t memRequired = strlen(utfResult) + 1; + size_t memRequired = mir_strlen(utfResult) + 1; // try to detect RTL HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE); @@ -2780,7 +2780,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR *szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf dbei.pBlob = (BYTE*)szText; db_event_get(hDBEvent, &dbei); - int iSize = int(strlen((char*)dbei.pBlob)) + 1; + int iSize = int(mir_strlen((char*)dbei.pBlob)) + 1; bool bNeedsFree = false; TCHAR *szConverted; diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 7dabdf9235..3815595ffa 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -99,7 +99,7 @@ public: static void AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename); ////////////////////////////////////////////////////////////////////////////////////// - // safe strlen function - do not overflow the given buffer length + // safe mir_strlen function - do not overflow the given buffer length // if the buffer does not contain a valid (zero-terminated) string, it // will return 0. // diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 623b25f81c..9d4c23a4ec 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -450,11 +450,11 @@ bool GetSubstText(MCONTACT hContact, const DISPLAYSUBST &ds, TCHAR *buff, int bu bool GetRawSubstText(MCONTACT hContact, char *szRawSpec, TCHAR *buff, int bufflen) { - size_t lenght = strlen(szRawSpec); + size_t lenght = mir_strlen(szRawSpec); for (size_t i = 0; i < lenght; i++) { if (szRawSpec[i] == '/') { szRawSpec[i] = 0; - if (strlen(szRawSpec) == 0) { + if (mir_strlen(szRawSpec) == 0) { char *szProto = GetContactProto(hContact); if (szProto) { if (translations[0].transFunc(hContact, szProto, &szRawSpec[i + 1], buff, bufflen) != 0) diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 55fadc002f..ff655894f6 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -696,7 +696,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP WCHAR wszProto[128]; long lLen = MultiByteToWideChar(CP_ACP, 0, ppProtos[i]->szModuleName, - (int)strlen(ppProtos[i]->szModuleName), wszProto, SIZEOF(wszProto)); + (int)mir_strlen(ppProtos[i]->szModuleName), wszProto, SIZEOF(wszProto)); wszProto[lLen] = L'\0'; lvi.pszText = wszProto; @@ -914,7 +914,7 @@ TCHAR *CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR * WCHAR wszProto[32]; - long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)strlen(szProto), wszProto, SIZEOF(wszProto)); + long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)mir_strlen(szProto), wszProto, SIZEOF(wszProto)); wszProto[lLen] = _T('\0'); mir_sntprintf(szString, iBufSize - 1, szFormatString, wszProto, _T(": "), szContactName); diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index b9777f9570..4749b7f457 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -1178,7 +1178,7 @@ void CreateProtocolList(void) // for (i = 0; i < NumberOfAccounts; i++) { - ProtoList[i].name = (char*)mir_alloc(strlen(acc[i]->szModuleName) + 1); + 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))); _tcscpy(ProtoList[i].tszAccountName, acc[i]->tszAccountName); diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 4d63814a8b..bdbd4cfd6c 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -192,7 +192,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, for (i = j = 0; (j < NumberOfAccounts) && (i < optionCount) ; i++) if ((options[i].dwFlag & OPTTREE_INVISIBLE) && !options[i].szSettingName) { - options[i].szSettingName = (char*)mir_alloc(1 + strlen(ProtoList[j].name)); + 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); options[i].szOptionName = (TCHAR*)mir_alloc(sizeof(TCHAR) * l); diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 37f7cfbce9..3d4942e84f 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -146,7 +146,7 @@ unsigned int hashSettingW_M2(const char * key) unsigned int hashSetting_M2(const char * key) { if (key == NULL) return 0; - const unsigned int len = (unsigned int)strlen((const char*)key); + const unsigned int len = (unsigned int)mir_strlen((const char*)key); return hash_M2(key, len); } diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h index dc8b7b2f66..940553dac9 100644 --- a/plugins/UserInfoEx/src/commonheaders.h +++ b/plugins/UserInfoEx/src/commonheaders.h @@ -89,7 +89,7 @@ using namespace std; * UserInfoEx plugin includes and macros ***********************************************************************************************************/ -#pragma intrinsic(memcmp, memcpy, memset, strcmp, strlen) +#pragma intrinsic(memcmp, memcpy, memset, strcmp, mir_strlen) #ifndef MIR_OK #define MIR_OK 0 // success value of a miranda service function diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index d0f2a7e6f7..f5f1e05bee 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -161,7 +161,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) LPSTR p1, p2 = NULL; LPSTR pszUIDValue, pszUIDSetting, pszProto = NULL; LPSTR pszBuf = &row[0]; - size_t cchBuf = strlen(row); + size_t cchBuf = mir_strlen(row); MIR_FREE(_pszProtoOld); MIR_FREE(_pszProto); @@ -207,7 +207,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) // create valid nickname _pszNick = mir_strdup(pszBuf); - size_t i = strlen(_pszNick)-1; + size_t i = mir_strlen(_pszNick)-1; while (i > 0 && (_pszNick[i] == ' ' || _pszNick[i] == '\t')) { _pszNick[i] = 0; i--; diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 803afccde9..f2082b398b 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -72,7 +72,7 @@ static void InitAlteredPlacesBar() if (!CallService(MS_DB_GETPROFILEPATH, SIZEOF(szProfilePath), (LPARAM)szProfilePath)) { // only add if different from profile path - RegSetValueExA(hkPlacesBar, "Place4", 0, REG_SZ, (PBYTE)szProfilePath, (DWORD)strlen(szProfilePath) + 1); + RegSetValueExA(hkPlacesBar, "Place4", 0, REG_SZ, (PBYTE)szProfilePath, (DWORD)mir_strlen(szProfilePath) + 1); } RegCloseKey(hkPlacesBar); diff --git a/plugins/UserInfoEx/src/ex_import/tinystr.cpp b/plugins/UserInfoEx/src/ex_import/tinystr.cpp index dcab417a21..1041e8f037 100644 --- a/plugins/UserInfoEx/src/ex_import/tinystr.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinystr.cpp @@ -110,7 +110,7 @@ TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) TiXmlString operator + (const TiXmlString & a, const char* b) { TiXmlString tmp; - TiXmlString::size_type b_len = static_cast(strlen(b)); + TiXmlString::size_type b_len = static_cast(mir_strlen(b)); tmp.reserve(a.length() + b_len); tmp += a; tmp.append(b, b_len); @@ -120,7 +120,7 @@ TiXmlString operator + (const TiXmlString & a, const char* b) TiXmlString operator + (const char* a, const TiXmlString & b) { TiXmlString tmp; - TiXmlString::size_type a_len = static_cast(strlen(a)); + TiXmlString::size_type a_len = static_cast(mir_strlen(a)); tmp.reserve(a_len + b.length()); tmp.append(a, a_len); tmp += b; diff --git a/plugins/UserInfoEx/src/ex_import/tinystr.h b/plugins/UserInfoEx/src/ex_import/tinystr.h index bc854c8ac5..9c66f2b7e9 100644 --- a/plugins/UserInfoEx/src/ex_import/tinystr.h +++ b/plugins/UserInfoEx/src/ex_import/tinystr.h @@ -82,7 +82,7 @@ class TiXmlString // TiXmlString constructor, based on a string TIXML_EXPLICIT TiXmlString (const char * copy) { - init(static_cast(strlen(copy))); + init(static_cast(mir_strlen(copy))); memcpy(start(), copy, length()); } @@ -102,7 +102,7 @@ class TiXmlString // = operator TiXmlString& operator = (const char * copy) { - return assign(copy, (size_type)strlen(copy)); + return assign(copy, (size_type)mir_strlen(copy)); } // = operator @@ -115,7 +115,7 @@ class TiXmlString // += operator. Maps to append TiXmlString& operator += (const char * suffix) { - return append(suffix, static_cast(strlen(suffix))); + return append(suffix, static_cast(mir_strlen(suffix))); } // += operator. Maps to append diff --git a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp index 0faa453a14..2c815d536c 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp @@ -114,7 +114,7 @@ void TiXmlBase::PutString(const TIXML_STRING& str, TIXML_STRING* outString) //*ME: warning C4267: convert 'size_t' to 'int' //*ME: Int-Cast to make compiler happy ... - outString->append(buf, (int)strlen(buf)); + outString->append(buf, (int)mir_strlen(buf)); ++i; } else diff --git a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp index 04203f2f7a..40f271cb3e 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp @@ -501,7 +501,7 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE { if (strncmp(entity[i].str, p, entity[i].strLength) == 0) { - assert(strlen(entity[i].str) == entity[i].strLength); + assert(mir_strlen(entity[i].str) == entity[i].strLength); *value = entity[i].chr; *length = 1; return (p + entity[i].strLength); @@ -616,7 +616,7 @@ const char* TiXmlBase::ReadText( const char* p, } } } - return p + strlen(endTag); + return p + mir_strlen(endTag); } #ifdef TIXML_USE_STL @@ -1315,7 +1315,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco document->SetError(TIXML_ERROR_PARSING_COMMENT, p, data, encoding); return 0; } - p += strlen(startTag); + p += mir_strlen(startTag); p = ReadText(p, &value, false, endTag, false, encoding); return p; } @@ -1467,7 +1467,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin document->SetError(TIXML_ERROR_PARSING_CDATA, p, data, encoding); return 0; } - p += strlen(startTag); + p += mir_strlen(startTag); // Keep all the white space, ignore the encoding, etc. while ( p && *p diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index ff9ea7eb14..9aa4809852 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -324,7 +324,7 @@ void RebuildGroup() CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; - char* tDest = text + strlen(text); + char* tDest = text + mir_strlen(text); // support new genmenu style mi.flags = CMIF_ROOTHANDLE; @@ -421,7 +421,7 @@ void RebuildSubGroup() CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; - char* tDest = text + strlen(text); + char* tDest = text + mir_strlen(text); // support new genmenu style mi.flags = CMIF_ROOTHANDLE; @@ -551,7 +551,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; - char* tDest = text + strlen( text ); + char* tDest = text + mir_strlen( text ); // support new genmenu style mi.flags = CMIF_ROOTHANDLE; diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp index 0e43a41517..d68ba2cb07 100644 --- a/plugins/UserInfoEx/src/mir_string.cpp +++ b/plugins/UserInfoEx/src/mir_string.cpp @@ -25,7 +25,7 @@ char* mir_strncat_c(char *pszDest, const char cSrc) { size_t size = 2; if (pszDest != NULL) - size += strlen(pszDest); //cSrc = 1 + 1 forNULL temination + size += mir_strlen(pszDest); //cSrc = 1 + 1 forNULL temination char *pszRet = (char *)mir_realloc(pszDest, (sizeof(char) * size)); if (pszRet == NULL) @@ -54,7 +54,7 @@ wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc) char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo) { char *pszReturn = NULL; - size_t sizeNew, sizeLen = strlen(pszDest); + size_t sizeNew, sizeLen = mir_strlen(pszDest); if (sizeFrom >= 0 && sizeFrom < sizeLen && sizeTo >= 0 && sizeTo <= sizeLen && sizeFrom < sizeTo) { sizeNew = sizeLen - (sizeTo - sizeFrom); size_t sizeCopy = sizeNew - sizeFrom; diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index b32516bd20..bcc90fa7b2 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -89,7 +89,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) LPSTR szUrl; INT_PTR len; - len = mir_strlen(val) + strlen("mailto:"); + len = mir_strlen(val) + mir_strlen("mailto:"); szUrl = (LPSTR)_alloca(len + 1); diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index a972c9f6c4..5391b1bcf4 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -34,7 +34,7 @@ static inline size_t __blen(const T *str) template<> static inline size_t __blen(const char *str) { - return strlen(str); + return mir_strlen(str); } template<> diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index da723406ce..5ccc20cea5 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -255,7 +255,7 @@ int getContactFromString(CONTACTSINFO *ci) TCHAR *cInfo = getContactInfoT(CNF_UNIQUEID, hContact); if (cInfo) { - size_t size = _tcslen(cInfo) + strlen(szProto) + 4; + size_t size = _tcslen(cInfo) + mir_strlen(szProto) + 4; szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR)); if (szFind != NULL) { mir_sntprintf(szFind, size, _T("<%S:%s>"), szProto, cInfo); @@ -416,7 +416,7 @@ TCHAR* encodeContactToString(MCONTACT hContact) if (szProto == NULL || tszUniqueId == NULL) return NULL; - size_t size = _tcslen(tszUniqueId) + strlen(szProto) + 4; + size_t size = _tcslen(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 e19b39e297..a76a3a15e9 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -246,7 +246,7 @@ static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) { while (*cur != 0) { if (*cur == '\t') { *cur = 0; - helpText = ( char* )mir_realloc(helpText, strlen(helpText)+1); + helpText = ( char* )mir_realloc(helpText, mir_strlen(helpText)+1); TCHAR *res = mir_a2t(helpText); mir_free(helpText); @@ -266,7 +266,7 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr) if (tr == NULL) return NULL; - char *cur = tr->szHelpText + strlen(tr->szHelpText); + char *cur = tr->szHelpText + mir_strlen(tr->szHelpText); while (cur > tr->szHelpText) { if (*cur == '\t') { @@ -314,7 +314,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr) } else args = NULL; - size_t len = _tcslen(tr->tszTokenString) + (args!=NULL?strlen(args):0) + 3; + size_t len = _tcslen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; TCHAR *desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR)); if (desc == NULL) { mir_free(helpText); diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index a28f0d844c..557f5be2eb 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -168,9 +168,9 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) if (szArgs != NULL && argc > 0) { szArgsA = mir_t2a(szArgs); - size_t size = 32 + strlen(szArgsA); + size_t size = 32 + mir_strlen(szArgsA); szHelp = (char *)mir_alloc(size); - memset(szHelp, '\0', 32 + strlen(szArgsA)); + memset(szHelp, '\0', 32 + mir_strlen(szArgsA)); mir_snprintf(szHelp, size, LPGEN("Alias")"\t(%s)\t"LPGEN("user defined"), szArgsA); res = registerIntToken(alias, parseTranslateAlias, TRF_FUNCTION | TRF_UNPARSEDARGS, szHelp); mir_free(szArgsA); diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 4843b6557f..c1c6f405ac 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -29,20 +29,20 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) return NULL; size_t cur = 0; - while (cur < strlen(res)) { + while (cur < mir_strlen(res)) { if (((*(res + cur) >= '0') && (*(res + cur) <= '9')) || ((*(res + cur) >= 'a') && (*(res + cur) <= 'z')) || ((*(res + cur) >= 'A') && (*(res + cur) <= 'Z'))) { cur++; continue; } - res = (char*)mir_realloc(res, strlen(res) + 4); + res = (char*)mir_realloc(res, mir_strlen(res) + 4); if (res == NULL) return NULL; char hex[8]; - memmove(res + cur + 3, res + cur + 1, strlen(res + cur + 1) + 1); + memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1); mir_snprintf(hex, SIZEOF(hex), "%%%x", *(res + cur)); - strncpy(res + cur, hex, strlen(hex)); - cur += strlen(hex); + strncpy(res + cur, hex, mir_strlen(hex)); + cur += mir_strlen(hex); } TCHAR *tres = mir_a2t(res); @@ -60,18 +60,18 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) return NULL; unsigned int cur = 0; - while (cur < strlen(res)) { - if ((*(res + cur) == '%') && (strlen(res + cur) >= 3)) { + while (cur < mir_strlen(res)) { + if ((*(res + cur) == '%') && (mir_strlen(res + cur) >= 3)) { char hex[8]; memset(hex, '\0', sizeof(hex)); strncpy(hex, res + cur + 1, 2); *(res + cur) = (char)strtol(hex, NULL, 16); - memmove(res + cur + 1, res + cur + 3, strlen(res + cur + 3) + 1); + memmove(res + cur + 1, res + cur + 3, mir_strlen(res + cur + 3) + 1); } cur++; } - res = (char*)mir_realloc(res, strlen(res) + 1); + res = (char*)mir_realloc(res, mir_strlen(res) + 1); TCHAR *tres = mir_a2t(res); mir_free(res); return tres; diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index f6dec5c4d0..a60aa9871a 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -475,7 +475,7 @@ static TCHAR* parseSpecialContact(ARGUMENTSINFO *ai) if (szUniqueID == NULL) return NULL; - size_t size = strlen(szProto) + _tcslen(szUniqueID) + 4; + size_t size = mir_strlen(szProto) + _tcslen(szUniqueID) + 4; TCHAR *res = (TCHAR*)mir_alloc(size * sizeof(TCHAR)); if (res == NULL) return NULL; diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 421e0616c3..fc92c323bc 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -329,12 +329,12 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) // if the var contains the escape character, this character must be doubled, we don't want it to act as an esacpe char /*for (tcur=parsedToken;*tcur != '\0';tcur++) { if (*tcur == DONTPARSE_CHAR) {//|| (*(var+pos) == ')')) { - parsedToken = mir_realloc(parsedToken, strlen(parsedToken) + 2); + parsedToken = mir_realloc(parsedToken, mir_strlen(parsedToken) + 2); if (parsedToken == NULL) { fi->err = EMEM; return NULL; } - memcpy(tcur+1, tcur, strlen(tcur)+1); + memcpy(tcur+1, tcur, mir_strlen(tcur)+1); tcur++; } }*/ diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index 00063245b9..3364662c6e 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -84,12 +84,12 @@ int Parser() // ReStart(); return 1; } - if(strlen(tmp2) > 2) + if(mir_strlen(tmp2) > 2) { strcpy(tmp, "password "); strcat(tmp, tmp2); strcat(tmp, "\n"); - Netlib_Send(ghConnection, tmp, (int)strlen(tmp), 0); + Netlib_Send(ghConnection, tmp, (int)mir_strlen(tmp), 0); recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); if(recvResult == SOCKET_ERROR) { @@ -99,14 +99,14 @@ int Parser() } mir_free(tmp2); } - Netlib_Send(ghConnection, "status\n", (int)strlen("status\n"), 0); + Netlib_Send(ghConnection, "status\n", (int)mir_strlen("status\n"), 0); recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); if(recvResult == SOCKET_ERROR) { mir_forkthread(&ReStart, 0); return 1; } - Netlib_Send(ghConnection, "currentsong\n", (int)strlen("currentsong\n"), 0); + Netlib_Send(ghConnection, "currentsong\n", (int)mir_strlen("currentsong\n"), 0); recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); if(recvResult == SOCKET_ERROR) { @@ -379,22 +379,22 @@ int SendCommand(HWND, int command, int) switch (command) { case WAT_CTRL_PREV: - Netlib_Send(ghConnection, "previous\n", (int)strlen("previous\n"), 0); + Netlib_Send(ghConnection, "previous\n", (int)mir_strlen("previous\n"), 0); return 0; case WAT_CTRL_PLAY: //add resuming support if(gbState != WAT_PLS_PAUSED) - Netlib_Send(ghConnection, "play\n", (int)strlen("play\n"), 0); + Netlib_Send(ghConnection, "play\n", (int)mir_strlen("play\n"), 0); else - Netlib_Send(ghConnection, "pause 0\n", (int)strlen("pause 0\n"), 0); + Netlib_Send(ghConnection, "pause 0\n", (int)mir_strlen("pause 0\n"), 0); return 0; case WAT_CTRL_PAUSE: - Netlib_Send(ghConnection, "pause 1\n", (int)strlen("pause 1\n"), 0); + Netlib_Send(ghConnection, "pause 1\n", (int)mir_strlen("pause 1\n"), 0); return 0; case WAT_CTRL_STOP: - Netlib_Send(ghConnection, "stop\n", (int)strlen("stop\n"), 0); + Netlib_Send(ghConnection, "stop\n", (int)mir_strlen("stop\n"), 0); return 0; case WAT_CTRL_NEXT: - Netlib_Send(ghConnection, "next\n", (int)strlen("next\n"), 0); + Netlib_Send(ghConnection, "next\n", (int)mir_strlen("next\n"), 0); return 0; case WAT_CTRL_VOLDN: return 0; diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index a29a666ce7..c3e1774746 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -432,7 +432,7 @@ void TrimString(char *str) { size_t len, start; - len = strlen(str); + len = mir_strlen(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); @@ -458,7 +458,7 @@ void ConvertBackslashes(char *str) case 't': *pstr = '\t'; break; default: *pstr = pstr[1]; break; } - memmove(pstr+1, pstr+2, strlen(pstr+2)+1); + memmove(pstr+1, pstr+2, mir_strlen(pstr+2)+1); } } } // replace spaces with _T("%20" @@ -467,7 +467,7 @@ void ConvertBackslashes(char *str) char *GetSearchStr(char *dis) { char *pstr = dis; - size_t len = strlen(dis); + size_t len = mir_strlen(dis); while (*pstr != 0) { if (*pstr == ' ') diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index fd33528024..e49019e489 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -89,7 +89,7 @@ WEATHERINFO LoadWeatherInfo(MCONTACT hContact) int DBGetData(MCONTACT hContact, char *setting, DBVARIANT *dbv) { if ( db_get_ts(hContact, WEATHERCONDITION, setting, dbv)) { - size_t len = strlen(setting) + 1; + size_t len = mir_strlen(setting) + 1; char *set = (char*)alloca(len + 1); *set = '#'; memcpy(set + 1, setting, len); @@ -371,7 +371,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData) void wSetData(char **Data, const char *Value) { if (Value[0] != 0) { - char *newData = (char*)mir_alloc(strlen(Value) + 3); + char *newData = (char*)mir_alloc(mir_strlen(Value) + 3); strcpy(newData, Value); *Data = newData; } @@ -398,7 +398,7 @@ void wSetData(WCHAR **Data, const WCHAR *Value) // Data = the string occuping the data to be freed void wfree(char **Data) { - if (*Data && strlen(*Data) > 0) + if (*Data && mir_strlen(*Data) > 0) mir_free(*Data); *Data = NULL; } diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 930d2ea828..4fcb96d091 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -350,7 +350,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) if (Line[1] != '/') { // if it is not a footer (for old ini) // save the group name - Temp = (char *)mir_alloc(strlen(Line)+10); + Temp = (char *)mir_alloc(mir_strlen(Line)+10); strncpy(Temp, Line+1, chop-Line-1); Temp[chop-Line-1] = 0; wfree(&Group); @@ -380,7 +380,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) if (Value == NULL) continue; // get the string before '=' (ValName) and after '=' (Value) - ValName = (char *)mir_alloc(strlen(Line)+1); + ValName = (char *)mir_alloc(mir_strlen(Line)+1); strncpy(ValName, Line, Value-Line); ValName[Value-Line] = 0; Value++; @@ -470,7 +470,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) } } // recalculate memory used - Data->MemUsed += (strlen(Value) + 10); + Data->MemUsed += (mir_strlen(Value) + 10); wfree(&ValName); } // calcualate memory used for the ini and close the file diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index b202fcd56b..c16649a62a 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -195,7 +195,7 @@ int UpdateWeather(MCONTACT hContact) dbei.flags = DBEF_READ|DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; dbei.pBlob = (PBYTE)mir_utf8encodeT(str2); - dbei.cbBlob = (DWORD)strlen((char*)dbei.pBlob)+1; + dbei.cbBlob = (DWORD)mir_strlen((char*)dbei.pBlob)+1; db_event_add(hContact, &dbei); } diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 8592a9ac9c..92679003b7 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -243,7 +243,7 @@ void SaveToFile(MCONTACT hContact, char *truncated) mir_snprintf(timestring, SIZEOF(timestring), "(%s)%s\n%s,%s\n", MODULENAME, url, temptime1, temptime2); fputs(timestring, pfile); - fwrite(truncated, strlen(truncated), 1, pfile); + fwrite(truncated, mir_strlen(truncated), 1, pfile); fputs("\n\n", pfile); fclose(pfile); } @@ -443,13 +443,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if ((pcachefile = _tfopen(newcachepath, _T("w"))) == NULL) WErrorPopup((MCONTACT)contactname, TranslateT("Cannot write to file 1")); else { - fwrite(tempraw, strlen(tempraw), 1, pcachefile); //smaller cache + fwrite(tempraw, mir_strlen(tempraw), 1, pcachefile); //smaller cache fclose(pcachefile); db_set_ts(hContact, MODULENAME, CACHE_FILE_KEY, newcachepath); } // end write to cache - if (strncmp(tempraw, cachecompare, strlen(tempraw)) != 0) { //lets try this instead + if (strncmp(tempraw, cachecompare, mir_strlen(tempraw)) != 0) { //lets try this instead // play sound? SkinPlaySound("webviewalert"); // there was an alert @@ -533,13 +533,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn memset(&alertpos, 0, sizeof(alertpos)); //end string alertpos = strstr(tempraw, Alerttempstring2); - statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2); + statalertposend = alertpos - tempraw + (int)mir_strlen(Alerttempstring2); if (statalertpos > statalertposend) { memset(&tempraw, ' ', statalertpos); memset(&alertpos, 0, sizeof(alertpos)); alertpos = strstr(tempraw, Alerttempstring2); - statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2); + statalertposend = alertpos - tempraw + (int)mir_strlen(Alerttempstring2); } if (statalertpos < statalertposend) { @@ -551,13 +551,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn //end string alertpos = strstr(tempraw, Alerttempstring2); - statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2); + statalertposend = alertpos - tempraw + (int)mir_strlen(Alerttempstring2); if (statalertpos > statalertposend) { memset(&tempraw, ' ', statalertpos); memset(&alertpos, 0, sizeof(alertpos)); alertpos = strstr(tempraw, Alerttempstring2); - statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2); + statalertposend = alertpos - tempraw + (int)mir_strlen(Alerttempstring2); } disalertpos = 0; @@ -655,12 +655,12 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if ((pcachefile = _tfopen(newcachepath, _T("w"))) == NULL) WErrorPopup((MCONTACT)contactname, TranslateT("Cannot write to file 2")); else { - fwrite(raw, strlen(raw), 1, pcachefile); //smaller cache + fwrite(raw, mir_strlen(raw), 1, pcachefile); //smaller cache db_set_ts(hContact, MODULENAME, CACHE_FILE_KEY, newcachepath); fclose(pcachefile); } // end write to cache - if (strncmp(raw, cachecompare, (strlen(raw))) != 0) { //lets try this instead + if (strncmp(raw, cachecompare, (mir_strlen(raw))) != 0) { //lets try this instead // play sound? SkinPlaySound("webviewalert"); // there was an alert @@ -760,7 +760,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn } } } - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); return wasAlert; } diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index f6336cb83f..67a4ee5a1d 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -380,13 +380,13 @@ void CodetoSymbol(char *truncated) position = stringfrompos - truncated; counter = 0; - while (counter != strlen(CharacterCodes[n])) { + while (counter != mir_strlen(CharacterCodes[n])) { truncated[position + counter] = ' '; counter++; } truncated[(position + counter) - 1] = Characters[n]; - strncpy(&truncated[position], &truncated[position + strlen(CharacterCodes[n])] - 1, strlen(&truncated[position]) - 1); + strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1); } // end does character code exist? if (recpos == position) @@ -584,7 +584,7 @@ void EraseBlock(char *truncated) positionStart = 0; positionEnd = 0; - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -625,7 +625,7 @@ void EraseSymbols(char *truncated) recpos = position; } - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -678,7 +678,7 @@ void NumSymbols(char *truncated) recpos = position; } - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -703,7 +703,7 @@ void FastTagFilter(char *truncated) } } - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -745,7 +745,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) tempraw[counter] = ' '; } // end for - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -760,7 +760,7 @@ void RemoveTabs(char *truncated) if (tempraw[counter] == '\t') tempraw[counter] = ' '; - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -779,7 +779,7 @@ void Removewhitespace(char *truncated) counter2++; pos2 = counter2; - strncpy(&truncated[pos1], &truncated[pos2], strlen(&truncated[pos1]) - 1); + strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1); } // end if } // end for } @@ -792,7 +792,7 @@ void Filter(char *truncated) for (int counter = 0; counter < mir_strlen(tempraw); counter++) if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t')) - strncpy(&tempraw[counter], &tempraw[counter + 1], strlen(&tempraw[counter]) - 1); + strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1); - strncpy(truncated, tempraw, strlen(truncated)); + strncpy(truncated, tempraw, mir_strlen(truncated)); } diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 0f98327ede..6982a6b8ef 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -62,15 +62,15 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara free(tempbuffer); Filter(buff); - CharUpperBuffA(buff, (int)strlen(buff)); + CharUpperBuffA(buff, (int)mir_strlen(buff)); GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, SIZEOF(NewSearchstr)); - CharUpperBuffA(NewSearchstr, (int)strlen(NewSearchstr)); + CharUpperBuffA(NewSearchstr, (int)mir_strlen(NewSearchstr)); OLDstartposition = startposition; if ((strstr(Searchstr, NewSearchstr)) != 0) - startposition = loc + (int)strlen(Searchstr); + startposition = loc + (int)mir_strlen(Searchstr); else { oldloc = 0; startposition = 0; @@ -78,7 +78,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara strcpy(Searchstr, NewSearchstr); - if (!(startposition > strlen(buff))) + if (!(startposition > mir_strlen(buff))) location = (strstr(buff + startposition, NewSearchstr)) - buff; oldloc = loc; @@ -88,14 +88,14 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara ShowWindow(GetDlgItem(hwndDlg, IDC_SEARCH_COMPLETE), SW_SHOW); loc = (strstr(buff, NewSearchstr)) - buff; startsel = loc; - endsel = loc + (int)strlen(NewSearchstr); + endsel = loc + (int)mir_strlen(NewSearchstr); oldloc = 0; startposition = 0; } else { ShowWindow(GetDlgItem(hwndDlg, IDC_SEARCH_COMPLETE), SW_HIDE); startsel = loc; - endsel = loc + (int)strlen(NewSearchstr); + endsel = loc + (int)mir_strlen(NewSearchstr); } CHARRANGE sel2 = {startsel, endsel}; diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 5563711733..a542e21c0a 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -101,7 +101,7 @@ void GetData(void *param) db_free(&dbv); } - if (strlen(url) < 3) + if (mir_strlen(url) < 3) WErrorPopup(hContact, TranslateT("URL not supplied")); NETLIBHTTPREQUEST nlhr = { sizeof(nlhr) }; @@ -194,13 +194,13 @@ void GetData(void *param) memset(&pos, 0, sizeof(pos)); // XXX: looks bad. // end string pos = strstr(truncated2, tempstring2); - statposend = pos - truncated2 + (int)strlen(tempstring2); + statposend = pos - truncated2 + (int)mir_strlen(tempstring2); if (statpos > statposend) { memset(&truncated2, ' ', statpos); memset(&pos, 0, sizeof(pos)); // XXX: looks bad. pos = strstr(truncated2, tempstring2); - statposend = pos - truncated2 + (int)strlen(tempstring2); + statposend = pos - truncated2 + (int)mir_strlen(tempstring2); } if (statpos < statposend) { memset(&raw, 0, sizeof(raw)); @@ -215,13 +215,13 @@ void GetData(void *param) // end string pos = strstr(truncated2, tempstring2); - statposend = pos - truncated2 + (int)strlen(tempstring2); + statposend = pos - truncated2 + (int)mir_strlen(tempstring2); if (statpos > statposend) { memset(&truncated2, ' ', statpos); memset(&pos, 0, sizeof(pos)); // XXX pos = strstr(truncated2, tempstring2); - statposend = pos - truncated2 + (int)strlen(tempstring2); + statposend = pos - truncated2 + (int)mir_strlen(tempstring2); } dispos = 0; @@ -437,13 +437,13 @@ LBL_Stop: TCHAR *statusText = TranslateT("Processing data stopped by user."); goto LBL_Stop; // removed any excess characters at the end. - if ((truncated[strlen(truncated) - 1] == truncated[strlen(truncated) - 2]) && (truncated[strlen(truncated) - 2] == truncated[strlen(truncated) - 3])) { + if ((truncated[mir_strlen(truncated) - 1] == truncated[mir_strlen(truncated) - 2]) && (truncated[mir_strlen(truncated) - 2] == truncated[mir_strlen(truncated) - 3])) { int counterx = 0; while (true) { counterx++; - if (truncated[strlen(truncated) - counterx] != truncated[strlen(truncated) - 1]) { - truncated[(strlen(truncated) - counterx) + 2] = '\0'; + if (truncated[mir_strlen(truncated) - counterx] != truncated[mir_strlen(truncated) - 1]) { + truncated[(mir_strlen(truncated) - counterx) + 2] = '\0'; break; } } diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 4b77d61724..cebcf5a6ca 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -333,7 +333,7 @@ int DoExport(TCHAR *fileName) char *szProto = GetContactProto(hContact); TCHAR *szHandle = GetContactID(hContact, szProto); - if ((szHandle) && (strlen(szProto) > 0)) + if ((szHandle) && (mir_strlen(szProto) > 0)) _ftprintf(fout, _T(BIRTHDAYS_EXPORT_FORMAT), szHandle, szProto, day, month, year); if (szHandle) diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 56db42471e..37b4e9ef11 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -50,7 +50,7 @@ int Log(char *format, ...) str[tBytes] = 0; va_end(vararg); - if (str[strlen(str) - 1] != '\n') + if (str[mir_strlen(str) - 1] != '\n') strcat(str, "\n"); fputs(str, fout); fclose(fout); @@ -114,7 +114,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName dbv.type = DBVT_ASCIIZ; if (db_get(hContact, szModule, szSettingName, &dbv) == 0) { res = 0; - size_t tmp = strlen(dbv.pszVal); + size_t tmp = mir_strlen(dbv.pszVal); len = (tmp < size - 1) ? tmp : size - 1; strncpy(szResult, dbv.pszVal, len); szResult[len] = '\0'; @@ -123,7 +123,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName else { res = 1; if (szError) { - size_t tmp = strlen(szError); + size_t tmp = mir_strlen(szError); len = (tmp < size - 1) ? tmp : size - 1; strncpy(szResult, szError, len); szResult[len] = '\0'; diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index f438bbf655..590c812355 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -750,7 +750,7 @@ DWORD WriteStringToFile(HANDLE File, char *Source) DWORD Length, WrittenBytes; char null = 0; - if ((Source == NULL) || !(Length = (DWORD)strlen(Source))) { + if ((Source == NULL) || !(Length = (DWORD)mir_strlen(Source))) { if (!WriteFile(File, &null, 1, &WrittenBytes, NULL)) { CloseHandle(File); return EACC_SYSTEM; diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 213779ff26..d2bd20ef05 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -103,7 +103,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n"); #endif - int size = (int)(strlen(ActualAccount->Name) + strlen(Translate(BADCONNECTTITLE))); + int size = (int)(mir_strlen(ActualAccount->Name) + mir_strlen(Translate(BADCONNECTTITLE))); TitleStrA = new char[size]; mir_snprintf(TitleStrA, size, Translate(BADCONNECTTITLE), ActualAccount->Name); diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index f08a71bcf3..b1b1df711b 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -407,12 +407,12 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (RunMailBrowser) { - size_t len = strlen(ActualAccount->Name) + strlen(Translate(MAILBROWSERTITLE)) + 10; //+10 chars for numbers + size_t len = mir_strlen(ActualAccount->Name) + mir_strlen(Translate(MAILBROWSERTITLE)) + 10; //+10 chars for numbers char *TitleStrA = new char[len]; WCHAR *TitleStrW = new WCHAR[len]; mir_snprintf(TitleStrA, len, Translate(MAILBROWSERTITLE), ActualAccount->Name, MN.Real.DisplayUC + MN.Virtual.DisplayUC, MN.Real.Display + MN.Virtual.Display); - MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, TitleStrA, -1, TitleStrW, (int)strlen(TitleStrA) + 1); + MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, TitleStrA, -1, TitleStrW, (int)mir_strlen(TitleStrA) + 1); SetWindowTextW(hDlg, TitleStrW); delete[] TitleStrA; delete[] TitleStrW; @@ -1088,7 +1088,7 @@ ULONGLONG MimeDateToFileTime(char *datein) if (year) { st.wYear = atoi(year); - if (strlen(year) < 4) if (st.wYear < 70)st.wYear += 2000; else st.wYear += 1900; + if (mir_strlen(year) < 4) if (st.wYear < 70)st.wYear += 2000; else st.wYear += 1900; }; if (month) for (int i = 0; i < 12; i++) if (strncmp(month, s_MonthNames[i], 3) == 0) { st.wMonth = i + 1; break; } if (day) st.wDay = atoi(day); @@ -1107,12 +1107,12 @@ ULONGLONG MimeDateToFileTime(char *datein) else { st.wHour = st.wMinute = st.wSecond = 0; } if (shift) { - if (strlen(shift) < 4) { + if (mir_strlen(shift) < 4) { //has only hour wShiftSeconds = (atoi(shift)) * 3600; } else { - char *smin = shift + strlen(shift) - 2; + char *smin = shift + mir_strlen(shift) - 2; int ismin = atoi(smin); smin[0] = 0; int ishour = atoi(shift); @@ -1444,12 +1444,12 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (!_strnicmp(contentType, "text", 4)) { if (transEncoding) { if (!_stricmp(transEncoding, "base64")) { - int size = (int)strlen(body) * 3 / 4 + 5; + int size = (int)mir_strlen(body) * 3 / 4 + 5; localBody = new char[size + 1]; DecodeBase64(body, localBody, size); } else if (!_stricmp(transEncoding, "quoted-printable")) { - int size = (int)strlen(body) + 2; + int size = (int)mir_strlen(body) + 2; localBody = new char[size + 1]; DecodeQuotedPrintable(body, localBody, size, FALSE); } diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index 2f2d3d1069..5b7d699558 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -97,8 +97,8 @@ void DebugLog(HANDLE File,const char *fmt,...) str=(char *)realloc(str,strsize+=65536); va_end(vararg); EnterCriticalSection(&FileAccessCS); - WriteFile(File,tids,(DWORD)strlen(tids),&Written,NULL); - WriteFile(File,str,(DWORD)strlen(str),&Written,NULL); + WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL); + WriteFile(File,str,(DWORD)mir_strlen(str),&Written,NULL); LeaveCriticalSection(&FileAccessCS); free(str); } @@ -118,7 +118,7 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...) str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR)); va_end(vararg); EnterCriticalSection(&FileAccessCS); - WriteFile(File,tids,(DWORD)strlen(tids),&Written,NULL); + WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL); WriteFile(File,str,(DWORD)wcslen(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 64bbc47ad1..f2a0837e7b 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -227,7 +227,7 @@ int GetCharsetFromString(char *input,size_t size) DebugLog(DecodeFile,"%s",pout); #endif for (int i=0;iNext=new YAMNMAIL; Browser=Browser->Next; } - Browser->ID=new char[strlen(From->ID)+1]; + Browser->ID=new char[mir_strlen(From->ID)+1]; strcpy(Browser->ID,From->ID); Browser->Number=From->Number; Browser->Flags=From->Flags; diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index 0be13215dc..0c7449bf94 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -200,7 +200,7 @@ char *ExtractFromContentType(char *ContentType,char *value) while((temp>ContentType) && WS(temp)) temp--; //now we have to find, if the word "Charset=" is located after ';' like "; Charset=" if (*temp != ';' && !ENDLINE(temp) && temp != ContentType) return NULL; - finder=finder+strlen(value); //jump over value string + finder=finder+mir_strlen(value); //jump over value string while(WS(finder)) finder++; //jump over whitespaces temp=finder; @@ -301,7 +301,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) ToLower(ContentType); if (NULL != (CharSetStr=ExtractFromContentType(ContentType,"charset="))) { - head->CP=GetCharsetFromString(CharSetStr,strlen(CharSetStr)); + head->CP=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr)); delete[] CharSetStr; } delete[] ContentType; @@ -505,7 +505,7 @@ struct APartDataType void ParseAPart(APartDataType *data) { - size_t len = strlen(data->Src); + size_t len = mir_strlen(data->Src); try { char *finder=data->Src; @@ -581,7 +581,7 @@ void ParseAPart(APartDataType *data) { MessageBox(NULL, TranslateT("Translate header error"), _T(""), 0); } - if (data->body) data->bodyLen = (int)strlen(data->body); + if (data->body) data->bodyLen = (int)mir_strlen(data->body); } //from decode.cpp @@ -592,7 +592,7 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out); WCHAR *ParseMultipartBody(char *src, char *bond) { char *srcback = _strdup(src); - size_t sizebond = strlen(bond); + size_t sizebond = mir_strlen(bond); int numparts = 1; int i; char *courbond = srcback; @@ -618,7 +618,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond) char *CharSetStr; if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) { - partData[i].CodePage=GetCharsetFromString(CharSetStr,strlen(CharSetStr)); + partData[i].CodePage=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr)); delete[] CharSetStr; } } @@ -662,32 +662,32 @@ FailBackRaw: if (i) { // part before first boudary should not have headers char infoline[1024]; size_t linesize = 0; mir_snprintf(infoline, SIZEOF(infoline), "%s %d", Translate("Part"), i); - linesize = strlen(infoline); + linesize = mir_strlen(infoline); if (partData[i].TransEnc) { mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].TransEnc); - linesize = strlen(infoline); + linesize = mir_strlen(infoline); } if (partData[i].ContType) { char *CharSetStr=strchr(partData[i].ContType,';'); if (CharSetStr) { CharSetStr[0]=0; mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].ContType); - linesize = strlen(infoline); + linesize = mir_strlen(infoline); partData[i].ContType=CharSetStr+1; if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) { mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", CharSetStr); - linesize = strlen(infoline); + linesize = mir_strlen(infoline); delete[] CharSetStr; } if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) { mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; \"%s\"", CharSetStr); - linesize = strlen(infoline); + linesize = mir_strlen(infoline); delete[] CharSetStr; } } else { mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].ContType); - linesize = strlen(infoline); + linesize = mir_strlen(infoline); } } mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, ".\r\n"); diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index 0e1e9ab5a5..7f24b0a5db 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -146,7 +146,7 @@ void CNLClient::Send(const char *query) throw(DWORD) #endif try { - if ((SOCKET_ERROR==(Sent=LocalNetlib_Send(hConnection,query,(int)strlen(query),MSG_DUMPASTEXT))) || Sent != (unsigned int)strlen(query)) + if ((SOCKET_ERROR==(Sent=LocalNetlib_Send(hConnection,query,(int)mir_strlen(query),MSG_DUMPASTEXT))) || Sent != (unsigned int)mir_strlen(query)) { SystemError=WSAGetLastError(); throw NetworkError=(DWORD)ENL_SEND; diff --git a/plugins/YAMN/src/proto/pop3/pop3.cpp b/plugins/YAMN/src/proto/pop3/pop3.cpp index a66c85e7af..f03a7d8a99 100644 --- a/plugins/YAMN/src/proto/pop3/pop3.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3.cpp @@ -243,8 +243,8 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp) throw POP3Error=(DWORD)EPOP3_APOP; mir_md5_state_s ctx; mir_md5_init(&ctx); - mir_md5_append(&ctx,(const unsigned char *)timestamp,(unsigned int)strlen(timestamp)); - mir_md5_append(&ctx,(const unsigned char *)pw,(unsigned int)strlen(pw)); + mir_md5_append(&ctx,(const unsigned char *)timestamp,(unsigned int)mir_strlen(timestamp)); + mir_md5_append(&ctx,(const unsigned char *)pw,(unsigned int)mir_strlen(pw)); mir_md5_finish(&ctx, digest); char hexdigest[40]; diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index aed070df27..3941b2a270 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -976,15 +976,15 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara } GetDlgItemTextA(hDlg, IDC_EDITAPP, Text, SIZEOF(Text)); - if (CheckApp && !(Length = strlen(Text))) { + if (CheckApp && !(Length = mir_strlen(Text))) { MessageBox(hDlg,TranslateT("Please select application to run"),TranslateT("Input error"),MB_OK); break; } GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, Text, SIZEOF(Text)); - if ( !( Length = strlen(Text))) { + if ( !( Length = mir_strlen(Text))) { GetDlgItemTextA(hDlg,IDC_EDITNAME, Text, SIZEOF(Text)); - if ( !(Length = strlen( Text ))) + if ( !(Length = mir_strlen( Text ))) break; } @@ -1037,29 +1037,29 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara #endif GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, SIZEOF(Text)); - if ( !(Length = strlen( Text ))) + if ( !(Length = mir_strlen( Text ))) break; if (NULL != ActualAccount->Name) delete[] ActualAccount->Name; - ActualAccount->Name = new char[ strlen(Text)+1]; + ActualAccount->Name = new char[ mir_strlen(Text)+1]; strcpy(ActualAccount->Name,Text); GetDlgItemTextA(hDlg,IDC_EDITSERVER,Text,SIZEOF(Text)); if (NULL != ActualAccount->Server->Name) delete[] ActualAccount->Server->Name; - ActualAccount->Server->Name=new char[ strlen(Text)+1]; + ActualAccount->Server->Name=new char[ mir_strlen(Text)+1]; strcpy(ActualAccount->Server->Name,Text); GetDlgItemTextA(hDlg,IDC_EDITLOGIN,Text,SIZEOF(Text)); if (NULL != ActualAccount->Server->Login) delete[] ActualAccount->Server->Login; - ActualAccount->Server->Login=new char[ strlen(Text)+1]; + ActualAccount->Server->Login=new char[ mir_strlen(Text)+1]; strcpy(ActualAccount->Server->Login,Text); GetDlgItemTextA(hDlg,IDC_EDITPASS,Text,SIZEOF(Text)); if (NULL != ActualAccount->Server->Passwd) delete[] ActualAccount->Server->Passwd; - ActualAccount->Server->Passwd=new char[ strlen(Text)+1]; + ActualAccount->Server->Passwd=new char[ mir_strlen(Text)+1]; strcpy(ActualAccount->Server->Passwd,Text); GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,SIZEOF(TextW)); diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 310eb5eece..d6f3d80d44 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -73,7 +73,7 @@ int ProtoAck(WPARAM,LPARAM lparam) dbei.timestamp = ltime; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (DWORD)strlen(p->msgText) + 1; + dbei.cbBlob = (DWORD)mir_strlen(p->msgText) + 1; dbei.pBlob = (PBYTE)p->msgText; db_event_add(hForwardTo, &dbei); } diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index 863a4648e9..75b4e8f75f 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -55,7 +55,7 @@ void ReadAvailableGroups() { mir_snprintf(tmp, SIZEOF(tmp), "%d", index); GetStringFromDatabase(NULL, CLIST_GROUPS, tmp, NULL, group, sizeof(group)); - if (strlen(group) > 0) + if (mir_strlen(group) > 0) { availableGroups.Add(_strdup(group + 1)); index += 1; @@ -124,7 +124,7 @@ void CreateGroup(char *group) while ((p = strchr(sub, '\\'))) { *p = 0; - if (strlen(buffer) > 0) + if (mir_strlen(buffer) > 0) { strncat(buffer, "\\", SIZEOF(buffer) - mir_strlen(buffer)); strncat(buffer, sub, SIZEOF(buffer) - mir_strlen(buffer)); @@ -144,7 +144,7 @@ void CreateGroup(char *group) if (sub) { - if (strlen(buffer) > 0) + if (mir_strlen(buffer) > 0) { strncat(buffer, "\\", SIZEOF(buffer) - mir_strlen(buffer)); strncat(buffer, sub, SIZEOF(buffer) - mir_strlen(buffer)); @@ -171,7 +171,7 @@ void YahooMoveCallback(MCONTACT hContact, char *unused) char protocol[128] = {0}; GetContactProtocol(hContact, protocol, sizeof(protocol)); - if (strlen(protocol) > 0) + if (mir_strlen(protocol) > 0) { char ygroup[128] = {0}; diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index 7c7fede24f..a2306b69b2 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -55,7 +55,7 @@ int Log(char *format, ...) } va_end(vararg); - if (str[strlen(str) - 1] != '\n') + if (str[mir_strlen(str) - 1] != '\n') { strcat(str, "\n"); } @@ -141,7 +141,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName if (db_get_s(hContact, szModule, szSettingName, &dbv) == 0) { res = 0; - int tmp = (int)strlen(dbv.pszVal); + int tmp = (int)mir_strlen(dbv.pszVal); len = (tmp < size - 1) ? tmp : size - 1; strncpy(szResult, dbv.pszVal, len); szResult[len] = '\0'; @@ -151,7 +151,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 1; if (szError) { - int tmp = (int)strlen(szError); + int tmp = (int)mir_strlen(szError); len = (tmp < size - 1) ? tmp : size - 1; strncpy(szResult, szError, len); szResult[len] = '\0'; -- cgit v1.2.3