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 +- protocols/AimOscar/src/avatars.cpp | 2 +- protocols/AimOscar/src/away.cpp | 6 +- protocols/AimOscar/src/client.cpp | 72 +++++------ protocols/AimOscar/src/conv.cpp | 118 +++++++++--------- protocols/AimOscar/src/file.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 6 +- protocols/AimOscar/src/proxy.cpp | 4 +- protocols/AimOscar/src/server.cpp | 4 +- protocols/AimOscar/src/ui.cpp | 6 +- protocols/AimOscar/src/utility.cpp | 14 +-- protocols/EmLanProto/src/mlan.cpp | 12 +- protocols/FacebookRM/src/connection.cpp | 2 +- protocols/FacebookRM/src/proto.cpp | 4 +- protocols/FacebookRM/src/theme.cpp | 2 +- protocols/FacebookRM/src/utils.cpp | 4 +- protocols/GTalkExt/src/inbox.cpp | 2 +- protocols/Gadu-Gadu/src/avatar.cpp | 8 +- protocols/Gadu-Gadu/src/core.cpp | 2 +- protocols/Gadu-Gadu/src/dialogs.cpp | 4 +- protocols/Gadu-Gadu/src/dynstuff.cpp | 8 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 12 +- protocols/Gadu-Gadu/src/gg.cpp | 4 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 44 +++---- protocols/Gadu-Gadu/src/import.cpp | 2 +- protocols/Gadu-Gadu/src/oauth.cpp | 24 ++-- protocols/Gadu-Gadu/src/ownerinfo.cpp | 2 +- protocols/Gadu-Gadu/src/services.cpp | 2 +- protocols/Gadu-Gadu/src/userutils.cpp | 2 +- protocols/ICQCorp/src/corp.cpp | 6 +- protocols/ICQCorp/src/packet.cpp | 2 +- protocols/ICQCorp/src/protocol.cpp | 20 +-- protocols/ICQCorp/src/services.cpp | 6 +- protocols/ICQCorp/src/transfer.cpp | 6 +- protocols/IRCG/src/commandmonitor.cpp | 2 +- protocols/IRCG/src/irclib.cpp | 4 +- protocols/IRCG/src/options.cpp | 2 +- protocols/IcqOscarJ/src/stdpackets.cpp | 4 +- protocols/JabberG/src/jabber_archive.cpp | 2 +- protocols/JabberG/src/jabber_frame.cpp | 4 +- protocols/JabberG/src/jabber_menu.cpp | 8 +- protocols/JabberG/src/jabber_misc.cpp | 6 +- protocols/JabberG/src/jabber_opt.cpp | 2 +- protocols/JabberG/src/jabber_privacy.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 26 ++-- protocols/JabberG/src/jabber_rc.cpp | 2 +- protocols/JabberG/src/jabber_secur.cpp | 28 ++--- protocols/JabberG/src/jabber_thread.cpp | 12 +- protocols/JabberG/src/jabber_util.cpp | 2 +- protocols/MRA/src/MraProto.cpp | 6 +- protocols/MRA/src/MraSendCommand.cpp | 2 +- protocols/MRA/src/Mra_functions.cpp | 2 +- protocols/MRA/src/Mra_menus.cpp | 4 +- protocols/MRA/src/Mra_proto.cpp | 2 +- protocols/MSN/src/msn_auth.cpp | 12 +- protocols/MSN/src/msn_commands.cpp | 46 +++---- protocols/MSN/src/msn_ftold.cpp | 8 +- protocols/MSN/src/msn_libstr.cpp | 4 +- protocols/MSN/src/msn_mail.cpp | 10 +- protocols/MSN/src/msn_menu.cpp | 4 +- protocols/MSN/src/msn_mime.cpp | 8 +- protocols/MSN/src/msn_misc.cpp | 44 +++---- protocols/MSN/src/msn_opts.cpp | 4 +- protocols/MSN/src/msn_p2p.cpp | 8 +- protocols/MSN/src/msn_proto.cpp | 26 ++-- protocols/MSN/src/msn_soapab.cpp | 32 ++--- protocols/MSN/src/msn_soapstore.cpp | 26 ++-- protocols/MSN/src/msn_ssl.cpp | 2 +- protocols/Sametime/src/options.cpp | 2 +- protocols/Sametime/src/sametime_session.cpp | 2 +- protocols/Sametime/src/userlist.cpp | 8 +- protocols/SkypeClassic/src/debug.cpp | 4 +- protocols/SkypeClassic/src/filexfer.cpp | 8 +- protocols/SkypeClassic/src/skype.cpp | 38 +++--- protocols/SkypeClassic/src/skypeapi.cpp | 50 ++++---- protocols/SkypeWeb/src/skype_db.cpp | 2 +- protocols/SkypeWeb/src/skype_menus.cpp | 2 +- protocols/SkypeWeb/src/skype_proto.cpp | 6 +- protocols/Steam/src/Steam/authorization.h | 6 +- protocols/Steam/src/Steam/friend_list.h | 6 +- protocols/Steam/src/Steam/login.h | 4 +- protocols/Steam/src/Steam/message.h | 6 +- protocols/Steam/src/Steam/pending.h | 6 +- protocols/Steam/src/Steam/session.h | 2 +- protocols/Steam/src/steam_menus.cpp | 2 +- protocols/Steam/src/steam_utils.cpp | 4 +- protocols/Tlen/src/tlen.cpp | 8 +- protocols/Tlen/src/tlen_avatar.cpp | 16 +-- protocols/Tlen/src/tlen_file.cpp | 4 +- protocols/Tlen/src/tlen_iqid.cpp | 2 +- protocols/Tlen/src/tlen_list.cpp | 6 +- protocols/Tlen/src/tlen_misc.cpp | 6 +- protocols/Tlen/src/tlen_p2p_old.cpp | 6 +- protocols/Tlen/src/tlen_presence.cpp | 6 +- protocols/Tlen/src/tlen_svc.cpp | 18 +-- protocols/Tlen/src/tlen_thread.cpp | 8 +- protocols/Tlen/src/tlen_util.cpp | 18 +-- protocols/Tlen/src/tlen_xml.cpp | 8 +- protocols/Tox/src/tox_menus.cpp | 2 +- protocols/Tox/src/tox_network.cpp | 2 +- protocols/Tox/src/tox_options.cpp | 2 +- protocols/Tox/src/tox_search.cpp | 2 +- protocols/Twitter/src/proto.cpp | 6 +- protocols/Twitter/src/ui.cpp | 6 +- protocols/WhatsApp/src/theme.cpp | 2 +- protocols/Xfire/src/Xfire_base.cpp | 18 +-- protocols/Xfire/src/Xfire_game.cpp | 18 +-- protocols/Xfire/src/addgamedialog.cpp | 16 +-- protocols/Xfire/src/clientinformationpacket.cpp | 12 +- protocols/Xfire/src/clientloginpacket.cpp | 2 +- protocols/Xfire/src/main.cpp | 26 ++-- protocols/Xfire/src/options.cpp | 4 +- protocols/Xfire/src/searching4games.cpp | 34 +++--- protocols/Xfire/src/tools.cpp | 16 +-- protocols/Xfire/src/userdetails.cpp | 4 +- protocols/Xfire/src/xfireparse.cpp | 2 +- protocols/Xfire/src/xfireutils.cpp | 8 +- src/core/stdauth/src/authdialogs.cpp | 14 +-- src/core/stdcrypt/src/Rijndael.cpp | 2 +- src/core/stdcrypt/src/encrypt.cpp | 2 +- src/core/stdfile/src/filerecvdlg.cpp | 2 +- src/core/stdmsg/src/msglog.cpp | 4 +- src/core/stdurl/urldialogs.cpp | 2 +- src/modules/clist/contacts.cpp | 4 +- src/modules/database/dbini.cpp | 2 +- src/modules/database/dbutils.cpp | 2 +- src/modules/database/mdatabasecache.cpp | 4 +- src/modules/langpack/lpservices.cpp | 2 +- src/modules/metacontacts/meta_services.cpp | 2 +- src/modules/netlib/netlibautoproxy.cpp | 8 +- src/modules/netlib/netlibhttp.cpp | 6 +- src/modules/netlib/netliblog.cpp | 2 +- src/modules/netlib/netlibopenconn.cpp | 4 +- src/modules/netlib/netlibsecurity.cpp | 4 +- src/modules/netlib/netlibupnp.cpp | 10 +- src/modules/protocols/protochains.cpp | 2 +- src/modules/protocols/protocols.cpp | 2 +- src/modules/protocols/protodir.cpp | 2 +- src/modules/skin/hotkeys.cpp | 2 +- src/modules/skin/skinicons.cpp | 4 +- src/modules/utils/path.cpp | 2 +- src/modules/xml/xmlParser.cpp | 4 +- 310 files changed, 1300 insertions(+), 1300 deletions(-) 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'; diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 2d6de87415..0ecf63cb42 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -34,7 +34,7 @@ void __cdecl CAimProto::avatar_request_thread(void* param) } char type = getByte(hContact, AIM_KEY_AHT, 1); - size_t len = (strlen(hash_str) + 1) / 2; + size_t len = (mir_strlen(hash_str) + 1) / 2; char* hash = (char*)alloca(len); string_to_bytes(hash_str, hash); debugLogA("Requesting an Avatar: %s (Hash: %s)", sn, hash_str); diff --git a/protocols/AimOscar/src/away.cpp b/protocols/AimOscar/src/away.cpp index 3b1665e2c9..ec8fdbb4fa 100644 --- a/protocols/AimOscar/src/away.cpp +++ b/protocols/AimOscar/src/away.cpp @@ -49,12 +49,12 @@ int CAimProto::aim_set_away(HANDLE hServerConn, unsigned short &seqno, const cha if (!amsg) return -1; setDword(AIM_KEY_LA, (DWORD)time(NULL)); html_msg = html_encode(amsg && amsg[0] ? amsg : DEFAULT_AWAY_MSG); - msg_size = strlen(html_msg); + msg_size = mir_strlen(html_msg); } aimString str(html_msg); const char *charset = str.isUnicode() ? AIM_MSG_TYPE_UNICODE : AIM_MSG_TYPE; - const unsigned short charset_len = (unsigned short)strlen(charset); + const unsigned short charset_len = (unsigned short)mir_strlen(charset); const char* msg = str.getBuf(); const unsigned short msg_len = str.getSize(); @@ -108,7 +108,7 @@ int CAimProto::aim_set_statusmsg(HANDLE hServerConn, unsigned short &seqno, cons int CAimProto::aim_query_away_message(HANDLE hServerConn, unsigned short &seqno, const char* sn) { unsigned short offset = 0; - unsigned short sn_length = (unsigned short)strlen(sn); + unsigned short sn_length = (unsigned short)mir_strlen(sn); char *buf = (char*)alloca(SNAC_SIZE + 5 + sn_length); aim_writesnac(0x02, 0x15, offset, buf); aim_writegeneric(4, "\0\0\0\x02", offset, buf); diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index a766db7187..169003f94c 100644 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -26,9 +26,9 @@ int CAimProto::aim_send_connection_packet(HANDLE hServerConn,unsigned short &seq int CAimProto::aim_authkey_request(HANDLE hServerConn,unsigned short &seqno) { unsigned short offset=0; - char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*3+strlen(username)); + char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*3+mir_strlen(username)); aim_writesnac(0x17,0x06,offset,buf); - aim_writetlv(0x01,(unsigned short)strlen(username),username,offset,buf); + aim_writetlv(0x01,(unsigned short)mir_strlen(username),username,offset,buf); aim_writetlv(0x4B,0,0,offset,buf); aim_writetlv(0x5A,0,0,offset,buf); return aim_sendflap(hServerConn,0x02,offset,buf,seqno); @@ -43,10 +43,10 @@ int CAimProto::aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const c mir_md5_state_t state; mir_md5_init(&state); - mir_md5_append(&state,(const BYTE *)password, (int)strlen(password)); + mir_md5_append(&state,(const BYTE *)password, (int)mir_strlen(password)); mir_md5_finish(&state,pass_hash); mir_md5_init(&state); - mir_md5_append(&state,(BYTE*)key, (int)strlen(key)); + mir_md5_append(&state,(BYTE*)key, (int)mir_strlen(key)); mir_md5_append(&state,(BYTE*)pass_hash,MD5_HASH_LENGTH); mir_md5_append(&state,(BYTE*)AIM_MD5_STRING, sizeof(AIM_MD5_STRING)-1); mir_md5_finish(&state,auth_hash); @@ -55,10 +55,10 @@ int CAimProto::aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const c CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mirver), (LPARAM)mirver); int client_id_len = mir_snprintf(client_id, SIZEOF(client_id), "Miranda AIM, version %s", mirver); - char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*14+MD5_HASH_LENGTH+strlen(username)+client_id_len+30+strlen(language)+strlen(country)); + char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*14+MD5_HASH_LENGTH+mir_strlen(username)+client_id_len+30+mir_strlen(language)+mir_strlen(country)); aim_writesnac(0x17,0x02,offset,buf); - aim_writetlv(0x01,(unsigned short)strlen(username),username,offset,buf); + aim_writetlv(0x01,(unsigned short)mir_strlen(username),username,offset,buf); aim_writetlv(0x25,MD5_HASH_LENGTH,(char*)auth_hash,offset,buf); aim_writetlv(0x4C,0,0,offset,buf);//signifies new password hash instead of old method aim_writetlv(0x03,(unsigned short)client_id_len,client_id,offset,buf); @@ -68,8 +68,8 @@ int CAimProto::aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const c aim_writetlvshort(0x1A,AIM_CLIENT_BUILD_NUMBER,offset,buf); aim_writetlvshort(0x16,AIM_CLIENT_ID_NUMBER,offset,buf); aim_writetlvlong(0x14,AIM_CLIENT_DISTRIBUTION_NUMBER,offset,buf); - aim_writetlv(0x0F,(unsigned short)strlen(language),language,offset,buf); - aim_writetlv(0x0E,(unsigned short)strlen(country),country,offset,buf); + aim_writetlv(0x0F,(unsigned short)mir_strlen(language),language,offset,buf); + aim_writetlv(0x0E,(unsigned short)mir_strlen(country),country,offset,buf); aim_writetlvchar(0x4A,getByte(AIM_KEY_FSC, 0) ? 3 : 1,offset,buf); // aim_writetlvchar(0x94,0,offset,buf); if (!getByte(AIM_KEY_DSSL, 0)) @@ -234,7 +234,7 @@ int CAimProto::aim_set_profile(HANDLE hServerConn,unsigned short &seqno, char* a { aimString str(amsg); const char *charset = str.isUnicode() ? AIM_MSG_TYPE_UNICODE : AIM_MSG_TYPE; - const unsigned short charset_len = (unsigned short)strlen(charset); + const unsigned short charset_len = (unsigned short)mir_strlen(charset); const char* msg = str.getBuf(); const unsigned short msg_len = str.getSize(); @@ -356,7 +356,7 @@ int CAimProto::aim_send_message(HANDLE hServerConn,unsigned short &seqno,const c aim_writegeneric(msg_len,msg,tlv_offset,tlv_buf); // message text unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); char* buf= (char*)alloca(SNAC_SIZE+8+3+sn_length+TLV_HEADER_SIZE*3+tlv_offset); aim_writesnac(0x04,0x06,offset,buf,get_random()); @@ -383,7 +383,7 @@ int CAimProto::aim_send_message(HANDLE hServerConn,unsigned short &seqno,const c int CAimProto::aim_query_profile(HANDLE hServerConn,unsigned short &seqno,char* sn) { unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); char* buf=(char*)alloca(SNAC_SIZE+5+sn_length); aim_writesnac(0x02,0x15,offset,buf); aim_writelong(0x01,offset,buf); @@ -396,7 +396,7 @@ int CAimProto::aim_delete_contact(HANDLE hServerConn, unsigned short &seqno, cha unsigned short group_id, unsigned short list, bool nil) { unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); char* buf=(char*)alloca(SNAC_SIZE+sn_length+10); aim_writesnac(0x13,0x0a,offset,buf, get_random()); // SSI Delete aim_writeshort(sn_length,offset,buf); // screen name length @@ -413,7 +413,7 @@ int CAimProto::aim_add_contact(HANDLE hServerConn, unsigned short &seqno, const unsigned short group_id, unsigned short list, char* nick, char* note) { unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); unsigned short nick_length = (unsigned short)mir_strlen(nick); unsigned short note_length = (unsigned short)mir_strlen(note); unsigned short tlv_len = nick || note ? TLV_HEADER_SIZE * 2 + nick_length + note_length : 0; @@ -439,7 +439,7 @@ int CAimProto::aim_mod_group(HANDLE hServerConn, unsigned short &seqno, const ch char* members, unsigned short members_length) { unsigned short offset=0; - unsigned short name_length=(unsigned short)strlen(name); + unsigned short name_length=(unsigned short)mir_strlen(name); char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE+name_length+members_length+10); aim_writesnac(0x13,0x09,offset,buf, get_random()); // SSI Edit aim_writeshort(name_length,offset,buf); // group name length @@ -457,7 +457,7 @@ int CAimProto::aim_mod_buddy(HANDLE hServerConn, unsigned short &seqno, const ch char* nick, char* note) { unsigned short offset=0; - unsigned short sn_length = (unsigned short)strlen(sn); + unsigned short sn_length = (unsigned short)mir_strlen(sn); unsigned short nick_length = (unsigned short)mir_strlen(nick); unsigned short note_length = (unsigned short)mir_strlen(note); unsigned short tlv_len = TLV_HEADER_SIZE * 2 + nick_length + note_length; @@ -574,7 +574,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno, aimString dscr(ft->message); const char* charset = dscr.isUnicode() ? "unicode-2-0" : "us-ascii"; - const unsigned short charset_len = (unsigned short)strlen(charset); + const unsigned short charset_len = (unsigned short)mir_strlen(charset); const char* desc_msg = dscr.getBuf(); const unsigned short desc_len = dscr.getSize(); @@ -587,7 +587,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno, aim_writetlv(0x0f,0,0,frag_offset,msg_frag); // request host check const char* fname = get_fname(ft->file); - const unsigned short fnlen = (unsigned short)strlen(fname); + const unsigned short fnlen = (unsigned short)mir_strlen(fname); char* fblock = (char*)alloca(9 + fnlen); *(unsigned short*)&fblock[0] = _htons(ft->pfts.totalFiles > 1 ? 2 : 1); // single file transfer @@ -608,7 +608,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno, } unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(ft->sn); + unsigned short sn_length=(unsigned short)mir_strlen(ft->sn); char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*2+12+frag_offset+sn_length); aim_writesnac(0x04,0x06,offset,buf); // msg to host aim_writegeneric(8,ft->icbm_cookie,offset,buf); // icbm cookie @@ -637,7 +637,7 @@ int CAimProto::aim_file_ad(HANDLE hServerConn,unsigned short &seqno,char* sn, ch // if (max_ver > 1) // aim_writetlvshort(0x12,2,frag_offset,msg_frag); // max protocol version - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); unsigned short offset=0; char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE+21+frag_offset+sn_length); aim_writesnac(0x04,0x06,offset,buf); // msg to host @@ -654,7 +654,7 @@ int CAimProto::aim_file_ad(HANDLE hServerConn,unsigned short &seqno,char* sn, ch int CAimProto::aim_typing_notification(HANDLE hServerConn,unsigned short &seqno,char* sn,unsigned short type) { unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); char* buf= (char*)alloca(SNAC_SIZE+sn_length+13); aim_writesnac(0x04,0x14,offset,buf); aim_writegeneric(8,"\0\0\0\0\0\0\0\0",offset,buf); // icbm cookie @@ -699,7 +699,7 @@ int CAimProto::aim_activate_mail(HANDLE hServerConn,unsigned short &seqno) int CAimProto::aim_request_avatar(HANDLE hServerConn,unsigned short &seqno, const char* sn, unsigned short bart_type, const char* hash, unsigned short hash_size) { unsigned short offset=0; - unsigned char sn_length=(unsigned char)strlen(sn); + unsigned char sn_length=(unsigned char)mir_strlen(sn); char* buf= (char*)alloca(SNAC_SIZE+sn_length+hash_size+12); aim_writesnac(0x10,0x06,offset,buf); aim_writechar(sn_length,offset,buf); // screen name length @@ -715,7 +715,7 @@ int CAimProto::aim_set_avatar_hash(HANDLE hServerConn, unsigned short &seqno, ch char bart_type_txt[8]; ultoa(bart_type, bart_type_txt, 10); - unsigned short bart_type_len = (unsigned short)strlen(bart_type_txt); + unsigned short bart_type_len = (unsigned short)mir_strlen(bart_type_txt); unsigned short req = 0x09; if (id == 0) @@ -751,7 +751,7 @@ int CAimProto::aim_delete_avatar_hash(HANDLE hServerConn, unsigned short &seqno, char bart_type_txt[8]; ultoa(bart_type, bart_type_txt, 10); - unsigned short bart_type_len = (unsigned short)strlen(bart_type_txt); + unsigned short bart_type_len = (unsigned short)mir_strlen(bart_type_txt); char* buf = (char*)alloca(SNAC_SIZE + 20 + bart_type_len); aim_writesnac(0x13,0x0a,offset,buf, get_random()); // SSI Delete @@ -779,7 +779,7 @@ int CAimProto::aim_upload_avatar(HANDLE hServerConn, unsigned short &seqno, unsi int CAimProto::aim_search_by_email(HANDLE hServerConn,unsigned short &seqno, const char* email) { unsigned short offset=0; - char em_length=(char)strlen(email); + char em_length=(char)mir_strlen(email); char* buf= (char*)alloca(SNAC_SIZE+em_length); aim_writesnac(0x0a,0x02,offset,buf); // Email search aim_writegeneric(em_length,email,offset,buf); @@ -797,7 +797,7 @@ int CAimProto::aim_chatnav_request_limits(HANDLE hServerConn,unsigned short &seq int CAimProto::aim_chatnav_create(HANDLE hServerConn,unsigned short &seqno, char* room, unsigned short exchage) { //* Join Pseudo Room (Get's the info we need for the real connection) - unsigned short room_len = (unsigned short)strlen(room); + unsigned short room_len = (unsigned short)mir_strlen(room); unsigned short offset=0; char* buf=(char*)alloca(SNAC_SIZE+10+room_len+26); @@ -818,7 +818,7 @@ int CAimProto::aim_chatnav_create(HANDLE hServerConn,unsigned short &seqno, char int CAimProto::aim_chatnav_room_info(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance) { unsigned short offset=0; - unsigned short chat_cookie_len = (unsigned short)strlen(chat_cookie); + unsigned short chat_cookie_len = (unsigned short)mir_strlen(chat_cookie); char* buf=(char*)alloca(SNAC_SIZE+7+chat_cookie_len); aim_writesnac(0x0d,0x04,offset,buf); aim_writeshort(exchange,offset,buf); // Exchange @@ -833,7 +833,7 @@ int CAimProto::aim_chat_join_room(HANDLE hServerConn,unsigned short &seqno, char unsigned short exchange, unsigned short instance, unsigned short id) { unsigned short offset=0; - unsigned short cookie_len = (unsigned short)strlen(chat_cookie); + unsigned short cookie_len = (unsigned short)mir_strlen(chat_cookie); char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*2+cookie_len+8); aim_writesnac(0x01,0x04,offset,buf,id); aim_writeshort(0x0e,offset,buf); // Service request for Chat @@ -856,7 +856,7 @@ int CAimProto::aim_chat_send_message(HANDLE hServerConn, unsigned short &seqno, aimString str(amsg); const char* charset = str.isUnicode() ? "unicode-2-0" : "us-ascii"; - const unsigned short chrset_len = (unsigned short)strlen(charset); + const unsigned short chrset_len = (unsigned short)mir_strlen(charset); const char* msg = str.getBuf(); const unsigned short msg_len = str.getSize(); @@ -883,9 +883,9 @@ int CAimProto::aim_chat_send_message(HANDLE hServerConn, unsigned short &seqno, int CAimProto::aim_chat_invite(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, char* sn, char* msg) { unsigned short offset=0; - unsigned short chat_cookie_len = (unsigned short)strlen(chat_cookie); - unsigned short sn_len = (unsigned short)strlen(sn); - unsigned short msg_len = (unsigned short)strlen(msg); + unsigned short chat_cookie_len = (unsigned short)mir_strlen(chat_cookie); + unsigned short sn_len = (unsigned short)mir_strlen(sn); + unsigned short msg_len = (unsigned short)mir_strlen(msg); char* buf=(char*)alloca(SNAC_SIZE+64+chat_cookie_len+sn_len+msg_len); aim_writesnac(0x04,0x06,offset,buf); aim_writegeneric(8,"\0\0\0\0\0\0\0\0",offset,buf); // ICBM Cookie @@ -917,7 +917,7 @@ int CAimProto::aim_chat_invite(HANDLE hServerConn,unsigned short &seqno, char* c int CAimProto::aim_chat_deny(HANDLE hServerConn,unsigned short &seqno,char* sn,char* icbm_cookie) { unsigned short offset=0; - unsigned short sn_length=(unsigned short)strlen(sn); + unsigned short sn_length=(unsigned short)mir_strlen(sn); char* buf=(char*)alloca(SNAC_SIZE+20+sn_length); aim_writesnac(0x04,0x0b,offset,buf); aim_writegeneric(8,icbm_cookie,offset,buf); // ICBM Cookie @@ -945,7 +945,7 @@ int CAimProto::aim_admin_ready(HANDLE hServerConn,unsigned short &seqno) int CAimProto::aim_admin_format_name(HANDLE hServerConn,unsigned short &seqno, const char* sn) { unsigned short offset=0; - unsigned short sn_len = (unsigned short)strlen(sn); + unsigned short sn_len = (unsigned short)mir_strlen(sn); char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE+sn_len); aim_writesnac(0x07,0x04,offset,buf); aim_writetlv(0x01,sn_len,sn,offset,buf); @@ -955,7 +955,7 @@ int CAimProto::aim_admin_format_name(HANDLE hServerConn,unsigned short &seqno, c int CAimProto::aim_admin_change_email(HANDLE hServerConn,unsigned short &seqno, const char* email) { unsigned short offset=0; - unsigned short email_len = (unsigned short)strlen(email); + unsigned short email_len = (unsigned short)mir_strlen(email); char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE+email_len); aim_writesnac(0x07,0x04,offset,buf); aim_writetlv(0x11,email_len,email,offset,buf); @@ -965,8 +965,8 @@ int CAimProto::aim_admin_change_email(HANDLE hServerConn,unsigned short &seqno, int CAimProto::aim_admin_change_password(HANDLE hServerConn,unsigned short &seqno, const char* cur_pw, const char* new_pw) { unsigned short offset=0; - unsigned short cur_pw_len = (unsigned short)strlen(cur_pw); - unsigned short new_pw_len = (unsigned short)strlen(new_pw); + unsigned short cur_pw_len = (unsigned short)mir_strlen(cur_pw); + unsigned short new_pw_len = (unsigned short)mir_strlen(new_pw); char* buf=(char*)alloca(SNAC_SIZE+2*TLV_HEADER_SIZE+cur_pw_len+new_pw_len); aim_writesnac(0x07,0x04,offset,buf); aim_writetlv(0x02,new_pw_len,new_pw,offset,buf); diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index faa4bdc01c..f0458f7fde 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -23,10 +23,10 @@ along with this program. If not, see . char* process_status_msg (const char *str, const char* sn) { const char *src = str; - size_t size = strlen(src) + 1; + size_t size = mir_strlen(src) + 1; char* res = (char*)mir_alloc(size); char* dest = res; - size_t len = strlen(sn); + size_t len = mir_strlen(sn); for (; *src; ++src) { @@ -77,7 +77,7 @@ char* process_status_msg (const char *str, const char* sn) void html_decode(char* str) { char *p, *q; -// char *rstr = (char*)mir_alloc(strlen(str)*2); +// char *rstr = (char*)mir_alloc(mir_strlen(str)*2); if (str == NULL) return; @@ -100,7 +100,7 @@ void html_decode(char* str) if (t1 && *t1) { strcpy(q, t1); - q += strlen(t1) - 1; + q += mir_strlen(t1) - 1; } mir_free(t1); p = s; @@ -214,8 +214,8 @@ char* html_to_bbcodes(char *src) } else { - dest=(char*)mir_realloc(dest,strlen(dest)+6); - memcpy(&dest[strlen(dest)],"[/b]",5); + dest=(char*)mir_realloc(dest,mir_strlen(dest)+6); + memcpy(&dest[mir_strlen(dest)],"[/b]",5); } } while ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) @@ -231,8 +231,8 @@ char* html_to_bbcodes(char *src) } else { - dest=(char*)mir_realloc(dest,strlen(dest)+6); - memcpy(&dest[strlen(dest)],"[/i]",5); + dest=(char*)mir_realloc(dest,mir_strlen(dest)+6); + memcpy(&dest[mir_strlen(dest)],"[/i]",5); } } while ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) @@ -248,8 +248,8 @@ char* html_to_bbcodes(char *src) } else { - dest=(char*)mir_realloc(dest,strlen(dest)+6); - memcpy(&dest[strlen(dest)],"[/u]",5); + dest=(char*)mir_realloc(dest,mir_strlen(dest)+6); + memcpy(&dest[mir_strlen(dest)],"[/u]",5); } } while ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) @@ -265,8 +265,8 @@ char* html_to_bbcodes(char *src) } else { - dest=(char*)mir_realloc(dest,strlen(dest)+6); - memcpy(&dest[strlen(dest)],"[/s]",5); + dest=(char*)mir_realloc(dest,mir_strlen(dest)+6); + memcpy(&dest[mir_strlen(dest)],"[/s]",5); } } rptr = dest; @@ -275,11 +275,11 @@ char* html_to_bbcodes(char *src) char* begin=ptr; ptrl = ptr + 4; memcpy(ptrl,"[url=",5); - memmove(ptr, ptrl, strlen(ptrl) + 1); + memmove(ptr, ptrl, mir_strlen(ptrl) + 1); if ((ptr = strstr(ptrl,">"))) { ptr-=1; - memmove(ptr, ptr+1, strlen(ptr+1) + 1); + memmove(ptr, ptr+1, mir_strlen(ptr+1) + 1); *(ptr)=']'; ptrl-=1; char* s1 = strstr(ptrl,""))) { ptr-=1; - memmove(ptr, ptr+1, strlen(ptr+1) + 1); + memmove(ptr, ptr+1, mir_strlen(ptr+1) + 1); *(ptr)=']'; ptrl-=1; char* s1 = strstr(ptrl,""))) { - memmove(ptrl+7,ptr,strlen(ptr)+1); + memmove(ptrl+7,ptr,mir_strlen(ptr)+1); *(ptrl+7)=']'; ptr=ptrl+7; char* s1 = strstr(ptr,""))) { - memmove(ptrl+7,ptr,strlen(ptr)+1); + memmove(ptrl+7,ptr,mir_strlen(ptr)+1); *(ptrl+7)=']'; ptr=ptrl+7; char* s1 = strstr(ptr,""))) { *(ptr)=']'; if ((ptrl = strstr(ptr, "",7); - memmove(ptr+7,ptr+8,strlen(ptr+8)+1); + memmove(ptr+7,ptr+8,mir_strlen(ptr+8)+1); } } else @@ -558,10 +558,10 @@ char* bbcodes_to_html(const char *src) while ((ptr = strstr(rptr, "[url="))) { int addr=ptr-rptr; - dest=(char*)mir_realloc(dest,strlen(dest)+8); + dest=(char*)mir_realloc(dest,mir_strlen(dest)+8); rptr=dest; ptr=rptr+addr; - memmove(ptr+3, ptr, strlen(ptr)+1); + memmove(ptr+3, ptr, mir_strlen(ptr)+1); memcpy(ptr,"",4); - memmove(ptr+4,ptr+6,strlen(ptr+6)+1); + memmove(ptr+4,ptr+6,mir_strlen(ptr+6)+1); } } else @@ -580,7 +580,7 @@ char* bbcodes_to_html(const char *src) void strip_tag(char* begin, char* end) { - memmove(begin,end+1,strlen(end+1)+1); + memmove(begin,end+1,mir_strlen(end+1)+1); } //strip a tag within a string @@ -719,7 +719,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) strcpy(&buf[pos]," face=\""); pos+=7; strcpy(&buf[pos],Face); - pos+=strlen(Face); + pos+=mir_strlen(Face); strcpy(&buf[pos],"\""); pos++; if (!(cfOld.dwEffects & CFE_AUTOBACKCOLOR)) @@ -728,7 +728,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) pos+=6; char chBackColor[7]; _itoa((_htonl(BackColor)>>8),chBackColor,16); - size_t len=strlen(chBackColor); + size_t len=mir_strlen(chBackColor); if (len<6) { memmove(chBackColor+(6-len),chBackColor,len+1); @@ -744,7 +744,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) pos+=8; char chColor[7]; _itoa((_htonl(Color)>>8),chColor,16); - size_t len=strlen(chColor); + size_t len=mir_strlen(chColor); if (len<6) { memmove(chColor+(6-len),chColor,len+1); @@ -773,7 +773,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) { char* txt = mir_utf8encodeT(text); strcpy(&buf[pos], txt); - pos += strlen(txt); + pos += mir_strlen(txt); mir_free(txt); } start++; @@ -832,7 +832,7 @@ void string_to_bytes(char* string, char* bytes) { char sbyte[3]; sbyte[2]='\0'; - size_t length=strlen(string); + size_t length=mir_strlen(string); for (size_t i=0; ipfts.totalFiles > 1 && ft->file[0]) { - size_t dlen = strlen(ft->file); + size_t dlen = mir_strlen(ft->file); if (strncmp(fname, ft->file, dlen) == 0 && fname[dlen] == '\\') { fnamea = &fname[dlen+1]; diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index b3b404cced..d68cf33608 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -162,8 +162,8 @@ HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const PROTOCHAR* if (ft->pfts.totalFiles > 1 && ft->file[0]) { - size_t path_len = strlen(path); - size_t len = strlen(ft->file) + 2; + size_t path_len = mir_strlen(path); + size_t len = mir_strlen(ft->file) + 2; path = (char*)mir_realloc(path, path_len + len); mir_snprintf(&path[path_len], len, "%s\\", ft->file); @@ -305,7 +305,7 @@ void __cdecl CAimProto::basic_search_ack_success(void* p) char *sn = normalize_name((char*)p); if (sn) // normalize it { - if (strlen(sn) > 32) + if (mir_strlen(sn) > 32) { ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0); } diff --git a/protocols/AimOscar/src/proxy.cpp b/protocols/AimOscar/src/proxy.cpp index 7cfaa76e19..3ed34d54af 100644 --- a/protocols/AimOscar/src/proxy.cpp +++ b/protocols/AimOscar/src/proxy.cpp @@ -137,7 +137,7 @@ void __cdecl CAimProto::aim_proxy_helper(void* param) int proxy_initialize_send(HANDLE connection, char* sn, char* cookie) { - const char sn_length = (char)strlen(sn); + const char sn_length = (char)mir_strlen(sn); const int len = sn_length + 21 + TLV_HEADER_SIZE + AIM_CAPS_LENGTH; char* buf= (char*)alloca(len); @@ -155,7 +155,7 @@ int proxy_initialize_send(HANDLE connection, char* sn, char* cookie) int proxy_initialize_recv(HANDLE connection,char* sn, char* cookie,unsigned short port_check) { - const char sn_length = (char)strlen(sn); + const char sn_length = (char)mir_strlen(sn); const int len = sn_length + 23 + TLV_HEADER_SIZE + AIM_CAPS_LENGTH; char* buf= (char*)alloca(len); diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 672beff746..3ae332dc39 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1265,7 +1265,7 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho if (channel == 1) { //Message not file if (auto_response) { //this message must be an autoresponse char* away = mir_utf8encodeT(TranslateT("[Auto-Response]:")); - size_t len = strlen(msg_buf) + strlen(away) + 2; + size_t len = mir_strlen(msg_buf) + mir_strlen(away) + 2; char* buf = (char*)mir_alloc(len); mir_snprintf(buf, len, "%s %s", away, msg_buf); mir_free(away); @@ -1292,7 +1292,7 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho char* s_msg = process_status_msg(*msgptr, sn); char* away = mir_utf8encodeT(TranslateT("[Auto-Response]:")); - size_t len = strlen(s_msg) + strlen(away) + 2; + size_t len = mir_strlen(s_msg) + mir_strlen(away) + 2; char* buf = (char*)alloca(len); mir_snprintf(buf, len, "%s %s", away, s_msg); mir_free(away); diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index bef02edf15..a01c6e54d7 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -624,7 +624,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects=0; char chsize[5] = ""; SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0),(LPARAM)chsize); - //strlcpy(cf.szFaceName,size,strlen(size)+1); + //strlcpy(cf.szFaceName,size,mir_strlen(size)+1); cf.yHeight=atoi(chsize)*20; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); @@ -692,7 +692,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char name[64]; GetDlgItemTextA(hwndDlg, IDC_FNAME, name, SIZEOF(name)); - if (strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) + if (mir_strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) { if (strcmp(name, dbv.pszVal)) ppro->aim_admin_format_name(ppro->hAdminConn,ppro->admin_seqno,name); @@ -701,7 +701,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char email[254]; GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, SIZEOF(email)); - if (strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown. + if (mir_strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown. { if (strcmp(email, dbv.pszVal)) ppro->aim_admin_change_email(ppro->hAdminConn,ppro->admin_seqno,email); diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 67a9e26c69..ea7dafe878 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -346,7 +346,7 @@ char *normalize_name(const char *s) char* trim_str(char* s) { if (s == NULL) return NULL; - size_t len = strlen(s); + size_t len = mir_strlen(s); while (len) { @@ -357,7 +357,7 @@ char* trim_str(char* s) char* sc = s; while (isspace(*sc)) ++sc; - memcpy(s,sc,strlen(sc)+1); + memcpy(s,sc,mir_strlen(sc)+1); return s; } @@ -568,9 +568,9 @@ void CAimProto::write_away_message(const char* sn, const char* msg, bool utf) if (utf) _write(fid, "\xEF\xBB\xBF", 3); char* s_msg=process_status_msg(msg, sn); _write(fid, "

", 4); - _write(fid, sn, (unsigned)strlen(sn)); + _write(fid, sn, (unsigned)mir_strlen(sn)); _write(fid, "'s Away Message:

", 21); - _write(fid, s_msg, (unsigned)strlen(s_msg)); + _write(fid, s_msg, (unsigned)mir_strlen(s_msg)); _close(fid); ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOW); mir_free(path); @@ -587,9 +587,9 @@ void CAimProto::write_profile(const char* sn, const char* msg, bool utf) if (utf) _write(fid, "\xEF\xBB\xBF", 3); char* s_msg=process_status_msg(msg, sn); _write(fid, "

", 4); - _write(fid, sn, (unsigned)strlen(sn)); + _write(fid, sn, (unsigned)mir_strlen(sn)); _write(fid, "'s Profile:

", 16); - _write(fid, s_msg, (unsigned)strlen(s_msg)); + _write(fid, s_msg, (unsigned)mir_strlen(s_msg)); _close(fid); ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOW); mir_free(path); @@ -646,7 +646,7 @@ char* long_ip_to_char_ip(unsigned long host, char* ip) { char store[16]; _itoa(bytes[i], store, 10); - size_t len = strlen(store); + size_t len = mir_strlen(store); memcpy(&ip[buf_loc], store, len); buf_loc += len; diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index ea863ab9ea..fe13fa4aaf 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -282,7 +282,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) cont->m_addr = from; cont->m_prev = m_pRootContact; cont->m_status = ID_STATUS_OFFLINE; - int nlen = (int)strlen(pak.strName); + int nlen = (int)mir_strlen(pak.strName); cont->m_nick = new char[nlen + 1]; memcpy(cont->m_nick, pak.strName, nlen + 1); m_pRootContact = cont; @@ -292,7 +292,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) if (pak.strName && strcmp(pak.strName, cont->m_nick) != 0) { delete[] cont->m_nick; - int nlen = (int)strlen(pak.strName); + int nlen = (int)mir_strlen(pak.strName); cont->m_nick = new char[nlen + 1]; memcpy(cont->m_nick, pak.strName, nlen + 1); } @@ -1063,14 +1063,14 @@ void CMLan::RecvFile(CCSDATA* ccs) db_unset(ccs->hContact, "CList", "Hidden"); szFile = pre->szMessage + sizeof(DWORD); - szDesc = szFile + strlen(szFile) + 1; + szDesc = szFile + mir_strlen(szFile) + 1; DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = PROTONAME; dbei.timestamp = pre->timestamp; dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0); dbei.eventType = EVENTTYPE_FILE; - dbei.cbBlob = DWORD(sizeof(DWORD) + strlen(szFile) + strlen(szDesc) + 2); + dbei.cbBlob = DWORD(sizeof(DWORD) + mir_strlen(szFile) + mir_strlen(szDesc) + 2); dbei.pBlob = (PBYTE)pre->szMessage; db_event_add(ccs->hContact, &dbei); } @@ -1395,12 +1395,12 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete delete[] * pf; *pf = _strdup(name); strcpy((char*)buf + len, filepart); - len += (int)strlen(filepart) + 1; + len += (int)mir_strlen(filepart) + 1; pf++; } strcpy((char*)buf + len, conn->m_szDescription); - len += (int)strlen(conn->m_szDescription) + 1; + len += (int)mir_strlen(conn->m_szDescription) + 1; *((int*)(buf + 1)) = size; *((int*)(buf + 1 + 4)) = filecount; diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 01e63d6ff9..57070cd827 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -171,7 +171,7 @@ bool FacebookProto::NegotiateConnection() debugLogA("*** Negotiating connection with Facebook"); ptrA username(getStringA(FACEBOOK_KEY_LOGIN)); - if (!username || !strlen(username)) { + if (!username || !mir_strlen(username)) { NotifyEvent(m_tszUserName, TranslateT("Please enter a username."), NULL, FACEBOOK_EVENT_CLIENT); return false; } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 2b8fba99de..a8a65bc88a 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -880,7 +880,7 @@ std::string FacebookProto::PrepareUrl(std::string url) { // Make realtive url if (!isRelativeUrl) { - url = url.substr(pos + strlen(FACEBOOK_SERVER_DOMAIN)); + url = url.substr(pos + mir_strlen(FACEBOOK_SERVER_DOMAIN)); // Strip eventual port pos = url.find("/"); @@ -1057,7 +1057,7 @@ void FacebookProto::InitHotkeys() { char text[200]; mir_strncpy(text, m_szModuleName, 100); - char *tDest = text + strlen(text); + char *tDest = text + mir_strlen(text); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = text; diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index d95a16b40c..bf3e953cc3 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -210,7 +210,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) { char text[200]; mir_strncpy(text, m_szModuleName, 100); - char *tDest = text + strlen(text); + char *tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index 2267f0cce9..d1f290f6d1 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -403,7 +403,7 @@ std::string utils::text::source_get_value2(std::string* data, const char *term, start = data->find(term); if (start != std::string::npos) { - start += strlen(term); + start += mir_strlen(term); end = data->find_first_of(endings, start); if (end != std::string::npos) { @@ -478,7 +478,7 @@ std::string utils::text::rand_string(int len, const char *chars, unsigned int *n { std::stringstream out; - int strLen = (int)strlen(chars); + int strLen = (int)mir_strlen(chars); for (int i = 0; i < len; ++i) { out << chars[utils::number::random(0, strLen, number)]; } diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 5fa07c9bed..8db7427a0d 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -161,7 +161,7 @@ int GetMailboxPwd(LPCSTR acc, LPSTR *pwd, int buffSize) if (db_get_static(NULL, acc, LOGIN_PASS_SETTING_NAME, buff, sizeof(buff))) return 0; - int result = (int)strlen(buff); + int result = (int)mir_strlen(buff); if (pwd) { if (buffSize < result + 1) diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index a28c471e2a..e6fcdaa74c 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -137,7 +137,7 @@ char *gg_avatarhash(char *param) return NULL; BYTE digest[MIR_SHA1_HASH_SIZE]; - mir_sha1_hash((BYTE*)param, (int)strlen(param), digest); + mir_sha1_hash((BYTE*)param, (int)mir_strlen(param), digest); return bin2hex(digest, sizeof(digest), result); } @@ -150,7 +150,7 @@ void GGPROTO::requestAvatarTransfer(MCONTACT hContact, char *szAvatarURL) gg_EnterCriticalSection(&avatar_mutex, "requestAvatarTransfer", 1, "avatar_mutex", 1); if (avatar_transfers.getIndex((GGGETAVATARDATA*)&hContact) == -1) { - GGGETAVATARDATA *data = (GGGETAVATARDATA*)mir_alloc(sizeof(GGGETAVATARDATA) + strlen(szAvatarURL)+1); + GGGETAVATARDATA *data = (GGGETAVATARDATA*)mir_alloc(sizeof(GGGETAVATARDATA) + mir_strlen(szAvatarURL)+1); data->hContact = hContact; data->szAvatarURL = strcpy((char*)(data+1), szAvatarURL); avatar_transfers.insert(data); @@ -388,11 +388,11 @@ void __cdecl GGPROTO::setavatarthread(void *param) mir_free(avatarFile); ptrA avatarFileB64Enc(mir_urlEncode(avatarFileB64)); - size_t avatarFileB64EncLen = strlen(avatarFileB64Enc); + size_t avatarFileB64EncLen = mir_strlen(avatarFileB64Enc); char dataPrefix[64]; mir_snprintf(dataPrefix, SIZEOF(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0)); - size_t dataPrefixLen = strlen(dataPrefix); + size_t dataPrefixLen = mir_strlen(dataPrefix); size_t dataLen = dataPrefixLen + avatarFileB64EncLen; char* data = (char*)mir_alloc(dataLen); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 01452e7a5f..cfbb68266d 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -922,7 +922,7 @@ retry: dbei.timestamp = (DWORD)e->event.multilogon_msg.time; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (DWORD)strlen(e->event.multilogon_msg.message) + 1; + dbei.cbBlob = (DWORD)mir_strlen(e->event.multilogon_msg.message) + 1; dbei.pBlob = (PBYTE)e->event.multilogon_msg.message; db_event_add( getcontact(e->event.multilogon_msg.sender, 1, 0, NULL), &dbei); } diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 88d5a1cd30..82a635c024 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -194,7 +194,7 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd) db_free(&dbv); } - if (uin > 0 && strlen(passwd) > 0 && (uin != olduin || strcmp(oldpasswd, passwd))) + if (uin > 0 && mir_strlen(passwd) > 0 && (uin != olduin || strcmp(oldpasswd, passwd))) check_first_conn = 1; } @@ -340,7 +340,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemTextA(hwndDlg, IDC_UIN, email, SIZEOF(email)); uin = atoi(email); GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); - if (!strlen(email)) + if (!mir_strlen(email)) MessageBox(NULL, TranslateT("You need to specify your registration e-mail first."), gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION); else if (MessageBox(NULL, diff --git a/protocols/Gadu-Gadu/src/dynstuff.cpp b/protocols/Gadu-Gadu/src/dynstuff.cpp index 9ae41daf59..17ce53a534 100644 --- a/protocols/Gadu-Gadu/src/dynstuff.cpp +++ b/protocols/Gadu-Gadu/src/dynstuff.cpp @@ -242,7 +242,7 @@ int string_append_n(string_t s, const char *str, int count) } if (count == -1) - count = (int)strlen(str); + count = (int)mir_strlen(str); string_realloc(s, s->len + count); @@ -275,7 +275,7 @@ void string_insert_n(string_t s, int index, const char *str, int count) return; if (count == -1) - count = (int)strlen(str); + count = (int)mir_strlen(str); if (index > s->len) index = s->len; @@ -310,8 +310,8 @@ string_t string_init(const char *value) value = ""; tmp->str = _strdup(value); - tmp->len = (int)strlen(value); - tmp->size = (int)strlen(value) + 1; + tmp->len = (int)mir_strlen(value); + tmp->size = (int)mir_strlen(value) + 1; return tmp; } diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 162c57f27c..7cf7f5f319 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -270,7 +270,7 @@ void __cdecl GGPROTO::dccmainthread(void*) PROTOFILETRANSFERSTATUS pfts; local_dcc->tick = tick; strncpy(filename, local_dcc->folder, sizeof(filename)); - strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - strlen(filename)); + strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - mir_strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (MCONTACT)local_dcc->contact; @@ -301,7 +301,7 @@ void __cdecl GGPROTO::dccmainthread(void*) { PROTOFILETRANSFERSTATUS pfts; strncpy(filename, local_dcc->folder, sizeof(filename)); - strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - strlen(filename)); + strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - mir_strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (MCONTACT)local_dcc->contact; @@ -500,7 +500,7 @@ void __cdecl GGPROTO::dccmainthread(void*) PROTOFILETRANSFERSTATUS pfts; local_dcc7->tick = tick; strncpy(filename, local_dcc7->folder, sizeof(filename)); - strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - strlen(filename)); + strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - mir_strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (MCONTACT)local_dcc7->contact; @@ -531,7 +531,7 @@ void __cdecl GGPROTO::dccmainthread(void*) { PROTOFILETRANSFERSTATUS pfts; strncpy(filename, local_dcc7->folder, sizeof(filename)); - strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - strlen(filename)); + strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - mir_strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (MCONTACT)local_dcc7->contact; @@ -667,7 +667,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath) struct gg_dcc *dcc = (struct gg_dcc *) hTransfer; char fileName[MAX_PATH], *path = mir_t2a(szPath); strncpy(fileName, path, sizeof(fileName)); - strncat(fileName, (char*)dcc->file_info.filename, sizeof(fileName) - strlen(fileName)); + strncat(fileName, (char*)dcc->file_info.filename, sizeof(fileName) - mir_strlen(fileName)); dcc->folder = _strdup((char *) path); dcc->tick = 0; mir_free(path); @@ -709,7 +709,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) char fileName[MAX_PATH], *path = mir_t2a(szPath); int iFtRemoveRes; strncpy(fileName, path, sizeof(fileName)); - strncat(fileName, (char*)dcc7->filename, sizeof(fileName) - strlen(fileName)); + strncat(fileName, (char*)dcc7->filename, sizeof(fileName) - mir_strlen(fileName)); dcc7->folder = _strdup((char *) path); dcc7->tick = 0; mir_free(path); diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 71f53ce6a7..9a79056216 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -440,11 +440,11 @@ void gg_debughandler(int level, const char *format, va_list ap) char prefix[6]; mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId()); - size_t prefixLen = strlen(prefix); + size_t prefixLen = mir_strlen(prefix); if (prefixLen < PREFIXLEN) memset(prefix + prefixLen, ' ', PREFIXLEN - prefixLen); memcpy(szText, prefix, PREFIXLEN); - mir_vsnprintf(szText + strlen(szText), sizeof(szText) - strlen(szText), szFormat, ap); + mir_vsnprintf(szText + mir_strlen(szText), sizeof(szText) - mir_strlen(szText), szFormat, ap); CallService(MS_NETLIB_LOG, NULL, (LPARAM)szText); free(szFormat); } diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 7d497c7033..bb8facc711 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -332,28 +332,28 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, { char *nick_utf8 = mir_utf8encodeT(nick); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nick_utf8); - strncat(data, nick_utf8, sizeof(data) - strlen(data)); + strncat(data, nick_utf8, sizeof(data) - mir_strlen(data)); mir_free(nick_utf8); } - strncat(data, ".", sizeof(data) - strlen(data)); + strncat(data, ".", sizeof(data) - mir_strlen(data)); if (firstName) { char *firstName_utf8 = mir_utf8encodeT(firstName); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); - strncat(data, firstName_utf8, sizeof(data) - strlen(data)); + strncat(data, firstName_utf8, sizeof(data) - mir_strlen(data)); mir_free(firstName_utf8); } - strncat(data, ".", sizeof(data) - strlen(data)); + strncat(data, ".", sizeof(data) - mir_strlen(data)); if (lastName) { char *lastName_utf8 = mir_utf8encodeT(lastName); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); - strncat(data, lastName_utf8, sizeof(data) - strlen(data)); + strncat(data, lastName_utf8, sizeof(data) - mir_strlen(data)); mir_free(lastName_utf8); } - strncat(data, ".", sizeof(data) - strlen(data)); + strncat(data, ".", sizeof(data) - mir_strlen(data)); // Count crc & check if the data was equal if yes do same search with shift crc = crc_get(data); @@ -409,40 +409,40 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) { char *firstName_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); - strncat(data, firstName_utf8, sizeof(data) - strlen(data)); + strncat(data, firstName_utf8, sizeof(data) - mir_strlen(data)); mir_free(firstName_utf8); } - /* 1 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 1 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text)); if (_tcslen(text)) { char *lastName_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); - strncat(data, lastName_utf8, sizeof(data) - strlen(data)); + strncat(data, lastName_utf8, sizeof(data) - mir_strlen(data)); mir_free(lastName_utf8); } - /* 2 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 2 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text)); if (_tcslen(text)) { char *nickName_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8); - strncat(data, nickName_utf8, sizeof(data) - strlen(data)); + strncat(data, nickName_utf8, sizeof(data) - mir_strlen(data)); mir_free(nickName_utf8); } - /* 3 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 3 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text)); if (_tcslen(text)) { char *city_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8); - strncat(data, city_utf8, sizeof(data) - strlen(data)); + strncat(data, city_utf8, sizeof(data) - mir_strlen(data)); mir_free(city_utf8); } - /* 4 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 4 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); GetDlgItemText(hwndDlg, IDC_AGEFROM, text, SIZEOF(text)); if (_tcslen(text)) @@ -470,33 +470,33 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) char *age_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, age_utf8); - strncat(data, age_utf8, sizeof(data) - strlen(data)); + strncat(data, age_utf8, sizeof(data) - mir_strlen(data)); mir_free(age_utf8); } - /* 5 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 5 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); switch(SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)) { case 1: gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_FEMALE); - strncat(data, GG_PUBDIR50_GENDER_MALE, sizeof(data) - strlen(data)); + strncat(data, GG_PUBDIR50_GENDER_MALE, sizeof(data) - mir_strlen(data)); break; case 2: gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_MALE); - strncat(data, GG_PUBDIR50_GENDER_FEMALE, sizeof(data) - strlen(data)); + strncat(data, GG_PUBDIR50_GENDER_FEMALE, sizeof(data) - mir_strlen(data)); break; } - /* 6 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 6 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); if (IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)) { gg_pubdir50_add(req, GG_PUBDIR50_ACTIVE, GG_PUBDIR50_ACTIVE_TRUE); - strncat(data, GG_PUBDIR50_ACTIVE_TRUE, sizeof(data) - strlen(data)); + strncat(data, GG_PUBDIR50_ACTIVE_TRUE, sizeof(data) - mir_strlen(data)); } - /* 7 */ strncat(data, ".", sizeof(data) - strlen(data)); + /* 7 */ strncat(data, ".", sizeof(data) - mir_strlen(data)); // No data entered - if (strlen(data) <= 7 || (strlen(data) == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED))) return (HWND)0; + if (mir_strlen(data) <= 7 || (mir_strlen(data) == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED))) return (HWND)0; // Count crc & check if the data was equal if yes do same search with shift crc = crc_get(data); diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index c39509f68a..536da7cb30 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -441,7 +441,7 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) FILE *f = _tfopen(str, _T("w")); if (f) { char *contacts = gg_makecontacts(this, 0); - fwrite(contacts, sizeof(char), strlen(contacts), f); + fwrite(contacts, sizeof(char), mir_strlen(contacts), f); fclose(f); free(contacts); diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 79aad2fa80..5a8455422b 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -59,7 +59,7 @@ char *oauth_uri_escape(const char *str) if (str == NULL) return mir_strdup(""); - size = (int)strlen(str) + 1; + size = (int)mir_strlen(str) + 1; res = (char *)mir_alloc(size); while (*str) { @@ -88,7 +88,7 @@ char *oauth_generate_signature(LIST ¶ms, const char *httpmet if (httpmethod == NULL || url == NULL || !params.getCount()) return mir_strdup(""); - urlnorm = (char *)mir_alloc(strlen(url) + 1); + urlnorm = (char *)mir_alloc(mir_strlen(url) + 1); while (*url) { if (*url == '?' || *url == '#') break; // see RFC 3986 section 3 urlnorm[ix++] = tolower(*url); @@ -96,19 +96,19 @@ char *oauth_generate_signature(LIST ¶ms, const char *httpmet } urlnorm[ix] = 0; if ((res = strstr(urlnorm, ":80")) != NULL) - memmove(res, res + 3, strlen(res) - 2); + memmove(res, res + 3, mir_strlen(res) - 2); else if ((res = strstr(urlnorm, ":443")) != NULL) - memmove(res, res + 4, strlen(res) - 3); + memmove(res, res + 4, mir_strlen(res) - 3); urlenc = oauth_uri_escape(urlnorm); mir_free(urlnorm); - size = (int)strlen(httpmethod) + (int)strlen(urlenc) + 1 + 2; + size = (int)mir_strlen(httpmethod) + (int)mir_strlen(urlenc) + 1 + 2; for (i = 0; i < params.getCount(); i++) { p = params[i]; if (!strcmp(p->name, "oauth_signature")) continue; if (i > 0) size += 3; - size += (int)strlen(p->name) + (int)strlen(p->value) + 3; + size += (int)mir_strlen(p->name) + (int)mir_strlen(p->value) + 3; } res = (char *)mir_alloc(size); @@ -194,20 +194,20 @@ int oauth_sign_request(LIST ¶ms, const char *httpmethod, con ptrA text( oauth_generate_signature(params, httpmethod, url)); ptrA csenc( oauth_uri_escape(consumer_secret)); ptrA tsenc( oauth_uri_escape(token_secret)); - ptrA key((char *)mir_alloc(strlen(csenc) + strlen(tsenc) + 2)); + ptrA key((char *)mir_alloc(mir_strlen(csenc) + mir_strlen(tsenc) + 2)); strcpy(key, csenc); strcat(key, "&"); strcat(key, tsenc); BYTE digest[MIR_SHA1_HASH_SIZE]; - mir_hmac_sha1(digest, (BYTE*)(char*)key, strlen(key), (BYTE*)(char*)text, strlen(text)); + mir_hmac_sha1(digest, (BYTE*)(char*)key, mir_strlen(key), (BYTE*)(char*)text, mir_strlen(text)); sign = mir_base64_encode(digest, MIR_SHA1_HASH_SIZE); } else { // PLAINTEXT ptrA csenc( oauth_uri_escape(consumer_secret)); ptrA tsenc( oauth_uri_escape(token_secret)); - sign = (char *)mir_alloc(strlen(csenc) + strlen(tsenc) + 2); + sign = (char *)mir_alloc(mir_strlen(csenc) + mir_strlen(tsenc) + 2); strcpy(sign, csenc); strcat(sign, "&"); strcat(sign, tsenc); @@ -225,7 +225,7 @@ char *oauth_generate_nonce() mir_snprintf(timestamp, SIZEOF(timestamp), "%ld", time(NULL)); CallService(MS_UTILS_GETRANDOM, (WPARAM)sizeof(randnum), (LPARAM)randnum); - int strSizeB = int(strlen(timestamp) + sizeof(randnum)); + int strSizeB = int(mir_strlen(timestamp) + sizeof(randnum)); ptrA str((char *)mir_calloc(strSizeB + 1)); strcpy(str, timestamp); strncat(str, randnum, sizeof(randnum)); @@ -269,7 +269,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD for (i = 0; i < oauth_parameters.getCount(); i++) { OAUTHPARAMETER *p = oauth_parameters[i]; if (i > 0) size++; - size += (int)strlen(p->name) + (int)strlen(p->value) + 3; + size += (int)mir_strlen(p->name) + (int)mir_strlen(p->value) + 3; } res = (char *)mir_alloc(size); @@ -360,7 +360,7 @@ int GGPROTO::oauth_receivetoken() httpHeaders[1].szName = "Content-Type"; httpHeaders[1].szValue = "application/x-www-form-urlencoded"; req.pData = str; - req.dataLength = (int)strlen(str); + req.dataLength = (int)mir_strlen(str); resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req); if (resp) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 25bb183156..7c8da3e1a4 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -37,7 +37,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) GGTOKEN token; debugLogA("remindpasswordthread(): Started."); - if (!rp || !rp->email || !rp->uin || !strlen(rp->email)) + if (!rp || !rp->email || !rp->uin || !mir_strlen(rp->email)) { free(rp); #ifdef DEBUGMODE diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 57fa852040..be57b3020f 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -43,7 +43,7 @@ char *gg_status2db(int status, const char *suffix) default: return NULL; } strncpy(str, prefix, sizeof(str)); - strncat(str, suffix, sizeof(str) - strlen(str)); + strncat(str, suffix, sizeof(str) - mir_strlen(str)); return str; } diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 88596aeaaf..8c47ebe3a6 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -226,7 +226,7 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA BOOL enable; GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass)); - enable = strlen(pass) && strlen(cpass) && !strcmp(cpass, pass); + enable = mir_strlen(pass) && mir_strlen(cpass) && !strcmp(cpass, pass); if (dat && dat->mode == GG_USERUTIL_REMOVE) EnableWindow(GetDlgItem(hwndDlg, IDOK), IsDlgButtonChecked(hwndDlg, IDC_CONFIRM) ? enable : FALSE); else diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp index ef8bff0dd8..a1dd243c59 100644 --- a/protocols/ICQCorp/src/corp.cpp +++ b/protocols/ICQCorp/src/corp.cpp @@ -70,7 +70,7 @@ extern "C" __declspec(dllexport) int Load() GetModuleFileName(hInstance, fileName, MAX_PATH); FindClose(FindFirstFile(fileName, &findData)); - findData.cFileName[strlen(findData.cFileName) - 4] = 0; + findData.cFileName[mir_strlen(findData.cFileName) - 4] = 0; strcpy(protoName, findData.cFileName); CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); @@ -110,8 +110,8 @@ void T(char *format, ...) hFile = CreateFile("ICQ Corp.log", GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); SetFilePointer(hFile, 0, 0, FILE_END); } - WriteFile(hFile, bufferTime, (DWORD)strlen(bufferTime), &result, NULL); - WriteFile(hFile, buffer, (DWORD)strlen(buffer), &result, NULL); + WriteFile(hFile, bufferTime, (DWORD)mir_strlen(bufferTime), &result, NULL); + WriteFile(hFile, buffer, (DWORD)mir_strlen(buffer), &result, NULL); } #endif diff --git a/protocols/ICQCorp/src/packet.cpp b/protocols/ICQCorp/src/packet.cpp index 0baebee9a7..45f753ef41 100644 --- a/protocols/ICQCorp/src/packet.cpp +++ b/protocols/ICQCorp/src/packet.cpp @@ -109,7 +109,7 @@ Packet &Packet::operator << (unsigned char data) Packet &Packet::operator << (char *data) { - unsigned int s = (unsigned int)strlen(data) + 1; + unsigned int s = (unsigned int)mir_strlen(data) + 1; operator << ((unsigned short)s); memcpy(nextData, data, s); sizeVal += s; diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 25967327d5..439add0b1e 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -913,7 +913,7 @@ void ICQ::processSystemMessage(Packet &packet, unsigned long checkUin, unsigned case ICQ_CMDxRCV_SYSxBROADCAST: T("broadcast message from %d\n", checkUin); - messageLen = (unsigned int)strlen(message); + messageLen = (unsigned int)mir_strlen(message); for (i=0; ihContact; ccs.szProtoService = PSR_FILE; diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index a94fa5450c..20796a0efb 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -275,7 +275,7 @@ static INT_PTR icqSetAwayMsg(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return 0; if (icq.awayMessage) delete [] icq.awayMessage; - icq.awayMessage = new char[strlen((char*)lParam) + 1]; + icq.awayMessage = new char[mir_strlen((char*)lParam) + 1]; strcpy(icq.awayMessage, (char*)lParam); return 0; @@ -446,7 +446,7 @@ static INT_PTR icqRecvFile(WPARAM wParam, LPARAM lParam) db_unset(ccs->hContact, "CList", "Hidden"); szFile = pre->szMessage + sizeof(DWORD); - szDesc = szFile + strlen(szFile) + 1; + szDesc = szFile + mir_strlen(szFile) + 1; ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize = sizeof(dbei); @@ -454,7 +454,7 @@ static INT_PTR icqRecvFile(WPARAM wParam, LPARAM lParam) dbei.timestamp = pre->timestamp; dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0); dbei.eventType = EVENTTYPE_FILE; - dbei.cbBlob = sizeof(DWORD)+(DWORD)strlen(szFile) + (DWORD)strlen(szDesc) + 2; + dbei.cbBlob = sizeof(DWORD)+(DWORD)mir_strlen(szFile) + (DWORD)mir_strlen(szDesc) + 2; dbei.pBlob = (PBYTE)pre->szMessage; db_event_add(ccs->hContact, &dbei); diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp index eb1a8dbf7b..a16369bd67 100644 --- a/protocols/ICQCorp/src/transfer.cpp +++ b/protocols/ICQCorp/src/transfer.cpp @@ -110,7 +110,7 @@ void ICQTransfer::processTcpPacket(Packet &packet) if (directoryName[0]) { - char *fullName = new char[strlen(directoryName) + strlen(files[current]) + 2]; + char *fullName = new char[mir_strlen(directoryName) + mir_strlen(files[current]) + 2]; sprintf(fullName, "%s\\%s", directoryName, files[current]); delete [] files[current]; files[current] = fullName; @@ -234,7 +234,7 @@ void ICQTransfer::sendPacket0x02() packet << (unsigned char)0x02 << directory << (strrchr(fileName, '\\') + 1) - << (directoryName + strlen(path) + 1) + << (directoryName + mir_strlen(path) + 1) << fileSize << fileDate << speed; @@ -396,7 +396,7 @@ void ICQTransfer::resume(int action, const char *newName) case FILERESUME_RENAME: T("[ ] rename file\n"); delete [] fileName; - fileName = new char[strlen(newName) + 1]; + fileName = new char[mir_strlen(newName) + 1]; strcpy(fileName, newName); files[current] = fileName; diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 824588b369..9d73f4b92c 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -228,7 +228,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, TCHAR* msg) dbei.timestamp = (DWORD)time(NULL); dbei.flags = DBEF_SENT + DBEF_UTF; dbei.pBlob = (PBYTE)mir_utf8encodeW(S.c_str()); - dbei.cbBlob = (DWORD)strlen((char*)dbei.pBlob) + 1; + dbei.cbBlob = (DWORD)mir_strlen((char*)dbei.pBlob) + 1; db_event_add(hContact, &dbei); mir_free(dbei.pBlob); return 1; diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index eaee830928..d330cc0963 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -176,7 +176,7 @@ void CIrcProto::SendIrcMessage(const TCHAR* msg, bool bNotify, int codepage) if (this) { char* str = mir_t2a_cp(msg, codepage); rtrim(str); - int cbLen = (int)strlen(str); + int cbLen = (int)mir_strlen(str); str = (char*)mir_realloc(str, cbLen + 3); strcat(str, "\r\n"); NLSend((const BYTE*)str, cbLen + 2); @@ -293,7 +293,7 @@ int CIrcProto::NLSend(const TCHAR* fmt, ...) va_end(marker); char* buf = mir_t2a_cp(szBuf, getCodepage()); - int result = NLSend((unsigned char*)buf, (int)strlen(buf)); + int result = NLSend((unsigned char*)buf, (int)mir_strlen(buf)); mir_free(buf); return result; } diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index abc5ef02dd..e7582fe1a9 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -45,7 +45,7 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) case DBVT_ASCIIZ: if (!getString(p->name, &dbv)) { if (p->size != -1) { - size_t len = min(p->size - 1, strlen(dbv.pszVal)); + size_t len = min(p->size - 1, mir_strlen(dbv.pszVal)); memcpy(ptr, dbv.pszVal, len); ptr[len] = 0; } diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index 59c0b51efc..dcda61cc90 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -659,7 +659,7 @@ void CIcqProto::icq_sendSetAimAwayMsgServ(const char *szMsg) if (IsUSASCII(szMsg, wMsgLen)) { const char* fmt = "text/x-aolrtf; charset=\"us-ascii\""; - size_t fmtlen = strlen(fmt); + size_t fmtlen = mir_strlen(fmt); serverPacketInit(&packet, 23 + wMsgLen + fmtlen); packFNACHeader(&packet, ICQ_LOCATION_FAMILY, ICQ_LOCATION_SET_USER_INFO, 0, dwCookie); @@ -669,7 +669,7 @@ void CIcqProto::icq_sendSetAimAwayMsgServ(const char *szMsg) } else { const char* fmt = "text/x-aolrtf; charset=\"unicode-2-0\""; - size_t fmtlen = strlen(fmt); + size_t fmtlen = mir_strlen(fmt); WCHAR *szMsgW = make_unicode_string(szMsg); wMsgLen = mir_wstrlen(szMsgW) * sizeof(WCHAR); diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 8b23af83a5..18fbec6911 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -293,7 +293,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) DBEVENTINFO dbei = { sizeof(DBEVENTINFO) }; dbei.eventType = EVENTTYPE_MESSAGE; dbei.szModule = m_szModuleName; - dbei.cbBlob = (DWORD)strlen(szEventText); + dbei.cbBlob = (DWORD)mir_strlen(szEventText); dbei.flags = DBEF_READ + DBEF_UTF + from; dbei.pBlob = (PBYTE)(char*)szEventText; dbei.timestamp = tmStart + _ttol(tszSecs) - timezone; diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 457b0bbde9..150b22e5d4 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -469,7 +469,7 @@ void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, TCHAR * void CJabberInfoFrame::ShowInfoItem(char *pszName, bool bShow) { bool bUpdate = false; - size_t length = strlen(pszName); + size_t length = mir_strlen(pszName); for (int i=0; i < m_pItems.getCount(); i++) if ((m_pItems[i].m_bShow != bShow) && !strncmp(m_pItems[i].m_pszName, pszName, length)) { m_pItems[i].m_bShow = bShow; @@ -484,7 +484,7 @@ void CJabberInfoFrame::ShowInfoItem(char *pszName, bool bShow) void CJabberInfoFrame::RemoveInfoItem(char *pszName) { bool bUpdate = false; - size_t length = strlen(pszName); + size_t length = mir_strlen(pszName); for (int i=0; i < m_pItems.getCount(); i++) if (!strncmp(m_pItems[i].m_pszName, pszName, length)) { if (!m_pItems[i].m_bShow) --m_hiddenItemCount; diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index d2923a76d1..5c2715f7bf 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -434,7 +434,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) char text[ 256 ]; strcpy(text, m_szModuleName); - size_t nModuleNameLength = strlen(text); + size_t nModuleNameLength = mir_strlen(text); char* tDest = text + nModuleNameLength; mi.flags = CMIF_CHILDPOPUP; @@ -603,7 +603,7 @@ void CJabberProto::MenuInit() { char text[200]; strncpy(text, m_szModuleName, sizeof(text)-1); - char* tDest = text + strlen(text); + char* tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; @@ -727,7 +727,7 @@ void CJabberProto::MenuInit() m_hMenuPriorityRoot = Menu_AddProtoMenuItem(&mi); TCHAR szName[128]; - char srvFce[MAX_PATH + 64], *svcName = srvFce + strlen(m_szModuleName); + char srvFce[MAX_PATH + 64], *svcName = srvFce + mir_strlen(m_szModuleName); mi.pszService = srvFce; mi.ptszName = szName; mi.position = 2000040000; @@ -826,7 +826,7 @@ void CJabberProto::GlobalMenuInit() char text[200]; strncpy(text, m_szModuleName, sizeof(text) - 1); - char* tDest = text + strlen(text); + char* tDest = text + mir_strlen(text); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = text; diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 36156ae559..5159477d75 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -83,14 +83,14 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) dbei.timestamp = (DWORD)time(NULL); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = (DWORD)(sizeof(DWORD)*2 + strlen(szNick) + strlen(szJid) + 5); + dbei.cbBlob = (DWORD)(sizeof(DWORD)*2 + mir_strlen(szNick) + mir_strlen(szJid) + 5); PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); - strcpy((char*)pCurBlob, szNick); pCurBlob += strlen(szNick)+1; + strcpy((char*)pCurBlob, szNick); pCurBlob += mir_strlen(szNick)+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName - strcpy((char*)pCurBlob, szJid); pCurBlob += strlen(szJid)+1; + strcpy((char*)pCurBlob, szJid); pCurBlob += mir_strlen(szJid)+1; *pCurBlob = '\0'; //reason db_event_add(NULL, &dbei); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index bc964b58f1..4116d1ac6b 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1235,7 +1235,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) char *tmp = mir_utf8encodeT(xtmp); xi.freeMem(xtmp); - fwrite(tmp, 1, strlen(tmp), fp); + fwrite(tmp, 1, mir_strlen(tmp), fp); mir_free(tmp); fclose(fp); } diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index f40f94429f..f20c678d00 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -2121,7 +2121,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mir_cslock lck(m_privacyListManager.m_cs); - char srvFce[MAX_PATH + 64], *svcName = srvFce + strlen(m_szModuleName); + char srvFce[MAX_PATH + 64], *svcName = srvFce + mir_strlen(m_szModuleName); CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 2000040000; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index a7663e7624..0df2add95a 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -365,9 +365,9 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEV return NULL; char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); MCONTACT hContact = (MCONTACT)AddToListByJID(newJid, flags); @@ -396,9 +396,9 @@ int CJabberProto::Authorize(MEVENT hDbEvent) return 1; char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; debugLog(_T("Send 'authorization allowed' to %s"), jid); @@ -450,9 +450,9 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) return 1; char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; debugLogA("Send 'authorization denied' to %s", jid); @@ -966,11 +966,11 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) } int isEncrypted, id = SerialNext(); - if (!strncmp(pszSrc, PGP_PROLOG, strlen(PGP_PROLOG))) { + if (!strncmp(pszSrc, PGP_PROLOG, mir_strlen(PGP_PROLOG))) { const char *szEnd = strstr(pszSrc, PGP_EPILOG); - char *tempstring = (char*)alloca(strlen(pszSrc) + 1); - size_t nStrippedLength = strlen(pszSrc) - strlen(PGP_PROLOG) - (szEnd ? strlen(szEnd) : 0); - strncpy_s(tempstring, nStrippedLength, pszSrc + strlen(PGP_PROLOG), _TRUNCATE); + char *tempstring = (char*)alloca(mir_strlen(pszSrc) + 1); + size_t nStrippedLength = mir_strlen(pszSrc) - mir_strlen(PGP_PROLOG) - (szEnd ? mir_strlen(szEnd) : 0); + strncpy_s(tempstring, nStrippedLength, pszSrc + mir_strlen(PGP_PROLOG), _TRUNCATE); tempstring[nStrippedLength] = 0; pszSrc = tempstring; isEncrypted = 1; diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 154db21e39..b83d3ef89c 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -580,7 +580,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe HXML addressesNode = msg << XCHILDNS(_T("addresses"), JABBER_FEAT_EXT_ADDRESSING); TCHAR szOFrom[JABBER_MAX_JID_LEN]; - size_t cbBlob = strlen((LPSTR)dbei.pBlob)+1; + size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1; if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1)); mir_sntprintf(szOFrom, SIZEOF(szOFrom), _T("%s/%s"), tszJid, szOResource); diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index d840ddcd89..3d380eb32a 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -162,37 +162,37 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) serv(mir_utf8encode(info->conn.server)); mir_md5_init(&ctx); - mir_md5_append(&ctx, (BYTE*)(char*)uname, (int)strlen(uname)); + mir_md5_append(&ctx, (BYTE*)(char*)uname, (int)mir_strlen(uname)); mir_md5_append(&ctx, (BYTE*)":", 1); - mir_md5_append(&ctx, (BYTE*)realm, (int)strlen(realm)); + mir_md5_append(&ctx, (BYTE*)realm, (int)mir_strlen(realm)); mir_md5_append(&ctx, (BYTE*)":", 1); - mir_md5_append(&ctx, (BYTE*)(char*)passw, (int)strlen(passw)); + mir_md5_append(&ctx, (BYTE*)(char*)passw, (int)mir_strlen(passw)); mir_md5_finish(&ctx, (BYTE*)hash1); mir_md5_init(&ctx); mir_md5_append(&ctx, (BYTE*)hash1, 16); mir_md5_append(&ctx, (BYTE*)":", 1); - mir_md5_append(&ctx, (BYTE*)nonce, (int)strlen(nonce)); + mir_md5_append(&ctx, (BYTE*)nonce, (int)mir_strlen(nonce)); mir_md5_append(&ctx, (BYTE*)":", 1); - mir_md5_append(&ctx, (BYTE*)cnonce, (int)strlen(cnonce)); + mir_md5_append(&ctx, (BYTE*)cnonce, (int)mir_strlen(cnonce)); mir_md5_finish(&ctx, (BYTE*)hash1); mir_md5_init(&ctx); mir_md5_append(&ctx, (BYTE*)"AUTHENTICATE:xmpp/", 18); - mir_md5_append(&ctx, (BYTE*)(char*)serv, (int)strlen(serv)); + mir_md5_append(&ctx, (BYTE*)(char*)serv, (int)mir_strlen(serv)); mir_md5_finish(&ctx, (BYTE*)hash2); mir_md5_init(&ctx); mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3])); - mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)strlen(tmpBuf)); + mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf)); mir_md5_append(&ctx, (BYTE*)":", 1); - mir_md5_append(&ctx, (BYTE*)nonce, (int)strlen(nonce)); + mir_md5_append(&ctx, (BYTE*)nonce, (int)mir_strlen(nonce)); mir_snprintf(tmpBuf, SIZEOF(tmpBuf), ":%08d:", iCallCount); - mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)strlen(tmpBuf)); - mir_md5_append(&ctx, (BYTE*)cnonce, (int)strlen(cnonce)); + mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf)); + mir_md5_append(&ctx, (BYTE*)cnonce, (int)mir_strlen(cnonce)); mir_md5_append(&ctx, (BYTE*)":auth:", 6); mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3])); - mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)strlen(tmpBuf)); + mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf)); mir_md5_finish(&ctx, (BYTE*)digest); char *buf = (char*)alloca(8000); @@ -249,7 +249,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge) for (char *p = strtok(NEWSTR_ALLOCA(chl), ","); p != NULL; p = strtok(NULL, ",")) { if (*p == 'r' && p[1] == '=') { // snonce - if (strncmp(cnonce, p + 2, strlen(cnonce))) + if (strncmp(cnonce, p + 2, mir_strlen(cnonce))) return NULL; snonce = mir_strdup(p + 2); } @@ -263,7 +263,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge) return NULL; ptrA passw(mir_utf8encodeT(info->conn.password)); - size_t passwLen = strlen(passw); + size_t passwLen = mir_strlen(passw); BYTE saltedPassw[MIR_SHA1_HASH_SIZE]; Hi(saltedPassw, passw, passwLen, salt, saltLen, ind); @@ -341,7 +341,7 @@ char* TPlainAuth::getInitialRequest() { ptrA uname(mir_utf8encodeT(info->conn.username)), passw(mir_utf8encodeT(info->conn.password)); - size_t size = 2 * strlen(uname) + strlen(passw) + strlen(info->conn.server) + 4; + size_t size = 2 * mir_strlen(uname) + mir_strlen(passw) + mir_strlen(info->conn.server) + 4; char *toEncode = (char*)alloca(size); if (bOld) size = mir_snprintf(toEncode, size, "%s@%s%c%s%c%s", uname, info->conn.server, 0, uname, 0, passw); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index f185af3e33..66ef740ca8 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -206,7 +206,7 @@ void CJabberProto::xmlStreamInitializeNow(ThreadData *info) LPTSTR xmlQuery = xi.toString(n, NULL); char* buf = mir_utf8encodeT(xmlQuery); - int bufLen = (int)strlen(buf); + int bufLen = (int)mir_strlen(buf); if (bufLen > 2) { strdel(buf + bufLen - 2, 1); bufLen--; @@ -392,7 +392,7 @@ LBL_FatalError: // User may change status to OFFLINE while we are connecting above if (m_iDesiredStatus != ID_STATUS_OFFLINE || info.bIsReg) { if (!info.bIsReg) { - size_t len = _tcslen(info.conn.username) + strlen(info.conn.server) + 1; + size_t len = _tcslen(info.conn.username) + mir_strlen(info.conn.server) + 1; m_szJabberJID = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1)); mir_sntprintf(m_szJabberJID, len + 1, _T("%s@%S"), info.conn.username, info.conn.server); m_bSendKeepAlive = m_options.KeepAlive != 0; @@ -1229,8 +1229,8 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (xmlGetChild(xNode, "delivered") != NULL || xmlGetChild(xNode, "offline") != NULL) { int id = -1; if (idNode != NULL && xmlGetText(idNode) != NULL) - if (!_tcsncmp(xmlGetText(idNode), _T(JABBER_IQID), strlen(JABBER_IQID))) - id = _ttoi((xmlGetText(idNode)) + strlen(JABBER_IQID)); + if (!_tcsncmp(xmlGetText(idNode), _T(JABBER_IQID), mir_strlen(JABBER_IQID))) + id = _ttoi((xmlGetText(idNode)) + mir_strlen(JABBER_IQID)); if (id != -1) ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)id, 0); @@ -1943,7 +1943,7 @@ int ThreadData::send(char* buffer, int bufsize) return 0; if (bufsize == -1) - bufsize = (int)strlen(buffer); + bufsize = (int)mir_strlen(buffer); WaitForSingleObject(iomutex, 6000); @@ -1988,7 +1988,7 @@ int ThreadData::send(HXML node) char* utfStr = mir_utf8encodeT(str); - int result = send(utfStr, (int)strlen(utfStr)); + int result = send(utfStr, (int)mir_strlen(utfStr)); mir_free(utfStr); xi.freeMem(str); diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 2c7da1dafe..5416ffa74f 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -170,7 +170,7 @@ char* __stdcall JabberSha1(const char *str, JabberShaStrBuf buf) BYTE digest[MIR_SHA1_HASH_SIZE]; mir_sha1_ctx sha; mir_sha1_init(&sha); - mir_sha1_append(&sha, (BYTE*)str, (int)strlen(str)); + mir_sha1_append(&sha, (BYTE*)str, (int)mir_strlen(str)); mir_sha1_finish(&sha, digest); bin2hex(digest, sizeof(digest), buf); diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index f22cb1cfdf..427638fc65 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -170,9 +170,9 @@ MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent) (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS)) { char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2); - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *email = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *email = lastName + mir_strlen(lastName) + 1; return AddToListByEmail(_A2T(email), _A2T(nick), _A2T(firstName), _A2T(lastName), 0); } } diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 4852f8a19e..873394ba0e 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -90,7 +90,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType buf.SetLPSW(_T(""));//***deb possible nick here buf.SetLPSW(lpwszMessage); lpszMessageConverted = mir_base64_encode(buf.Data(), (int)buf.Len()); - dwMessageConvertedSize = strlen(lpszMessageConverted); + dwMessageConvertedSize = mir_strlen(lpszMessageConverted); } // messages with Flash else if (dwFlags & MESSAGE_FLAG_FLASH) { diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 26ccd72fe8..d2f84ff04f 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -670,7 +670,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (getByte("TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) { strncpy(szServiceFunction, m_szModuleName, MAX_PATH); - pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName); + pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName); memcpy(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX)); cle.pszService = szServiceFunction; } diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 4fcf9cbdd0..1638ad1054 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -279,7 +279,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) { CHAR szServiceFunction[MAX_PATH * 2], *pszServiceFunctionName, szValueName[MAX_PATH]; strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction)); - pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName); + pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName); TCHAR szItem[MAX_PATH + 64]; mir_sntprintf(szItem, SIZEOF(szItem), _T("%s Custom Status"), m_tszUserName); @@ -327,7 +327,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI char szServiceFunction[MAX_PATH]; strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction)); - char *pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName); + char *pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName); CLISTMENUITEM mi = { sizeof(mi) }; diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index f17cc8ce60..856ab61442 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -1763,7 +1763,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & ptrA lpbBuffer(mir_u2a_cp(wszMessage, MRA_CODE_PAGE)); pre.flags = 0; pre.szMessage = (LPSTR)lpbBuffer; - pre.lParam = strlen(lpbBuffer); + pre.lParam = mir_strlen(lpbBuffer); LPSTR lpbBufferCurPos = lpbBuffer; while (TRUE) { // öèêë çàìåíû ; íà 0 diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index ae8bc6814b..b54ef2c1ba 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -186,7 +186,7 @@ int CMsnProto::MSN_GetPassportAuth(void) const char *errurl; { errurl = NULL; - ezxml_t xml = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xml = ezxml_parse_str(tResult, mir_strlen(tResult)); ezxml_t tokr = ezxml_get(xml, "S:Body", 0, "wst:RequestSecurityTokenResponseCollection", 0, @@ -389,7 +389,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) derive_key(key2, key1, key1len, (unsigned char*)encdata1, sizeof(encdata1) - 1); derive_key(key3, key1, key1len, (unsigned char*)encdata2, sizeof(encdata2) - 1); - size_t chllen = strlen(challenge); + size_t chllen = mir_strlen(challenge); BYTE hash[MIR_SHA1_HASH_SIZE]; mir_hmac_sha1(hash, key2, MIR_SHA1_HASH_SIZE + 4, (BYTE*)challenge, chllen); @@ -576,7 +576,7 @@ static int CopyCookies(NETLIBHTTPREQUEST *nlhrReply, NETLIBHTTPHEADER *hdr) if (*hdr->szValue) strcat (hdr->szValue, "; "); strcat (hdr->szValue, nlhrReply->headers[i].szValue); } - else nSize += (int)strlen(nlhrReply->headers[i].szValue) + 2; + else nSize += (int)mir_strlen(nlhrReply->headers[i].szValue) + 2; } return nSize; } @@ -618,7 +618,7 @@ bool CMsnProto::RefreshOAuth(const char *pszRefreshToken, const char *pszService ptrA(mir_urlEncode(pszService)), pszRefreshToken); nlhr.pData = (char*)(const char*)post; - nlhr.dataLength = (int)strlen(nlhr.pData); + nlhr.dataLength = (int)mir_strlen(nlhr.pData); nlhr.szUrl = "https://login.live.com/oauth20_token.srf"; // Query @@ -783,7 +783,7 @@ int CMsnProto::MSN_AuthOAuth(void) nlhr.requestType = REQUEST_POST; nlhr.flags &= (~NLHRF_REDIRECT); mHttpsTS = clock(); - nlhr.dataLength = (int)strlen(post); + nlhr.dataLength = (int)mir_strlen(post); nlhr.pData = (char*)(const char*)post; nlhr.nlc = hHttpsConnection; NETLIBHTTPREQUEST *nlhrReply2 = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr); @@ -848,7 +848,7 @@ int CMsnProto::MSN_AuthOAuth(void) /* Prepare headers*/ nlhr.headers[2].szValue = "application/json"; nlhr.pData = "{\"trouterurl\":\"https://\",\"connectionid\":\"a\"}"; - nlhr.dataLength = (int)strlen(nlhr.pData); + nlhr.dataLength = (int)mir_strlen(nlhr.pData); nlhr.szUrl = "https://skypewebexperience.live.com/v1/User/Initialization"; nlhr.nlc = hHttpsConnection; diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 0f3cd8db04..e4fc9428e1 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -145,7 +145,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para buf.AppendFormat("Ack-Id: %s\r\n", tHeader["Ack-Id"]); if (msnRegistration) buf.AppendFormat("Registration: %s\r\n", msnRegistration); buf.AppendFormat("\r\n"); - msnNsThread->sendPacket("ACK", "MSGR %d\r\n%s", strlen(buf), buf); + msnNsThread->sendPacket("ACK", "MSGR %d\r\n%s", mir_strlen(buf), buf); } msgBody = tHeader.readFromBuffer(msgBody); if (!(email = NEWSTR_ALLOCA(tHeader["From"]))) return; @@ -173,7 +173,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (tChunks) idx = addCachedMsg(tMsgId, msg, 0, msgBytes, atol(tChunks), true); else - idx = addCachedMsg(tMsgId, msgBody, 0, strlen(msgBody), 0, true); + idx = addCachedMsg(tMsgId, msgBody, 0, mir_strlen(msgBody), 0, true); size_t newsize; if (!getCachedMsg(idx, newbody, newsize)) return; @@ -214,7 +214,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para MCONTACT hContact = strncmp(email, "19:", 3)?MSN_HContactFromEmail(email, nick, true, true):NULL; if (!_stricmp(tHeader["Message-Type"], "RichText/Contacts")) { - ezxml_t xmli = ezxml_parse_str(msgBody, strlen(msgBody)); + ezxml_t xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody)); if (xmli) { if (!strcmp(xmli->name, "contacts")) { ezxml_t c; @@ -275,7 +275,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para const char* tP4Context = tHeader["P4-Context"]; if (tP4Context) { - size_t newlen = strlen(msgBody) + strlen(tP4Context) + 4; + size_t newlen = mir_strlen(msgBody) + mir_strlen(tP4Context) + 4; char* newMsgBody = (char*)mir_alloc(newlen); mir_snprintf(newMsgBody, newlen, "[%s] %s", tP4Context, msgBody); mir_free(newbody); @@ -284,7 +284,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (mChatID[0]) { if (!_strnicmp(tHeader["Message-Type"], "ThreadActivity/", 15)) { - ezxml_t xmli = ezxml_parse_str(msgBody, strlen(msgBody)); + ezxml_t xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody)); if (xmli) { MSN_GCProcessThreadActivity(xmli, mChatID); ezxml_free(xmli); @@ -312,7 +312,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para dbei.flags = DBEF_SENT | DBEF_UTF | (haveWnd ? 0 : DBEF_READ) | (isRtl ? DBEF_RTL : 0); dbei.szModule = m_szModuleName; dbei.timestamp = time(NULL); - dbei.cbBlob = (unsigned)strlen(msgBody) + 1; + dbei.cbBlob = (unsigned)mir_strlen(msgBody) + 1; dbei.pBlob = (PBYTE)msgBody; db_event_add(hContact, &dbei); } @@ -680,14 +680,14 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) size_t lenPart = mir_snprintf(part, SIZEOF(part), "{%d}", i - 4); if (parts[i][0] == '\0' && unknown != NULL) parts[i] = unknown; - size_t lenPartsI = strlen(parts[i]); + size_t lenPartsI = mir_strlen(parts[i]); for (p = strstr(format, part); p; p = strstr(p + lenPartsI, part)) { if (lenPart < lenPartsI) { int loc = p - format; - format = (char *)mir_realloc(format, strlen(format) + (lenPartsI - lenPart) + 1); + format = (char *)mir_realloc(format, mir_strlen(format) + (lenPartsI - lenPart) + 1); p = format + loc; } - memmove(p + lenPartsI, p + lenPart, strlen(p + lenPart) + 1); + memmove(p + lenPartsI, p + lenPart, mir_strlen(p + lenPart) + 1); memmove(p, parts[i], lenPartsI); } } @@ -827,7 +827,7 @@ LBL_InvalidCommand: "%.*s\r\n", msnP24Ver, (msnP24Ver>1?"1":""), msnStoreAppId, msnProductVer, - strlen(MyOptions.szMachineGuid)-2, MyOptions.szMachineGuid+1); + mir_strlen(MyOptions.szMachineGuid)-2, MyOptions.szMachineGuid+1); bSentBND = true; } else @@ -859,7 +859,7 @@ LBL_InvalidCommand: replaceStr(msnRegistration,tHeader["Set-Registration"]); if (!strcmp(data.typeId, "CON")) { - ezxml_t xmlbnd = ezxml_parse_str(msgBody, strlen(msgBody)); + ezxml_t xmlbnd = ezxml_parse_str(msgBody, mir_strlen(msgBody)); ezxml_t xmlbdy = ezxml_child(xmlbnd, "nonce"); if (xmlbdy) { @@ -920,7 +920,7 @@ LBL_InvalidCommand: } else { /* Skype username/pass login */ - ezxml_t xmlcnt = ezxml_parse_str(msgBody, strlen(msgBody)); + ezxml_t xmlcnt = ezxml_parse_str(msgBody, mir_strlen(msgBody)); ezxml_t xmlnonce = ezxml_child(xmlcnt, "nonce"); if (xmlnonce) { char szUIC[1024]={0}; @@ -958,7 +958,7 @@ LBL_InvalidCommand: ezxml_t xmli; if (tHeader["Set-Registration"]) replaceStr(msnRegistration,tHeader["Set-Registration"]); - if (xmli = ezxml_parse_str(msgBody, strlen(msgBody))) + if (xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody))) { if (!strcmp(xmli->name, "recentconversations-response")) { @@ -1027,7 +1027,7 @@ LBL_InvalidCommand: stripHTML(message); HtmlDecode(message); } else if (!strncmp(msgtype->txt, "ThreadActivity/", 15)) { - if (ezxml_t xmlact = ezxml_parse_str(content->txt, strlen(content->txt))) { + if (ezxml_t xmlact = ezxml_parse_str(content->txt, mir_strlen(content->txt))) { MSN_GCProcessThreadActivity(xmlact, _A2T(id->txt)); ezxml_free(xmlact); } @@ -1046,7 +1046,7 @@ LBL_InvalidCommand: MEVENT hDbEvent; bool bDuplicate = false; DBEVENTINFO dbei = { sizeof(dbei) }; - DWORD cbBlob = (DWORD)strlen(message); + DWORD cbBlob = (DWORD)mir_strlen(message); dbei.cbBlob = cbBlob; BYTE *pszMsgBuf = (BYTE*)mir_calloc(cbBlob); if (pszMsgBuf) { @@ -1076,7 +1076,7 @@ LBL_InvalidCommand: dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = m_szModuleName; dbei.timestamp = ts; - dbei.cbBlob = (unsigned)strlen(message) + 1; + dbei.cbBlob = (unsigned)mir_strlen(message) + 1; dbei.pBlob = (PBYTE)message; db_event_add(hContact, &dbei); } @@ -1122,7 +1122,7 @@ LBL_InvalidCommand: } else if (!strcmp(data.typeId, "MSGR\\ABCH")) { MimeHeaders tHeader; msgBody = tHeader.readFromBuffer(msgBody); - MSN_ProcessNotificationMessage(msgBody, strlen(msgBody)); + MSN_ProcessNotificationMessage(msgBody, mir_strlen(msgBody)); break; } @@ -1139,7 +1139,7 @@ LBL_InvalidCommand: if (pszFrom) { ezxml_t xmli; - if (xmli = ezxml_parse_str(msgBody, strlen(msgBody))) + if (xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody))) { if (!strcmp(xmli->name, "user")) { @@ -1164,7 +1164,7 @@ LBL_InvalidCommand: char *msgBody = tHeader.readFromBuffer(info->mData); ezxml_t xmli; - if (xmli = ezxml_parse_str(msgBody, strlen(msgBody))) + if (xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody))) { MSN_ChatStart(xmli); ezxml_free(xmli); @@ -1190,7 +1190,7 @@ LBL_InvalidCommand: if (tHeader["Set-Registration"]) replaceStr(msnRegistration,tHeader["Set-Registration"]); if (cmdString[1]=='N') { // PNG - if (ezxml_t xmli = ezxml_parse_str(msgBody, strlen(msgBody))) { + if (ezxml_t xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody))) { if (ezxml_t wait = ezxml_child(xmli, "wait")) { msnPingTimeout = atoi(ezxml_txt(wait)); if (msnPingTimeout && hKeepAliveThreadEvt != NULL) @@ -1200,7 +1200,7 @@ LBL_InvalidCommand: } } else { // PUT ezxml_t xmli; - if (*msgBody && (xmli = ezxml_parse_str(msgBody, strlen(msgBody)))) { + if (*msgBody && (xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody)))) { if (!strcmp(xmli->name, "presence-response")) { ezxml_t user, from; if ((user = ezxml_child(xmli, "user")) && (from = ezxml_child(xmli, "from"))) { @@ -1239,7 +1239,7 @@ LBL_InvalidCommand: HReadBuffer buf(info, 0); char* msgBody = tHeader.readFromBuffer((char*)buf.surelyRead(atol(data.strMsgBytes))); if (!strcmp(data.typeId, "CON")) { - ezxml_t xmlxfr = ezxml_parse_str(msgBody, strlen(msgBody)); + ezxml_t xmlxfr = ezxml_parse_str(msgBody, mir_strlen(msgBody)); ezxml_t xmltgt = ezxml_child(xmlxfr, "target"); if (xmltgt) { @@ -1514,7 +1514,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i memcpy(ft->p2p_object, tok1, sz); ft->p2p_object[sz] = 0; - size_t slen = strlen(lastsml); + size_t slen = mir_strlen(lastsml); ptrA buf(mir_base64_encode((PBYTE)lastsml, (unsigned)slen)); ptrA smileyName(mir_urlEncode(buf)); diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index dfd2e296c7..f30b06bb66 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -37,7 +37,7 @@ void CMsnProto::msnftp_sendAcceptReject(filetransfer *ft, bool acc) "Invitation-Cookie: %s\r\n" "Launch-Application: FALSE\r\n" "Request-Data: IP-Address:\r\n\r\n", - 172 + 4 + strlen(ft->szInvcookie), ft->szInvcookie); + 172 + 4 + mir_strlen(ft->szInvcookie), ft->szInvcookie); } else { thread->sendPacket("MSG", @@ -46,7 +46,7 @@ void CMsnProto::msnftp_sendAcceptReject(filetransfer *ft, bool acc) "Invitation-Command: CANCEL\r\n" "Invitation-Cookie: %s\r\n" "Cancel-Code: REJECT\r\n\r\n", - 172 - 33 + 4 + strlen(ft->szInvcookie), ft->szInvcookie); + 172 - 33 + 4 + mir_strlen(ft->szInvcookie), ft->szInvcookie); } } @@ -181,7 +181,7 @@ LBL_InvalidCommand: } else if (info->mCaller == 2) { //send static const char sttCommand[] = "VER MSNFTP\r\n"; - info->send(sttCommand, strlen(sttCommand)); + info->send(sttCommand, mir_strlen(sttCommand)); } break; @@ -210,7 +210,7 @@ LBL_Error: if (tIsTransitionFinished) { LBL_Success: static const char sttCommand[] = "BYE 16777989\r\n"; - info->send(sttCommand, strlen(sttCommand)); + info->send(sttCommand, mir_strlen(sttCommand)); return 1; } diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index a77a343a2d..f67299fa4c 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -63,7 +63,7 @@ bool txtParseParam(const char* szData, const char* presearch, const char* start, cp = strstr(cp1, start); if (cp == NULL) return false; - cp += strlen(start); + cp += mir_strlen(start); while (*cp == ' ') ++cp; if (finish) { @@ -338,7 +338,7 @@ char* getNewUuid(void) BYTE *p; UuidToStringA(&id, &p); - size_t len = strlen((char*)p) + 3; + size_t len = mir_strlen((char*)p) + 3; char *result = (char*)mir_alloc(len); mir_snprintf(result, len, "{%s}", p); _strupr(result); diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 77d5d9600c..984e8fe8b2 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -45,7 +45,7 @@ ezxml_t CMsnProto::oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr tbdy = ezxml_add_child(bdy, service, 0); ezxml_set_attr(tbdy, "xmlns", "http://www.hotmail.msn.com/ws/2004/09/oim/rsi"); - size_t hdrsz = strlen(service) + sizeof(mailReqHdr) + 20; + size_t hdrsz = mir_strlen(service) + sizeof(mailReqHdr) + 20; httphdr = (char*)mir_alloc(hdrsz); mir_snprintf(httphdr, hdrsz, mailReqHdr, service); @@ -88,7 +88,7 @@ void CMsnProto::getOIMs(ezxml_t xmli) mir_free(url); if (tResult != NULL && status == 200) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); ezxml_t body = getSoapResponse(xmlm, "GetMessage"); MimeHeaders mailInfo; @@ -168,7 +168,7 @@ void CMsnProto::getMetaData(void) mir_free(getReqHdr); if (tResult != NULL && status == 200) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); ezxml_t xmli = ezxml_get(xmlm, "s:Body", 0, "GetMetadataResponse", 0, "MD", -1); if (!xmli) xmli = ezxml_get(xmlm, "soap:Body", 0, "GetMetadataResponse", 0, "MD", -1); @@ -186,7 +186,7 @@ void CMsnProto::processMailData(char* mailData) getMetaData(); } else { - ezxml_t xmli = ezxml_parse_str(mailData, strlen(mailData)); + ezxml_t xmli = ezxml_parse_str(mailData, mir_strlen(mailData)); ezxml_t toke = ezxml_child(xmli, "E"); @@ -357,7 +357,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) static void TruncUtf8(char *str, size_t sz) { - size_t len = strlen(str); + size_t len = mir_strlen(str); if (sz > len) sz = len; size_t cntl = 0, cnt = 0; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index fc1eb5441d..c596f06b87 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -274,7 +274,7 @@ void CMsnProto::MsnInitMainMenu(void) { char servicefunction[100]; strcpy(servicefunction, m_szModuleName); - char* tDest = servicefunction + strlen(servicefunction); + char* tDest = servicefunction + mir_strlen(servicefunction); CLISTMENUITEM mi = { sizeof(mi) }; @@ -410,7 +410,7 @@ void MSN_InitContactMenu(void) { char servicefunction[100]; strcpy(servicefunction, "MSN"); - char* tDest = servicefunction + strlen(servicefunction); + char* tDest = servicefunction + mir_strlen(servicefunction); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = servicefunction; diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index 9a60356ab1..7545c5759d 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -111,7 +111,7 @@ void MimeHeaders::addBool(const char* name, bool lValue) char* MimeHeaders::flipStr(const char* src, size_t len, char* dest) { - if (len == -1) len = strlen(src); + if (len == -1) len = mir_strlen(src); if (src == dest) { const unsigned b = (unsigned)len-- / 2; @@ -139,7 +139,7 @@ size_t MimeHeaders::getLength(void) size_t iResult = 0; for (unsigned i = 0; i < mCount; i++) { MimeHeader& H = mVals[i]; - iResult += strlen(H.name) + strlen(H.value) + 4; + iResult += mir_strlen(H.name) + mir_strlen(H.value) + 4; } return iResult + (iResult ? 2 : 0); @@ -219,7 +219,7 @@ const char* MimeHeaders::find(const char* szFieldName) return MH.value; } - const size_t len = strlen(szFieldName); + const size_t len = mir_strlen(szFieldName); char* szFieldNameR = (char*)alloca(len + 1); flipStr(szFieldName, len, szFieldNameR); @@ -400,7 +400,7 @@ static size_t utf8toutf16(char* str, wchar_t* res) wchar_t* MimeHeaders::decode(const char* val) { - size_t ssz = strlen(val) * 2 + 1; + size_t ssz = mir_strlen(val) * 2 + 1; char* tbuf = (char*)alloca(ssz); memcpy(tbuf, val, ssz); diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index ff7e203847..fcf168788d 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -89,13 +89,13 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true); - int emaillen = (int)strlen(email); + int emaillen = (int)mir_strlen(email); if (nick == NULL) nick = ""; - int nicklen = (int)strlen(nick); + int nicklen = (int)mir_strlen(nick); if (reason == NULL) reason = ""; - int reasonlen = (int)strlen(reason); + int reasonlen = (int)mir_strlen(reason); PROTORECVEVENT pre = { 0 }; pre.timestamp = (DWORD)time(NULL); @@ -139,7 +139,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) char *res = NULL; - ezxml_t xmli = ezxml_parse_str(NEWSTR_ALLOCA(szContext), strlen(szContext)); + ezxml_t xmli = ezxml_parse_str(NEWSTR_ALLOCA(szContext), mir_strlen(szContext)); const char *szAvatarHash = ezxml_attr(xmli, "SHA1D"); if (szAvatarHash != NULL) { unsigned hashLen; @@ -248,13 +248,13 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) ezxml_t xmlp = ezxml_new("msnobj"); mir_sha1_append(&sha1ctx, (PBYTE)"Creator", 7); - mir_sha1_append(&sha1ctx, (PBYTE)MyOptions.szEmail, (int)strlen(MyOptions.szEmail)); + mir_sha1_append(&sha1ctx, (PBYTE)MyOptions.szEmail, (int)mir_strlen(MyOptions.szEmail)); ezxml_set_attr(xmlp, "Creator", MyOptions.szEmail); char szFileSize[20]; _ultoa((unsigned)cbLen, szFileSize, 10); mir_sha1_append(&sha1ctx, (PBYTE)"Size", 4); - mir_sha1_append(&sha1ctx, (PBYTE)szFileSize, (int)strlen(szFileSize)); + mir_sha1_append(&sha1ctx, (PBYTE)szFileSize, (int)mir_strlen(szFileSize)); ezxml_set_attr(xmlp, "Size", szFileSize); mir_sha1_append(&sha1ctx, (PBYTE)"Type", 4); @@ -262,7 +262,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) ezxml_set_attr(xmlp, "Type", "3"); mir_sha1_append(&sha1ctx, (PBYTE)"Location", 8); - mir_sha1_append(&sha1ctx, (PBYTE)szFname, (int)strlen(szFname)); + mir_sha1_append(&sha1ctx, (PBYTE)szFname, (int)mir_strlen(szFname)); ezxml_set_attr(xmlp, "Location", szFname); mir_sha1_append(&sha1ctx, (PBYTE)"Friendly", 8); @@ -270,7 +270,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) ezxml_set_attr(xmlp, "Friendly", "AAA="); mir_sha1_append(&sha1ctx, (PBYTE)"SHA1D", 5); - mir_sha1_append(&sha1ctx, (PBYTE)(char*)szSha1d, (int)strlen(szSha1d)); + mir_sha1_append(&sha1ctx, (PBYTE)(char*)szSha1d, (int)mir_strlen(szSha1d)); ezxml_set_attr(xmlp, "SHA1D", szSha1d); mir_sha1_finish(&sha1ctx, sha1c); @@ -506,7 +506,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha pszMsgType, pszNick, pszContType, - strlen(parMsg)); + mir_strlen(parMsg)); if (*tFontName) buf.AppendFormat("X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n", tFontName, tFontStyle, tFontColor, (parFlags & MSG_RTL) ? ";RL=1" : ""); @@ -530,10 +530,10 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha #ifdef OBSOLETE if (netId == NETID_YAHOO || netId == NETID_MOB || (parFlags & MSG_OFFLINE)) seq = sendPacket("UUM", "%s %d %c %d\r\n%s%s", email, netId, msgType, - strlen(parMsg) + off, buf, parMsg); + mir_strlen(parMsg) + off, buf, parMsg); else seq = sendPacket("MSG", "%c %d\r\n%s%s", msgType, - strlen(parMsg) + off, buf, parMsg); + mir_strlen(parMsg) + off, buf, parMsg); #endif return seq; @@ -571,7 +571,7 @@ int ThreadData::sendRawMessage(int msgType, const char* data, int datLen) data = ""; if (datLen == -1) - datLen = (int)strlen(data); + datLen = (int)mir_strlen(data); char* buf = (char*)alloca(datLen + 100); @@ -732,7 +732,7 @@ int ThreadData::sendPacket(const char* cmd, const char* fmt, ...) if (strchr(str, '\r') == NULL) strcat(str, "\r\n"); - int result = send(str, strlen(str)); + int result = send(str, mir_strlen(str)); mir_free(str); return (result > 0) ? thisTrid : -1; } @@ -750,7 +750,7 @@ int ThreadData::sendPacketPayload(const char* cmd, const char *param, const char va_start(vararg, fmt); thisTrid = InterlockedIncrement(&mTrid); - int regSz = proto->msnRegistration ? (int)strlen(proto->msnRegistration)+16 : 0; + int regSz = proto->msnRegistration ? (int)mir_strlen(proto->msnRegistration)+16 : 0; int paramStart = mir_snprintf(str, strsize, "%s %d %s ", cmd, thisTrid, param), strszstart = 0, strSz; while ((strSz = mir_vsnprintf(str + paramStart, strsize - paramStart - regSz - 10, fmt, vararg)) == -1) str = (char*)mir_realloc(str, strsize += 512); @@ -762,7 +762,7 @@ int ThreadData::sendPacketPayload(const char* cmd, const char *param, const char str[strsize - 3] = 0; va_end(vararg); - int result = send(str, strlen(str)); + int result = send(str, mir_strlen(str)); mir_free(str); return (result > 0) ? thisTrid : -1; } @@ -1257,7 +1257,7 @@ char* directconnection::calcHashedNonce(UUID* nonce) char* p; UuidToStringA((UUID*)&sha, (BYTE**)&p); - size_t len = strlen(p) + 3; + size_t len = mir_strlen(p) + 3; char* result = (char*)mir_alloc(len); mir_snprintf(result, len, "{%s}", p); _strupr(result); @@ -1270,7 +1270,7 @@ char* directconnection::mNonceToText(void) { char* p; UuidToStringA(mNonce, (BYTE**)&p); - size_t len = strlen(p) + 3; + size_t len = mir_strlen(p) + 3; char* result = (char*)mir_alloc(len); mir_snprintf(result, len, "{%s}", p); _strupr(result); @@ -1282,7 +1282,7 @@ char* directconnection::mNonceToText(void) void directconnection::xNonceToBin(UUID* nonce) { - size_t len = strlen(xNonce); + size_t len = mir_strlen(xNonce); char *p = (char*)alloca(len); strcpy(p, xNonce + 1); p[len - 2] = 0; @@ -1377,8 +1377,8 @@ void MSN_MakeDigest(const char* chl, char* dgst) DWORD md5hash[4], md5hashOr[4]; mir_md5_state_t context; mir_md5_init(&context); - mir_md5_append(&context, (BYTE*)chl, (int)strlen(chl)); - mir_md5_append(&context, (BYTE*)msnProtChallenge, (int)strlen(msnProtChallenge)); + mir_md5_append(&context, (BYTE*)chl, (int)mir_strlen(chl)); + mir_md5_append(&context, (BYTE*)msnProtChallenge, (int)mir_strlen(msnProtChallenge)); mir_md5_finish(&context, (BYTE*)md5hash); memcpy(md5hashOr, md5hash, sizeof(md5hash)); @@ -1389,11 +1389,11 @@ void MSN_MakeDigest(const char* chl, char* dgst) char chlString[128]; mir_snprintf(chlString, SIZEOF(chlString), "%s%s00000000", chl, msnProductID); - chlString[(strlen(chl) + strlen(msnProductID) + 7) & 0xF8] = 0; + chlString[(mir_strlen(chl) + mir_strlen(msnProductID) + 7) & 0xF8] = 0; LONGLONG high = 0, low = 0; int* chlStringArray = (int*)chlString; - for (i = 0; i < strlen(chlString) / 4; i += 2) { + for (i = 0; i < mir_strlen(chlString) / 4; i += 2) { LONGLONG temp = chlStringArray[i]; temp = (0x0E79A9C1 * temp) % 0x7FFFFFFF; diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index e512463499..08565ce654 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -182,7 +182,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char* p = strchr(szFile + 1, '\"'); if (p != NULL) { *p = '\0'; - memmove(szFile, szFile + 1, strlen(szFile)); + memmove(szFile, szFile + 1, mir_strlen(szFile)); tSelectLen += 2; goto LBL_Continue; } @@ -191,7 +191,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char* p = strchr(szFile, ' '); if (p != NULL) *p = '\0'; LBL_Continue: - tSelectLen += strlen(szFile); + tSelectLen += mir_strlen(szFile); OPENFILENAMEA ofn = { 0 }; ofn.lStructSize = sizeof(ofn); diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 06f90bb63b..fcba3a8e3f 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -1158,8 +1158,8 @@ void CMsnProto::p2p_InitFileTransfer( if (pictmatch) { UrlDecode(dbv.pszVal); - ezxml_t xmlcon = ezxml_parse_str((char*)szContext, strlen(szContext)); - ezxml_t xmldb = ezxml_parse_str(dbv.pszVal, strlen(dbv.pszVal)); + ezxml_t xmlcon = ezxml_parse_str((char*)szContext, mir_strlen(szContext)); + ezxml_t xmldb = ezxml_parse_str(dbv.pszVal, mir_strlen(dbv.pszVal)); const char *szCtBuf = ezxml_attr(xmlcon, "SHA1C"); if (szCtBuf) { @@ -2051,7 +2051,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) return; } - ezxml_t xmlo = ezxml_parse_str(NEWSTR_ALLOCA(ft->p2p_object), strlen(ft->p2p_object)); + ezxml_t xmlo = ezxml_parse_str(NEWSTR_ALLOCA(ft->p2p_object), mir_strlen(ft->p2p_object)); ezxml_t xmlr = ezxml_new("msnobj"); const char* p; @@ -2080,7 +2080,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) ezxml_set_attr(xmlr, "SHA1C", p); pContext = ezxml_toxml(xmlr, false); - cbContext = strlen(pContext) + 1; + cbContext = mir_strlen(pContext) + 1; ezxml_free(xmlr); ezxml_free(xmlo); diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index a49e3bca54..8e1eebc17f 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -271,9 +271,9 @@ MCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int, MEVENT hDbEvent) if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return NULL; char* nick = (char *)(dbei.pBlob + sizeof(DWORD) * 2); - char* firstName = nick + strlen(nick) + 1; - char* lastName = firstName + strlen(firstName) + 1; - char* email = lastName + strlen(lastName) + 1; + char* firstName = nick + mir_strlen(nick) + 1; + char* lastName = firstName + mir_strlen(firstName) + 1; + char* email = lastName + mir_strlen(lastName) + 1; return AddToListByEmail(email, nick, flags); } @@ -335,9 +335,9 @@ int CMsnProto::Authorize(MEVENT hDbEvent) return 1; char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2); - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *email = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *email = lastName + mir_strlen(lastName) + 1; MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, 0); int netId = Lists_GetNetId(email); @@ -373,9 +373,9 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) return 1; char* nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2); - char* firstName = nick + strlen(nick) + 1; - char* lastName = firstName + strlen(firstName) + 1; - char* email = lastName + strlen(lastName) + 1; + char* firstName = nick + mir_strlen(nick) + 1; + char* lastName = firstName + mir_strlen(firstName) + 1; + char* email = lastName + mir_strlen(lastName) + 1; MsnContact* msc = Lists_Get(email); if (msc == NULL) return 0; @@ -833,7 +833,7 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) switch (netId) { case NETID_MOB: - if (strlen(msg) > 133) { + if (mir_strlen(msg) > 133) { errMsg = Translate("Message is too long: SMS page limited to 133 UTF8 chars"); seq = 999997; } @@ -845,7 +845,7 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) break; case NETID_YAHOO: - if (strlen(msg) > 1202) { + if (mir_strlen(msg) > 1202) { seq = 999996; errMsg = Translate("Message is too long: MSN messages are limited by 1202 UTF8 chars"); ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, errMsg, this)); @@ -857,7 +857,7 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) break; default: - if (strlen(msg) > 1202) { + if (mir_strlen(msg) > 1202) { seq = 999996; errMsg = Translate("Message is too long: MSN messages are limited by 1202 UTF8 chars"); ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, errMsg, this)); @@ -940,7 +940,7 @@ int __cdecl CMsnProto::SetAwayMsg(int status, const TCHAR* msg) mir_free(*msgptr); char* buf = *msgptr = mir_utf8encodeT(msg); - if (buf && strlen(buf) > 1859) { + if (buf && mir_strlen(buf) > 1859) { buf[1859] = 0; const int i = 1858; if (buf[i] & 128) { diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 073d8ac3aa..ec01f9a0ee 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -64,7 +64,7 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t& ezxml_set_txt(node, "00000000-0000-0000-0000-000000000000"); } - size_t hdrsz = strlen(service) + sizeof(abReqHdr) + 20; + size_t hdrsz = mir_strlen(service) + sizeof(abReqHdr) + 20; httphdr = (char*)mir_alloc(hdrsz); mir_snprintf(httphdr, hdrsz, abReqHdr, service); @@ -161,7 +161,7 @@ bool CMsnProto::MSN_ABAdd(bool allowRecurse) if (tResult != NULL) { UpdateABHost("ABAdd", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { @@ -239,7 +239,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) free(szData); if (tResult != NULL) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); if (status == 200) { UpdateABCacheKey(xmlm, true); ezxml_t body = getSoapResponse(xmlm, "FindMembership"); @@ -425,7 +425,7 @@ bool CMsnProto::MSN_SharingAddDelMember(const char* szEmail, const int listId, c if (tResult != NULL) { UpdateABHost(szMethod, abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, true); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); @@ -503,7 +503,7 @@ bool CMsnProto::MSN_SharingMyProfile(bool allowRecurse) mir_free(reqHdr); free(szData); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { @@ -617,7 +617,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas free(szData); if (tResult != NULL) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 200) { @@ -842,7 +842,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas } if (!msnLoggedIn && msnNsThread) { char *szCircleTicket = ezxml_txt(ezxml_get(body, "CircleResult", 0, "CircleTicket", -1)); - ptrA szCircleTicketEnc(mir_base64_encode((PBYTE)szCircleTicket, (unsigned)strlen(szCircleTicket))); + ptrA szCircleTicketEnc(mir_base64_encode((PBYTE)szCircleTicket, (unsigned)mir_strlen(szCircleTicket))); if (szCircleTicketEnc) msnNsThread->sendPacket("USR", "SHA A %s", szCircleTicketEnc); } @@ -898,7 +898,7 @@ bool CMsnProto::MSN_ABRefreshClist(void) if (nlhrReply) { hHttpsConnection = nlhrReply->nlc; if (nlhrReply->resultCode == 200 && nlhrReply->pData) { - ezxml_t xmlm = ezxml_parse_str(nlhrReply->pData, strlen(nlhrReply->pData)); + ezxml_t xmlm = ezxml_parse_str(nlhrReply->pData, mir_strlen(nlhrReply->pData)); if (xmlm) { bRet = true; @@ -1021,7 +1021,7 @@ bool CMsnProto::MSN_ABAddDelContactGroup(const char* szCntId, const char* szGrpI if (tResult != NULL) { UpdateABHost(szMethod, abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); @@ -1082,7 +1082,7 @@ void CMsnProto::MSN_ABAddGroup(const char* szGrpName, bool allowRecurse) if (tResult != NULL) { UpdateABHost("ABGroupAdd", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 200) { ezxml_t body = getSoapResponse(xmlm, "ABGroupAdd"); @@ -1139,7 +1139,7 @@ void CMsnProto::MSN_ABRenameGroup(const char* szGrpName, const char* szGrpId, bo if (tResult != NULL) { UpdateABHost("ABGroupUpdate", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); @@ -1224,7 +1224,7 @@ bool CMsnProto::MSN_ABAddRemoveContact(const char* szCntId, int netId, bool add, if (tResult != NULL) { UpdateABHost("ABContactUpdate", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); @@ -1290,7 +1290,7 @@ bool CMsnProto::MSN_ABUpdateProperty(const char* szCntId, const char* propName, if (tResult != NULL) { UpdateABHost("ABContactUpdate", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); @@ -1355,7 +1355,7 @@ void CMsnProto::MSN_ABUpdateAttr(const char* szCntId, const char* szAttr, const if (tResult != NULL) { UpdateABHost("ABContactUpdate", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); @@ -1478,7 +1478,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in free(szData); if (tResult != NULL) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 200) { ezxml_t body = getSoapResponse(xmlm, "ABContactAdd"); @@ -1617,7 +1617,7 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) if (tResult != NULL) { UpdateABHost("UpdateDynamicItem", abUrl); - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateABCacheKey(xmlm, false); if (status == 500) { const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index 27393513a6..9bbe50fb89 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -60,7 +60,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml tbdy = ezxml_add_child(bdy, service, 0); ezxml_set_attr(tbdy, "xmlns", "http://www.msn.com/webservices/storage/2008"); - size_t hdrsz = strlen(service) + sizeof(storeReqHdr) + 20; + size_t hdrsz = mir_strlen(service) + sizeof(storeReqHdr) + 20; httphdr = (char*)mir_alloc(hdrsz); mir_snprintf(httphdr, hdrsz, storeReqHdr, service); @@ -123,7 +123,7 @@ bool CMsnProto::MSN_StoreCreateProfile(bool allowRecurse) if (tResult != NULL) { if (status == 200) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); UpdateStoreCacheKey(xmlm); ezxml_t body = getSoapResponse(xmlm, "CreateProfile"); @@ -133,7 +133,7 @@ bool CMsnProto::MSN_StoreCreateProfile(bool allowRecurse) ezxml_free(xmlm); } else if (status == 500) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { MSN_GetPassportAuth(); @@ -174,7 +174,7 @@ bool CMsnProto::MSN_StoreShareItem(const char* id, bool allowRecurse) free(szData); if (tResult != NULL && status == 500) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { MSN_GetPassportAuth(); @@ -252,7 +252,7 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) if (tResult != NULL) { if (status == 200) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); ezxml_t body = getSoapResponse(xmlm, "GetProfile"); UpdateStoreHost("GetProfile", body ? storeUrl : NULL); @@ -290,7 +290,7 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) ezxml_free(xmlm); } else if (status == 500 && allowRecurse) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0) { MSN_GetPassportAuth(); @@ -361,7 +361,7 @@ bool CMsnProto::MSN_StoreUpdateProfile(const char* szNick, const char* szStatus, MSN_ABUpdateDynamicItem(); } else if (status == 500 && allowRecurse) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0) { MSN_GetPassportAuth(); @@ -419,7 +419,7 @@ bool CMsnProto::MSN_StoreCreateRelationships(bool allowRecurse) UpdateStoreHost("CreateRelationships", storeUrl); if (status == 500) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { MSN_GetPassportAuth(); @@ -486,7 +486,7 @@ bool CMsnProto::MSN_StoreDeleteRelationships(bool tile, bool allowRecurse) if (tResult != NULL) { UpdateStoreHost("DeleteRelationships", storeUrl); if (status == 500) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { MSN_GetPassportAuth(); @@ -563,13 +563,13 @@ bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMime if (tResult != NULL) { UpdateStoreHost("CreateDocument", storeUrl); if (status == 200) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); ezxml_t bdy = getSoapResponse(xmlm, "CreateDocument"); strncpy_s(photoid, ezxml_txt(bdy), _TRUNCATE); ezxml_free(xmlm); } else if (status == 500) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { MSN_GetPassportAuth(); @@ -635,7 +635,7 @@ bool CMsnProto::MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMime if (tResult != NULL) { UpdateStoreHost("UpdateDocument", storeUrl); if (status == 500 && allowRecurse) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0) { MSN_GetPassportAuth(); @@ -715,7 +715,7 @@ bool CMsnProto::MSN_StoreFindDocuments(bool allowRecurse) if (tResult != NULL) { UpdateStoreHost("FindDocuments", storeUrl); if (status == 500) { - ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult)); + ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult)); const char* szErr = ezxml_txt(getSoapFault(xmlm, true)); if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) { MSN_GetPassportAuth(); diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index b4f0402e4b..a2fdb581b3 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.cpp @@ -35,7 +35,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char nlhr.requestType = REQUEST_POST; nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_PERSISTENT | NLHRF_REDIRECT; nlhr.szUrl = *parUrl; - nlhr.dataLength = (int)strlen(parAuthInfo); + nlhr.dataLength = (int)mir_strlen(parAuthInfo); nlhr.pData = (char*)parAuthInfo; nlhr.nlc = hHttpsConnection; diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index f86fdbdd96..cd44b6c915 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -411,7 +411,7 @@ void CSametimeProto::LoadOptions() if (options.err_method == ED_POP && !ServiceExists(MS_POPUP_SHOWMESSAGE)) options.err_method = ED_BAL; if (options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_MB; - debugLog(_T("LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]"), options.server_name == NULL ? -1 : strlen(options.server_name), options.id == NULL ? -1 : strlen(options.id), options.pword == NULL ? -1 : strlen(options.pword)); + debugLog(_T("LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]"), options.server_name == NULL ? -1 : mir_strlen(options.server_name), options.id == NULL ? -1 : mir_strlen(options.id), options.pword == NULL ? -1 : mir_strlen(options.pword)); debugLog(_T("LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]"), options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor); debugLog(_T("LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]"), options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method); diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 2e65171e51..871baf250b 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -275,7 +275,7 @@ int CSametimeProto::SetSessionStatus(int status) us.desc = AwayMessages.szOnline; us.status = mwStatus_ACTIVE; break; } - debugLog(_T("SetSessionStatus() mwSession_setUserStatus us.status=[%d], us.desc:len=[%d]"), us.status, us.desc == NULL ? -1 : strlen(us.desc)); + debugLog(_T("SetSessionStatus() mwSession_setUserStatus us.status=[%d], us.desc:len=[%d]"), us.status, us.desc == NULL ? -1 : mir_strlen(us.desc)); mwSession_setUserStatus(session, &us); return 0; diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 2523182785..223cecfdce 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -92,13 +92,13 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) // add to miranda if (new_contact) db_set_utf(hContact, m_szModuleName, "stid", id); - if (name && strlen(name)) + if (name && mir_strlen(name)) db_set_utf(hContact, m_szModuleName, "Name", name); - if (nick && strlen(nick)) { + if (nick && mir_strlen(nick)) { db_set_utf(hContact, m_szModuleName, "Nick", nick); } - else if (name && strlen(name)) { + else if (name && mir_strlen(name)) { db_set_utf(hContact, m_szModuleName, "Nick", name); } else { @@ -731,7 +731,7 @@ void mwResolve_handler_details_callback(mwServiceResolve* srvc, guint32 id, guin MCONTACT hContact = proto->FindContactByUserId(((mwResolveMatch*)mri->data)->id); if (hContact) { char* name = ((mwResolveMatch*)mri->data)->name; - if (name && strlen(name)) { + if (name && mir_strlen(name)) { db_set_utf(hContact, proto->m_szModuleName, "Name", name); db_set_utf(hContact, proto->m_szModuleName, "Nick", name); db_set_utf(hContact, "CList", "MyHandle", name); diff --git a/protocols/SkypeClassic/src/debug.cpp b/protocols/SkypeClassic/src/debug.cpp index 4e7f7fd7b7..5b28e748de 100644 --- a/protocols/SkypeClassic/src/debug.cpp +++ b/protocols/SkypeClassic/src/debug.cpp @@ -51,7 +51,7 @@ void do_log(const char *pszFormat, ...) { EnterCriticalSection(&m_WriteFileMutex); time(<); ct=ctime(<); - ct[strlen(ct)-1]=0; + ct[mir_strlen(ct)-1]=0; do { va_start(ap, pszFormat); @@ -61,7 +61,7 @@ void do_log(const char *pszFormat, ...) { { if (!(pNewBuf = (char*)realloc (m_szLogBuf, m_iBufSize*2))) { - iLen = strlen (m_szLogBuf); + iLen = mir_strlen (m_szLogBuf); break; } m_szLogBuf = pNewBuf; diff --git a/protocols/SkypeClassic/src/filexfer.cpp b/protocols/SkypeClassic/src/filexfer.cpp index d0caedea03..af8af1c1cc 100644 --- a/protocols/SkypeClassic/src/filexfer.cpp +++ b/protocols/SkypeClassic/src/filexfer.cpp @@ -23,7 +23,7 @@ INT_PTR SkypeRecvFile(WPARAM, LPARAM lParam) if (pre->flags & PREF_CREATEREAD) dbei.flags |= DBEF_READ; dbei.eventType = EVENTTYPE_FILE; dbei.cbBlob = sizeof(DWORD); - for (nFiles = 0; cbFilename = strlen(&pre->szMessage[dbei.cbBlob]); nFiles++) + for (nFiles = 0; cbFilename = mir_strlen(&pre->szMessage[dbei.cbBlob]); nFiles++) dbei.cbBlob += DWORD(cbFilename) + 1; dbei.cbBlob++; dbei.pBlob = (PBYTE)pre->szMessage; @@ -41,7 +41,7 @@ INT_PTR SkypeRecvFile(WPARAM, LPARAM lParam) pfts->totalFiles = nFiles; if (pfts->pszFiles = (char**)calloc(nFiles + 1, sizeof(char*))) { char *pFN; - for (size_t i = 0; cbFilename = strlen(pFN = &pre->szMessage[iOffs]); i++) { + for (size_t i = 0; cbFilename = mir_strlen(pFN = &pre->szMessage[iOffs]); i++) { pfts->pszFiles[i] = strdup(pFN); iOffs += cbFilename + 1; } @@ -76,7 +76,7 @@ INT_PTR SkypeSendFile(WPARAM, LPARAM lParam) size_t iLen = 0; for (nFiles = 0; files[nFiles]; nFiles++) { utfmsg = (char*)make_utf8_string(files[nFiles]); - iLen += strlen(utfmsg) + 3; + iLen += mir_strlen(utfmsg) + 3; if (pszFile = pszFile ? (char*)realloc(pszFile, iLen) : (char*)calloc(1, iLen)) { if (nFiles > 0) strcat(pszFile, ","); strcat(pszFile, "\""); @@ -221,7 +221,7 @@ BOOL FXHandleRecv(PROTORECVEVENT *pre, MCONTACT hContact) if (!strcmp(pszType, "INCOMING")) { char *pszFN = SkypeGetErr("FILETRANSFER", pszMsgNum, "FILENAME"); if (pszFN) { - cbNewSize = cbMsg + strlen(pszFN) + 2; + cbNewSize = cbMsg + mir_strlen(pszFN) + 2; if ((pre->szMessage = (char*)realloc(pre->szMessage, cbNewSize))) { memcpy(pre->szMessage + cbMsg, pszFN, cbNewSize - cbMsg - 1); cbMsg = cbNewSize - 1; diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index e152a1496e..7a28811213 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -222,7 +222,7 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { mir_tstrcpy(MessagePopup.lptzText, lpzText); #ifdef _UNICODE - mbstowcs(MessagePopup.lptzContactName, SKYPE_PROTONAME, strlen(SKYPE_PROTONAME) + 1); + mbstowcs(MessagePopup.lptzContactName, SKYPE_PROTONAME, mir_strlen(SKYPE_PROTONAME) + 1); #else mir_tstrcpy(MessagePopup.lptzContactName, SKYPE_PROTONAME); #endif @@ -242,9 +242,9 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { int ShowMessageA(int iconID, char *lpzText, int mustShow) { WCHAR *lpwText; int iRet; - size_t len = mbstowcs(NULL, lpzText, strlen(lpzText)); + size_t len = mbstowcs(NULL, lpzText, mir_strlen(lpzText)); if (len == -1 || !(lpwText = (WCHAR*)calloc(len + 1, sizeof(WCHAR)))) return -1; - mbstowcs(lpwText, lpzText, strlen(lpzText)); + mbstowcs(lpwText, lpzText, mir_strlen(lpzText)); iRet = ShowMessage(iconID, lpwText, mustShow); free(lpwText); return iRet; @@ -503,12 +503,12 @@ static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq) } } - pre.lParam = sizeof(DWORD)+sizeof(HANDLE)+strlen(pszNick) + 5; - if (firstname) pre.lParam += strlen(firstname); - if (lastname) pre.lParam += strlen(lastname); + pre.lParam = sizeof(DWORD)+sizeof(HANDLE)+mir_strlen(pszNick) + 5; + if (firstname) pre.lParam += mir_strlen(firstname); + if (lastname) pre.lParam += mir_strlen(lastname); if (pszAuthRq) authmsg = strdup(pszAuthRq); if (authmsg || ((protocol >= 4 || bIsImoproxy) && (authmsg = SkypeGetID("USER", pszNick, "RECEIVEDAUTHREQUEST")))) - pre.lParam += strlen(authmsg); + pre.lParam += mir_strlen(authmsg); if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) { pCurBlob += sizeof(DWORD); // Not used memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE); @@ -644,7 +644,7 @@ void __cdecl SkypeSystemInit(char *dummy) { // against CURRENTUSERHANDLE if (pszUser = SkypeRcv("CURRENTUSERHANDLE", INFINITE)) { - memmove(pszUser, pszUser + 18, strlen(pszUser + 17)); + memmove(pszUser, pszUser + 18, mir_strlen(pszUser + 17)); if (_stricmp(dbv.pszVal, pszUser)) { // Doesn't match, maybe we have a second Skype instance we have to take @@ -1133,7 +1133,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { __leave; // We failed } free(who); - who = (char *)memmove(ptr, pTok, strlen(pTok) + 1); + who = (char *)memmove(ptr, pTok, mir_strlen(pTok) + 1); direction = DBEF_SENT; } db_free(&dbv); @@ -1167,7 +1167,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { __leave; } if (strncmp(ptr, "ERROR", 5)) { - msgptr = ptr + strlen(szBuf + 4) + 1; + msgptr = ptr + mir_strlen(szBuf + 4) + 1; bHasPartList = strncmp(msgptr, "tEdited) { // Mark the message as edited @@ -1202,7 +1202,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { mir_free(ci.pszVal); } } - newlen = int(strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9); + newlen = int(mir_strlen(msgptr) + (pszUTFnick ? mir_strlen(pszUTFnick) : 0) + 9); if (pMsg = (char *)malloc(newlen)) { sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr); free(ptr); @@ -1225,7 +1225,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { msgptr = msg; free(ptr); } - msglen = (int)strlen(msgptr) + 1; + msglen = (int)mir_strlen(msgptr) + 1; } else { free(ptr); @@ -1538,7 +1538,7 @@ void RingThread(char *szSkypeMsg) { dbei.szModule = SKYPE_PROTONAME; dbei.timestamp = (DWORD)SkypeTime(NULL); dbei.pBlob = (unsigned char*)Translate("Phone call"); - dbei.cbBlob = (int)strlen((const char*)dbei.pBlob) + 1; + dbei.cbBlob = (int)mir_strlen((const char*)dbei.pBlob) + 1; if (!strncmp(ptr, "INCOMING", 8)) { TCHAR *lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR); @@ -1990,7 +1990,7 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) // Other proerties that can be directly assigned to a DB-Value for (int i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++) { if (!strcmp(ptr, m_settings[i].SkypeSetting)) { - char *pszProp = ptr + strlen(m_settings[i].SkypeSetting) + 1; + char *pszProp = ptr + mir_strlen(m_settings[i].SkypeSetting) + 1; if (*pszProp) db_set_utf(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp); else @@ -2070,7 +2070,7 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) *ptr = ' '; } else if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) { - int iLen=strlen(ptr+14)+1; + int iLen=mir_strlen(ptr+14)+1; char *pParam=(char*)calloc(iLen+1, 1); *pParam=TRUE; memcpy(pParam+1, ptr+14, iLen); @@ -2128,14 +2128,14 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) { char *pMsgs; int iLen; - if (strlen(szSkypeMsg) <= (UINT)((pMsgs=strchr(szSkypeMsg, ' ')) - szSkypeMsg + 1)) + if (mir_strlen(szSkypeMsg) <= (UINT)((pMsgs=strchr(szSkypeMsg, ' ')) - szSkypeMsg + 1)) { LOG(("%s %d %s %d", szSkypeMsg, (UINT)(strchr(szSkypeMsg, ' ') - szSkypeMsg + 1), - strchr(szSkypeMsg, ' '), strlen(szSkypeMsg))); + strchr(szSkypeMsg, ' '), mir_strlen(szSkypeMsg))); break; } LOG(("MessageListProcessingThread launched")); - char *pParam=(char*)calloc((iLen=strlen(pMsgs)+1)+1, 1); + char *pParam=(char*)calloc((iLen=mir_strlen(pMsgs)+1)+1, 1); memcpy(pParam+1, pMsgs, iLen); pthread_create((pThreadFunc)MessageListProcessingThread, pParam); break; @@ -2754,7 +2754,7 @@ INT_PTR SkypeRecvMessage(WPARAM, LPARAM lParam) dbei.flags |= DBEF_READ; dbei.flags |= DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (int)strlen(pre->szMessage) + 1; + dbei.cbBlob = (int)mir_strlen(pre->szMessage) + 1; dbei.pBlob = (PBYTE)pre->szMessage; MsgList_Add((DWORD)pre->lParam, db_event_add(ccs->hContact, &dbei)); return 0; diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index bd8b8d6d11..35b4117560 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -195,7 +195,7 @@ void rcvThread(char *dummy) { COPYDATASTRUCT CopyData; CopyData.dwData=0; CopyData.lpData=buf; - CopyData.cbData=(DWORD)strlen(buf)+1; + CopyData.cbData=(DWORD)mir_strlen(buf)+1; if (!SendMessage(g_hWnd, WM_COPYDATALOCAL, (WPARAM)hSkypeWnd, (LPARAM)&CopyData)) { LOG(("SendMessage failed: %08X", GetLastError())); @@ -215,7 +215,7 @@ void sendThread(char *dummy) { while (SkypeMsgToSend) { if (WaitForSingleObject(SkypeMsgToSend, INFINITE) != WAIT_OBJECT_0) return; if (!(szMsg = MsgQ_Get(&SkypeSendQueue))) continue; - length=(unsigned int)strlen(szMsg); + length=(unsigned int)mir_strlen(szMsg); if (UseSockets) { mir_cslock lck(SendMutex); @@ -397,7 +397,7 @@ int SkypeSend(char *szFmt, ...) { { if (!(pNewBuf = (char*)realloc (m_szSendBuf, m_iBufSize*2))) { - iLen = strlen (m_szSendBuf); + iLen = mir_strlen (m_szSendBuf); break; } m_szSendBuf = pNewBuf; @@ -450,23 +450,23 @@ char *SkypeRcvTime(char *what, time_t st, DWORD maxwait) { token=NULL; break; } - token+=strlen(token)+1; + token+=mir_strlen(token)+1; } } //if (j==1) {LOG(("SkypeRcv compare %s (%lu) -- %s (%lu)", ptr->message, ptr->tReceived, what, st));} if ((st == 0 || ptr->tReceived >= st) && - (what==NULL || token || (what[0] && !strncmp(ptr->message, what, strlen(what))) || - (bIsChatMsg = (j==1 && bChatMsg && !strncmp(ptr->message, what+4, strlen(what+4)))) || + (what==NULL || token || (what[0] && !strncmp(ptr->message, what, mir_strlen(what))) || + (bIsChatMsg = (j==1 && bChatMsg && !strncmp(ptr->message, what+4, mir_strlen(what+4)))) || (j==1 && !strncmp(ptr->message, "ERROR", 5)))) { msg=MsgQ_RemoveMsg(&SkypeMsgs, ptr); LOG(("tReceived >= st && (strncmp(pCurMsg, "MESSAGE", 7) == 0 || strncmp(pCurMsg, "CHATMESSAGE", 11) == 0 ) ) || bIsError || @@ -586,7 +586,7 @@ static char *__SkypeGet(char *szID, char *szWhat, char *szWho, char *szProperty) time_t st = 0; st = *szID?0:SkypeTime(NULL); - str=(char *)_alloca((len=strlen(szWhat)+strlen(szWho)+strlen(szProperty)+(*szWho?2:1)+(len_id=strlen(szID)))+5); + str=(char *)_alloca((len=mir_strlen(szWhat)+mir_strlen(szWho)+mir_strlen(szProperty)+(*szWho?2:1)+(len_id=mir_strlen(szID)))+5); sprintf(str, "%sGET %s%s%s %s", szID, szWhat, *szWho?" ":"", szWho, szProperty); if (__sendMsg(str)) return NULL; if (*szProperty) len++; @@ -594,7 +594,7 @@ static char *__SkypeGet(char *szID, char *szWhat, char *szWho, char *szProperty) sprintf(str, "%s%s%s%s %s", szID, szWhat, *szWho?" ":"", szWho, szProperty); ptr = SkypeRcvTime(str, st, INFINITE); } else ptr = SkypeRcvTime(str+4, st, INFINITE); - if (ptr && strncmp (ptr+len_id, "ERROR", 5)) memmove(ptr, ptr+len, strlen(ptr)-len+1); + if (ptr && strncmp (ptr+len_id, "ERROR", 5)) memmove(ptr, ptr+len, mir_strlen(ptr)-len+1); LOG(("SkypeGet - Request %s -> Answer %s", str, ptr)); return ptr; } @@ -708,7 +708,7 @@ INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam) { res = -1; // no direct return, because dbv needs to be freed } else { if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; - msg=(char *)malloc(strlen(dbv.pszVal)+6); + msg=(char *)malloc(mir_strlen(dbv.pszVal)+6); strcpy(msg, "CALL "); strcat(msg, dbv.pszVal); res=SkypeSend(msg); @@ -737,7 +737,7 @@ INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam) char *msg=0; if (!db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) { - msg=(char *)malloc(strlen(dbv.pszVal)+21); + msg=(char *)malloc(mir_strlen(dbv.pszVal)+21); sprintf(msg, "SET %s STATUS FINISHED", dbv.pszVal); //sprintf(msg, "ALTER CALL %s HANGUP", dbv.pszVal); int res=SkypeSend(msg); @@ -746,7 +746,7 @@ INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam) #endif //} else { // if (db_get(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; - // msg=(char *)malloc(strlen(dbv.pszVal)+6); + // msg=(char *)malloc(mir_strlen(dbv.pszVal)+6); // strcpy(msg, "CALL "); // strcat(msg, dbv.pszVal); // res=SkypeSend(msg); @@ -763,10 +763,10 @@ INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam) * Params : p - Pointer to the buffer with the number */ static void FixNumber(char *p) { - for (unsigned int i=0;i<=strlen(p);i++) + for (unsigned int i=0;i<=mir_strlen(p);i++) if ((p[i]<'0' || p[i]>'9')) if (p[i]) { - memmove(p+i, p+i+1, strlen(p+i)); + memmove(p+i, p+i+1, mir_strlen(p+i)); i--; } else break; } @@ -863,7 +863,7 @@ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR TempAdded=TRUE; } if (!db_set_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", number)) { - msg=(char *)malloc(strlen(number)+6); + msg=(char *)malloc(mir_strlen(number)+6); strcpy(msg, "CALL "); strcat(msg, number); if (SkypeSend(msg) || (ptr=SkypeRcv("ERROR", 500))) { @@ -1152,7 +1152,7 @@ INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam) { if (filename == NULL) return -1; - len = strlen(filename); + len = mir_strlen(filename); if (len < 4) return -1; @@ -1374,7 +1374,7 @@ char *GetSkypeErrorMsg(char *str) { case SENDER_NOT_AUTHORIZED: msg=Translate("Sending IM message to user, who has not authorized you and has chosen 'only people whom I have authorized can start IM'"); break; default: msg=Translate("Unknown error"); } - reason=(char *)malloc(strlen(pos)+strlen(msg)+3); + reason=(char *)malloc(mir_strlen(pos)+mir_strlen(msg)+3); sprintf (reason, "%s: %s", pos, msg); return reason; } @@ -1438,7 +1438,7 @@ void TranslateMirandaRelativePathToAbsolute(LPCSTR cszPath, LPSTR szAbsolutePath *szAbsolutePath = 0; CallService (MS_UTILS_PATHTOABSOLUTE, (WPARAM)(*cszPath ? cszPath : ".\\"), (LPARAM)szAbsolutePath); if(fQuoteSpaces && strchr((LPCSTR)szAbsolutePath, ' ')){ - memmove (szAbsolutePath+1, szAbsolutePath, strlen(szAbsolutePath)+1); + memmove (szAbsolutePath+1, szAbsolutePath, mir_strlen(szAbsolutePath)+1); *szAbsolutePath='"'; strcat (szAbsolutePath, "\""); } @@ -1455,7 +1455,7 @@ static int my_spawnv(const char *cmdname, const char *const *argv, PROCESS_INFOR memset (pi, 0, sizeof(PROCESS_INFORMATION)); for (i=0; argv[i]; i++) - iLen += (int)strlen(argv[i])+1; + iLen += (int)mir_strlen(argv[i])+1; if (!(CommandLine = (char*)calloc(1, iLen))) return -1; for (i=0; argv[i]; i++) { if (i) strcat (CommandLine, " "); @@ -1523,7 +1523,7 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { OUTPUT(TranslateT("Authentication is not supported/needed for this Skype proxy server. It will be disabled.")); db_set_b(NULL, SKYPE_PROTONAME, "RequiresPassword", 0); } else { - unsigned int length=(unsigned int)strlen(dbv.pszVal); + unsigned int length=(unsigned int)mir_strlen(dbv.pszVal); BOOL res = send(ClientSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR || send(ClientSocket, dbv.pszVal, length, 0)==SOCKET_ERROR || recv(ClientSocket, (char *)&reply, sizeof(reply), 0)==SOCKET_ERROR; @@ -1645,7 +1645,7 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { { int paramSize; TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, TRUE); - paramSize = (int)strlen(SkypeOptions[i]) + (int)strlen(szAbsolutePath); + paramSize = (int)mir_strlen(SkypeOptions[i]) + (int)mir_strlen(szAbsolutePath); pFree = args[j] = (char*)malloc(paramSize + 1); sprintf(args[j],"%s%s",SkypeOptions[i],szAbsolutePath); db_free(&dbv); @@ -1692,7 +1692,7 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { }*/ // if there is no skype installed and no custom command line, then exit .. else it crashes - if (args[0] == NULL || strlen(args[0])==0) + if (args[0] == NULL || mir_strlen(args[0])==0) { return -1; } diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 318c4b76ba..87a067b3f1 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -41,7 +41,7 @@ MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, L if (dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != SKYPE_DB_EVENT_TYPE_ACTION && dbei.eventType != SKYPE_DB_EVENT_TYPE_CALL_INFO) continue; - size_t cbLen = strlen((char*)dbei.pBlob); + size_t cbLen = mir_strlen((char*)dbei.pBlob); if (memcmp(&dbei.pBlob[cbLen + 1], messageId, messageIdLength) == 0) return hDbEvent; diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 00b2383e77..93c7add2a3 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -110,7 +110,7 @@ int CSkypeProto::OnInitStatusMenu() { char text[MAX_PATH]; mir_strcpy(text, m_szModuleName); - char *tDest = text + strlen(text); + char *tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index dc95b115ea..266e522395 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -122,9 +122,9 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) return NULL; char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2); - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *skypename = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *skypename = lastName + mir_strlen(lastName) + 1; char *newSkypename = (dbei.flags & DBEF_UTF) ? mir_utf8decodeA(skypename) : skypename; MCONTACT hContact = AddContact(newSkypename); diff --git a/protocols/Steam/src/Steam/authorization.h b/protocols/Steam/src/Steam/authorization.h index 047b408b05..57401f91c5 100644 --- a/protocols/Steam/src/Steam/authorization.h +++ b/protocols/Steam/src/Steam/authorization.h @@ -18,7 +18,7 @@ namespace SteamWebApi ptrA(mir_urlEncode(password)), timestamp); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); } AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *guardCode) : @@ -34,7 +34,7 @@ namespace SteamWebApi guardCode, timestamp); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); } AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *captchaId, const char *captchaText) : @@ -51,7 +51,7 @@ namespace SteamWebApi ptrA(mir_urlEncode(captchaText)), timestamp); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); } }; } diff --git a/protocols/Steam/src/Steam/friend_list.h b/protocols/Steam/src/Steam/friend_list.h index eccc3d1224..cfa383c533 100644 --- a/protocols/Steam/src/Steam/friend_list.h +++ b/protocols/Steam/src/Steam/friend_list.h @@ -33,7 +33,7 @@ namespace SteamWebApi sessionId, who); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); AddHeader("Cookie", cookie); } }; @@ -56,7 +56,7 @@ namespace SteamWebApi sessionId, who); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); AddHeader("Cookie", cookie); } }; @@ -79,7 +79,7 @@ namespace SteamWebApi sessionId, who); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); AddHeader("Cookie", cookie); } }; diff --git a/protocols/Steam/src/Steam/login.h b/protocols/Steam/src/Steam/login.h index bf19c6f522..e2b9b41a81 100644 --- a/protocols/Steam/src/Steam/login.h +++ b/protocols/Steam/src/Steam/login.h @@ -12,7 +12,7 @@ namespace SteamWebApi char data[256]; mir_snprintf(data, SIZEOF(data), "access_token=%s&ui_mode=web", token); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); } }; @@ -25,7 +25,7 @@ namespace SteamWebApi char data[256]; mir_snprintf(data, SIZEOF(data), "access_token=%s&umqid=%s", token, umqId); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); } }; } diff --git a/protocols/Steam/src/Steam/message.h b/protocols/Steam/src/Steam/message.h index ee5b5dcea7..bf0cb78b3d 100644 --- a/protocols/Steam/src/Steam/message.h +++ b/protocols/Steam/src/Steam/message.h @@ -31,7 +31,7 @@ namespace SteamWebApi // state); // SecureHttpPostRequest request(hConnection, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001"); - // request.SetData(data, strlen(data)); + // request.SetData(data, mir_strlen(data)); // mir_ptr response(request.Send()); // if (!response) @@ -56,7 +56,7 @@ namespace SteamWebApi // ptrA(mir_urlEncode(text))); // SecureHttpPostRequest request(hConnection, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001"); - // request.SetData(data, strlen(data)); + // request.SetData(data, mir_strlen(data)); // mir_ptr response(request.Send()); // if (!response) @@ -91,7 +91,7 @@ namespace SteamWebApi // steamId); // SecureHttpPostRequest request(hConnection, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001"); - // request.SetData(data, strlen(data)); + // request.SetData(data, mir_strlen(data)); // mir_ptr response(request.Send()); // if (!response) diff --git a/protocols/Steam/src/Steam/pending.h b/protocols/Steam/src/Steam/pending.h index 68b86ad689..65a72d25d4 100644 --- a/protocols/Steam/src/Steam/pending.h +++ b/protocols/Steam/src/Steam/pending.h @@ -18,7 +18,7 @@ namespace SteamWebApi char data[MAX_PATH]; mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=accept&action=approvePending&itype=friend&json=1&xml=0", sessionId, who); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); AddHeader("Cookie", cookie); } }; @@ -38,7 +38,7 @@ namespace SteamWebApi char data[MAX_PATH]; mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=ignore&action=approvePending&itype=friend&json=1&xml=0", sessionId, who); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); AddHeader("Cookie", cookie); } }; @@ -58,7 +58,7 @@ namespace SteamWebApi char data[MAX_PATH]; mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=block&action=approvePending&itype=friend&json=1&xml=0", sessionId, who); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); AddHeader("Cookie", cookie); } }; diff --git a/protocols/Steam/src/Steam/session.h b/protocols/Steam/src/Steam/session.h index ea42cc77c4..20a5d7db53 100644 --- a/protocols/Steam/src/Steam/session.h +++ b/protocols/Steam/src/Steam/session.h @@ -18,7 +18,7 @@ namespace SteamWebApi steamId, cookie); - SetData(data, strlen(data)); + SetData(data, mir_strlen(data)); } }; } diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 8e2865bf22..a7b9626fc5 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -99,7 +99,7 @@ void CSteamProto::OnInitStatusMenu() { char text[200]; mir_strncpy(text, m_szModuleName, 100); - char* tDest = text + strlen(text); + char* tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 46b7d8b6de..9484252d3a 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -50,7 +50,7 @@ int CSteamProto::MirandaToSteamState(int status) int CSteamProto::RsaEncrypt(const char *pszModulus, const char *data, BYTE *encryptedData, DWORD &encryptedSize) { - DWORD cchModulus = (DWORD)strlen(pszModulus); + DWORD cchModulus = (DWORD)mir_strlen(pszModulus); int result = 0; BYTE *pbBuffer = 0; BYTE *pKeyBlob = 0; @@ -118,7 +118,7 @@ int CSteamProto::RsaEncrypt(const char *pszModulus, const char *data, BYTE *encr goto exit; } - DWORD dataSize = (DWORD)strlen(data); + DWORD dataSize = (DWORD)mir_strlen(data); // if data is not allocated just renurn size if (encryptedData == NULL) diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 32dbe61ffa..f824620131 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -184,7 +184,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) if (db_get_b(NULL, m_szModuleName, "SavePassword", TRUE) == TRUE) password = db_get_sa(NULL, m_szModuleName, "Password"); - else if (threadData != NULL && strlen(threadData->password) > 0) + else if (threadData != NULL && mir_strlen(threadData->password) > 0) password = mir_strdup(threadData->password); memset(&cookie, 0, sizeof(cookie)); @@ -199,7 +199,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) req.headersCount = 1; req.headers = headers; req.pData = form; - req.dataLength = (int)strlen(form); + req.dataLength = (int)mir_strlen(form); req.szUrl = "http://poczta.o2.pl/login.html"; resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req); if (resp != NULL) { @@ -212,7 +212,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) char *end = strstr(resp->headers[i].szValue, ";"); start = start + 5; if (end == NULL) { - end = resp->headers[i].szValue + strlen(resp->headers[i].szValue); + end = resp->headers[i].szValue + mir_strlen(resp->headers[i].szValue); } strncpy(cookie, start, (end - start)); break; @@ -261,7 +261,7 @@ void TlenProtocol::initMenuItems() { char text[_MAX_PATH]; strncpy_s(text, sizeof(text), m_szModuleName, _TRUNCATE); - char *pSvcName = text + strlen(text); + char *pSvcName = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }, clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_GRAYED; diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index ba336d2660..bfa27646e0 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -173,17 +173,17 @@ void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITE static char *replaceTokens(const char *base, const char *uri, const char *login, const char* token, int type, int access) { char *result; int i, l, size; - l = (int)strlen(uri); - size = (int)strlen(base); + l = (int)mir_strlen(uri); + size = (int)mir_strlen(base); for (i = 0; i < l; ) { if (!strncmp(uri + i, "^login^", 7)) { - size += (int)strlen(login); + size += (int)mir_strlen(login); i += 7; } else if (!strncmp(uri + i, "^type^", 6)) { size++; i += 6; } else if (!strncmp(uri + i, "^token^", 7)) { - size += (int)strlen(token); + size += (int)mir_strlen(token); i += 7; } else if (!strncmp(uri + i, "^access^", 8)) { size++; @@ -195,18 +195,18 @@ static char *replaceTokens(const char *base, const char *uri, const char *login, } result = (char *)mir_alloc(size +1); strcpy(result, base); - size = (int)strlen(base); + size = (int)mir_strlen(base); for (i = 0; i < l; ) { if (!strncmp(uri + i, "^login^", 7)) { strcpy(result + size, login); - size += (int)strlen(login); + size += (int)mir_strlen(login); i += 7; } else if (!strncmp(uri + i, "^type^", 6)) { result[size++] = '0' + type; i += 6; } else if (!strncmp(uri + i, "^token^", 7)) { strcpy(result + size, token); - size += (int)strlen(token); + size += (int)mir_strlen(token); i += 7; } else if (!strncmp(uri + i, "^access^", 8)) { result[size++] = '0' + access; @@ -400,7 +400,7 @@ void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int if (proto->threadData != NULL && dataLen > 0 && data != NULL) { char *mpartHead = "--AaB03x\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"plik.png\"\r\nContent-Type: image/png\r\n\r\n"; char *mpartTail = "\r\n--AaB03x--\r\n"; - int size, sizeHead = (int)strlen(mpartHead), sizeTail = (int)strlen(mpartTail); + int size, sizeHead = (int)mir_strlen(mpartHead), sizeTail = (int)mir_strlen(mpartTail); char *request = replaceTokens(proto->threadData->tlenConfig.mailBase, proto->threadData->tlenConfig.avatarUpload, "", proto->threadData->avatarToken, 0, access); TLENUPLOADAVATARTHREADDATA *threadData = (TLENUPLOADAVATARTHREADDATA *)mir_alloc(sizeof(TLENUPLOADAVATARTHREADDATA)); threadData->proto = proto; diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 830c828cf4..9d05fef08f 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -79,9 +79,9 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) TlenP2PPacketSend(ft->s, packet); TlenP2PPacketFree(packet); - fullFileName = (char *) mir_alloc(strlen(ft->szSavePath) + strlen(ft->files[ft->currentFile]) + 2); + fullFileName = (char *) mir_alloc(mir_strlen(ft->szSavePath) + mir_strlen(ft->files[ft->currentFile]) + 2); strcpy(fullFileName, ft->szSavePath); - if (fullFileName[strlen(fullFileName)-1] != '\\') + if (fullFileName[mir_strlen(fullFileName)-1] != '\\') strcat(fullFileName, "\\"); strcat(fullFileName, ft->files[ft->currentFile]); ft->fileId = _open(fullFileName, _O_BINARY|_O_WRONLY|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE); diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 7c5368822f..837a24d81b 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -407,7 +407,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) char *str = TlenXmlGetAttrValue(iqNode, "id"); if (str == NULL) return; - int id = atoi(str+strlen(TLEN_IQID)); + int id = atoi(str+mir_strlen(TLEN_IQID)); if (!strcmp(type, "result")) { if ((queryNode=TlenXmlGetChild(iqNode, "query")) == NULL) return; diff --git a/protocols/Tlen/src/tlen_list.cpp b/protocols/Tlen/src/tlen_list.cpp index ddd31b3340..5827fad64f 100644 --- a/protocols/Tlen/src/tlen_list.cpp +++ b/protocols/Tlen/src/tlen_list.cpp @@ -111,13 +111,13 @@ int TlenListExist(TlenProtocol *proto, TLEN_LIST list, const char *jid) size_t len; char *s, *p; s = GetItemId(list, jid); - len = strlen(s); + len = mir_strlen(s); mir_cslock lck(proto->csLists); for (i=0; ilistsCount; i++) if (proto->lists[i].list == list) { p = proto->lists[i].jid; - if (p && strlen(p) >= len && (p[(int)len] == '\0' || p[(int)len] == '/') && !strncmp(p, s, len)) { + if (p && mir_strlen(p) >= len && (p[(int)len] == '\0' || p[(int)len] == '/') && !strncmp(p, s, len)) { mir_free(s); return i+1; } @@ -265,7 +265,7 @@ TLEN_LIST_ITEM *TlenListFindItemPtrById2(TlenProtocol *proto, TLEN_LIST list, co size_t len; char *p; - len = strlen(id); + len = mir_strlen(id); mir_cslock lck(proto->csLists); for (i=0; ilistsCount; i++) { diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index c7205a31cd..e3b4fe6c1e 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -60,14 +60,14 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) proto->debugLogA("auth request: %s, %s", jid, nick); //blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ) - cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5; + cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)mir_strlen(nick) + (int)mir_strlen(jid) + 5; pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob); *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); - strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1; + strcpy((char *) pCurBlob, nick); pCurBlob += mir_strlen(nick)+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName - strcpy((char *) pCurBlob, jid); pCurBlob += strlen(jid)+1; + strcpy((char *) pCurBlob, jid); pCurBlob += mir_strlen(jid)+1; *pCurBlob = '\0'; //reason TlenDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, pBlob, cbBlob); } diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 3d3668b42d..dee4b8831a 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -309,7 +309,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) *(PDWORD)(buf+4) = INADDR_ANY; if (sb->useAuth) { strcpy((char*)buf+8, sb->szUser); - len = (int)strlen(sb->szUser); + len = (int)mir_strlen(sb->szUser); } else { buf[8] = 0; len = 0; @@ -374,8 +374,8 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) int nUserLen, nPassLen; PBYTE pAuthBuf; - nUserLen = (int)strlen(sb->szUser); - nPassLen = (int)strlen(sb->szPassword); + nUserLen = (int)mir_strlen(sb->szUser); + nPassLen = (int)mir_strlen(sb->szPassword); pAuthBuf = (PBYTE)mir_alloc(3+nUserLen+nPassLen); pAuthBuf[0] = 1; //auth version pAuthBuf[1] = nUserLen; diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index e9e4b11fe7..a3920281b7 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -281,9 +281,9 @@ static void TlenSendPresenceTo(TlenProtocol *proto, int status, char *to) else if (!_strnicmp(ptr+i,"%date%",6)) GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,substituteStr,sizeof(substituteStr)); else continue; - if (strlen(substituteStr)>6) ptr=(char*)mir_realloc(ptr,strlen(ptr)+1+strlen(substituteStr)-6); - memmove(ptr+i+strlen(substituteStr),ptr+i+6,strlen(ptr)-i-5); - memcpy(ptr+i,substituteStr,strlen(substituteStr)); + if (mir_strlen(substituteStr)>6) ptr=(char*)mir_realloc(ptr,mir_strlen(ptr)+1+mir_strlen(substituteStr)-6); + memmove(ptr+i+mir_strlen(substituteStr),ptr+i+6,mir_strlen(ptr)-i-5); + memcpy(ptr+i,substituteStr,mir_strlen(substituteStr)); } } } diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 9481729dd8..b578bf6e6b 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -251,9 +251,9 @@ MCONTACT TlenProtocol::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; MCONTACT hContact = (MCONTACT) AddToListByJID(this, jid, flags); mir_free(dbei.pBlob); @@ -284,9 +284,9 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; TlenSend(this, "", jid); @@ -333,9 +333,9 @@ int TlenProtocol::AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; TlenSend(this, "", jid); TlenSend(this, "", jid); diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 6d93071a28..2b6af296c1 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -635,7 +635,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) if ((bodyNode=TlenXmlGetChild(node, "body")) != NULL) { if (bodyNode->text != NULL) { if ((subjectNode=TlenXmlGetChild(node, "subject")) != NULL && subjectNode->text != NULL && subjectNode->text[0] != '\0') { - size_t size = strlen(subjectNode->text)+strlen(bodyNode->text)+5; + size_t size = mir_strlen(subjectNode->text)+mir_strlen(bodyNode->text)+5; p = (char *)mir_alloc(size); mir_snprintf(p, size, "%s\r\n%s", subjectNode->text, bodyNode->text); localMessage = TlenTextDecode(p); @@ -744,8 +744,8 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) id = -1; if ((idStr=TlenXmlGetAttrValue(node, "id")) != NULL) { - if (!strncmp(idStr, TLEN_IQID, strlen(TLEN_IQID))) - id = atoi(idStr+strlen(TLEN_IQID)); + if (!strncmp(idStr, TLEN_IQID, mir_strlen(TLEN_IQID))) + id = atoi(idStr+mir_strlen(TLEN_IQID)); } queryNode = TlenXmlGetChild(node, "query"); @@ -1130,7 +1130,7 @@ static void TlenProcessP(XmlNode *node, ThreadData *info) iNode = TlenXmlGetChild(xNode, "i"); if (iNode != NULL) { iStr = TlenXmlGetAttrValue(iNode, "i"); - temp = (char*)mir_alloc(strlen(f)+strlen(iStr)+2); + temp = (char*)mir_alloc(mir_strlen(f)+mir_strlen(iStr)+2); strcpy(temp, f); strcat(temp, "/"); strcat(temp, iStr); diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index 228f8dae8e..55420658cd 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -62,7 +62,7 @@ int TlenSend(TlenProtocol *proto, const char *fmt, ...) va_end(vararg); proto->debugLogA("SEND:%s", str); - size = (int)strlen(str); + size = (int)mir_strlen(str); if (proto->threadData != NULL) { if (proto->threadData->useAES) { result = TlenWsSendAES(proto, str, size, &proto->threadData->aes_out_context, proto->threadData->aes_out_iv); @@ -84,9 +84,9 @@ char *TlenResourceFromJID(const char *jid2) p=strchr(jid, '/'); if (p != NULL && p[1] != '\0') { p++; - if ((nick=(char *) mir_alloc(1+strlen(jid)-(p-jid))) != NULL) { - strncpy(nick, p, strlen(jid)-(p-jid)); - nick[strlen(jid)-(p-jid)] = '\0'; + if ((nick=(char *) mir_alloc(1+mir_strlen(jid)-(p-jid))) != NULL) { + strncpy(nick, p, mir_strlen(jid)-(p-jid)); + nick[mir_strlen(jid)-(p-jid)] = '\0'; } } else { @@ -161,7 +161,7 @@ char *TlenSha1(char *str) return NULL; mir_sha1_init( &sha ); - mir_sha1_append( &sha, (BYTE* )str, (int)strlen( str )); + mir_sha1_append( &sha, (BYTE* )str, (int)mir_strlen( str )); mir_sha1_finish( &sha, (BYTE* )digest ); if ((result=(char *)mir_alloc(41)) == NULL) return NULL; @@ -215,7 +215,7 @@ char *TlenUrlEncode(const char *str) unsigned char c; if (str == NULL) return NULL; - res = (char *) mir_alloc(3*strlen(str) + 1); + res = (char *) mir_alloc(3*mir_strlen(str) + 1); for (p=(char *)str,q=res; *p != '\0'; p++,q++) { if (*p == ' ') { *q = '+'; @@ -406,8 +406,8 @@ void TlenStringAppend(char **str, int *sizeAlloced, const char *fmt, ...) len = 0; } else { - len = (int)strlen(*str); - size = *sizeAlloced - (int)strlen(*str); + len = (int)mir_strlen(*str); + size = *sizeAlloced - (int)mir_strlen(*str); } p = *str + len; @@ -433,7 +433,7 @@ BOOL IsAuthorized(TlenProtocol *proto, const char *jid) void TlenLogMessage(TlenProtocol *proto, MCONTACT hContact, DWORD flags, const char *message) { - int size = (int)strlen(message) + 2; + int size = (int)mir_strlen(message) + 2; char *localMessage = (char *)mir_alloc(size); strcpy(localMessage, message); localMessage[size - 1] = '\0'; diff --git a/protocols/Tlen/src/tlen_xml.cpp b/protocols/Tlen/src/tlen_xml.cpp index 87fdd52211..04e6aa79a3 100644 --- a/protocols/Tlen/src/tlen_xml.cpp +++ b/protocols/Tlen/src/tlen_xml.cpp @@ -193,7 +193,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) char *p; XmlAttr *a; - if (node == NULL || text == NULL || strlen(text) <= 0) + if (node == NULL || text == NULL || mir_strlen(text) <= 0) return; for (p=text;;) { @@ -387,7 +387,7 @@ char *TlenXmlGetAttrValue(XmlNode *node, char *key) { int i; - if (node == NULL || node->numAttr <= 0 || key == NULL || strlen(key) <= 0) + if (node == NULL || node->numAttr <= 0 || key == NULL || mir_strlen(key) <= 0) return NULL; for (i=0; inumAttr; i++) { if (node->attr[i]->name && !strcmp(key, node->attr[i]->name)) @@ -405,7 +405,7 @@ XmlNode *TlenXmlGetNthChild(XmlNode *node, char *tag, int nth) { int i, num; - if (node == NULL || node->numChild <= 0 || tag == NULL || strlen(tag) <= 0 || nth < 1) + if (node == NULL || node->numChild <= 0 || tag == NULL || mir_strlen(tag) <= 0 || nth < 1) return NULL; num = 1; for (i=0; inumChild; i++) { @@ -424,7 +424,7 @@ XmlNode *TlenXmlGetChildWithGivenAttrValue(XmlNode *node, char *tag, char *attrK int i; char *str; - if (node == NULL || node->numChild <= 0 || tag == NULL || strlen(tag) <= 0 || attrKey == NULL || strlen(attrKey) <= 0 || attrValue == NULL || strlen(attrValue) <= 0) + if (node == NULL || node->numChild <= 0 || tag == NULL || mir_strlen(tag) <= 0 || attrKey == NULL || mir_strlen(attrKey) <= 0 || attrValue == NULL || mir_strlen(attrValue) <= 0) return NULL; for (i=0; inumChild; i++) { if (node->child[i]->name && !strcmp(tag, node->child[i]->name)) { diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 6338b74767..95b37d9dcb 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -78,7 +78,7 @@ int CToxProto::OnInitStatusMenu() { char text[MAX_PATH]; mir_strcpy(text, m_szModuleName); - char *tDest = text + strlen(text); + char *tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index d97496b856..1191568773 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -68,7 +68,7 @@ void CToxProto::BootstrapNodesFromIni(bool isIPv6) BootstrapNode(address, port, pubKey); } } - section += strlen(section) + 1; + section += mir_strlen(section) + 1; } } } diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 131abcb858..40cfa41e49 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -429,7 +429,7 @@ void CToxOptionsNodeList::OnInitDialog() GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName); m_nodes.SetItem(iItem, 3, mir_a2t(value)); } - section += strlen(section) + 1; + section += mir_strlen(section) + 1; } } diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 0c66c33fea..0eb8eca77e 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -108,7 +108,7 @@ void CToxProto::SearchByNameAsync(void *arg) tox_dns3_kill(dns); } } - section += strlen(section) + 1; + section += mir_strlen(section) + 1; } } diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index dd28a80e25..d2391def89 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -258,7 +258,7 @@ int TwitterProto::OnBuildStatusMenu(WPARAM, LPARAM) char text[200]; strcpy(text, m_szModuleName); - char *tDest = text + strlen(text); + char *tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; @@ -421,9 +421,9 @@ void TwitterProto::SendTweetWorker(void *p) return; char *text = static_cast(p); - if (strlen(text) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here. + if (mir_strlen(text) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here. TCHAR errorPopup[280]; - mir_sntprintf(errorPopup, SIZEOF(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), strlen(text)); + mir_sntprintf(errorPopup, SIZEOF(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text)); ShowPopup(errorPopup, 1); return; } diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index 4d696207a1..00ed1aab76 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -83,7 +83,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR tstr[128]; GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str) - 1); - if (str[strlen(str) - 1] != '/') + if (str[mir_strlen(str) - 1] != '/') strncat(str, "/", SIZEOF(str) - mir_strlen(str)); db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str); @@ -148,7 +148,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam case WM_SETREPLY: char foo[512]; mir_snprintf(foo, SIZEOF(foo), "@%s ", (char*)wParam); - size_t len = strlen(foo); + size_t len = mir_strlen(foo); SetDlgItemTextA(hwndDlg, IDC_TWEETMSG, foo); SendDlgItemMessage(hwndDlg, IDC_TWEETMSG, EM_SETSEL, len, len); @@ -230,7 +230,7 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar db_set_s(0, proto->ModuleName(), TWITTER_KEY_UN, str); GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, SIZEOF(str) - 1); - if (str[strlen(str) - 1] != '/') + if (str[mir_strlen(str) - 1] != '/') strncat(str, "/", SIZEOF(str) - mir_strlen(str)); db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str); diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index b95e7649b2..768ad6cccf 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -49,7 +49,7 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam) { char text[200]; strcpy(text, m_szModuleName); - char *tDest = text + strlen(text); + char *tDest = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 6cf65879c9..a3247c4301 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -11,7 +11,7 @@ BYTE Xfire_base::accStringByte(char* str){ if (str == NULL) return 0; - for (unsigned int i = 0; i < (int)strlen(str); i++) + for (unsigned int i = 0; i < (int)mir_strlen(str); i++) { temp += str[i]; } @@ -27,7 +27,7 @@ void Xfire_base::strtolower(char*str) return; //lowercase it :) - for (unsigned int i = 0; i < (int)strlen(str); i++) + for (unsigned int i = 0; i < (int)mir_strlen(str); i++) { str[i] = tolower(str[i]); } @@ -54,7 +54,7 @@ void Xfire_base::strtoupper(char*str) return; //lowercase it :) - for (unsigned int i = 0; i < (int)strlen(str); i++) + for (unsigned int i = 0; i < (int)mir_strlen(str); i++) { str[i] = toupper(str[i]); } @@ -68,7 +68,7 @@ void Xfire_base::setString(char*from, char**to) return; //stringgröße auslesen - int size = strlen(from); + int size = mir_strlen(from); //bestehenden zielpointer leeren if (*to != NULL) @@ -89,8 +89,8 @@ void Xfire_base::appendString(char*from, char**to) return; //stringgröße auslesen - int size = strlen(from); - int size2 = strlen(*to); + int size = mir_strlen(from); + int size2 = mir_strlen(*to); //temporären pointer anlegen char* append = new char[size + size2 + 1]; @@ -329,8 +329,8 @@ BOOL Xfire_base::inString(char*str, char*search, char**pos) { } //ist der gesuchte string größer, wie der string wo gesucht werden soll? dann FALSE zurück - unsigned int sizeofsearch = strlen(search); - if (sizeofsearch > strlen(str)) + unsigned int sizeofsearch = mir_strlen(search); + if (sizeofsearch > mir_strlen(str)) { //poszeiger, falls übergeben, auf NULL setzen if (pos) *pos = NULL; @@ -389,7 +389,7 @@ void Xfire_base::strreplace(char*search, char*replace, char**data) { //ersetzendes anhängen this->appendString(replace, &newdata); //poszeiger um die größe des zusuchenden strings erhöhen - pos += strlen(search); + pos += mir_strlen(search); //rest anhängen this->appendString(pos, &newdata); //alten string löschen diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 12acb76b07..167495b2d6 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -23,7 +23,7 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { return FALSE; //ist launchparam großgenug für eibne urlprüfung? - if (strlen(this->launchparams) > 5) + if (mir_strlen(this->launchparams) > 5) { //launchparams ne url? dann openurl funktion von miranda verwenden if (this->launchparams[0] == 'h'&& @@ -49,10 +49,10 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { //größe des netzwerparams berechnen if (this->pwparams) - pwsize += strlen(this->pwparams); + pwsize += mir_strlen(this->pwparams); - mynetworkparams = new char[strlen(this->networkparams) + pwsize]; - strcpy_s(mynetworkparams, strlen(this->networkparams) + pwsize, this->networkparams); + mynetworkparams = new char[mir_strlen(this->networkparams) + pwsize]; + strcpy_s(mynetworkparams, mir_strlen(this->networkparams) + pwsize, this->networkparams); //port begrenzen port = port % 65535; @@ -92,19 +92,19 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { } if (mynetworkparams) - networksize = strlen(mynetworkparams) + strlen(this->networkparams); + networksize = mir_strlen(mynetworkparams) + mir_strlen(this->networkparams); } //extra parameter int extraparamssize = 0; if (this->extraparams) { - extraparamssize = strlen(this->extraparams); + extraparamssize = mir_strlen(this->extraparams); } //temporäres array anlegen char*temp = NULL; - temp = new char[strlen(this->launchparams) + networksize + extraparamssize + 1]; + temp = new char[mir_strlen(this->launchparams) + networksize + extraparamssize + 1]; if (temp == NULL) { @@ -116,7 +116,7 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { } //launcherstring ins temporäre array - strcpy_s(temp, strlen(this->launchparams) + 1, this->launchparams); + strcpy_s(temp, mir_strlen(this->launchparams) + 1, this->launchparams); //netzwerkparameter ? if (mynetworkparams) @@ -289,7 +289,7 @@ void Xfire_game::readFromDB(unsigned dbid) if (this->path) { BOOL found = FALSE; - for (unsigned int i = 0; i < strlen(this->path); i++) + for (unsigned int i = 0; i < mir_strlen(this->path); i++) { if (this->path[i] == '~') { diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index 7d1aefb1c0..3c8f50ada9 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -267,7 +267,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) { //filterstring aufbauen mir_snprintf(szFilter, SIZEOF(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files")); //umbruch in 0 wandeln - unsigned int sizeFilter = strlen(szFilter); + unsigned int sizeFilter = mir_strlen(szFilter); for (unsigned int i = 0; i < sizeFilter; i++) if (szFilter[i] == '|') szFilter[i] = 0; //openfiledia vorbereiten @@ -629,7 +629,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM //Spielname GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, SIZEOF(temp)); - if (!strlen(temp)) + if (!mir_strlen(temp)) { if (!editgame) delete newgame; return MessageBox(hwndDlg, TranslateT("Please enter a game name."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION); @@ -644,7 +644,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM //spielid nur setzen/prüfen, wenn kein editgame if (!editgame) { GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, SIZEOF(temp)); - if (!strlen(temp)) + if (!mir_strlen(temp)) { if (!editgame) delete newgame; return MessageBox(hwndDlg, TranslateT("Please enter a game ID."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION); @@ -672,7 +672,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } //zu sendene spielid GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, SIZEOF(temp)); - if (strlen(temp)) + if (mir_strlen(temp)) { //standardmäßig wird bei einem customeintrag keine id versendet int sendid = atoi(temp); @@ -682,7 +682,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM //launcher exe GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, SIZEOF(temp)); - if (strlen(temp)) + if (mir_strlen(temp)) { //lowercase pfad newgame->strtolower(temp); @@ -691,7 +691,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } //detectexe GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, SIZEOF(temp)); - if (!strlen(temp)) + if (!mir_strlen(temp)) { if (!editgame) delete newgame; return MessageBox(hwndDlg, TranslateT("Please select a game exe. Note: If you don't select a launcher exe, the game exe will be used in the game start menu."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION); @@ -709,13 +709,13 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } //mustcontain parameter GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, SIZEOF(temp)); - if (strlen(temp)) + if (mir_strlen(temp)) { newgame->setString(temp, &newgame->mustcontain); } //statusmsg speichern GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, SIZEOF(temp)); - if (strlen(temp)) + if (mir_strlen(temp)) { newgame->setString(temp, &newgame->statusmsg); newgame->setstatusmsg = 1; diff --git a/protocols/Xfire/src/clientinformationpacket.cpp b/protocols/Xfire/src/clientinformationpacket.cpp index f0d65e8a00..7843c6d8a8 100644 --- a/protocols/Xfire/src/clientinformationpacket.cpp +++ b/protocols/Xfire/src/clientinformationpacket.cpp @@ -39,17 +39,17 @@ namespace xfirelib { packet[index++] = 0x01; packet[index++] = (char)skins; packet[index++] = 0x00; - packet[index++] = strlen("Standard"); + packet[index++] = mir_strlen("Standard"); packet[index++] = 0x00; - memcpy(packet+index,"Standard",strlen("Standard"));/*add first skin name*/ - index += strlen("Standard"); + memcpy(packet+index,"Standard",mir_strlen("Standard"));/*add first skin name*/ + index += mir_strlen("Standard"); - packet[index++] = strlen("XFire"); + packet[index++] = mir_strlen("XFire"); packet[index++] = 0x00; - memcpy(packet+index,"XFire",strlen("XFire"));/*add second skin name*/ - index += strlen("XFire"); + memcpy(packet+index,"XFire",mir_strlen("XFire"));/*add second skin name*/ + index += mir_strlen("XFire"); VariableValue val; val.setName( "version" ); diff --git a/protocols/Xfire/src/clientloginpacket.cpp b/protocols/Xfire/src/clientloginpacket.cpp index f46b0cd21e..97c1478ceb 100644 --- a/protocols/Xfire/src/clientloginpacket.cpp +++ b/protocols/Xfire/src/clientloginpacket.cpp @@ -105,7 +105,7 @@ void ClientLoginPacket::hashSha1(const char *string, unsigned char *sha){ unsigned char temp[1024]; CSHA1 sha1; sha1.Reset(); - sha1.Update((UINT_8 *)string, strlen(string)); + sha1.Update((UINT_8 *)string, mir_strlen(string)); sha1.Final(); sha1.GetHash(temp); diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index ff8e1b947d..f2aac56cde 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -274,7 +274,7 @@ void XFireClient::handlingBuddy(MCONTACT handle) } void XFireClient::setNick(char*nnick) { - /*if (strlen(nnick)==0) + /*if (mir_strlen(nnick)==0) return;*/ SendNickChangePacket nick; nick.nick = nnick; @@ -284,7 +284,7 @@ void XFireClient::setNick(char*nnick) { void XFireClient::sendmsg(char*usr, char*cmsg) { SendMessagePacket msg; - // if (strlen(cmsg)>255) + // if (mir_strlen(cmsg)>255) // *(cmsg+255)=0; msg.init(client, usr, cmsg); client->send(&msg); @@ -845,7 +845,7 @@ INT_PTR UrlCall(WPARAM wparam, LPARAM lparam) { //tempbuffer für die frage and en user char temp[100]; - if (strlen(g) > 25) //zugroße abschneiden + if (mir_strlen(g) > 25) //zugroße abschneiden *(g + 25) = 0; mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to add %s to your friend list?"), g); @@ -1601,10 +1601,10 @@ MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline, int cla db_set_b(hContact, "CList", "NotOnList", 1); db_unset(hContact, "CList", "Hidden"); - if (strlen(xfc.nick) > 0) { + if (mir_strlen(xfc.nick) > 0) { db_set_utf(hContact, protocolname, "Nick", xfc.nick); } - else if (strlen(xfc.username) > 0) { + else if (mir_strlen(xfc.username) > 0) { db_set_s(hContact, protocolname, "Nick", xfc.username); } @@ -1624,7 +1624,7 @@ MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline, int cla { XFire_SetAvatar* xsa = new XFire_SetAvatar; xsa->hContact = hContact; - xsa->username = new char[strlen(xfc.username) + 1]; + xsa->username = new char[mir_strlen(xfc.username) + 1]; strcpy(xsa->username, xfc.username); mir_forkthread(SetAvatar, (LPVOID)xsa); } @@ -1925,7 +1925,7 @@ static INT_PTR GetIPPort(WPARAM hContact, LPARAM lParam) if (OpenClipboard(NULL)) { EmptyClipboard(); - HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp) + 1); + HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(temp) + 1); char *buffer = (char*)GlobalLock(clipbuffer); strcpy(buffer, LPCSTR(temp)); GlobalUnlock(clipbuffer); @@ -1953,7 +1953,7 @@ static INT_PTR GetVIPPort(WPARAM hContact, LPARAM lParam) if (OpenClipboard(NULL)) { EmptyClipboard(); - HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp) + 1); + HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(temp) + 1); char *buffer = (char*)GlobalLock(clipbuffer); strcpy(buffer, LPCSTR(temp)); GlobalUnlock(clipbuffer); @@ -2612,7 +2612,7 @@ if (db_get(entry->hcontact,"ContactPhoto", "File",&dbv)) { XFire_SetAvatar* xsa=new XFire_SetAvatar; xsa->hContact=entry->hcontact; -xsa->username=new char[strlen(entry->username.c_str())+1]; +xsa->username=new char[mir_strlen(entry->username.c_str())+1]; strcpy(xsa->username,entry->username.c_str()); mir_forkthread(SetAvatar,(LPVOID)xsa); @@ -2703,7 +2703,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc DummyXFireGame *gameob; - if (strlen(entry->gameinfo.c_str()) > 0) + if (mir_strlen(entry->gameinfo.c_str()) > 0) db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str()); //beim voicechat foglendes machn @@ -2790,7 +2790,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc if (entry->lastpopup == NULL) { //größe des popupstrings - int size = strlen(temp) + 1; + int size = mir_strlen(temp) + 1; //popup darstellen displayPopup(NULL, temp, PLUGIN_TITLE, 0, hicongame); //letzten popup definieren @@ -2806,7 +2806,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc entry->lastpopup = NULL; //größe des popupstrings - int size = strlen(temp) + 1; + int size = mir_strlen(temp) + 1; //popup darstellen displayPopup(NULL, temp, PLUGIN_TITLE, 0, hicongame); //letzten popup definieren @@ -3140,7 +3140,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) strcpy(statusmessage[0], (char*)lParam); } else if (wParam != ID_STATUS_OFFLINE) { - if (db_get_b(NULL, protocolname, "nocustomaway", 0) == 0 && strlen((char*)lParam) > 0) { + if (db_get_b(NULL, protocolname, "nocustomaway", 0) == 0 && mir_strlen((char*)lParam) > 0) { mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", (char*)lParam); //strcpy(statusmessage[1],( char* )lParam); } diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 127f789b19..c108822805 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -104,7 +104,7 @@ static mytreeitem mytree[] = { //funktion zum auslesen aller einträge unter XFireBlock static int enumSettingsProc(const char *szSetting, LPARAM lParam) { - if (strlen(szSetting) > 0) + if (mir_strlen(szSetting) > 0) { SendDlgItemMessageA((HWND)lParam, IDC_BLOCKUSER, LB_ADDSTRING, 0, (LPARAM)szSetting); } @@ -895,7 +895,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char* buffer; EmptyClipboard(); - clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(out)+1); + clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(out)+1); buffer = (char*)GlobalLock(clipbuffer); strcpy(buffer, LPCSTR(out)); GlobalUnlock(clipbuffer); diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 9796d02414..a73e624d56 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -68,7 +68,7 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL) char temp[XFIRE_MAX_STATIC_STRING_LEN]; strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1); - *(temp + strlen(temp) - 1) = 0; + *(temp + mir_strlen(temp) - 1) = 0; strncat(temp, wfd.cFileName, SIZEOF(temp) - mir_strlen(temp)); strncat(temp, "\\", SIZEOF(temp) - mir_strlen(temp)); strncat(temp, pos, SIZEOF(temp) - mir_strlen(temp)); @@ -328,7 +328,7 @@ void Scan4Games(LPVOID lparam) //zusätzlichen pfad anhängen if (xfire_GetPrivateProfileString(temp, "LauncherDirAppend", "", ret2, 255, inipath)) { - if (*(path + strlen(path) - 1) == '\\'&&*(ret2) == '\\') + if (*(path + mir_strlen(path) - 1) == '\\'&&*(ret2) == '\\') strcat(path, (ret2 + 1)); else strcat(path, ret2); @@ -350,11 +350,11 @@ void Scan4Games(LPVOID lparam) if (pos != 0) *pos = 0; - if (*(path + strlen(path) - 1) != '\\') - *(path + strlen(path) - strlen(ret2)) = 0; + if (*(path + mir_strlen(path) - 1) != '\\') + *(path + mir_strlen(path) - mir_strlen(ret2)) = 0; } - if (*(path + strlen(path) - 1) != '\\') + if (*(path + mir_strlen(path) - 1) != '\\') strcat(path, "\\"); @@ -369,7 +369,7 @@ void Scan4Games(LPVOID lparam) { if (xfire_GetPrivateProfileString(temp, "DetectExe", "", ret, 255, inipath)) { - cutforlaunch = path + strlen(path); + cutforlaunch = path + mir_strlen(path); strcpy(pathtemp, path); //wenn backslash bei detectexe, dann diesen skippen (eveonline bug) @@ -393,7 +393,7 @@ void Scan4Games(LPVOID lparam) } else if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath)) { - cutforlaunch = path + strlen(path); + cutforlaunch = path + mir_strlen(path); strcat(path, ret2); } } @@ -404,7 +404,7 @@ void Scan4Games(LPVOID lparam) } else if (xfire_GetPrivateProfileString(temp, "DetectExe[0]", "", ret2, 255, inipath)) { - cutforlaunch = path + strlen(path); + cutforlaunch = path + mir_strlen(path); strcat(path, ret2); multiexe = TRUE; if (!CheckPath(path, path_r)) @@ -414,7 +414,7 @@ void Scan4Games(LPVOID lparam) } else if (xfire_GetPrivateProfileString(temp, "DetectExe", "", ret2, 255, inipath)) { - cutforlaunch = path + strlen(path); + cutforlaunch = path + mir_strlen(path); //wenn backslash bei detectexe, dann diesen skippen (eveonline bug) if (ret2[0] == '\\') @@ -433,7 +433,7 @@ void Scan4Games(LPVOID lparam) } else if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath)) { - cutforlaunch = path + strlen(path); + cutforlaunch = path + mir_strlen(path); strcat(path, ret2); } @@ -448,7 +448,7 @@ void Scan4Games(LPVOID lparam) //GetLongPathNameA(path,path,sizeof(path)); //lowercase pfad - for (unsigned int ii = 0; ii < strlen(path); ii++) + for (unsigned int ii = 0; ii < mir_strlen(path); ii++) path[ii] = tolower(path[ii]); if (path_r[0] == 0) @@ -456,7 +456,7 @@ void Scan4Games(LPVOID lparam) else { //lowercase wildcard pfad - for (unsigned int ii = 0; ii < strlen(path_r); ii++) + for (unsigned int ii = 0; ii < mir_strlen(path_r); ii++) path_r[ii] = tolower(path_r[ii]); newgame->setString(path_r, &newgame->path); } @@ -483,10 +483,10 @@ void Scan4Games(LPVOID lparam) } else { - for (unsigned int i2 = 0; i2 < strlen(path); i2++) + for (unsigned int i2 = 0; i2 < mir_strlen(path); i2++) path[i2] = tolower(path[i2]); - char* mpathtemp = new char[strlen(path) + 1]; + char* mpathtemp = new char[mir_strlen(path) + 1]; strcpy(mpathtemp, path); newgame->mpath.push_back(mpathtemp); } @@ -508,7 +508,7 @@ void Scan4Games(LPVOID lparam) char launchpath[XFIRE_MAX_STATIC_STRING_LEN] = ""; strcpy(launchpath, path); //letzten backslash entfernen - if (launchpath[strlen(launchpath) - 1] == '\\') launchpath[strlen(launchpath) - 1] = 0; + if (launchpath[mir_strlen(launchpath) - 1] == '\\') launchpath[mir_strlen(launchpath) - 1] = 0; strcat(path, ret2); @@ -608,7 +608,7 @@ void Scan4Games(LPVOID lparam) //GetLongPathNameA(ret2,ret2,sizeof(ret2)); //lowercase pfad - for (unsigned int i = 0; i < strlen(ret2); i++) + for (unsigned int i = 0; i < mir_strlen(ret2); i++) ret2[i] = tolower(ret2[i]); newgame->setString(ret2, &newgame->path); @@ -722,7 +722,7 @@ void Scan4Games(LPVOID lparam) if (!db_get_b(NULL, protocolname, "dontdisresults", 0)) { - int p = strlen(gamelist) - 2; + int p = mir_strlen(gamelist) - 2; if (p > -1) gamelist[p] = 0; //letztes koma killen mir_snprintf(ret, SIZEOF(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist); diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index 7675e55762..f2783b6be3 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -65,13 +65,13 @@ BOOL str_replace(char*src, char*find, char*rep) if (pos > -1) { - char *temp = new char[strlen(src) + strlen(rep) + 1]; + char *temp = new char[mir_strlen(src) + mir_strlen(rep) + 1]; strcpy(temp, src); *(temp + pos) = 0; strcat(temp, rep); - strcat(temp, (src + pos + strlen(find))); + strcat(temp, (src + pos + mir_strlen(find))); strcpy(src, temp); delete[] temp; @@ -134,7 +134,7 @@ char*menuitemtext(char*mtext) if (!mtext) return NULL; - int size = strlen(mtext); + int size = mir_strlen(mtext); if (!size || size > 255) return mtext; @@ -739,7 +739,7 @@ char * getItem(char * string, char delim, int count) if (count > 1) item[0] = 0; - for (unsigned int i = 0; i < strlen(item); i++) + for (unsigned int i = 0; i < mir_strlen(item); i++) { item[i] = tolower(item[i]); } @@ -831,19 +831,19 @@ BOOL checkCommandLine(HANDLE hProcess, char * mustcontain, char * mustnotcontain buffer2[correctsize - 1] = 0; - for (unsigned int i = 0; i < strlen(buffer2); i++) + for (unsigned int i = 0; i < mir_strlen(buffer2); i++) { buffer2[i] = tolower(buffer2[i]); } //lowercase mustcontain/mustnotcontain if (mustcontain) - for (unsigned int i = 0; i < strlen(mustcontain); i++) + for (unsigned int i = 0; i < mir_strlen(mustcontain); i++) { mustcontain[i] = tolower(mustcontain[i]); } if (mustnotcontain) - for (unsigned int i = 0; i < strlen(mustnotcontain); i++) + for (unsigned int i = 0; i < mir_strlen(mustnotcontain); i++) { mustnotcontain[i] = tolower(mustnotcontain[i]); } @@ -1015,7 +1015,7 @@ unsigned int getfilesize(char*path) //funktion soll erst in der userini suchen, danach in der xfire_games.ini DWORD xfire_GetPrivateProfileString(__in LPCSTR lpAppName, __in LPCSTR lpKeyName, __in LPCSTR lpDefault, __out LPSTR lpReturnedString, __in DWORD nSize, __in LPCSTR lpFileName) { //xfire_games.ini - int size = strlen(lpFileName); + int size = mir_strlen(lpFileName); if (size > 15) { char*file = (char*)lpFileName; diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 2b3cdb9681..4a38300ca6 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -101,7 +101,7 @@ static int GetIPPortUDetails(MCONTACT hContact, char* feld1, char* feld2) if (OpenClipboard(NULL)) { EmptyClipboard(); - HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp) + 1); + HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(temp) + 1); char *buffer = (char*)GlobalLock(clipbuffer); strcpy(buffer, LPCSTR(temp)); GlobalUnlock(clipbuffer); @@ -254,7 +254,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam DBVARIANT dbv; if (!db_get(hContact, protocolname, "Username", &dbv)) { - int usernamesize = strlen(dbv.pszVal) + 1; + int usernamesize = mir_strlen(dbv.pszVal) + 1; char* username = new char[usernamesize]; if (username) { diff --git a/protocols/Xfire/src/xfireparse.cpp b/protocols/Xfire/src/xfireparse.cpp index 4f872f4401..382901f853 100644 --- a/protocols/Xfire/src/xfireparse.cpp +++ b/protocols/Xfire/src/xfireparse.cpp @@ -32,7 +32,7 @@ XFireParse::XFireParse() { /*void XFireParse::readVariableAttribut( char *value, char *packet, char *attr,int packet_length,int attr_length, int start,int max_length ) { -int length_index = findString2(packet,attr, packet_length,strlen(attr),start)+attr_length+1; +int length_index = findString2(packet,attr, packet_length,mir_strlen(attr),start)+attr_length+1; unsigned int length = xfire_hex_to_intC(packet[length_index]); diff --git a/protocols/Xfire/src/xfireutils.cpp b/protocols/Xfire/src/xfireutils.cpp index 5df7ba314b..93793c72e7 100644 --- a/protocols/Xfire/src/xfireutils.cpp +++ b/protocols/Xfire/src/xfireutils.cpp @@ -36,9 +36,9 @@ using namespace std; } int XFireUtils::addAttributName(char *packet,int packet_length, char *att){ - XDEBUG3( "Adding %d chars at position %d\n",strlen(att),packet_length); - packet[packet_length] = (char)strlen(att);//set att length - memcpy(packet+packet_length+1,att,strlen(att)); //set attname - return packet_length+1+strlen(att); + XDEBUG3( "Adding %d chars at position %d\n",mir_strlen(att),packet_length); + packet[packet_length] = (char)mir_strlen(att);//set att length + memcpy(packet+packet_length+1,att,mir_strlen(att)); //set attname + return packet_length+1+mir_strlen(att); } }; diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 4c8c66ce5d..d1b1e3833d 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -46,9 +46,9 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar DWORD uin = *(PDWORD)dbei.pBlob; MCONTACT hContact = DbGetAuthEventContact(&dbei); char* nick = (char*)dbei.pBlob + sizeof(DWORD) * 2; - char* first = nick + strlen(nick) + 1; - char* last = first + strlen(first) + 1; - char* email = last + strlen(last) + 1; + char* first = nick + mir_strlen(nick) + 1; + char* last = first + mir_strlen(first) + 1; + char* email = last + mir_strlen(last) + 1; SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0)); SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0)); @@ -169,10 +169,10 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DWORD uin = *(PDWORD)dbei.pBlob; MCONTACT hContact = DbGetAuthEventContact(&dbei); char *nick = (char*)dbei.pBlob + sizeof(DWORD) * 2; - char *first = nick + strlen(nick) + 1; - char *last = first + strlen(first) + 1; - char *email = last + strlen(last) + 1; - char *reason = email + strlen(email) + 1; + char *first = nick + mir_strlen(nick) + 1; + char *last = first + mir_strlen(first) + 1; + char *email = last + mir_strlen(last) + 1; + char *reason = email + mir_strlen(email) + 1; SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0)); SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0)); diff --git a/src/core/stdcrypt/src/Rijndael.cpp b/src/core/stdcrypt/src/Rijndael.cpp index 95cc317099..e721c3e36d 100644 --- a/src/core/stdcrypt/src/Rijndael.cpp +++ b/src/core/stdcrypt/src/Rijndael.cpp @@ -963,7 +963,7 @@ int CRijndael::MakeKey(BYTE const* key, char const* chain, int keylength, int bl m_keylength = keylength; m_blockSize = blockSize; //Initialize the chain - size_t len = strlen(chain); + size_t len = mir_strlen(chain); if (len >= m_blockSize) memcpy(m_chain0, chain, m_blockSize); else { diff --git a/src/core/stdcrypt/src/encrypt.cpp b/src/core/stdcrypt/src/encrypt.cpp index e2b3281bcc..7c997e9825 100644 --- a/src/core/stdcrypt/src/encrypt.cpp +++ b/src/core/stdcrypt/src/encrypt.cpp @@ -125,7 +125,7 @@ BYTE* CStdCrypt::encodeString(const char *src, size_t *cbResultLen) return NULL; } - return encodeBuffer(src, strlen(src)+1, cbResultLen); + return encodeBuffer(src, mir_strlen(src)+1, cbResultLen); } BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen) diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index f28660dea0..ccfaa427e2 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -244,7 +244,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ptrT ptszFileName(DbGetEventStringT(&dbei, str)); SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName); - unsigned len = (unsigned)strlen(str) + 1; + unsigned len = (unsigned)mir_strlen(str) + 1; if (len + 4 < dbei.cbBlob) { str += len; ptrT ptszDescription(DbGetEventStringT(&dbei, str)); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 9a458701f0..aa8cf996f3 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -112,7 +112,7 @@ static int AppendToBufferWithRTF(char *&buffer, size_t &cbBufferEnd, size_t &cbB if (line[1] == bbcodes[i][1]) { size_t lenb = _tcslen(bbcodes[i]); if (!_tcsnicmp(line, bbcodes[i], lenb)) { - size_t len = strlen(bbcodefmt[i]); + size_t len = mir_strlen(bbcodefmt[i]); memcpy(d, bbcodefmt[i], len); d += len; line += lenb - 1; @@ -362,7 +362,7 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT case EVENTTYPE_FILE: { char* filename = (char*)dbei.pBlob + sizeof(DWORD); - char* descr = filename + strlen(filename) + 1; + char* descr = filename + mir_strlen(filename) + 1; ptrT ptszFileName(DbGetEventStringT(&dbei, filename)); AppendToBuffer(buffer, bufferEnd, bufferAlloced, " %s ", SetToStyle(MSGFONTID_NOTICE)); diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index 96bef0f424..d681aa2bde 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -626,7 +626,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbei.flags = DBEF_SENT; dbei.szModule = GetContactProto(dat->hContact); dbei.timestamp = time(NULL); - dbei.cbBlob = (DWORD)(strlen(dat->sendBuffer)+strlen(dat->sendBuffer+strlen(dat->sendBuffer)+1)+2); + dbei.cbBlob = (DWORD)(mir_strlen(dat->sendBuffer)+mir_strlen(dat->sendBuffer+mir_strlen(dat->sendBuffer)+1)+2); dbei.pBlob = (PBYTE)dat->sendBuffer; db_event_add(dat->hContact, &dbei); KillTimer(hwndDlg, 0); diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index 98e2669fe0..7bb91e1cd7 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -191,7 +191,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) ci->pszVal = (TCHAR*)buf; } else { - size_t len = strlen(dbv.pszVal) + strlen(dbv2.pszVal) + 2; + size_t len = mir_strlen(dbv.pszVal) + mir_strlen(dbv2.pszVal) + 2; char* buf = (char*)mir_alloc(len); if (buf != NULL) strcat(strcat(strcpy(buf, dbv.pszVal), " "), dbv2.pszVal); @@ -316,7 +316,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) ci->pszVal = (TCHAR*)buf; } else { - size_t len = strlen(dbv.pszVal) + strlen(dbv2.pszVal) + 2; + size_t len = mir_strlen(dbv.pszVal) + mir_strlen(dbv2.pszVal) + 2; char* buf = (char*)mir_alloc(len); if (buf != NULL) strcat(strcat(strcpy(buf, dbv.pszVal), " "), dbv2.pszVal); diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 4bd9c42f96..be17cf1416 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -211,7 +211,7 @@ static void ConvertBackslashes(char *str, UINT fileCp) case 'r': *pstr = '\r'; 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); } } } diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index b073fbcb49..425cc5d7b4 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -86,7 +86,7 @@ static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam) static TCHAR* getEventString(DBEVENTINFO *dbei, LPSTR &buf) { LPSTR in = buf; - buf += strlen(buf) + 1; + buf += mir_strlen(buf) + 1; return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2t(in); } diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp index c864394261..f0638b147d 100644 --- a/src/modules/database/mdatabasecache.cpp +++ b/src/modules/database/mdatabasecache.cpp @@ -157,9 +157,9 @@ void MDatabaseCache::SetCachedVariant(DBVARIANT* s /* new */, DBVARIANT* d /* ca memcpy(d, s, sizeof(DBVARIANT)); if ((s->type == DBVT_UTF8 || s->type == DBVT_ASCIIZ) && s->pszVal != NULL) { if (szSave != NULL) - d->pszVal = (char*)HeapReAlloc(m_hCacheHeap, 0, szSave, strlen(s->pszVal) + 1); + d->pszVal = (char*)HeapReAlloc(m_hCacheHeap, 0, szSave, mir_strlen(s->pszVal) + 1); else - d->pszVal = (char*)HeapAlloc(m_hCacheHeap, 0, strlen(s->pszVal) + 1); + d->pszVal = (char*)HeapAlloc(m_hCacheHeap, 0, mir_strlen(s->pszVal) + 1); strcpy(d->pszVal, s->pszVal); } else if (szSave != NULL) diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index 7649492722..5bb898b709 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -73,7 +73,7 @@ static INT_PTR srvPcharToTchar(WPARAM wParam, LPARAM lParam) if (pszStr == NULL) return NULL; - int len = (int)strlen(pszStr); + int len = (int)mir_strlen(pszStr); TCHAR *result = (TCHAR*)alloca((len+1)*sizeof(TCHAR)); MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pszStr, -1, result, len); result[len] = 0; diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index 9d3a0c89a0..d3fec41eb0 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -82,7 +82,7 @@ INT_PTR Meta_GetCaps(WPARAM wParam, LPARAM lParam) INT_PTR Meta_GetName(WPARAM wParam, LPARAM lParam) { char *name = (char *)Translate(META_PROTO); - size_t size = min(strlen(name), wParam - 1); // copy only the first size bytes. + size_t size = min(mir_strlen(name), wParam - 1); // copy only the first size bytes. if (strncpy((char *)lParam, name, size) == NULL) return 1; ((char *)lParam)[size] = '\0'; diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp index 2de498752e..df46abd73b 100644 --- a/src/modules/netlib/netlibautoproxy.cpp +++ b/src/modules/netlib/netlibautoproxy.cpp @@ -299,8 +299,8 @@ static void NetlibIeProxyThread(void *arg) char *proxy = proxyBuffer; DWORD dwProxyLen = sizeof(proxyBuffer); - if (pInternetGetProxyInfo(param->szUrl, (DWORD)strlen(param->szUrl), - param->szHost, (DWORD)strlen(param->szHost), &proxy, &dwProxyLen)) + if (pInternetGetProxyInfo(param->szUrl, (DWORD)mir_strlen(param->szUrl), + param->szHost, (DWORD)mir_strlen(param->szHost), &proxy, &dwProxyLen)) param->szProxy = mir_strdup(lrtrim(proxy)); NetlibLogf(NULL, "Autoproxy got response %s, Param: %s %s", param->szProxy, param->szUrl, param->szHost); @@ -341,7 +341,7 @@ char* NetlibGetIeProxy(char *szUrl) if (ind < 0 || !szProxyHost[ind]) return NULL; - size_t len = strlen(szHost) + 20; + size_t len = mir_strlen(szHost) + 20; res = (char*)mir_alloc(len); mir_snprintf(res, len, "%s %s", ind == 2 ? "SOCKS" : "PROXY", szProxyHost[ind]); return res; @@ -408,7 +408,7 @@ void NetlibLoadIeProxy(void) szProxyHost[ind] = mir_strdup(szProxy); else { - size_t len = strlen(szProxy) + 10; + size_t len = mir_strlen(szProxy) + 10; szProxyHost[ind] = (char*)mir_alloc(len); mir_snprintf(szProxyHost[ind], len, "%s:%u", szProxy, ind == 2 ? 1080 : 8080); } diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index 7d6734ce8f..0fa5d91f42 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -324,7 +324,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime, if ((peol = strchr(buffer, '\n')) != NULL) break; - if ((int)strlen(buffer) < bytesPeeked) { + if ((int)mir_strlen(buffer) < bytesPeeked) { SetLastError(ERROR_BAD_FORMAT); return 0; } @@ -578,10 +578,10 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) phost = strstr(pszFullUrl, "://"); phost = phost ? phost + 3 : pszFullUrl; ppath = strchr(phost, '/'); - rlen = ppath ? ppath - pszFullUrl : strlen(pszFullUrl); + rlen = ppath ? ppath - pszFullUrl : mir_strlen(pszFullUrl); } - nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + strlen(tmpUrl) * 3 + 1); + nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + mir_strlen(tmpUrl) * 3 + 1); strncpy(nlc->szNewUrl, pszFullUrl, rlen); strcpy(nlc->szNewUrl + rlen, tmpUrl); diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 5590d2305c..e673ae8561 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -337,7 +337,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) } if (logOptions.toFile && !logOptions.tszFile.IsEmpty()) { - size_t len = strlen(pszMsg); + size_t len = mir_strlen(pszMsg); mir_writeLogA(hLogger, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n"); } diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index c7daa9dea2..0e40641eec 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -115,8 +115,8 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE // http://www.socks.nec.com/protocol/socks4.protocol and http://www.socks.nec.com/protocol/socks4a.protocol if (!nloc || !nloc->szHost || !nloc->szHost[0]) return 0; - size_t nHostLen = strlen(nloc->szHost) + 1; - size_t nUserLen = nlu->settings.szProxyAuthUser ? strlen(nlu->settings.szProxyAuthUser) + 1 : 1; + size_t nHostLen = mir_strlen(nloc->szHost) + 1; + size_t nUserLen = nlu->settings.szProxyAuthUser ? mir_strlen(nlu->settings.szProxyAuthUser) + 1 : 1; size_t len = 8 + nUserLen; char* pInit = (char*)alloca(len + nHostLen); diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 4f47cbf2d8..0e4151d1ad 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -383,7 +383,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, char *szLogin = mir_t2a(login); char *szPassw = mir_t2a(psw); - size_t authLen = strlen(szLogin) + strlen(szPassw) + 5; + size_t authLen = mir_strlen(szLogin) + mir_strlen(szPassw) + 5; char *szAuth = (char*)alloca(authLen); int len = mir_snprintf(szAuth, authLen, "%s:%s", szLogin, szPassw); @@ -401,7 +401,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, return szOutputToken; ptrA szProvider(mir_t2a(hNtlm->szProvider)); - size_t resLen = strlen(szOutputToken) + strlen(szProvider) + 10; + size_t resLen = mir_strlen(szOutputToken) + mir_strlen(szProvider) + 10; char *result = (char*)mir_alloc(resLen); mir_snprintf(result, resLen, "%s %s", szProvider, szOutputToken); mir_free(szOutputToken); diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 513aafaa55..c97a24050f 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -139,7 +139,7 @@ static bool txtParseParam(char* szData, char* presearch, cp = strstr(cp1, start); if (cp == NULL) return false; - cp += strlen(start); + cp += mir_strlen(start); while (*cp == ' ') ++cp; cp1 = strstr(cp, finish); @@ -163,7 +163,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) else phost += 3; ppath = strchr(phost, '/'); - if (ppath == NULL) ppath = phost + strlen(phost); + if (ppath == NULL) ppath = phost + mir_strlen(phost); pport = strchr(phost, ':'); if (pport == NULL) pport = ppath; @@ -452,7 +452,7 @@ retry: acksz += chunkBytes; peol2++; - memmove(data, peol2, strlen(peol2) + 1); + memmove(data, peol2, mir_strlen(peol2) + 1); sz -= peol2 - data; // Last chunk, all data received @@ -535,10 +535,10 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) rpth = rpth ? rpth + 2 : szCtlUrl; rpth = strchr(rpth, '/'); - if (rpth == NULL) rpth = szCtlUrl + strlen(szCtlUrl); + if (rpth == NULL) rpth = szCtlUrl + mir_strlen(szCtlUrl); } else { // relative URI rel_path - size_t ctlCLen = strlen(szCtlUrl); + size_t ctlCLen = mir_strlen(szCtlUrl); rpth = szCtlUrl + ctlCLen; if (ctlCLen != 0 && *(rpth - 1) != '/') strncpy(rpth++, "/", sizeof(szCtlUrl) - ctlCLen); diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index 187a463e77..bc94b9cc25 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -49,7 +49,7 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen) if (cc == NULL) cc = currDb->m_cache->AddContactToCache(hContact); - cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, (int)strlen(szBuf)); + cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, (int)mir_strlen(szBuf)); } return res; } diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 3787696bd9..526b767328 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -130,7 +130,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) dbei.szModule = GetContactProto(ccs->hContact); dbei.timestamp = pre->timestamp; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1; + dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; dbei.pBlob = (PBYTE)pre->szMessage; if (pre->cbCustomDataSize != 0) { diff --git a/src/modules/protocols/protodir.cpp b/src/modules/protocols/protodir.cpp index 27626880ad..96f442dfc8 100644 --- a/src/modules/protocols/protodir.cpp +++ b/src/modules/protocols/protodir.cpp @@ -107,7 +107,7 @@ char * contactDir_Proto_Add(contactDir * cd, char * proto) mir_cslock lck(cd->csLock); if ( List_GetIndex(&cd->protoNameCache, proto, &index) ) szCache = cd->protoNameCache.items[index]; else { - szCache = HeapAlloc(hCacheHeap, HEAP_NO_SERIALIZE, strlen(proto)+1); + szCache = HeapAlloc(hCacheHeap, HEAP_NO_SERIALIZE, mir_strlen(proto)+1); strcpy(szCache, proto); List_Insert(&cd->protoNameCache, szCache, index); } diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index e2795ae92e..13dfc09ad0 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -218,7 +218,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) char pszNamePrefix[MAXMODULELABELLENGTH]; size_t cbNamePrefix; mir_snprintf(pszNamePrefix, SIZEOF(pszNamePrefix), "%s$", pszName); - cbNamePrefix = strlen(pszNamePrefix); + cbNamePrefix = mir_strlen(pszNamePrefix); for (i=0; i < hotkeys.getCount(); i++) { diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index d7c2884f14..2382da9976 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -383,8 +383,8 @@ HICON LoadSkinIcon(int idx, bool big) static void convertOneProtocol(char *moduleName, char *iconName) { - char *pm = moduleName + strlen(moduleName); - char *pi = iconName + strlen(iconName); + char *pm = moduleName + mir_strlen(moduleName); + char *pi = iconName + mir_strlen(iconName); for (int i=0; i < SIZEOF(statusIcons); i++) { _itoa(statusIcons[i].id, pm, 10); diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index a7ac429900..f1fa55ea5c 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -107,7 +107,7 @@ TCHAR *GetContactID(MCONTACT hContact) static __forceinline int _xcscmp(const char *s1, const char *s2) { return strcmp(s1, s2); } static __forceinline int _xcsncmp(const char *s1, const char *s2, size_t n) { return strncmp(s1, s2, n); } -static __forceinline size_t _xcslen(const char *s1) { return strlen(s1); } +static __forceinline size_t _xcslen(const char *s1) { return mir_strlen(s1); } static __forceinline char *_xcscpy(char *s1, const char *s2) { return strcpy(s1, s2); } static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return strncpy(s1, s2, n); } static __forceinline char *_xstrselect(char *, char *s1, TCHAR *s2) { return s1; } diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 67d65089c7..ab9db2f58e 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -236,7 +236,7 @@ char *myWideCharToMultiByte(const wchar_t *s) return d; } static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return fopen(filename, mode); } -static inline size_t xstrlen(XMLCSTR c) { return strlen(c); } +static inline size_t xstrlen(XMLCSTR c) { return mir_strlen(c); } #ifdef __BORLANDC__ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strnicmp(c1, c2, l);} static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return stricmp(c1, c2); } @@ -325,7 +325,7 @@ static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) } #else static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return fopen(filename, mode); } -static inline int xstrlen(XMLCSTR c) { return strlen(c); } +static inline int xstrlen(XMLCSTR c) { return mir_strlen(c); } static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncasecmp(c1, c2, l);} static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1, c2, l);} static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return strcasecmp(c1, c2); } -- cgit v1.2.3