summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-03 16:02:14 +0200
committerGeorge Hazan <ghazan@miranda.im>2018-05-03 16:02:14 +0200
commit3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a (patch)
tree412a28ef6a572efc7039df1c363bf47a3dec4b19
parent9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff)
mir_forkThread<typename> - stronger typizatioin for thread function parameter
-rw-r--r--include/m_core.h6
-rw-r--r--plugins/AVS/src/cache.cpp2
-rw-r--r--plugins/AVS/src/main.cpp2
-rw-r--r--plugins/AVS/src/poll.cpp2
-rw-r--r--plugins/AVS/src/services.cpp10
-rw-r--r--plugins/AssocMgr/src/utils.cpp5
-rw-r--r--plugins/AutoShutdown/src/cpuusage.cpp6
-rw-r--r--plugins/AutoShutdown/src/frame.cpp2
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp6
-rw-r--r--plugins/AutoShutdown/src/utils.cpp5
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp10
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp2
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp13
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.h2
-rw-r--r--plugins/BasicHistory/src/Options.cpp2
-rw-r--r--plugins/BasicHistory/src/Options.h2
-rw-r--r--plugins/BasicHistory/src/Scheduler.cpp14
-rw-r--r--plugins/Boltun/src/actionQueue.cpp2
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp8
-rw-r--r--plugins/BuddyPounce/src/main.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_aniavatars.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_awaymsg.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_cachefuncs.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp2
-rw-r--r--plugins/Clist_nicer/src/clc.cpp2
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp2
-rw-r--r--plugins/Clist_nicer/src/cluiframes.cpp2
-rw-r--r--plugins/Clist_nicer/src/contact.cpp2
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp6
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp6
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp6
-rw-r--r--plugins/CloudFile/src/utils.cpp2
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp2
-rw-r--r--plugins/CmdLine/src/services.cpp2
-rw-r--r--plugins/Console/src/Console.cpp2
-rw-r--r--plugins/ContactsPlus/src/send.cpp2
-rw-r--r--plugins/CountryFlags/src/ip2country.cpp2
-rw-r--r--plugins/Db_autobackups/src/backup.cpp6
-rw-r--r--plugins/FTPFileYM/src/dbentry.cpp4
-rw-r--r--plugins/FTPFileYM/src/deletetimer.cpp2
-rw-r--r--plugins/FTPFileYM/src/job_delete.cpp6
-rw-r--r--plugins/FTPFileYM/src/job_delete.h2
-rw-r--r--plugins/FTPFileYM/src/job_packer.cpp12
-rw-r--r--plugins/FTPFileYM/src/job_packer.h2
-rw-r--r--plugins/FTPFileYM/src/job_upload.cpp16
-rw-r--r--plugins/FTPFileYM/src/job_upload.h2
-rw-r--r--plugins/FavContacts/src/contact_cache.cpp10
-rw-r--r--plugins/GmailNotifier/src/notify.cpp149
-rw-r--r--plugins/GmailNotifier/src/stdafx.h1
-rw-r--r--plugins/HTTPServer/src/main.cpp5
-rw-r--r--plugins/HistoryStats/src/settings.cpp2
-rw-r--r--plugins/HistoryStats/src/statistic.cpp12
-rw-r--r--plugins/HistoryStats/src/statistic.h4
-rw-r--r--plugins/HistorySweeperLight/src/historysweeperlight.cpp2
-rw-r--r--plugins/IEView/src/ChatHTMLBuilder.cpp2
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.cpp4
-rw-r--r--plugins/IEView/src/MUCCHTMLBuilder.cpp4
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.cpp6
-rw-r--r--plugins/IEView/src/TabSRMMHTMLBuilder.cpp10
-rw-r--r--plugins/IEView/src/TemplateHTMLBuilder.cpp4
-rw-r--r--plugins/Import/src/import.cpp4
-rw-r--r--plugins/Import/src/miranda.cpp2
-rw-r--r--plugins/KeyboardNotify/src/flash.cpp4
-rw-r--r--plugins/KeyboardNotify/src/main.cpp2
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp2
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp2
-rw-r--r--plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp2
-rw-r--r--plugins/MirFox/src/MirandaUtils.cpp2
-rw-r--r--plugins/MirLua/Modules/m_schedule/src/main.cpp24
-rw-r--r--plugins/MirLua/src/m_message.cpp2
-rw-r--r--plugins/MirOTR/src/dbfilter.cpp4
-rw-r--r--plugins/MirOTR/src/utils.cpp4
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp2
-rw-r--r--plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp6
-rw-r--r--plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp2
-rwxr-xr-xplugins/Msg_Export/src/options.cpp6
-rw-r--r--plugins/NewAwaySysMod/src/Client.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/MsgEventAdded.cpp13
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp4
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp2
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp2
-rw-r--r--plugins/NewsAggregator/Src/CheckFeed.cpp16
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp2
-rw-r--r--plugins/NewsAggregator/Src/Update.cpp2
-rw-r--r--plugins/NotifyAnything/src/main.cpp2
-rw-r--r--plugins/Nudge/src/main.cpp12
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp6
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp2
-rw-r--r--plugins/Ping/src/pingthread.cpp4
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp3
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp14
-rw-r--r--plugins/Popup/src/history.cpp2
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp2
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.cpp2
-rw-r--r--plugins/SMS/src/receive.cpp4
-rw-r--r--plugins/SMS/src/send.cpp2
-rw-r--r--plugins/Scriver/src/chat_window.cpp9
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/msgdialog.cpp6
-rw-r--r--plugins/Scriver/src/msglog.cpp4
-rw-r--r--plugins/SecureIM/src/dbevent.cpp2
-rw-r--r--plugins/SecureIM/src/main.cpp2
-rw-r--r--plugins/SecureIM/src/svcs_proto.cpp8
-rw-r--r--plugins/SeenPlugin/src/utils.cpp17
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp2
-rw-r--r--plugins/ShellExt/src/shlcom.cpp7
-rw-r--r--plugins/SimpleAR/src/Main.cpp6
-rw-r--r--plugins/SkypeStatusChange/src/main.cpp2
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp2
-rw-r--r--plugins/SmileyAdd/src/download.cpp2
-rw-r--r--plugins/SmileyAdd/src/imagecache.cpp6
-rw-r--r--plugins/SmileyAdd/src/options.cpp2
-rw-r--r--plugins/SmileyAdd/src/services.cpp2
-rw-r--r--plugins/SmileyAdd/src/smltool.cpp5
-rw-r--r--plugins/SmileyAdd/src/smltool.h3
-rw-r--r--plugins/Spamotron/src/bayes.cpp2
-rw-r--r--plugins/Spamotron/src/spamotron.cpp10
-rw-r--r--plugins/SplashScreen/src/main.cpp2
-rw-r--r--plugins/StartupSilence/src/main.cpp79
-rw-r--r--plugins/StartupSilence/src/stdafx.h1
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp2
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp2
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp4
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp13
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp2
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp4
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp4
-rw-r--r--plugins/TabSRMM/src/msglog.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp8
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp14
-rw-r--r--plugins/TabSRMM/src/templates.cpp4
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp4
-rw-r--r--plugins/TipperYM/src/subst.cpp4
-rw-r--r--plugins/TipperYM/src/tipper.cpp2
-rw-r--r--plugins/TipperYM/src/translations.cpp4
-rw-r--r--plugins/UserInfoEx/src/mir_contactqueue.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_contactqueue.h2
-rw-r--r--plugins/Variables/src/parse_miranda.cpp2
-rwxr-xr-xplugins/Watrack_MPD/src/main.cpp22
-rw-r--r--plugins/Weather/src/weather_addstn.cpp4
-rw-r--r--plugins/Weather/src/weather_update.cpp2
-rw-r--r--plugins/WebView/src/webview.cpp6
-rw-r--r--plugins/WebView/src/webview.h1
-rw-r--r--plugins/WebView/src/webview_alerts.cpp2
-rw-r--r--plugins/WebView/src/webview_getdata.cpp6
-rw-r--r--plugins/WebView/src/webview_services.cpp26
-rw-r--r--plugins/WhenWasIt/src/date_utils.cpp2
-rw-r--r--plugins/WhenWasIt/src/services.cpp2
-rw-r--r--plugins/WhenWasIt/src/utils.cpp2
-rw-r--r--plugins/WhoUsesMyFiles/src/wumfplug.cpp2
-rw-r--r--plugins/YAMN/src/browser/badconnect.cpp2
-rw-r--r--plugins/YAPP/src/services.cpp8
-rw-r--r--protocols/Discord/src/dispatch.cpp6
-rw-r--r--protocols/Discord/src/guilds.cpp4
-rw-r--r--protocols/Discord/src/utils.cpp4
-rw-r--r--protocols/EmLanProto/src/lan.cpp9
-rw-r--r--protocols/EmLanProto/src/mlan.cpp2
-rw-r--r--protocols/FacebookRM/src/chat.cpp8
-rw-r--r--protocols/FacebookRM/src/communication.cpp2
-rw-r--r--protocols/FacebookRM/src/connection.cpp12
-rw-r--r--protocols/FacebookRM/src/contacts.cpp2
-rw-r--r--protocols/FacebookRM/src/feeds.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp4
-rw-r--r--protocols/FacebookRM/src/main.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp2
-rw-r--r--protocols/FacebookRM/src/process.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.h4
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp4
-rw-r--r--protocols/ICQCorp/src/protocol.cpp12
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp18
-rw-r--r--protocols/IRCG/src/input.cpp2
-rw-r--r--protocols/IRCG/src/irclib.cpp26
-rw-r--r--protocols/IRCG/src/scripting.cpp7
-rw-r--r--protocols/IRCG/src/tools.cpp2
-rw-r--r--protocols/IRCG/src/windows.cpp2
-rw-r--r--protocols/IcqOscarJ/src/chan_05ping.cpp4
-rw-r--r--protocols/IcqOscarJ/src/cookies.cpp6
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_02location.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_03buddy.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_04message.cpp20
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp4
-rw-r--r--protocols/IcqOscarJ/src/fam_15icqserver.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_direct.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_directmsg.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_filerequests.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_infoupdate.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_rates.cpp5
-rw-r--r--protocols/IcqOscarJ/src/icq_server.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_xtraz.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icqosc_svcs.cpp2
-rw-r--r--protocols/IcqOscarJ/src/init.cpp2
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp2
-rw-r--r--protocols/IcqOscarJ/src/stdpackets.cpp4
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp2
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_omemo.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp582
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp2
-rw-r--r--protocols/MRA/src/Mra_functions.cpp7
-rw-r--r--protocols/MSN/src/msn_auth.cpp8
-rw-r--r--protocols/MSN/src/msn_chat.cpp2
-rw-r--r--protocols/MSN/src/msn_commands.cpp14
-rw-r--r--protocols/MSN/src/msn_libstr.cpp2
-rw-r--r--protocols/MSN/src/msn_mail.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp4
-rw-r--r--protocols/MSN/src/stdafx.h2
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp6
-rw-r--r--protocols/MinecraftDynmap/src/communication.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/proto.h2
-rw-r--r--protocols/Omegle/src/chat.cpp8
-rw-r--r--protocols/Omegle/src/communication.cpp2
-rw-r--r--protocols/Omegle/src/connection.cpp4
-rw-r--r--protocols/Sametime/src/conference.cpp6
-rw-r--r--protocols/Sametime/src/files.cpp21
-rw-r--r--protocols/Sametime/src/messaging.cpp2
-rw-r--r--protocols/Sametime/src/sametime.cpp12
-rw-r--r--protocols/Sametime/src/sametime.h15
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp8
-rw-r--r--protocols/Sametime/src/sametime_proto.h20
-rw-r--r--protocols/Sametime/src/sametime_session.cpp94
-rw-r--r--protocols/Sametime/src/userlist.cpp2
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp14
-rw-r--r--protocols/SkypeWeb/src/request_queue.h4
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp14
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_trouter.cpp6
-rw-r--r--protocols/Steam/src/stdafx.h2
-rw-r--r--protocols/Tox/libtox/src/toxcore/Messenger.c2
-rw-r--r--protocols/Tox/libtox/src/toxcore/util.c2
-rw-r--r--protocols/Tox/src/stdafx.h2
-rw-r--r--protocols/Twitter/src/chat.cpp4
-rw-r--r--protocols/VKontakte/src/misc.cpp10
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp6
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp30
-rw-r--r--protocols/VKontakte/src/vk_files.cpp2
-rw-r--r--protocols/VKontakte/src/vk_history.cpp2
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp8
-rw-r--r--protocols/VKontakte/src/vk_pollserver.cpp8
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp4
-rw-r--r--src/core/stdemail/src/email.cpp4
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp18
-rw-r--r--src/core/stdmsg/src/chat_window.cpp11
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp2
-rw-r--r--src/core/stduihist/src/history.cpp5
-rw-r--r--src/mir_app/src/chat_opts.cpp2
-rw-r--r--src/mir_app/src/chat_tools.cpp2
-rw-r--r--src/mir_app/src/meta_services.cpp5
-rw-r--r--src/mir_app/src/netlibautoproxy.cpp5
-rw-r--r--src/mir_app/src/netlibbind.cpp5
-rw-r--r--src/mir_app/src/netlibupnp.cpp4
-rw-r--r--src/mir_app/src/proto_accs.cpp5
-rw-r--r--src/mir_app/src/searchresults.cpp17
-rw-r--r--src/mir_core/src/openurl.cpp8
-rw-r--r--src/mir_core/src/timezones.cpp2
-rw-r--r--src/mir_core/src/utils.cpp2
-rw-r--r--utils/std_string_utils.cpp2
279 files changed, 1110 insertions, 1182 deletions
diff --git a/include/m_core.h b/include/m_core.h
index 00ac529c3d..e5d7cbfb59 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -554,6 +554,12 @@ MIR_CORE_DLL(void) UnloadCoreModule(void);
#if defined(__cplusplus)
}
+template <typename T>
+HANDLE mir_forkThread(void(__cdecl *pFunc)(T* param), T *arg)
+{
+ return mir_forkthread((pThreadFunc)pFunc, arg);
+}
+
template <size_t _Size>
inline int mir_snprintf(char(&buffer)[_Size], const char* fmt, ...)
{
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index 6b4ac7417e..1823bdef10 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -80,7 +80,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny)
mir_cslock lck(cachecs);
cc = arCache.find((CacheNode*)&hContact);
if (cc) {
- cc->t_lastAccess = time(nullptr);
+ cc->t_lastAccess = time(0);
return (cc->loaded || findAny) ? cc : nullptr;
}
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp
index 23bcbd79c4..18cbe3ae9d 100644
--- a/plugins/AVS/src/main.cpp
+++ b/plugins/AVS/src/main.cpp
@@ -317,7 +317,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
mir_snwprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId());
hLoaderEvent = CreateEvent(nullptr, TRUE, FALSE, szEventName);
- SetThreadPriority(mir_forkthread(PicLoader, nullptr), THREAD_PRIORITY_IDLE);
+ SetThreadPriority(mir_forkthread(PicLoader), THREAD_PRIORITY_IDLE);
// Folders plugin support
hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT L"\\Avatars");
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index 471ca4a41f..60f9480438 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -62,7 +62,7 @@ static mir_cs cs;
void InitPolls()
{
// Init request queue
- mir_forkthread(RequestThread, nullptr);
+ mir_forkthread(RequestThread);
}
void UninitPolls()
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index 5302ccfe36..cf7f6cafe9 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -718,7 +718,7 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
else ace = (AVATARCACHEENTRY *)GetAvatarBitmap((WPARAM)r->hContact, 0);
if (ace && (!(r->dwFlags & AVDRQ_RESPECTHIDDEN) || !(ace->dwFlags & AVS_HIDEONCLIST))) {
- ace->t_lastAccess = time(nullptr);
+ ace->t_lastAccess = time(0);
if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == nullptr)
return 0;
@@ -750,12 +750,10 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-static void ReloadMyAvatar(LPVOID lpParam)
+static void ReloadMyAvatar(char *szProto)
{
Thread_SetName("AVS: ReloadMyAvatar");
- char *szProto = (char *)lpParam;
-
mir_sleep(500);
if (g_shutDown)
return;
@@ -785,7 +783,7 @@ static void ReloadMyAvatar(LPVOID lpParam)
NotifyEventHooks(hMyAvatarChanged, (WPARAM)myAvatarProto, 0);
}
- mir_free(lpParam);
+ mir_free(szProto);
}
INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
@@ -799,7 +797,7 @@ INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
continue;
if (!mir_strcmp(it->szProtoname, proto)) {
- mir_forkthread(ReloadMyAvatar, mir_strdup(it->szProtoname));
+ mir_forkThread<char>(ReloadMyAvatar, mir_strdup(it->szProtoname));
return 0;
}
}
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp
index 02718bd02f..db1143432f 100644
--- a/plugins/AssocMgr/src/utils.cpp
+++ b/plugins/AssocMgr/src/utils.cpp
@@ -141,9 +141,8 @@ BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,cha
/************************* Error Output ***************************/
-static void MessageBoxIndirectFree(void *param)
+static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
{
- MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)param;
MessageBoxIndirectA(mbp);
mir_free((char*)mbp->lpszCaption); /* does NULL check */
mir_free((char*)mbp->lpszText); /* does NULL check */
@@ -176,7 +175,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...)
case NIIF_WARNING: mbp->dwStyle|=MB_ICONWARNING; break;
case NIIF_ERROR: mbp->dwStyle|=MB_ICONERROR;
}
- mir_forkthread(MessageBoxIndirectFree, mbp);
+ mir_forkThread<MSGBOXPARAMSA>(MessageBoxIndirectFree, mbp);
}
// LocalFree() the return value
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp
index 2959013407..25eb542f35 100644
--- a/plugins/AutoShutdown/src/cpuusage.cpp
+++ b/plugins/AutoShutdown/src/cpuusage.cpp
@@ -72,10 +72,8 @@ static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage)
return !Miranda_IsTerminated();
}
-static void WinNT_PollThread(void *vparam)
+static void WinNT_PollThread(CpuUsageThreadParams *param)
{
- CpuUsageThreadParams *param = (CpuUsageThreadParams*)vparam;
-
DWORD dwBufferSize = 0, dwCount;
BYTE *pBuffer = nullptr;
PERF_DATA_BLOCK *pPerfData = nullptr;
@@ -204,7 +202,7 @@ DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc, LPARAM lParam, DWORD dwDe
param->hFirstEvent = hFirstEvent;
/* start thread */
- if (mir_forkthread(WinNT_PollThread, param) != INVALID_HANDLE_VALUE)
+ if (mir_forkThread<CpuUsageThreadParams>(WinNT_PollThread, param) != INVALID_HANDLE_VALUE)
WaitForSingleObject(hFirstEvent, INFINITE); /* wait for first success */
else
mir_free(param); /* thread not started */
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index 5908be544f..89b010b0b7 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -290,7 +290,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP
case M_SET_COUNTDOWN:
if (dat->fTimeFlags&SDWTF_ST_TIME) {
dat->settingLastTime = (time_t)db_get_dw(NULL, "AutoShutdown", "TimeStamp", SETTING_TIMESTAMP_DEFAULT);
- dat->countdown = time(nullptr);
+ dat->countdown = time(0);
if (dat->settingLastTime > dat->countdown) dat->countdown = dat->settingLastTime - dat->countdown;
else dat->countdown = 0;
}
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index f16108840d..1aca711b4b 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -255,14 +255,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
GetLocalTime(&stBuf);
if (SystemTimeToTimeStamp(&st, &timestamp)) {
/* set to current date if earlier */
- if (timestamp < time(nullptr)) {
+ if (timestamp < time(0)) {
st.wDay = stBuf.wDay;
st.wDayOfWeek = stBuf.wDayOfWeek;
st.wMonth = stBuf.wMonth;
st.wYear = stBuf.wYear;
if (SystemTimeToTimeStamp(&st, &timestamp)) {
/* step one day up if still earlier */
- if (timestamp < time(nullptr)) {
+ if (timestamp < time(0)) {
timestamp += 24 * 60 * 60;
TimeStampToSystemTime(timestamp, &st);
}
@@ -351,7 +351,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
time_t timestamp;
DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
if (!SystemTimeToTimeStamp(&st, &timestamp))
- timestamp = time(nullptr);
+ timestamp = time(0);
db_set_dw(NULL, "AutoShutdown", "TimeStamp", (DWORD)timestamp);
}
/* shutdown type */
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp
index e288740dbb..e80f819147 100644
--- a/plugins/AutoShutdown/src/utils.cpp
+++ b/plugins/AutoShutdown/src/utils.cpp
@@ -66,9 +66,8 @@ void TrimString(wchar_t *pszStr)
/************************* Error Output ***************************/
-static void MessageBoxIndirectFree(void *param)
+static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
{
- MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)param;
MessageBoxIndirectA(mbp);
mir_free((char*)mbp->lpszCaption); /* does NULL check */
mir_free((char*)mbp->lpszText); /* does NULL check */
@@ -99,7 +98,7 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, .
case NIIF_WARNING: mbp->dwStyle |= MB_ICONWARNING; break;
case NIIF_ERROR: mbp->dwStyle |= MB_ICONERROR;
}
- mir_forkthread(MessageBoxIndirectFree, mbp);
+ mir_forkThread<MSGBOXPARAMSA>(MessageBoxIndirectFree, mbp);
}
// LocalFree() the return value
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index 987d5cf803..ed1bd5761b 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -64,10 +64,9 @@ public:
wchar_t *filelink;
};
-static void __cdecl AvatarDialogThread(void *param)
+static void __cdecl AvatarDialogThread(AvatarDialogData *data)
{
- struct AvatarDialogData* data = (struct AvatarDialogData*)param;
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AVATARDLG), data->parent, AvatarDlgProc, (LPARAM)param);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AVATARDLG), data->parent, AvatarDlgProc, (LPARAM)data);
}
int OpenAvatarDialog(MCONTACT hContact, char* fn)
@@ -79,15 +78,14 @@ int OpenAvatarDialog(MCONTACT hContact, char* fn)
return 0;
}
- struct AvatarDialogData *avdlg = (struct AvatarDialogData*)malloc(sizeof(struct AvatarDialogData));
- memset(avdlg, 0, sizeof(struct AvatarDialogData));
+ AvatarDialogData *avdlg = (AvatarDialogData*)calloc(1, sizeof(AvatarDialogData));
avdlg->hContact = hContact;
if (fn == nullptr)
avdlg->fn[0] = '\0';
else
MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, _countof(avdlg->fn));
- mir_forkthread(AvatarDialogThread, (void*)avdlg);
+ mir_forkThread<AvatarDialogData>(AvatarDialogThread, avdlg);
return 0;
}
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 476171afdd..371e873281 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -215,7 +215,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.eventType = EVENTTYPE_AVATAR_CHANGE;
dbei.cbBlob = (DWORD)mir_strlen(blob) + 1;
dbei.pBlob = blob;
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index d9d1b86a59..8425368ad1 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -923,7 +923,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
if (!historyWindow->isLoading) {
historyWindow->isLoading = true;
historyWindow->ReloadContacts();
- mir_forkthread(HistoryWindow::FillHistoryThread, historyWindow);
+ mir_forkThread<HistoryWindow>(HistoryWindow::FillHistoryThread, historyWindow);
}
DlgReturn(TRUE);
@@ -1180,9 +1180,8 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
-void HistoryWindow::FillHistoryThread(void* param)
+void HistoryWindow::FillHistoryThread(HistoryWindow *hInfo)
{
- HistoryWindow *hInfo = (HistoryWindow*)param;
HWND hwndList = hInfo->listWindow;
ListView_DeleteAllItems(hwndList);
hInfo->SelectEventGroup(-1);
@@ -1668,11 +1667,11 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
AppendMenu(hPopupMenu, searcher.IsAllUsers() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ALLUSERS, TranslateT("All contacts"));
AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
HMENU hFilterMenu = CreatePopupMenu();
- int filter = GetFilterNr();
+ DWORD filter = GetFilterNr();
AppendMenu(hFilterMenu, filter == 0 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERDEF, TranslateT("Default history events"));
AppendMenu(hFilterMenu, filter == 1 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERALL, TranslateT("All events"));
for (size_t i = 0; i < Options::instance->customFilters.size(); ++i) {
- UINT flags = MF_STRING;
+ DWORD flags = MF_STRING;
if (filter - 2 == i)
flags |= MF_CHECKED;
@@ -1975,7 +1974,7 @@ bool HistoryWindow::ContactChanged(bool sync)
if (sync)
FillHistoryThread(this);
else
- mir_forkthread(HistoryWindow::FillHistoryThread, this);
+ mir_forkThread<HistoryWindow>(HistoryWindow::FillHistoryThread, this);
return true;
}
}
@@ -1988,7 +1987,7 @@ bool HistoryWindow::ContactChanged(bool sync)
if (sync)
FillHistoryThread(this);
else
- mir_forkthread(HistoryWindow::FillHistoryThread, this);
+ mir_forkThread<HistoryWindow>(HistoryWindow::FillHistoryThread, this);
return true;
}
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.h b/plugins/BasicHistory/src/HistoryWindow.h
index d21403f421..8b19d2f439 100644
--- a/plugins/BasicHistory/src/HistoryWindow.h
+++ b/plugins/BasicHistory/src/HistoryWindow.h
@@ -29,7 +29,7 @@ private:
static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static int HistoryDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc);
- static void FillHistoryThread(void* param);
+ static void FillHistoryThread(HistoryWindow *hInfo);
static void Close(HistoryWindow* historyWindow);
static void ChangeToFreeWindow(HistoryWindow* historyWindow);
void ReplaceIcons(HWND hwndDlg, int selStart, BOOL isSent);
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 22f3cb55ae..ed1902db74 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -1808,7 +1808,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
}
- toCp.lastExport = time(nullptr);
+ toCp.lastExport = time(0);
*to = toCp;
EndDialog(hwndDlg, IDOK);
diff --git a/plugins/BasicHistory/src/Options.h b/plugins/BasicHistory/src/Options.h
index acb27417f2..f10e807b27 100644
--- a/plugins/BasicHistory/src/Options.h
+++ b/plugins/BasicHistory/src/Options.h
@@ -123,7 +123,7 @@ struct TaskOptions
filePath += TranslateT("History");
filePath += L"_<contact>_<date>.<ext>";
- lastExport = time(nullptr);
+ lastExport = time(0);
}
};
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp
index 2601eeacfa..f234d55275 100644
--- a/plugins/BasicHistory/src/Scheduler.cpp
+++ b/plugins/BasicHistory/src/Scheduler.cpp
@@ -244,7 +244,7 @@ bool DoTask(TaskOptions& to)
return true;
}
- DWORD now = time(nullptr);
+ DWORD now = time(0);
long long int t = to.eventDeltaTime * 60;
if (to.eventUnit > TaskOptions::Minute)
t *= 60LL;
@@ -715,7 +715,7 @@ void SchedulerThreadFunc(void*)
while (!finishThread) {
DWORD timeWait;
- time_t now = time(nullptr);
+ time_t now = time(0);
while (nextExportTime <= now)
if (!ExecuteCurrentTask(now))
return;
@@ -732,11 +732,11 @@ void StartThread(bool init)
StopThread();
initTask = false;
- bool isExport = GetNextExportTime(init, time(nullptr));
+ bool isExport = GetNextExportTime(init, time(0));
if (isExport) {
finishThread = false;
hThreadEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
- hThread = mir_forkthread(SchedulerThreadFunc, nullptr);
+ hThread = mir_forkthread(SchedulerThreadFunc);
}
}
@@ -803,7 +803,7 @@ bool ExecuteCurrentTask(time_t now)
mir_cslock lck(Options::instance->criticalSection);
for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
if (it->forceExecute) {
- it->lastExport = time(nullptr);
+ it->lastExport = time(0);
Options::instance->SaveTaskTime(*it);
to = *it;
isExport = true;
@@ -812,7 +812,7 @@ bool ExecuteCurrentTask(time_t now)
else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) {
time_t t = GetNextExportTime(*it);
if (t <= now) {
- it->lastExport = time(nullptr);
+ it->lastExport = time(0);
Options::instance->SaveTaskTime(*it);
to = *it;
isExport = true;
@@ -1283,7 +1283,7 @@ void DoError(const TaskOptions& to, const std::wstring _error)
DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
dbei.flags = DBEF_UTF | DBEF_READ;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
// For now I do not convert event data from string to blob, and event type must be message to handle it properly
dbei.eventType = EVENTTYPE_MESSAGE;
int len = (int)error.length() + 1;
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp
index fbad765f55..d75952e392 100644
--- a/plugins/Boltun/src/actionQueue.cpp
+++ b/plugins/Boltun/src/actionQueue.cpp
@@ -92,7 +92,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = BOLTUN_NAME;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
db_event_add(hContact, &dbei);
bot->AnswerGiven(hContact, *info);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index 85b579f761..e7a9de1dae 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -73,7 +73,7 @@ time_t getLastSeen(MCONTACT hContact)
void setLastSeen(MCONTACT hContact)
{
- db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(nullptr));
+ db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(0));
if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
}
@@ -213,7 +213,7 @@ bool isContactGoneFor(MCONTACT hContact, int days)
{
time_t lastSeen = getLastSeen(hContact);
time_t lastInputMsg = getLastInputMsg(hContact);
- time_t currentTime = time(nullptr);
+ time_t currentTime = time(0);
int daysSinceOnline = -1;
if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen) / (60 * 60 * 24));
@@ -640,7 +640,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
int ContactAdded(WPARAM hContact, LPARAM)
{
- db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(nullptr));
+ db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(0));
return 0;
}
@@ -670,7 +670,7 @@ extern "C" int __declspec(dllexport) Load(void)
// ensure all contacts are timestamped
DBVARIANT dbv;
- DWORD current_time = (DWORD)time(nullptr);
+ DWORD current_time = (DWORD)time(0);
for (auto &hContact : Contacts()) {
if (!db_get(hContact, MODULE_NAME, "CreationTime", &dbv))
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp
index cc8e31c67e..e2c5bd5ec9 100644
--- a/plugins/BuddyPounce/src/main.cpp
+++ b/plugins/BuddyPounce/src/main.cpp
@@ -70,7 +70,7 @@ int MsgAck(WPARAM, LPARAM lParam)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT;
dbei.szModule = (char*)ack->szModule;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)(char*)pszUtf;
db_event_add(ack->hContact, &dbei);
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp
index c04448b182..b9e2d04ab6 100644
--- a/plugins/Clist_modern/src/modern_aniavatars.cpp
+++ b/plugins/Clist_modern/src/modern_aniavatars.cpp
@@ -996,7 +996,7 @@ int AniAva_InitModule()
_AniAva_LoadOptions();
s_hExitEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
- mir_forkthread(_AniAva_AnimationTreadProc, nullptr);
+ mir_forkthread(_AniAva_AnimationTreadProc);
return 1;
}
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp
index 79d9ea0c99..a2c0ef7927 100644
--- a/plugins/Clist_modern/src/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/src/modern_awaymsg.cpp
@@ -152,7 +152,7 @@ void amRequestAwayMsg(MCONTACT hContact)
void InitAwayMsgModule()
{
hamProcessEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
- g_hAwayMsgThread = mir_forkthread(amThreadProc, nullptr);
+ g_hAwayMsgThread = mir_forkthread(amThreadProc);
}
void UninitAwayMsgModule()
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index 060e141c5c..52f3ec176e 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -723,7 +723,7 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact)
contact->avatar_data = nullptr;
if (contact->avatar_data != nullptr)
- contact->avatar_data->t_lastAccess = (DWORD)time(nullptr);
+ contact->avatar_data->t_lastAccess = (DWORD)time(0);
}
else contact->avatar_data = nullptr;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 371d7ce1f2..2d552b4ad4 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -155,7 +155,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam)
static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam)
{
- g_CluiData.t_now = time(nullptr);
+ g_CluiData.t_now = time(0);
if (hContact && lParam) {
DBEVENTINFO dbei = {};
db_event_get(lParam, &dbei);
@@ -598,7 +598,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR
switch (wParam) {
case TIMERID_INVALIDATE:
{
- time_t cur_time = (time(nullptr) / 60);
+ time_t cur_time = (time(0) / 60);
if (cur_time != dat->last_tick_time) {
cliInvalidateRect(hwnd, nullptr, FALSE);
dat->last_tick_time = cur_time;
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index d9632a965a..b9995d711c 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -1836,7 +1836,7 @@ void CLCPaint::_FreePaintContext(_PaintContext &pc)
void CLCPaint::_PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *_rcPaint)
{
- g_CluiData.t_now = time(nullptr);
+ g_CluiData.t_now = time(0);
if (_rcPaint && IsRectEmpty(_rcPaint)) return; // check if draw area is not empty
if (!IsWindowVisible(hwnd)) return; // and window is visible
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 8ff5b06bff..8cab4be93d 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -67,7 +67,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam)
{
DWORD new_freq = 0;
- cfg::dat.t_now = time(nullptr);
+ cfg::dat.t_now = time(0);
if (hContact && lParam) {
DBEVENTINFO dbei = {};
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 6c013e5248..012fb45f44 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -1219,7 +1219,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint)
hbmTempAV = CreateCompatibleBitmap(g_HDC, g_maxAV_X, g_maxAV_Y);
hbmTempOldAV = reinterpret_cast<HBITMAP>(SelectObject(hdcTempAV, hbmTempAV));
- cfg::dat.t_now = time(nullptr);
+ cfg::dat.t_now = time(0);
GetSystemTime(&cfg::dat.st);
SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft);
diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp
index 2b28b797a7..5e11de208f 100644
--- a/plugins/Clist_nicer/src/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/cluiframes.cpp
@@ -2882,7 +2882,7 @@ static int CLUIFrameOnModulesLoad(WPARAM, LPARAM)
{
mir_snwprintf(g_ptszEventName, L"mf_update_evt_%d", GetCurrentThreadId());
g_hEventThread = CreateEvent(nullptr, TRUE, FALSE, g_ptszEventName);
- hThreadMFUpdate = mir_forkthread(MF_UpdateThread, nullptr);
+ hThreadMFUpdate = mir_forkthread(MF_UpdateThread);
SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE);
CLUIFramesLoadMainMenu();
CLUIFramesCreateMenuForFrame(-1, nullptr, 000010000, false);
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp
index 7b815b40d8..9e3933a039 100644
--- a/plugins/Clist_nicer/src/contact.cpp
+++ b/plugins/Clist_nicer/src/contact.cpp
@@ -66,7 +66,7 @@ HANDLE hThreadMFUpdate = nullptr;
static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep)
{
- DWORD curTime = time(nullptr);
+ DWORD curTime = time(0);
DWORD frequency, eventCount;
MEVENT hEvent = db_event_last(hContact);
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index cd1d252c11..798981a9c9 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -36,7 +36,7 @@ bool CGDriveService::IsLoggedIn()
ptrA token(getStringA("TokenSecret"));
if (!token || token[0] == 0)
return false;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t expiresIn = getDword("ExpiresIn");
return now < expiresIn;
}
@@ -55,7 +55,7 @@ void CGDriveService::Login(HWND owner)
setString("TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(nullptr) + node.as_int();
+ time_t expiresIn = time(0) + node.as_int();
setDword("ExpiresIn", expiresIn);
return;
@@ -116,7 +116,7 @@ void CGDriveService::RequestAccessTokenThread(void *param)
db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(nullptr) + node.as_int();
+ time_t expiresIn = time(0) + node.as_int();
db_set_dw(NULL, GetAccountName(), "ExpiresIn", expiresIn);
node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 2a3f3c19b4..722560aec8 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -36,7 +36,7 @@ bool COneDriveService::IsLoggedIn()
ptrA token(getStringA("TokenSecret"));
if (!token || token[0] == 0)
return false;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t expiresIn = getDword("ExpiresIn");
return now < expiresIn;
}
@@ -54,7 +54,7 @@ void COneDriveService::Login(HWND owner)
db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(nullptr) + node.as_int();
+ time_t expiresIn = time(0) + node.as_int();
setDword("ExpiresIn", expiresIn);
return;
@@ -117,7 +117,7 @@ void COneDriveService::RequestAccessTokenThread(void *param)
setString("TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(nullptr) + node.as_int();
+ time_t expiresIn = time(0) + node.as_int();
setDword("ExpiresIn", expiresIn);
node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index acc9fb0315..6609e7c4b3 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -36,7 +36,7 @@ bool CYandexService::IsLoggedIn()
ptrA token(getStringA("TokenSecret"));
if (!token || token[0] == 0)
return false;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t expiresIn = getDword("ExpiresIn");
return now < expiresIn;
}
@@ -55,7 +55,7 @@ void CYandexService::Login(HWND owner)
setString("TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(nullptr) + node.as_int();
+ time_t expiresIn = time(0) + node.as_int();
setDword("ExpiresIn", expiresIn);
node = root.at("refresh_token");
@@ -119,7 +119,7 @@ void CYandexService::RequestAccessTokenThread(void *param)
setString("TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(nullptr) + node.as_int();
+ time_t expiresIn = time(0) + node.as_int();
setDword("ExpiresIn", expiresIn);
node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/utils.cpp b/plugins/CloudFile/src/utils.cpp
index 4d1ed11fa6..cb9bb8bf94 100644
--- a/plugins/CloudFile/src/utils.cpp
+++ b/plugins/CloudFile/src/utils.cpp
@@ -28,7 +28,7 @@ MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD cbBlob, PBY
{
DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.eventType = type;
dbei.cbBlob = cbBlob;
dbei.pBlob = pBlob;
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index b24ef0eaba..2971dbd8c3 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -745,7 +745,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re
strncpy_s(module, ack->szModule, _countof(module));
e.szModule = module;
- e.timestamp = (DWORD)time(nullptr);
+ e.timestamp = (DWORD)time(0);
db_event_add(ack->hContact, &e);
}
diff --git a/plugins/CmdLine/src/services.cpp b/plugins/CmdLine/src/services.cpp
index 66f1c6d310..333cc893a1 100644
--- a/plugins/CmdLine/src/services.cpp
+++ b/plugins/CmdLine/src/services.cpp
@@ -72,7 +72,7 @@ int StartServer()
{
if (sdCmdLine->instances == 0)
{
- HANDLE server = mir_forkthread(ServerWorkerThread, nullptr);
+ HANDLE server = mir_forkthread(ServerWorkerThread);
if (server)
{
wchar_t path[MIMFOLDER_SIZE];
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp
index b0a746d157..32660d933f 100644
--- a/plugins/Console/src/Console.cpp
+++ b/plugins/Console/src/Console.cpp
@@ -1215,7 +1215,7 @@ void InitConsole()
LoadSettings();
- hConsoleThread = mir_forkthread(ConsoleThread, nullptr);
+ hConsoleThread = mir_forkthread(ConsoleThread);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp
index 430bbe36b3..d13f37a2f3 100644
--- a/plugins/ContactsPlus/src/send.cpp
+++ b/plugins/ContactsPlus/src/send.cpp
@@ -402,7 +402,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
dbei.szModule = GetContactProto(ackData->hContact);
dbei.eventType = EVENTTYPE_CONTACTS;
dbei.flags = DBEF_SENT | DBEF_UTF;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
//make blob
TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend));
memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend)));
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp
index 1014bb8753..ce4c45e020 100644
--- a/plugins/CountryFlags/src/ip2country.cpp
+++ b/plugins/CountryFlags/src/ip2country.cpp
@@ -305,7 +305,7 @@ void InitIpToCountry(void)
/* Services */
CreateServiceFunction(MS_FLAGS_IPTOCOUNTRY,ServiceIpToCountry);
#ifdef BINCONV
- mir_forkthread(BinConvThread,NULL);
+ mir_forkthread(BinConvThread);
#endif
}
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index df31953a22..cb43a50d68 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -243,7 +243,7 @@ int Backup(wchar_t *backup_filename)
}
SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0);
UpdateWindow(progress_dialog);
- db_set_dw(0, MODULE, "LastBackupTimestamp", (DWORD)time(nullptr));
+ db_set_dw(0, MODULE, "LastBackupTimestamp", (DWORD)time(0));
if (options.use_cloudfile)
{
@@ -308,7 +308,7 @@ void BackupStart(wchar_t *backup_filename)
}
if (backup_filename != nullptr)
tm = mir_wstrdup(backup_filename);
- if (mir_forkthread(BackupThread, (void*)tm) == INVALID_HANDLE_VALUE) {
+ if (mir_forkthread(BackupThread, tm) == INVALID_HANDLE_VALUE) {
InterlockedExchange(&m_state, 0); /* Backup done. */
mir_free(tm);
}
@@ -316,7 +316,7 @@ void BackupStart(wchar_t *backup_filename)
VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- time_t t = time(nullptr);
+ time_t t = time(0);
time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", 0);
if (diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24)))))
BackupStart(nullptr);
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp
index f5c5684327..79f74005f4 100644
--- a/plugins/FTPFileYM/src/dbentry.cpp
+++ b/plugins/FTPFileYM/src/dbentry.cpp
@@ -137,7 +137,7 @@ void DBEntry::add(GenericJob *job)
DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->m_szSafeFileName);
if (job->m_tab->m_iOptAutoDelete != -1) {
- time_t deleteTS = time(nullptr);
+ time_t deleteTS = time(0);
deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS);
}
@@ -149,7 +149,7 @@ void DBEntry::add(GenericJob *job)
void DBEntry::setDeleteTS(GenericJob *job)
{
if (job->m_tab->m_iOptAutoDelete != -1) {
- time_t deleteTS = time(nullptr);
+ time_t deleteTS = time(0);
deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID, deleteTS);
}
diff --git a/plugins/FTPFileYM/src/deletetimer.cpp b/plugins/FTPFileYM/src/deletetimer.cpp
index fe642e8a83..cb7b0063d7 100644
--- a/plugins/FTPFileYM/src/deletetimer.cpp
+++ b/plugins/FTPFileYM/src/deletetimer.cpp
@@ -56,7 +56,7 @@ void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND, UINT, UINT_PTR, DWORD)
DBEntry *entry = DBEntry::getFirst();
while (entry != nullptr) {
- if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(nullptr)) {
+ if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(0)) {
DeleteJob *job = new DeleteJob(new DBEntry(entry), nullptr);
job->start();
}
diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp
index 6bb44b32dd..d9efb9ae97 100644
--- a/plugins/FTPFileYM/src/job_delete.cpp
+++ b/plugins/FTPFileYM/src/job_delete.cpp
@@ -38,10 +38,8 @@ DeleteJob::~DeleteJob()
delete m_entry;
}
-void DeleteJob::waitingThread(void *arg)
+void DeleteJob::waitingThread(DeleteJob *job)
{
- DeleteJob *job = (DeleteJob *)arg;
-
while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -67,7 +65,7 @@ void DeleteJob::waitingThread(void *arg)
void DeleteJob::start()
{
- mir_forkthread(&DeleteJob::waitingThread, this);
+ mir_forkThread<DeleteJob>(&DeleteJob::waitingThread, this);
}
void DeleteJob::run()
diff --git a/plugins/FTPFileYM/src/job_delete.h b/plugins/FTPFileYM/src/job_delete.h
index 73e6b79822..a3d719fa92 100644
--- a/plugins/FTPFileYM/src/job_delete.h
+++ b/plugins/FTPFileYM/src/job_delete.h
@@ -37,7 +37,7 @@ private:
char *getDelFileString();
char *getDelUrlString();
- static void waitingThread(void *arg);
+ static void __cdecl waitingThread(DeleteJob *job);
void run();
public:
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp
index 79c4c9454e..e85e28910b 100644
--- a/plugins/FTPFileYM/src/job_packer.cpp
+++ b/plugins/FTPFileYM/src/job_packer.cpp
@@ -75,10 +75,8 @@ void PackerJob::addToUploadDlg()
start();
}
-void PackerJob::waitingThread(void *arg)
+void PackerJob::waitingThread(PackerJob *job)
{
- PackerJob *job = (PackerJob *)arg;
-
while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -103,7 +101,7 @@ void PackerJob::waitingThread(void *arg)
void PackerJob::start()
{
- mir_forkthread(&PackerJob::waitingThread, this);
+ mir_forkThread<PackerJob>(&PackerJob::waitingThread, this);
}
void PackerJob::pack()
@@ -115,7 +113,7 @@ void PackerJob::pack()
}
setStatus(STATUS_PACKING);
- m_startTS = time(nullptr);
+ m_startTS = time(0);
int res = createZipFile();
if (res == ZIP_OK) {
@@ -230,10 +228,10 @@ uLong PackerJob::getFileTime(wchar_t *file, tm_zip*, uLong *dt)
void PackerJob::updateStats()
{
DWORD dwNewTick = GetTickCount();
- if (m_uiReaded && (time(nullptr) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
+ if (m_uiReaded && (time(0) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
m_lastUpdateTick = dwNewTick;
- double speed = ((double)m_uiReaded / 1024) / (time(nullptr) - m_startTS);
+ double speed = ((double)m_uiReaded / 1024) / (time(0) - m_startTS);
mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed);
double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0;
diff --git a/plugins/FTPFileYM/src/job_packer.h b/plugins/FTPFileYM/src/job_packer.h
index 14edcbeda1..36c5a0ddb8 100644
--- a/plugins/FTPFileYM/src/job_packer.h
+++ b/plugins/FTPFileYM/src/job_packer.h
@@ -36,7 +36,7 @@ private:
static mir_cs mutexJobCount;
static int iRunningJobCount;
- static void waitingThread(void *arg);
+ static void __cdecl waitingThread(PackerJob *job);
static uLong getFileTime(wchar_t *file, tm_zip *tmzip, uLong *dt);
void pack();
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp
index f7edbebf25..0fd6aae79c 100644
--- a/plugins/FTPFileYM/src/job_upload.cpp
+++ b/plugins/FTPFileYM/src/job_upload.cpp
@@ -95,7 +95,7 @@ void UploadJob::autoSend()
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.cbBlob = (DWORD)mir_strlen(m_szFileLink) + 1;
dbei.pBlob = (PBYTE)m_szFileLink;
db_event_add(m_hContact, &dbei);
@@ -137,7 +137,7 @@ void UploadJob::pauseHandler()
void UploadJob::resume()
{
m_uiSent = 0;
- m_startTS = time(nullptr);
+ m_startTS = time(0);
if (!isCompleted()) {
curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
setStatus(STATUS_UPLOADING);
@@ -150,10 +150,8 @@ void UploadJob::cancel()
curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
}
-void UploadJob::waitingThread(void *arg)
+void UploadJob::waitingThread(UploadJob *job)
{
- UploadJob *job = (UploadJob *)arg;
-
while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -182,7 +180,7 @@ void UploadJob::waitingThread(void *arg)
void UploadJob::start()
{
- mir_forkthread(&UploadJob::waitingThread, this);
+ mir_forkThread<UploadJob>(&UploadJob::waitingThread, this);
}
char *UploadJob::getChmodString()
@@ -312,7 +310,7 @@ void UploadJob::upload()
if (uploadFile) {
curl_easy_setopt(m_hCurl, CURLOPT_UPLOAD, 1L);
setStatus(STATUS_CONNECTING);
- m_startTS = time(nullptr);
+ m_startTS = time(0);
int result = curl_easy_perform(hCurl);
curl_slist_free_all(headerList);
@@ -385,8 +383,8 @@ size_t UploadJob::ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg)
void UploadJob::updateStats()
{
- if (m_uiSent && (time(nullptr) > m_startTS)) {
- double speed = ((double)m_uiSent / 1024) / (time(nullptr) - m_startTS);
+ if (m_uiSent && (time(0) > m_startTS)) {
+ double speed = ((double)m_uiSent / 1024) / (time(0) - m_startTS);
m_avgSpeed = speed;
for (int i = 0; i < _countof(m_lastSpeed); i++) {
m_avgSpeed += (m_lastSpeed[i] == 0 ? speed : m_lastSpeed[i]);
diff --git a/plugins/FTPFileYM/src/job_upload.h b/plugins/FTPFileYM/src/job_upload.h
index 211eee3756..cf46c48a06 100644
--- a/plugins/FTPFileYM/src/job_upload.h
+++ b/plugins/FTPFileYM/src/job_upload.h
@@ -53,7 +53,7 @@ private:
CURL* curlInit(char *szUrl, struct curl_slist *headerList);
- static void waitingThread(void *arg);
+ static void __cdecl waitingThread(UploadJob *job);
static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg);
static INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp
index 13bd394571..7e69ffa91d 100644
--- a/plugins/FavContacts/src/contact_cache.cpp
+++ b/plugins/FavContacts/src/contact_cache.cpp
@@ -30,9 +30,9 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent)
if (dbei.eventType != EVENTTYPE_MESSAGE)
return 0;
- float weight = GetEventWeight(time(nullptr) - dbei.timestamp);
- float q = GetTimeWeight(time(nullptr) - m_lastUpdate);
- m_lastUpdate = time(nullptr);
+ float weight = GetEventWeight(time(0) - dbei.timestamp);
+ float q = GetTimeWeight(time(0) - m_lastUpdate);
+ m_lastUpdate = time(0);
if (!weight)
return 0;
@@ -77,8 +77,8 @@ float CContactCache::GetTimeWeight(unsigned long age)
void CContactCache::Rebuild()
{
- unsigned long timestamp = time(nullptr);
- m_lastUpdate = time(nullptr);
+ unsigned long timestamp = time(0);
+ m_lastUpdate = time(0);
for (auto &hContact : Contacts()) {
TContactInfo *info = new TContactInfo;
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp
index ee1bbc04e4..8222d5c4cf 100644
--- a/plugins/GmailNotifier/src/notify.cpp
+++ b/plugins/GmailNotifier/src/notify.cpp
@@ -1,5 +1,76 @@
#include "stdafx.h"
+static void __cdecl Login_ThreadFunc(Account *curAcc)
+{
+ if (curAcc == nullptr)
+ return;
+
+ HANDLE hTempFile;
+ DWORD dwBytesWritten, dwBufSize = 1024;
+ char szTempName[MAX_PATH];
+ char buffer[1024];
+ char *str_temp;
+ char lpPathBuffer[1024];
+
+ if (GetBrowser(lpPathBuffer)) {
+ if (opt.AutoLogin == 0) {
+ if (curAcc->hosted[0]) {
+ mir_strcat(lpPathBuffer, "https://mail.google.com/a/");
+ mir_strcat(lpPathBuffer, curAcc->hosted);
+ mir_strcat(lpPathBuffer, "/?logout");
+ }
+ else {
+ mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout");
+ }
+ }
+ else {
+ if (curAcc->hosted[0]) {
+ GetTempPathA(dwBufSize, buffer);
+ GetTempFileNameA(buffer, "gmail", 0, szTempName);
+
+ hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ mir_strcpy(buffer, FORMDATA1);
+ mir_strcat(buffer, curAcc->hosted);
+ mir_strcat(buffer, FORMDATA2);
+ mir_strcat(buffer, curAcc->hosted);
+ mir_strcat(buffer, FORMDATA3);
+ mir_strcat(buffer, "<input type=hidden name=userName value=");
+ mir_strcat(buffer, curAcc->name);
+ if ((str_temp = strstr(buffer, "@")) != nullptr)
+ *str_temp = '\0';
+ mir_strcat(buffer, "><input type=hidden name=password value=");
+ mir_strcat(buffer, curAcc->pass);
+ mir_strcat(buffer, "></form></body>");
+ WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, nullptr);
+ CloseHandle(hTempFile);
+ mir_strcat(lpPathBuffer, szTempName);
+ }
+ else {
+ char *szEncodedURL = mir_urlEncode(curAcc->name);
+ mir_strcat(lpPathBuffer, LINK);
+ mir_strcat(lpPathBuffer, szEncodedURL);
+ //mir_strcat(lpPathBuffer, "&Passwd=");
+ //mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->pass));
+ if (opt.AutoLogin == 1)
+ mir_strcat(lpPathBuffer, "&PersistentCookie=yes");
+ mir_free(szEncodedURL);
+ }
+ }
+ }
+
+ STARTUPINFOA suInfo = { 0 };
+ PROCESS_INFORMATION procInfo;
+ suInfo.cb = sizeof(suInfo);
+ suInfo.wShowWindow = SW_MAXIMIZE;
+ if (CreateProcessA(nullptr, lpPathBuffer, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &suInfo, &procInfo))
+ CloseHandle(procInfo.hProcess);
+
+ if (curAcc->hosted[0]) {
+ Sleep(30000);
+ DeleteFileA(szTempName);
+ }
+}
+
int OpenBrowser(WPARAM hContact, LPARAM)
{
char *proto = GetContactProto(hContact);
@@ -16,7 +87,7 @@ int OpenBrowser(WPARAM hContact, LPARAM)
DeleteResults(curAcc->results.next);
curAcc->results.next = nullptr;
}
- mir_forkthread(Login_ThreadFunc, curAcc);
+ mir_forkThread<Account>(Login_ThreadFunc, curAcc);
}
return FALSE;
}
@@ -27,6 +98,8 @@ INT_PTR Notifying(WPARAM, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = PUGetContact(hWnd);
@@ -76,7 +149,7 @@ void NotifyUser(Account *curAcc)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_READ;
dbei.szModule = MODULE_NAME;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
resultLink *prst = curAcc->results.next;
for (int i = 0; i < newMails; i++) {
@@ -135,75 +208,3 @@ void DeleteResults(resultLink *prst)
free(prst);
}
}
-
-void __cdecl Login_ThreadFunc(void *lpParam)
-{
- if (lpParam == nullptr)
- return;
-
- HANDLE hTempFile;
- DWORD dwBytesWritten, dwBufSize = 1024;
- char szTempName[MAX_PATH];
- char buffer[1024];
- char *str_temp;
- char lpPathBuffer[1024];
- Account *curAcc = (Account *)lpParam;
-
- if (GetBrowser(lpPathBuffer)) {
- if (opt.AutoLogin == 0) {
- if (curAcc->hosted[0]) {
- mir_strcat(lpPathBuffer, "https://mail.google.com/a/");
- mir_strcat(lpPathBuffer, curAcc->hosted);
- mir_strcat(lpPathBuffer, "/?logout");
- }
- else {
- mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout");
- }
- }
- else {
- if (curAcc->hosted[0]) {
- GetTempPathA(dwBufSize, buffer);
- GetTempFileNameA(buffer, "gmail", 0, szTempName);
-
- hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
- mir_strcpy(buffer, FORMDATA1);
- mir_strcat(buffer, curAcc->hosted);
- mir_strcat(buffer, FORMDATA2);
- mir_strcat(buffer, curAcc->hosted);
- mir_strcat(buffer, FORMDATA3);
- mir_strcat(buffer, "<input type=hidden name=userName value=");
- mir_strcat(buffer, curAcc->name);
- if ((str_temp = strstr(buffer, "@")) != nullptr)
- *str_temp = '\0';
- mir_strcat(buffer, "><input type=hidden name=password value=");
- mir_strcat(buffer, curAcc->pass);
- mir_strcat(buffer, "></form></body>");
- WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, nullptr);
- CloseHandle(hTempFile);
- mir_strcat(lpPathBuffer, szTempName);
- }
- else {
- char *szEncodedURL = mir_urlEncode(curAcc->name);
- mir_strcat(lpPathBuffer, LINK);
- mir_strcat(lpPathBuffer, szEncodedURL);
- //mir_strcat(lpPathBuffer, "&Passwd=");
- //mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->pass));
- if (opt.AutoLogin == 1)
- mir_strcat(lpPathBuffer, "&PersistentCookie=yes");
- mir_free(szEncodedURL);
- }
- }
- }
-
- STARTUPINFOA suInfo = { 0 };
- PROCESS_INFORMATION procInfo;
- suInfo.cb = sizeof(suInfo);
- suInfo.wShowWindow = SW_MAXIMIZE;
- if (CreateProcessA(nullptr, lpPathBuffer, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &suInfo, &procInfo))
- CloseHandle(procInfo.hProcess);
-
- if (curAcc->hosted[0]) {
- Sleep(30000);
- DeleteFileA(szTempName);
- }
-}
diff --git a/plugins/GmailNotifier/src/stdafx.h b/plugins/GmailNotifier/src/stdafx.h
index f5cedab022..0012cb756c 100644
--- a/plugins/GmailNotifier/src/stdafx.h
+++ b/plugins/GmailNotifier/src/stdafx.h
@@ -85,7 +85,6 @@ BOOL GetBrowser(char *);
void NotifyUser(Account *);
int OptInit(WPARAM, LPARAM);
void Check_ThreadFunc(void *);
-void Login_ThreadFunc(void *);
int OpenBrowser(WPARAM, LPARAM);
void DeleteResults(resultLink *);
void BuildList(void);
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp
index 859806d57e..5409b6f430 100644
--- a/plugins/HTTPServer/src/main.cpp
+++ b/plugins/HTTPServer/src/main.cpp
@@ -560,9 +560,8 @@ static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/)
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void HandleNewConnection(void *ch)
+void __cdecl HandleNewConnection(CLHttpUser *pclUser)
{
- CLHttpUser * pclUser = (CLHttpUser *)ch;
pclUser->HandleNewConnection();
delete pclUser;
}
@@ -587,7 +586,7 @@ void ConnectionOpen(HNETLIBCONN hNewConnection, DWORD dwRemoteIP)
stAddr.S_un.S_addr = htonl(dwRemoteIP);
CLHttpUser *pclUser = new CLHttpUser(hNewConnection, stAddr);
- mir_forkthread(HandleNewConnection, pclUser);
+ mir_forkThread<CLHttpUser>(HandleNewConnection, pclUser);
}
/////////////////////////////////////////////////////////////////////
diff --git a/plugins/HistoryStats/src/settings.cpp b/plugins/HistoryStats/src/settings.cpp
index 722e6e0c96..f41602217c 100644
--- a/plugins/HistoryStats/src/settings.cpp
+++ b/plugins/HistoryStats/src/settings.cpp
@@ -41,7 +41,7 @@ Settings::CharMapper::CharMapper(const Settings& settings)
Settings::Filter::Filter(const ext::string& strID)
: m_strID(strID), m_nMode(fwmWordsMatching), m_nRef(0)
{
- time_t curTime = time(nullptr);
+ time_t curTime = time(0);
struct tm* curTM = localtime(&curTime);
m_strName += utils::intToPadded(1900 + curTM->tm_year, 4);
diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp
index 842e24106e..321ad138a7 100644
--- a/plugins/HistoryStats/src/statistic.cpp
+++ b/plugins/HistoryStats/src/statistic.cpp
@@ -1188,7 +1188,7 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN
m_nFirstTime(0),
m_nLastTime(0)
{
- m_TimeStarted = TimeZone_ToLocal(time(nullptr));
+ m_TimeStarted = TimeZone_ToLocal(time(0));
m_MSecStarted = GetTickCount();
m_AverageMinTime = settings.m_AverageMinTime * 24 * 60 * 60; // calculate seconds from days
}
@@ -1214,7 +1214,7 @@ bool Statistic::createStatistics()
utils::centerDialog(m_hWndProgress);
UpdateWindow(m_hWndProgress);
- HANDLE hThread = mir_forkthread(threadProcSteps, (void*)this);
+ HANDLE hThread = mir_forkThread<Statistic>(threadProcSteps, this);
bool bDone = false;
MSG msg;
@@ -1304,11 +1304,10 @@ void Statistic::createStatisticsSteps()
setProgressLabel(false, TranslateT("Done"));
}
-void __cdecl Statistic::threadProc(void *lpParameter)
+void __cdecl Statistic::threadProc(Statistic* pStats)
{
Thread_SetName("HistoryStats: Statistic::threadProc");
- Statistic* pStats = reinterpret_cast<Statistic*>(lpParameter);
SetEvent(pStats->m_hThreadPushEvent);
// perform action
@@ -1324,10 +1323,9 @@ void __cdecl Statistic::threadProc(void *lpParameter)
m_bRunning = false;
}
-void __cdecl Statistic::threadProcSteps(void *lpParameter)
+void __cdecl Statistic::threadProcSteps(Statistic *pStats)
{
Thread_SetName("HistoryStats: Statistic::threadProcSteps");
- Statistic *pStats = reinterpret_cast<Statistic*>(lpParameter);
if (pStats->m_Settings.m_ThreadLowPriority)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
@@ -1421,7 +1419,7 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS
Statistic *pStats = new Statistic(settings, invokedFrom, hInst);
pStats->m_hThreadPushEvent = hEvent;
// create worker thread
- HANDLE hThread = mir_forkthread(threadProc, (void*)pStats);
+ HANDLE hThread = mir_forkThread<Statistic>(threadProc, pStats);
// wait for thread to place itself on thread unwind stack
if (hThread != nullptr)
diff --git a/plugins/HistoryStats/src/statistic.h b/plugins/HistoryStats/src/statistic.h
index e05254b5d7..fc4f2cacb0 100644
--- a/plugins/HistoryStats/src/statistic.h
+++ b/plugins/HistoryStats/src/statistic.h
@@ -160,8 +160,8 @@ private:
explicit Statistic(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst);
bool createStatistics();
void createStatisticsSteps();
- static void __cdecl threadProc(void *lpParameter);
- static void __cdecl threadProcSteps(void *lpParameter);
+ static void __cdecl threadProc(Statistic *pStats);
+ static void __cdecl threadProcSteps(Statistic *pStats);
public:
~Statistic();
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
index ffb4298471..e73fb24e0c 100644
--- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp
+++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
@@ -30,7 +30,7 @@ typedef struct
// build criteria
time_t BuildCriteria(int dwti)
{
- time_t tim = time(nullptr);
+ time_t tim = time(0);
switch (dwti) {
case 0:
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp
index 22e77eef4e..b956a740c7 100644
--- a/plugins/IEView/src/ChatHTMLBuilder.cpp
+++ b/plugins/IEView/src/ChatHTMLBuilder.cpp
@@ -41,7 +41,7 @@ static const char *classNames[] = {
ChatHTMLBuilder::ChatHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(nullptr));
+ setLastEventTime(time(0));
}
void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp
index 7be90be9b5..cf343e9651 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.cpp
+++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp
@@ -65,8 +65,8 @@ static const char *dbSpanSettingNames[] = {
HistoryHTMLBuilder::HistoryHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(nullptr));
- startedTime = time(nullptr);
+ setLastEventTime(time(0));
+ startedTime = time(0);
}
bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp
index d42635dc8f..bbcdd90c3e 100644
--- a/plugins/IEView/src/MUCCHTMLBuilder.cpp
+++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp
@@ -37,7 +37,7 @@ static const char *classNames[] = {
MUCCHTMLBuilder::MUCCHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(nullptr));
+ setLastEventTime(time(0));
}
void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
@@ -86,7 +86,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check)
szResult[0] = '\0';
struct tm tm_now, tm_today;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index 3b575be015..c0e569cca7 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -64,8 +64,8 @@ static const char *classNames[] = {
ScriverHTMLBuilder::ScriverHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(nullptr));
- startedTime = time(nullptr);
+ setLastEventTime(time(0));
+ startedTime = time(0);
}
bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
@@ -128,7 +128,7 @@ char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod
if ((mode == 0 || mode == 1) && (dwFlags & SMF_LOG_SHOWDATE)) {
struct tm tm_now, tm_today;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
index 4cde3546ac..01e63bdc89 100644
--- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
+++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
@@ -77,9 +77,9 @@ static const char *classNames[] = {
TabSRMMHTMLBuilder::TabSRMMHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(nullptr));
- lastEventTime = time(nullptr);
- startedTime = time(nullptr);
+ setLastEventTime(time(0));
+ lastEventTime = time(0);
+ startedTime = time(0);
}
bool TabSRMMHTMLBuilder::isDbEventShown(DWORD dwFlags, DBEVENTINFO *dbei)
@@ -158,7 +158,7 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG
const char *szFormat;
struct tm tm_now, tm_today;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t today;
if (!isGroupBreak || !(dwFlags & MWF_LOG_SHOWDATES)) {
@@ -291,7 +291,7 @@ time_t TabSRMMHTMLBuilder::getStartedTime()
void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
- DWORD today = (DWORD)time(nullptr);
+ DWORD today = (DWORD)time(0);
today = today - today % 86400;
DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp
index 576b372b70..bdf5882c08 100644
--- a/plugins/IEView/src/TemplateHTMLBuilder.cpp
+++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TemplateHTMLBuilder::TemplateHTMLBuilder()
{
iLastEventType = -1;
- startedTime = lastEventTime = time(nullptr);
+ startedTime = lastEventTime = time(0);
groupTemplate = nullptr;
}
@@ -85,7 +85,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo
TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? L"s" : L"t", str, _countof(str));
else { // date
struct tm tm_now, tm_today;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 752400ecc8..1e54739a08 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -1052,7 +1052,7 @@ void MirandaImport(HWND hdlg)
dstDb->SetCacheSafetyMode(FALSE);
// Start benchmark timer
- DWORD dwTimer = time(nullptr);
+ DWORD dwTimer = time(0);
OBJLIST<char> arSkippedAccs(1, CompareModules);
arSkippedAccs.insert(newStr("CListGroups"));
@@ -1143,7 +1143,7 @@ void MirandaImport(HWND hdlg)
delete srcDb;
// Stop timer
- dwTimer = time(nullptr) - dwTimer;
+ dwTimer = time(0) - dwTimer;
// Print statistics
AddMessage(LPGENW("Import completed in %d seconds."), dwTimer);
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp
index 56b28849b2..977b62652f 100644
--- a/plugins/Import/src/miranda.cpp
+++ b/plugins/Import/src/miranda.cpp
@@ -227,7 +227,7 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hwndDlg, UINT message, WPARAM wP
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(nullptr));
+ dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(0));
struct tm *TM = localtime(&dwSinceDate);
struct _SYSTEMTIME ST = { 0 };
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp
index 2a47c528b7..b5da36a964 100644
--- a/plugins/KeyboardNotify/src/flash.cpp
+++ b/plugins/KeyboardNotify/src/flash.cpp
@@ -310,7 +310,7 @@ void testSequence(wchar_t *testStr)
static FLASHING_SEQUENCE Test = {0};
Test = str2FS(testStr);
- mir_forkthread(TestThread, (void*)&Test);
+ mir_forkthread(TestThread, &Test);
}
@@ -339,7 +339,7 @@ void previewFlashing(BOOL buttonState)
return;
bPreviewSemaphore = TRUE;
- mir_forkthread(PreviewThread, nullptr);
+ mir_forkthread(PreviewThread);
}
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index 305a817183..091fe7d903 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -914,7 +914,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
mir_snwprintf(eventName, L"%s/ExitEvent", eventPrefix);
hExitEvent = CreateEvent(nullptr, FALSE, FALSE, eventName);
- hThread = mir_forkthread(FlashThreadFunction, nullptr);
+ hThread = mir_forkthread(FlashThreadFunction);
HookEvent(ME_MC_ENABLED, OnMetaChanged);
HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index d57cdb86bf..955cbbd483 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -429,7 +429,7 @@ static void ReplaceVars(Buffer<wchar_t> *buffer, MCONTACT hContact, wchar_t **va
}
else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) {
wchar_t tmp[128];
- TimeZone_ToStringT(time(nullptr), L"d s", tmp, _countof(tmp));
+ TimeZone_ToStringT(time(0), L"d s", tmp, _countof(tmp));
buffer->replace(j, i + 1, tmp);
}
else {
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index e8d3277e4b..ef35101dbc 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -555,7 +555,7 @@ int check() {
Menu_EnableItem(hMenuHandle, !running);
log(L"check: starting checkthread");
- mir_forkthread(checkthread, nullptr);
+ mir_forkthread(checkthread);
return 0;
}
diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp
index 5696e7695a..7a1fa45ad6 100644
--- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp
+++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp
@@ -1230,7 +1230,7 @@ time_t
SharedMemoryUtils::mfGetCurrentTimestamp()
{
- time_t currentTimestamp = time(nullptr);
+ time_t currentTimestamp = time(0);
//logger->log_dp(L"mfGetCurrentTimestamp() [" SCNuPTR L"]", currentTimestamp);
return currentTimestamp;
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp
index 233b45be76..20deed6d35 100644
--- a/plugins/MirFox/src/MirandaUtils.cpp
+++ b/plugins/MirFox/src/MirandaUtils.cpp
@@ -294,7 +294,7 @@ void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = targetHandleSzProto;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.cbBlob = (DWORD)bufSize;
dbei.pBlob = (PBYTE)msgBuffer;
db_event_add(hContact, &dbei);
diff --git a/plugins/MirLua/Modules/m_schedule/src/main.cpp b/plugins/MirLua/Modules/m_schedule/src/main.cpp
index fd6820ea9f..0e7fc3c92c 100644
--- a/plugins/MirLua/Modules/m_schedule/src/main.cpp
+++ b/plugins/MirLua/Modules/m_schedule/src/main.cpp
@@ -24,7 +24,7 @@ struct ScheduleTask
ScheduleTask()
{
- timestamp = time(nullptr);
+ timestamp = time(0);
interval = 0;
repeat = false;
}
@@ -63,7 +63,7 @@ void ExecuteTaskThread(void *arg)
{
mir_cslock lock(threadLock);
- time_t now = time(nullptr);
+ time_t now = time(0);
if (task->timestamp + task->interval >= now)
task->timestamp += task->interval;
else
@@ -87,7 +87,7 @@ wait: WaitForSingleObject(hScheduleEvent, waitTime);
if (Miranda_IsTerminated())
return;
- time_t now = time(nullptr);
+ time_t now = time(0);
if (task->timestamp > now)
{
waitTime = (task->timestamp - now) * 1000;
@@ -165,7 +165,7 @@ static int fluent_Do(lua_State *L)
ScheduleTask *task = *(ScheduleTask**)lua_touserdata(L, lua_upvalueindex(1));
- time_t now = time(nullptr);
+ time_t now = time(0);
if (task->timestamp < now)
{
if (task->interval == 0)
@@ -323,7 +323,7 @@ static int fluent_Week(lua_State *L)
static int fluent_Monday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(1 - ti->tm_wday);
@@ -339,7 +339,7 @@ static int fluent_Monday(lua_State *L)
static int fluent_Tuesday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(2 - ti->tm_wday);
@@ -355,7 +355,7 @@ static int fluent_Tuesday(lua_State *L)
static int fluent_Wednesday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(3 - ti->tm_wday);
@@ -371,7 +371,7 @@ static int fluent_Wednesday(lua_State *L)
static int fluent_Thursday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(4 - ti->tm_wday);
@@ -387,7 +387,7 @@ static int fluent_Thursday(lua_State *L)
static int fluent_Friday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(5 - ti->tm_wday);
@@ -403,7 +403,7 @@ static int fluent_Friday(lua_State *L)
static int fluent_Saturday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(6 - ti->tm_wday);
@@ -419,7 +419,7 @@ static int fluent_Saturday(lua_State *L)
static int fluent_Sunday(lua_State *L)
{
- time_t timestamp = time(nullptr);
+ time_t timestamp = time(0);
struct tm *ti = localtime(&timestamp);
ti->tm_mday += abs(-ti->tm_wday);
@@ -446,7 +446,7 @@ static int schedule_At(lua_State *L)
{
ScheduleTask **task = (ScheduleTask**)lua_newuserdata(L, sizeof(ScheduleTask));
*task = new ScheduleTask();
- (*task)->timestamp = luaM_opttimestamp(L, 1, time(nullptr));
+ (*task)->timestamp = luaM_opttimestamp(L, 1, time(0));
lua_newtable(L);
lua_newtable(L);
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp
index e382616954..b35b4dd67d 100644
--- a/plugins/MirLua/src/m_message.cpp
+++ b/plugins/MirLua/src/m_message.cpp
@@ -36,7 +36,7 @@ static int message_Send(lua_State *L)
else if ((res = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message)) != ACKRESULT_FAILED) {
DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)mir_strlen(message);
dbei.pBlob = (PBYTE)mir_strdup(message);
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp
index 4c6108f6d0..155907a3cf 100644
--- a/plugins/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/src/dbfilter.cpp
@@ -23,7 +23,7 @@ void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) {
DBEVENTINFO info = {};
next = DeleteEvents.first;
while (current = next) {
- if (difftime(time(nullptr), current->timestamp) < 1) break;
+ if (difftime(time(0), current->timestamp) < 1) break;
if (!db_event_get(current->hDbEvent, &info)) // && info.flags&DBEF_READ)
{
db_event_delete(current->hContact, current->hDbEvent);
@@ -133,7 +133,7 @@ int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam)
DeleteEventNode *node = new DeleteEventNode();
node->hContact = hContact;
node->hDbEvent = lParam;
- node->timestamp = time(nullptr);
+ node->timestamp = time(0);
node->next = nullptr;
mir_cslock lck(RemoveChainCS);
if (DeleteEvents.last)
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index a89ef8121f..0dcd1e1cfe 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -238,7 +238,7 @@ void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) {
T2Utf utf(buff);
PROTORECVEVENT pre = {0};
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.szMessage = utf;
pre.flags = PREF_BYPASS_OTR;
ProtoChainRecvMsg(hContact, &pre);
@@ -249,7 +249,7 @@ void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg) {
mir_snprintf(buff, "%s%s", LANG_INLINE_PREFIX, msg);
PROTORECVEVENT pre = {0};
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.szMessage = buff;
pre.flags = PREF_BYPASS_OTR;
ProtoChainRecvMsg(hContact, &pre);
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 4b9692dd87..80181272d1 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -661,7 +661,7 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = szProto;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
// Check if protocoll is valid
if (dbei.szModule == nullptr)
return;
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp
index 2ec4f18332..f704f1ee08 100644
--- a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp
+++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp
@@ -21,9 +21,9 @@ DWORD WINAPI notificationCallback(IN int,
}
-void __cdecl initializeDrawingThread(void *pParam)
+void __cdecl initializeDrawingThread(CLCDConnectionLogitech *pParam)
{
- ((CLCDConnectionLogitech*)pParam)->runDrawingThread();
+ pParam->runDrawingThread();
}
void CLCDConnectionLogitech::runDrawingThread() {
@@ -109,7 +109,7 @@ CLCDConnectionLogitech::CLCDConnectionLogitech()
CLCDConnectionLogitech::m_pInstance = this;
- m_hDrawingThread = mir_forkthread(initializeDrawingThread, (void*)this);
+ m_hDrawingThread = mir_forkThread<CLCDConnectionLogitech>(initializeDrawingThread, this);
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp
index a40b18d2a8..53cd59b701 100644
--- a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp
+++ b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp
@@ -64,7 +64,7 @@ CLCDScreen *CLCDOutputManager::GetActiveScreen()
//************************************************************************
bool CLCDOutputManager::Initialize(tstring strAppletName,bool bAutostart, bool bConfigDialog)
{
- srand ( time(nullptr) );
+ srand ( time(0) );
InitDebug();
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index 64d2a01d83..88f4f6001f 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -144,10 +144,8 @@ struct ExportDialogData {
HWND hDialog;
};
-void exportContactsMessages(void *p)
+void __cdecl exportContactsMessages(ExportDialogData *data)
{
- ExportDialogData *data = (ExportDialogData *)p;
-
HWND hDlg = data->hDialog;
HWND hProg = GetDlgItem(hDlg, IDC_EXPORT_PROGRESS);
HWND hStatus = GetDlgItem(hDlg, IDC_EXP_ALL_STATUS);
@@ -291,7 +289,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected)
ShowWindow(hDlg, SW_SHOWNORMAL);
// Process the export in other thread
- mir_forkthread(&exportContactsMessages, data);
+ mir_forkThread<ExportDialogData>(&exportContactsMessages, data);
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp
index 661385e298..975db0e8cd 100644
--- a/plugins/NewAwaySysMod/src/Client.cpp
+++ b/plugins/NewAwaySysMod/src/Client.cpp
@@ -71,7 +71,7 @@ void InitUpdateMsgs()
}
else if (!g_hUpdateMsgsThread && UpdateMsgs) {
g_hTerminateUpdateMsgsThread = CreateEvent(nullptr, TRUE, FALSE, nullptr);
- g_hUpdateMsgsThread = (HANDLE)mir_forkthread(UpdateMsgsThreadProc, nullptr);
+ g_hUpdateMsgsThread = mir_forkthread(UpdateMsgsThreadProc);
}
}
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
index 266437ea13..f86c1d6e00 100644
--- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
+++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
@@ -48,11 +48,10 @@ public:
};
// _ad must be allocated using "new CAutoreplyData()"
-void __cdecl AutoreplyDelayThread(void *_ad)
+void __cdecl AutoreplyDelayThread(CAutoreplyData *ad)
{
Thread_SetName("NewAwaySysMod: AutoreplyDelayThread");
- CAutoreplyData *ad = (CAutoreplyData*)_ad;
_ASSERT(ad && ad->hContact && ad->Reply.GetLen());
char *szProto = GetContactProto(ad->hContact);
if (!szProto) {
@@ -69,7 +68,7 @@ void __cdecl AutoreplyDelayThread(void *_ad)
dbeo.eventType = EVENTTYPE_MESSAGE;
dbeo.flags = DBEF_SENT | DBEF_UTF;
dbeo.szModule = szProto;
- dbeo.timestamp = time(nullptr);
+ dbeo.timestamp = time(0);
dbeo.cbBlob = ReplyLen;
dbeo.pBlob = (PBYTE)(char*)pszReply;
@@ -114,7 +113,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
if (dbei->flags & DBEF_SENT || (dbei->eventType != EVENTTYPE_MESSAGE && dbei->eventType != EVENTTYPE_URL && dbei->eventType != EVENTTYPE_FILE))
return 0;
- if (time(nullptr) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages
+ if (time(0) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages
return 0;
char *szProto = GetContactProto(hContact);
@@ -133,7 +132,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
return 0;
// remove outdated events first
- DWORD CurTime = time(nullptr);
+ DWORD CurTime = time(0);
int i;
for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
@@ -155,7 +154,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
// ugly workaround for metacontacts, part i; store all metacontacts' events to a temporary array, so we'll be able to get the 'source' protocol when subcontact event happens later. we need the protocol to get its status and per-status settings properly
if (!mir_strcmp(szProto, META_PROTO)) {
// remove outdated events first
- DWORD CurTime = time(nullptr);
+ DWORD CurTime = time(0);
for (int i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
MetacontactEvents.RemoveElem(i);
@@ -232,7 +231,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
if (Reply.GetLen()) {
CAutoreplyData *ad = new CAutoreplyData(hContact, Reply);
- mir_forkthread(AutoreplyDelayThread, ad);
+ mir_forkThread<CAutoreplyData>(AutoreplyDelayThread, ad);
}
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 60649d6deb..09d9025e14 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -270,7 +270,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt)
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.szModule = MODULE;
MEVENT hDBEvent = db_event_add(smi->hContact, &dbei);
@@ -355,7 +355,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.szModule = MODULE;
MEVENT hDBEvent = db_event_add(hContact, &dbei);
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index 4c73abb6f9..697876bf22 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -298,7 +298,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc)
dbei.pBlob = (PBYTE)(char*)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.szModule = MODULE;
MEVENT hDBEvent = db_event_add(xsc->hContact, &dbei);
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 33de2251a7..f8c2531190 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -568,7 +568,7 @@ void HistoryLog(MCONTACT hContact, db_event evt)
Event.eventType = evt.eventType;
Event.flags = evt.flags;
if (!evt.timestamp)
- Event.timestamp = (DWORD)time(nullptr);
+ Event.timestamp = (DWORD)time(0);
else
Event.timestamp = evt.timestamp;
Event.cbBlob = (DWORD)mir_strlen((char*)evt.pBlob) + 1;
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp
index 448cf8d1da..559b52d3d9 100644
--- a/plugins/NewsAggregator/Src/CheckFeed.cpp
+++ b/plugins/NewsAggregator/Src/CheckFeed.cpp
@@ -176,7 +176,7 @@ static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStr
if (!MesExist) {
if (stamp == 0)
- stamp = time(nullptr);
+ stamp = time(0);
T2Utf pszMessage(message);
@@ -392,10 +392,10 @@ void CheckCurrentFeed(MCONTACT hContact)
szChildText = xmlGetText(child);
if (szChildText) {
time_t stamp = DateToUnixTime(szChildText, 0);
- double deltaupd = difftime(time(nullptr), stamp);
- double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double deltaupd = difftime(time(0), stamp);
+ double deltacheck = difftime(time(0), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(0));
xmlDestroyNode(hXml);
return;
}
@@ -525,10 +525,10 @@ void CheckCurrentFeed(MCONTACT hContact)
if (szChildText) {
wchar_t *lastupdtime = (wchar_t *)szChildText;
time_t stamp = DateToUnixTime(lastupdtime, 1);
- double deltaupd = difftime(time(nullptr), stamp);
- double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double deltaupd = difftime(time(0), stamp);
+ double deltacheck = difftime(time(0), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(0));
xmlDestroyNode(hXml);
return;
}
@@ -601,7 +601,7 @@ void CheckCurrentFeed(MCONTACT hContact)
xmlDestroyNode(hXml);
}
}
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(0));
}
void CheckCurrentFeedAvatar(MCONTACT hContact)
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index bf9030bb6f..0cc91bec3e 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -38,7 +38,7 @@ int NewsAggrInit(WPARAM, LPARAM)
for (auto &hContact : Contacts(MODULE)) {
if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
- db_set_dw(hContact, MODULE, "LastCheck", time(nullptr));
+ db_set_dw(hContact, MODULE, "LastCheck", time(0));
db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE);
}
diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp
index 893a00239b..45db5d3f7e 100644
--- a/plugins/NewsAggregator/Src/Update.cpp
+++ b/plugins/NewsAggregator/Src/Update.cpp
@@ -32,7 +32,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
bool HaveUpdates = FALSE;
for (auto &hContact : Contacts(MODULE)) {
if (db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) {
- double diff = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double diff = difftime(time(0), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) {
UpdateListAdd(hContact);
HaveUpdates = TRUE;
diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp
index 6069a5962e..2cef244540 100644
--- a/plugins/NotifyAnything/src/main.cpp
+++ b/plugins/NotifyAnything/src/main.cpp
@@ -948,7 +948,7 @@ void start_threads()
{
g_exit_threads = false;
g_udp_thread = mir_forkthread(udptcpThreadFunc, (void *)1);
- g_tcp_thread = mir_forkthread(udptcpThreadFunc, nullptr);
+ g_tcp_thread = mir_forkthread(udptcpThreadFunc);
}
void stop_threads()
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index 4770a71d76..25ab897289 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -45,7 +45,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam, LPARAM lParam)
INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
{
char *protoName = GetContactProto(hContact);
- int diff = time(nullptr) - db_get_dw(hContact, "Nudge", "LastSent", time(nullptr) - 30);
+ int diff = time(0) - db_get_dw(hContact, "Nudge", "LastSent", time(0) - 30);
if (diff < GlobalNudge.sendTimeSec) {
wchar_t msg[500];
mir_snwprintf(msg, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
@@ -59,7 +59,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
return 0;
}
- db_set_dw(hContact, "Nudge", "LastSent", time(nullptr));
+ db_set_dw(hContact, "Nudge", "LastSent", time(0));
if (GlobalNudge.useByProtocol) {
for (auto &p : arNudges)
@@ -85,7 +85,7 @@ int NudgeReceived(WPARAM hContact, LPARAM lParam)
{
char *protoName = GetContactProto(hContact);
- DWORD currentTimestamp = time(nullptr);
+ DWORD currentTimestamp = time(0);
DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp;
int diff = currentTimestamp - db_get_dw(hContact, "Nudge", "LastReceived", currentTimestamp - 30);
@@ -409,7 +409,7 @@ int Preview()
if (p->openMessageWindow)
CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
if (p->shakeChat)
- ShakeChat(hContact, (LPARAM)time(nullptr));
+ ShakeChat(hContact, (LPARAM)time(0));
}
}
}
@@ -425,7 +425,7 @@ int Preview()
if (DefaultNudge.openMessageWindow)
CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
if (DefaultNudge.shakeChat)
- ShakeChat(hContact, (LPARAM)time(nullptr));
+ ShakeChat(hContact, (LPARAM)time(0));
}
}
return 0;
@@ -470,7 +470,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact)
DBEVENTINFO dbei = {};
dbei.szModule = MODULENAME;
dbei.flags = DBEF_SENT | DBEF_UTF;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.eventType = 1;
dbei.cbBlob = (DWORD)mir_strlen(buff) + 1;
dbei.pBlob = (PBYTE)buff;
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index ae5706dfaa..9554653ffd 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -374,15 +374,15 @@ void DoCheck(int iFlag)
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
else if (iFlag) {
- hCheckThread = mir_forkthread(CheckUpdates, nullptr);
- db_set_dw(NULL, MODNAME, "LastUpdate", time(nullptr));
+ hCheckThread = mir_forkthread(CheckUpdates);
+ db_set_dw(NULL, MODNAME, "LastUpdate", time(0));
}
}
BOOL AllowUpdateOnStartup()
{
if (OnlyOnceADay) {
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
if ((now - was) < 86400)
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 6839195d4b..d5b3b77d88 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -128,7 +128,7 @@ void PasteIt(MCONTACT hContact, int mode)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.cbBlob = (DWORD)mir_strlen(pasteToWeb->szFileLink) + 1;
dbei.pBlob = (PBYTE)pasteToWeb->szFileLink;
db_event_add(hContact, &dbei);
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp
index 080f044345..6bac84f199 100644
--- a/plugins/Ping/src/pingthread.cpp
+++ b/plugins/Ping/src/pingthread.cpp
@@ -147,7 +147,7 @@ void __cdecl sttCheckStatusThreadProc(void*)
i->responding = pa.responding;
i->round_trip_time = pa.round_trip_time;
history_entry.first = i->round_trip_time;
- history_entry.second = time(nullptr);
+ history_entry.second = time(0);
history_map[i->item_id].push_back(history_entry);
// maintain history (-1 represents no response)
while (history_map[i->item_id].size() >= MAX_HISTORY)
@@ -227,7 +227,7 @@ void start_ping_thread()
{
if (status_update_thread)
CloseHandle(status_update_thread);
- status_update_thread = mir_forkthread(sttCheckStatusThreadProc, nullptr);
+ status_update_thread = mir_forkthread(sttCheckStatusThreadProc);
}
void stop_ping_thread()
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 7151781255..0402a1dc9b 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -423,8 +423,7 @@ static void DoGetList()
SetForegroundWindow(hwndDialog);
SetFocus(hwndDialog);
}
- else
- hListThread = mir_forkthread(GetList, nullptr);
+ else hListThread = mir_forkthread(GetList);
}
void UninitListNew()
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index a657c4a1a2..800ee9852c 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -384,9 +384,9 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
#if MIRANDA_VER >= 0x0A00
- db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(nullptr));
+ db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(0));
#endif
- mir_forkthread(InitTimer, nullptr);
+ mir_forkthread(InitTimer);
break;
}
@@ -837,9 +837,9 @@ static void DoCheck(bool bSilent = true)
else {
opts.bSilent = bSilent;
#if MIRANDA_VER >= 0x0A00
- db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(nullptr));
+ db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(0));
#endif
- hCheckThread = mir_forkthread(CheckUpdates, nullptr);
+ hCheckThread = mir_forkthread(CheckUpdates);
}
}
@@ -874,7 +874,7 @@ void CheckUpdateOnStartup()
{
if (opts.bUpdateOnStartup) {
if (opts.bOnlyOnceADay) {
- time_t now = time(nullptr),
+ time_t now = time(0),
was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
if ((now - was) < 86400)
@@ -921,7 +921,7 @@ void InitTimer(void *type)
switch ((INT_PTR)type) {
case 0: // default, plan next check relative to last check
{
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
@@ -954,5 +954,5 @@ void InitTimer(void *type)
void CreateTimer() {
hTimer = CreateWaitableTimer(nullptr, FALSE, nullptr);
- mir_forkthread(InitTimer, nullptr);
+ mir_forkthread(InitTimer);
}
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp
index 163fea25bb..5be7176009 100644
--- a/plugins/Popup/src/history.cpp
+++ b/plugins/Popup/src/history.cpp
@@ -82,7 +82,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew)
ppd->lpzText = mir_strdup(ppd->lpzText);
}
ppd->lpzSkin = mir_strdup(ppd->lpzSkin);
- ppd->dwTimestamp = time(nullptr);
+ ppd->dwTimestamp = time(0);
{
mir_cslock lck(csPopupHistory);
if (arPopupHistory.getCount() >= popupHistoryBuffer) {
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index fada19920f..63dab2976a 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -815,7 +815,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(msg) + 1;
dbei.pBlob = (PBYTE)msg;
db_event_add(hContact, &dbei);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index 86f2cedecf..9acd7c06f0 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
@@ -547,7 +547,7 @@ bool show_popup(const IQuotesProvider* pProvider,
void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/)
{
- time_t nTime = ::time(nullptr);
+ time_t nTime = ::time(0);
if (false == rsSymbol.empty())
db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsSymbol.c_str());
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp
index 55c1a491b5..71f2d052a5 100644
--- a/plugins/SMS/src/receive.cpp
+++ b/plugins/SMS/src/receive.cpp
@@ -65,7 +65,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam)
MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize);
dbei.szModule = GetModuleName(hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.flags = DBEF_UTF;
dbei.eventType = ICQEVENTTYPE_SMS;
dbei.cbBlob = (mir_snprintf((LPSTR)dbei.pBlob, ((dwBuffLen + dwPhoneSize)), "SMS From: +%s\r\n%s", szPhone, lpszMessageUTF) + sizeof(DWORD));
@@ -93,7 +93,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam)
DBEVENTINFO dbei = {};
dbei.szModule = GetModuleName(hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.flags = DBEF_UTF;
dbei.eventType = ICQEVENTTYPE_SMSCONFIRMATION;
if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) {
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp
index 0970e5c400..f1a9f98653 100644
--- a/plugins/SMS/src/send.cpp
+++ b/plugins/SMS/src/send.cpp
@@ -60,7 +60,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP
WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, nullptr, nullptr);
dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize);
- pdbei->timestamp = time(nullptr);
+ pdbei->timestamp = time(0);
pdbei->flags = (DBEF_SENT | DBEF_UTF);
pdbei->eventType = ICQEVENTTYPE_SMS;
pdbei->cbBlob = (mir_snprintf(lpszBuff, dwBuffSize, "SMS To: +%s\r\n%s", szPhone, lpszMessageUTF) + 4);
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index f53118c989..5021e20fb0 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -375,11 +375,10 @@ void CChatRoomDlg::onChange_Message(CCtrlEdit*)
/////////////////////////////////////////////////////////////////////////////////////////
-static void __cdecl phase2(void *lParam)
+static void __cdecl phase2(SESSION_INFO *si)
{
Thread_SetName("Scriver: phase2");
- SESSION_INFO *si = (SESSION_INFO*)lParam;
Sleep(30);
if (si && si->pDlg)
si->pDlg->RedrawLog2();
@@ -401,7 +400,7 @@ void CChatRoomDlg::RedrawLog()
index++;
}
StreamInEvents(pLog, true);
- mir_forkthread(phase2, m_si);
+ mir_forkThread<SESSION_INFO>(phase2, m_si);
}
else StreamInEvents(m_si->pLogEnd, true);
}
@@ -677,8 +676,8 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
if (db_get_b(0, SRMM_MODULE, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
- if (m_iLastEnterTime + 2 < time(nullptr))
- m_iLastEnterTime = time(nullptr);
+ if (m_iLastEnterTime + 2 < time(0))
+ m_iLastEnterTime = time(0);
else {
m_message.SendMsg(WM_KEYDOWN, VK_BACK, 0);
m_message.SendMsg(WM_KEYUP, VK_BACK, 0);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 9d5f880dc3..058f0d5286 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -142,7 +142,7 @@ static int ackevent(WPARAM, LPARAM lParam)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT | ((item->flags & PREF_RTL) ? DBEF_RTL : 0);
dbei.szModule = GetContactProto(hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1;
dbei.pBlob = (PBYTE)item->sendBuffer;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 0ea68c5da6..f40d639084 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -195,8 +195,8 @@ void CSrmmWindow::OnInitDialog()
SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr);
m_lastEventType = -1;
- m_lastEventTime = time(nullptr);
- m_startTime = time(nullptr);
+ m_lastEventTime = time(0);
+ m_startTime = time(0);
m_bUseRtl = db_get_b(m_hContact, SRMM_MODULE, "UseRTL", 0) != 0;
m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false;
@@ -322,7 +322,7 @@ void CSrmmWindow::OnInitDialog()
case LOADHISTORY_TIME:
if (m_hDbEventFirst == 0) {
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
hPrevEvent = db_event_last(m_hContact);
}
else {
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 74c7d1330c..f388f9eae8 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -169,7 +169,7 @@ static EventData* GetTestEvent(DWORD flags)
evt->eventType = EVENTTYPE_MESSAGE;
evt->dwFlags = IEEDF_READ | flags;
evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
- evt->time = time(nullptr);
+ evt->time = time(0);
return evt;
}
@@ -333,7 +333,7 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode)
format[0] = '\0';
if ((mode == 0 || mode == 1) && (dwFlags & SMF_SHOWDATE)) {
struct tm tm_now, tm_today;
- time_t now = time(nullptr);
+ time_t now = time(0);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp
index 495bc324e2..a072dd108c 100644
--- a/plugins/SecureIM/src/dbevent.cpp
+++ b/plugins/SecureIM/src/dbevent.cpp
@@ -5,7 +5,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText)
DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_SENT | DBEF_READ;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)mir_strlen(szText) + 1;
dbei.pBlob = (PBYTE)szText;
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index 4cfa2d69b2..fd9dbd2f17 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -105,7 +105,7 @@ static int onModulesLoaded(WPARAM, LPARAM)
}
if (!rsa_4096)
- mir_forkthread(sttGenerateRSA, nullptr);
+ mir_forkthread(sttGenerateRSA);
mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10));
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp
index cc763dbb25..d2405a10d0 100644
--- a/plugins/SecureIM/src/svcs_proto.cpp
+++ b/plugins/SecureIM/src/svcs_proto.cpp
@@ -18,10 +18,8 @@ int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = nullptr)
/////////////////////////////////////////////////////////////////////////////////////////
-static void sttFakeAck(LPVOID param)
+static void sttFakeAck(TFakeAckParams *tParam)
{
- TFakeAckParams *tParam = (TFakeAckParams*)param;
-
Sleep(100);
if (tParam->msg == nullptr)
SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->id, 0);
@@ -33,13 +31,13 @@ static void sttFakeAck(LPVOID param)
int returnNoError(MCONTACT hContact)
{
- mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, nullptr));
+ mir_forkThread<TFakeAckParams>(sttFakeAck, new TFakeAckParams(hContact, 777, nullptr));
return 777;
}
int returnError(MCONTACT hContact, LPCSTR err)
{
- mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 666, err));
+ mir_forkThread<TFakeAckParams>(sttFakeAck, new TFakeAckParams(hContact, 666, err));
return 666;
}
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 4d0a7a7eb5..efce4f5e25 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -514,12 +514,10 @@ void myPlaySound(MCONTACT hcontact, WORD newStatus, WORD oldStatus)
}
// will add hContact to queue and will return position;
-static void waitThread(void *param)
+static void waitThread(logthread_info* infoParam)
{
Thread_SetName("SeenPlugin: waitThread");
- logthread_info* infoParam = (logthread_info*)param;
-
WORD prevStatus = db_get_w(infoParam->hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE);
// I hope in 1.5 second all the needed info will be set
@@ -586,7 +584,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
mir_snprintf(str, "OffTime-%s", szProto);
DWORD t = db_get_dw(NULL, S_MOD, str, 0);
if (!t)
- t = time(nullptr);
+ t = time(0);
DBWriteTimeTS(t, hContact);
}
@@ -613,7 +611,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
if (cws->value.wVal == prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0))
return 0;
- DBWriteTimeTS(time(nullptr), hContact);
+ DBWriteTimeTS(time(0), hContact);
if (g_bFileActive) FileWrite(hContact);
if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus);
@@ -636,7 +634,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
p->hContact = hContact;
mir_strncpy(p->sProtoName, cws->szModule, _countof(p->sProtoName));
arContacts.insert(p);
- mir_forkthread(waitThread, p);
+ mir_forkThread<logthread_info>(waitThread, p);
}
p->currStatus = isIdleEvent ? db_get_w(hContact, cws->szModule, "Status", ID_STATUS_OFFLINE) : cws->value.wVal;
}
@@ -645,11 +643,10 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
return 0;
}
-static void cleanThread(void *param)
+static void cleanThread(logthread_info* infoParam)
{
Thread_SetName("SeenPlugin: cleanThread");
- logthread_info* infoParam = (logthread_info*)param;
char *szProto = infoParam->sProtoName;
// I hope in 10 secons all logged-in contacts will be listed
@@ -681,7 +678,7 @@ int ModeChange(WPARAM, LPARAM lparam)
if (!IsWatchedProtocol(courProtoName) && strncmp(courProtoName, "MetaContacts", 12))
return 0;
- DBWriteTimeTS(time(nullptr), NULL);
+ DBWriteTimeTS(time(0), NULL);
WORD isetting = (WORD)ack->lParam;
if (isetting < ID_STATUS_OFFLINE)
@@ -695,7 +692,7 @@ int ModeChange(WPARAM, LPARAM lparam)
info->hContact = 0;
info->currStatus = 0;
- mir_forkthread(cleanThread, info);
+ mir_forkThread<logthread_info>(cleanThread, info);
}
}
else if ((isetting == ID_STATUS_OFFLINE) && ((UINT_PTR)ack->hProcess > ID_STATUS_OFFLINE)) {
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index be37a59bf9..f985aec6f4 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -378,7 +378,7 @@ void CSend::DB_EventAdd(WORD EventType)
dbei.szModule = m_pszProto;
dbei.eventType = EventType;
dbei.flags = DBEF_SENT;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.flags |= DBEF_UTF;
dbei.cbBlob = m_cbEventMsg;
dbei.pBlob = (PBYTE)m_szEventMsg;
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp
index 9307ddf530..608b35fd86 100644
--- a/plugins/ShellExt/src/shlcom.cpp
+++ b/plugins/ShellExt/src/shlcom.cpp
@@ -128,9 +128,8 @@ void NTAPI MainThreadIssueTransfer(ULONG_PTR param)
SetEvent(p->hEvent);
}
-void __cdecl IssueTransferThread(void *param)
+void __cdecl IssueTransferThread(THeaderIPC *pipch)
{
- THeaderIPC *pipch = (THeaderIPC *)param;
HANDLE hMainThread = HANDLE(pipch->Param);
char szBuf[MAX_PATH];
@@ -377,12 +376,12 @@ void __stdcall ipcService(ULONG_PTR)
memcpy(cloned, pMMT, IPC_PACKET_SIZE);
ipcFixupAddresses(cloned);
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &cloned->Param, THREAD_SET_CONTEXT, false, 0);
- mir_forkthread(&IssueTransferThread, cloned);
+ mir_forkThread<THeaderIPC>(&IssueTransferThread, cloned);
goto Reply;
}
// the request was to clear the MRU entries, we have no return data
if (*bits & REQUEST_CLEARMRU) {
- mir_forkthread(&ClearMRUThread, nullptr);
+ mir_forkthread(&ClearMRUThread);
goto Reply;
}
// the IPC header may have pointers that need to be translated
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index 8375b1e5df..5a73931214 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -175,7 +175,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
return FALSE;
if (!(dbei.flags & DBEF_SENT)) {
- int timeBetween = time(nullptr) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
+ int timeBetween = time(0) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
if (timeBetween > interval || db_get_w(hContact, protocolname, "LastStatus", 0) != status) {
size_t msgLen = 1;
int isQun = db_get_b(hContact, pszProto, "IsQun", 0);
@@ -218,7 +218,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT;
dbei.szModule = pszProto;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)pszUtf;
db_event_add(hContact, &dbei);
@@ -231,7 +231,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
}
}
- db_set_dw(hContact, protocolname, "LastReplyTS", time(nullptr));
+ db_set_dw(hContact, protocolname, "LastReplyTS", time(0));
db_set_w(hContact, protocolname, "LastStatus", status);
}
return 0;
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp
index 819896be8f..5bd5d69fa5 100644
--- a/plugins/SkypeStatusChange/src/main.cpp
+++ b/plugins/SkypeStatusChange/src/main.cpp
@@ -298,7 +298,7 @@ extern "C" int __declspec(dllexport) Load()
g_bMirandaIsShutdown = false;
g_hEventShutdown = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
- g_hThread = mir_forkthread(ThreadFunc, nullptr);
+ g_hThread = mir_forkthread(ThreadFunc);
HookEvent(ME_PROTO_ACK, SSC_OnProtocolAck);
HookEvent(ME_SYSTEM_PRESHUTDOWN, SSC_OnPreShutdown);
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 61964955f1..884b323837 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -188,7 +188,7 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam)
stwp->direction = 0;
stwp->xPosition = pcbc->pt.x;
stwp->yPosition = pcbc->pt.y;
- mir_forkthread(SmileyToolThread, stwp);
+ mir_forkThread<SmileyToolWindowParam>(SmileyToolThread, stwp);
return 0;
}
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index 306b980276..328bae9afd 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -191,7 +191,7 @@ bool GetSmileyFile(CMStringW &url, const CMStringW &packstr)
if (!threadRunning) {
threadRunning = true;
- mir_forkthread(SmileyDownloadThread, nullptr);
+ mir_forkthread(SmileyDownloadThread);
}
url = filename;
diff --git a/plugins/SmileyAdd/src/imagecache.cpp b/plugins/SmileyAdd/src/imagecache.cpp
index cbf5c69a39..87e0426512 100644
--- a/plugins/SmileyAdd/src/imagecache.cpp
+++ b/plugins/SmileyAdd/src/imagecache.cpp
@@ -29,7 +29,7 @@ static UINT_PTR timerId;
static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
{
WaitForSingleObject(g_hMutexIm, 3000);
- const time_t ts = time(nullptr) - 10;
+ const time_t ts = time(0) - 10;
if (lastmodule && ts > laststamp) {
FreeLibrary(lastmodule);
lastmodule = nullptr;
@@ -69,7 +69,7 @@ static HMODULE LoadDll(const CMStringW &file)
lastmodule = LoadLibraryEx(file.c_str(), nullptr, LOAD_LIBRARY_AS_DATAFILE);
}
- laststamp = time(nullptr);
+ laststamp = time(0);
ReleaseMutex(g_hMutexIm);
return lastmodule;
@@ -98,7 +98,7 @@ long ImageBase::Release(void)
long cnt = m_lRefCount;
if (cnt) m_lRefCount = --cnt;
- if (cnt == 0) m_timestamp = time(nullptr);
+ if (cnt == 0) m_timestamp = time(0);
ReleaseMutex(g_hMutexIm);
return cnt;
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index 3f1551fd42..897982ade5 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -538,7 +538,7 @@ void OptionsDialogType::ShowSmileyPreview(void)
stwp->direction = 1;
stwp->hContact = NULL;
- mir_forkthread(SmileyToolThread, stwp);
+ mir_forkThread<SmileyToolWindowParam>(SmileyToolThread, stwp);
}
void OptionsType::Save(void)
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp
index adc15d008e..0bb2349dc5 100644
--- a/plugins/SmileyAdd/src/services.cpp
+++ b/plugins/SmileyAdd/src/services.cpp
@@ -125,7 +125,7 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam)
stwp->yPosition = smaddInfo->yPosition;
stwp->direction = smaddInfo->Direction;
- mir_forkthread(SmileyToolThread, stwp);
+ mir_forkThread<SmileyToolWindowParam>(SmileyToolThread, stwp);
return TRUE;
}
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp
index 84c0e687ea..d264e314e4 100644
--- a/plugins/SmileyAdd/src/smltool.cpp
+++ b/plugins/SmileyAdd/src/smltool.cpp
@@ -737,11 +737,10 @@ int SmileyToolWindowType::CalculateCoordinatesToButton(POINT pt, int scroll)
return pos;
}
-void __cdecl SmileyToolThread(void *arg)
+void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp)
{
Thread_SetName("SmileyAdd: SmileyToolThread");
- SmileyToolWindowParam *stwp = (SmileyToolWindowParam*)arg;
if (stwp->pSmileyPack && stwp->pSmileyPack->VisibleSmileyCount()) {
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof(wndclass);
@@ -761,7 +760,7 @@ void __cdecl SmileyToolThread(void *arg)
CreateWindowEx(WS_EX_TOPMOST | WS_EX_NOPARENTNOTIFY, L"SmileyTool", nullptr,
WS_BORDER | WS_POPUP | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- ((SmileyToolWindowParam*)arg)->hWndParent, nullptr, g_hInst, arg);
+ stwp->hWndParent, nullptr, g_hInst, stwp);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
diff --git a/plugins/SmileyAdd/src/smltool.h b/plugins/SmileyAdd/src/smltool.h
index 41072787a0..26221543dd 100644
--- a/plugins/SmileyAdd/src/smltool.h
+++ b/plugins/SmileyAdd/src/smltool.h
@@ -35,8 +35,7 @@ struct SmileyToolWindowParam
MCONTACT hContact;
};
-
-void __cdecl SmileyToolThread(void *arg);
+void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp);
#ifndef min
#define min(A, B) ((A) < (B) ? (A) : (B))
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp
index dc4d23e635..c4fde0f693 100644
--- a/plugins/Spamotron/src/bayes.cpp
+++ b/plugins/Spamotron/src/bayes.cpp
@@ -276,7 +276,7 @@ void bayes_approve_contact(MCONTACT hContact)
void dequeue_messages()
{
- time_t t = time(nullptr);
+ time_t t = time(0);
sqlite3_stmt *stmt;
const char *message;
wchar_t *messageW;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index 0a628931f2..f23b7861e9 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -57,9 +57,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
/*** Dequeue and learn messages ***/
if (bayesEnabled && _getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
- if (time(nullptr) - last_queue_check > 4*3600) { // dequeue every 4 hours
+ if (time(0) - last_queue_check > 4*3600) { // dequeue every 4 hours
dequeue_messages();
- last_queue_check = time(nullptr);
+ last_queue_check = time(0);
}
/*** Check for conditional and unconditional approval ***/
@@ -375,7 +375,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
else
_getOptS(challengeW, maxmsglen, "Challenge", defaultChallenge);
_getOptS(buf, buflen, "Response", defaultResponse);
- srand(time(nullptr));
+ srand(time(0));
_setCOptD(hContact, "ResponseNum", rand() % get_response_num(buf));
ReplaceVarsNum(challengeW, maxmsglen, _getCOptD(hContact, "ResponseNum", 0));
ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
@@ -507,14 +507,14 @@ extern "C" __declspec(dllexport) int Load()
{
mir_getLP(&pluginInfo);
- srand((unsigned)time(nullptr));
+ srand((unsigned)time(0));
bayesdb = nullptr;
if (_getOptB("BayesEnabled", defaultBayesEnabled)) {
if (CheckBayes()) {
OpenBayes();
if (_getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved)) {
dequeue_messages();
- last_queue_check = time(nullptr);
+ last_queue_check = time(0);
}
}
}
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp
index b143b9d756..e6d9106950 100644
--- a/plugins/SplashScreen/src/main.cpp
+++ b/plugins/SplashScreen/src/main.cpp
@@ -166,7 +166,7 @@ void SplashMain()
} //if
} while (FindNextFile(hFind, &ffd));
- srand((unsigned)time(nullptr));
+ srand((unsigned)time(0));
int r = 0;
if (filescount) r = (rand() % filescount) + 1;
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp
index 4c525f867d..5bb39c8103 100644
--- a/plugins/StartupSilence/src/main.cpp
+++ b/plugins/StartupSilence/src/main.cpp
@@ -86,11 +86,49 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
+static void __cdecl AdvSt(void*)
+{
+ Thread_SetName("StartupSilenc: AdvSt");
+
+ if ((Enabled == 1)) {
+ POPUPDATAT ppd = { 0 };
+ wchar_t *lptzText = L"";
+ db_set_b(NULL, "Skin", "UseSound", 0);
+ EnablePopupModule();
+
+ if (PopUp == 1) {
+ lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED;
+ ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
+ ppd.lchContact = NULL;
+ ppd.iSeconds = PopUpTime;
+ wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
+ lptzText = TranslateW(MENU_NAMEW);
+ wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE);
+ PUAddPopupT(&ppd);
+ }
+
+ timer = 2;
+ Sleep(delay * 1000);
+ timer = 0;
+
+ if (PopUp == 1) {
+ lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED;
+ ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
+ wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
+ PUAddPopupT(&ppd);
+ }
+ if (DefEnabled == 1) { //predefined sound setting
+ db_set_b(NULL, "Skin", "UseSound", DefSound);
+ }
+ else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts
+ }
+}
+
INT_PTR StartupSilence()
{
InitSettings();
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- mir_forkthread((pThreadFunc)AdvSt, nullptr);
+ mir_forkthread((pThreadFunc)AdvSt);
CreateServiceFunction(SS_SERVICE_NAME, StartupSilenceEnabled);
CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection);
IsMenu();
@@ -220,45 +258,6 @@ void IsMenu()
}
}
-static INT_PTR AdvSt()
-{
- Thread_SetName("StartupSilenc: AdvSt");
-
- if ((Enabled == 1)) {
- POPUPDATAT ppd = {0};
- wchar_t * lptzText =L"";
- db_set_b(NULL, "Skin", "UseSound", 0);
- EnablePopupModule();
-
- if (PopUp == 1) {
- lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED;
- ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
- ppd.lchContact = NULL;
- ppd.iSeconds = PopUpTime;
- wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
- lptzText = TranslateW(MENU_NAMEW);
- wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE);
- PUAddPopupT(&ppd);
- }
-
- timer = 2;
- Sleep(delay * 1000);
- timer = 0;
-
- if (PopUp == 1) {
- lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED;
- ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
- wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
- PUAddPopupT(&ppd);
- }
- if (DefEnabled == 1) { //predefined sound setting
- db_set_b(NULL, "Skin", "UseSound", DefSound);
- }
- else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts
- }
- return 0;
-}
-
INT_PTR StartupSilenceEnabled(WPARAM, LPARAM)
{
db_set_b(NULL, MODULE_NAME, EnabledComp, !Enabled);
diff --git a/plugins/StartupSilence/src/stdafx.h b/plugins/StartupSilence/src/stdafx.h
index c6d9df5352..0a6e0c0be4 100644
--- a/plugins/StartupSilence/src/stdafx.h
+++ b/plugins/StartupSilence/src/stdafx.h
@@ -22,7 +22,6 @@
#include "version.h"
#include "resource.h"
-static INT_PTR AdvSt();
static INT_PTR InitMenu();
void InitSettings();
void LoadSettings();
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index 1b13ad2dfc..cd24606687 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -758,7 +758,7 @@ static void CheckContinuouslyFunction(void *)
static VOID CALLBACK CheckContinueslyTimer(HWND, UINT, UINT_PTR, DWORD)
{
if (db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE))
- mir_forkthread(CheckContinuouslyFunction, nullptr);
+ mir_forkthread(CheckContinuouslyFunction);
else
CheckContinuouslyFunction(nullptr);
}
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index 1328b68d78..5cd1e160a6 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -324,7 +324,7 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags)
Event.szModule = pluginName;
Event.eventType = event_type;
Event.flags = flags | DBEF_UTF;
- Event.timestamp = (DWORD)time(nullptr);
+ Event.timestamp = (DWORD)time(0);
Event.cbBlob = (DWORD)mir_strlen(data) + 1;
Event.pBlob = (PBYTE)_strdup(data);
db_event_add(hContact, &Event);
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index 0f03ecf541..16bce15921 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -44,7 +44,7 @@ static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi)
si->pDlg->UpdateStatusBar();
if (mi)
- mi->idleTimeStamp = time(nullptr);
+ mi->idleTimeStamp = time(0);
}
static void OnReplaceSession(SESSION_INFO *si)
@@ -77,7 +77,7 @@ static void OnChangeNick(SESSION_INFO *si)
static void OnCreateModule(MODULEINFO *mi)
{
- mi->idleTimeStamp = time(nullptr);
+ mi->idleTimeStamp = time(0);
}
static void OnLoadSettings()
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index c7c020de8c..5c3799ae88 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -455,11 +455,10 @@ LBL_SkipEnd:
return false;
}
-static void __cdecl phase2(void * lParam)
+static void __cdecl phase2(SESSION_INFO *si)
{
Thread_SetName("TabSRMM: phase2");
- SESSION_INFO *si = (SESSION_INFO*)lParam;
Sleep(30);
if (si && si->pDlg)
si->pDlg->RedrawLog2();
@@ -660,7 +659,7 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*)
if (ptszText[0] == '/' || m_si->iType == GCW_SERVER)
fSound = false;
Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
- mi->idleTimeStamp = time(nullptr);
+ mi->idleTimeStamp = time(0);
mi->lastIdleCheck = 0;
UpdateStatusBar();
if (m_pContainer)
@@ -810,7 +809,7 @@ void CChatRoomDlg::RedrawLog()
index++;
}
StreamInEvents(pLog, TRUE);
- mir_forkthread(phase2, m_si);
+ mir_forkThread<SESSION_INFO>(phase2, m_si);
}
else StreamInEvents(m_si->pLogEnd, TRUE);
}
@@ -894,7 +893,7 @@ void CChatRoomDlg::UpdateStatusBar()
wchar_t szFinalStatusBarText[512];
if (m_pPanel.isActive()) {
- time_t now = time(nullptr);
+ time_t now = time(0);
DWORD diff = (now - mi->idleTimeStamp) / 60;
if ((diff >= 1 && diff != mi->lastIdleCheck)) {
@@ -1270,8 +1269,8 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
break;
if (PluginConfig.m_bSendOnDblEnter) {
- if (m_iLastEnterTime + 2 < time(nullptr)) {
- m_iLastEnterTime = time(nullptr);
+ if (m_iLastEnterTime + 2 < time(0)) {
+ m_iLastEnterTime = time(0);
break;
}
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 92ae6c0c39..ce3e1c94b7 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -180,7 +180,7 @@ void CContactCache::updateStats(int iType, size_t value)
m_stats->lastReceivedChars = 0;
break;
case TSessionStats::INIT_TIMER:
- m_stats->started = time(nullptr);
+ m_stats->started = time(0);
break;
case TSessionStats::SET_LAST_RCV:
m_stats->lastReceivedChars = (unsigned int)value;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 6935c5f924..6ff956a773 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -573,7 +573,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
dbei.cbBlob = (int)mir_strlen(szMsg) + 1;
dbei.flags = DBEF_UTF | DBEF_READ;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.szModule = (char*)c->getProto();
dat->StreamInEvents(0, 1, 1, &dbei);
}
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 69300b36ad..94428ebea9 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -533,8 +533,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendMessage(pCont->m_hwnd, WM_TIMER, TIMERID_HEARTBEAT, 0);
// process send later contacts and jobs, if enough time has elapsed
- if (sendLater->isAvail() && !sendLater->isInteractive() && (time(nullptr) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
- sendLater->setLastProcessed(time(nullptr));
+ if (sendLater->isAvail() && !sendLater->isInteractive() && (time(0) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
+ sendLater->setLastProcessed(time(0));
// check the list of contacts that may have new send later jobs
// (added on user's request)
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index dd938a0d8c..73de2f3dad 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -486,7 +486,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
wchar_t szBuf[256];
if (m_dat->m_idle) {
- time_t diff = time(nullptr) - m_dat->m_idle;
+ time_t diff = time(0) - m_dat->m_idle;
int i_hrs = diff / 3600;
int i_mins = (diff - i_hrs * 3600) / 60;
mir_snwprintf(szBuf, TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 4131d2a048..41a908d09c 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -2028,8 +2028,8 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
break;
if (PluginConfig.m_bSendOnDblEnter) {
- if (m_iLastEnterTime + 2 < time(nullptr)) {
- m_iLastEnterTime = time(nullptr);
+ if (m_iLastEnterTime + 2 < time(0)) {
+ m_iLastEnterTime = time(0);
break;
}
else {
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 5e792de93a..4ef01fa859 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -130,7 +130,7 @@ static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lP
static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic)
{
wchar_t szFinalFilename[MAX_PATH];
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
DWORD setView = 1;
@@ -1154,7 +1154,7 @@ void CTabBaseDlg::FindFirstEvent()
case LOADHISTORY_TIME:
DBEVENTINFO dbei = {};
if (m_hDbEventFirst == 0)
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
else
db_event_get(m_hDbEventFirst, &dbei);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index af0aee1ff3..c4c0ac3a40 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -1184,7 +1184,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D
HWND hwndrtf = m_hwndIEView ? m_hwndIWebBrowserControl : m_log.GetHwnd();
rtfFonts = m_pContainer->theme.rtfFonts ? m_pContainer->theme.rtfFonts : &(rtfFontsGlobal[0][0]);
- time_t now = time(nullptr);
+ time_t now = time(0);
struct tm tm_now = *localtime(&now);
struct tm tm_today = tm_now;
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index bd7b744e35..be918c6e92 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -161,7 +161,7 @@ CSendLater::CSendLater() :
m_hFilter(0)
{
m_fAvail = M.GetByte("sendLaterAvail", 0) != 0;
- m_last_sendlater_processed = time(nullptr);
+ m_last_sendlater_processed = time(0);
m_fIsInteractive = false;
m_fErrorPopups = M.GetByte("qmgrErrorPopups", 0) != 0;
m_fSuccessPopups = M.GetByte("qmgrSuccessPopups", 0) != 0;
@@ -344,7 +344,7 @@ int CSendLater::addJob(const char *szSetting, void *lParam)
// this is ONLY called from the WM_TIMER handler and should never be executed directly.
int CSendLater::sendIt(CSendLaterJob *job)
{
- time_t now = time(nullptr);
+ time_t now = time(0);
if (job->bCode == CSendLaterJob::JOB_HOLD || job->bCode == CSendLaterJob::JOB_DEFERRED || job->fSuccess || job->fFailed || job->lastSent > now)
return 0; // this one is frozen or done (will be removed soon), don't process it now.
@@ -440,7 +440,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto((p->hContact));
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1;
dbei.pBlob = (PBYTE)(p->sendBuffer);
db_event_add(p->hContact, &dbei);
@@ -802,7 +802,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
else if (job->bCode == CSendLaterJob::JOB_AGE) {
job->fFailed = false;
job->bCode = '-';
- job->created = time(nullptr);
+ job->created = time(0);
}
break;
}
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 5b2fbd4979..a053cf5659 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -79,7 +79,7 @@ int SendQueue::addTo(CTabBaseDlg *dat, size_t iLen, int dwFlags)
// this entry is used, check if it's orphaned and can be removed...
if (m_jobs[i].hOwnerWnd && IsWindow(m_jobs[i].hOwnerWnd)) // window exists, do not reuse it
continue;
- if (time(nullptr) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it
+ if (time(0) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it
continue;
clearJob(i);
iFound = i;
@@ -99,7 +99,7 @@ entry_found:
memcpy(job.szSendBuffer, dat->m_sendBuffer, iLen);
job.dwFlags = dwFlags;
- job.dwTime = time(nullptr);
+ job.dwTime = time(0);
HWND hwndDlg = dat->GetHwnd();
@@ -359,7 +359,7 @@ void SendQueue::logError(CTabBaseDlg *dat, int iSendJobIndex, const wchar_t *szE
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.cbBlob = (int)iMsgLen;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.szModule = (char *)szErrMsg;
dat->StreamInEvents(0, 1, 1, &dbei);
}
@@ -462,7 +462,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(job.hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(job.szSendBuffer) + 1;
if (dat)
@@ -552,7 +552,7 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(dat->m_hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(utfText) + 1;
dbei.pBlob = (PBYTE)(char*)utfText;
dat->StreamInEvents(0, 1, 1, &dbei);
@@ -578,13 +578,13 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b
wchar_t tszHeader[150];
if (fIsSendLater) {
- time_t now = time(nullptr);
+ time_t now = time(0);
wchar_t tszTimestamp[30];
wcsftime(tszTimestamp, _countof(tszTimestamp), L"%Y.%m.%d - %H:%M", _localtime32((__time32_t *)&now));
mir_snprintf(szKeyName, "S%d", now);
mir_snwprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp);
}
- else mir_snwprintf(tszHeader, L"M%d|", time(nullptr));
+ else mir_snwprintf(tszHeader, L"M%d|", time(0));
T2Utf utf_header(tszHeader);
size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10;
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index b24b4412e5..0c2db1ff55 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -241,7 +241,7 @@ void CTemplateEditDlg::onClick_Preview(CCtrlButton*)
DBEVENTINFO dbei = {};
dbei.szModule = m_szProto;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE;
dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
if (dbei.eventType == EVENTTYPE_ERRMSG)
@@ -250,7 +250,7 @@ void CTemplateEditDlg::onClick_Preview(CCtrlButton*)
dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob) + 1;
dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
dbei.flags |= (rtl ? DBEF_RTL : 0);
- m_lastEventTime = (iIndex == 4 || iIndex == 5) ? time(nullptr) - 1 : 0;
+ m_lastEventTime = (iIndex == 4 || iIndex == 5) ? time(0) - 1 : 0;
m_iLastEventType = MAKELONG(dbei.flags, dbei.eventType);
m_log.SetText(L"");
m_dwFlags = MWF_LOG_ALL;
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index b649dfc931..8cd57b7863 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -94,7 +94,7 @@ void TSAPI CreateTrayMenus(int mode)
mir_snwprintf(g_eventName, L"tsr_evt_%d", GetCurrentThreadId());
g_hEvent = CreateEvent(nullptr, FALSE, FALSE, g_eventName);
isAnimThreadRunning = TRUE;
- hTrayAnimThread = mir_forkthread(TrayAnimThread, nullptr);
+ hTrayAnimThread = mir_forkthread(TrayAnimThread);
PluginConfig.g_hMenuTrayUnread = CreatePopupMenu();
PluginConfig.g_hMenuFavorites = CreatePopupMenu();
@@ -228,7 +228,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c
}
}
addnew:
- db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(nullptr));
+ db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(0));
AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry);
}
else if (hMenu == PluginConfig.g_hMenuFavorites) { // insert the item sorted...
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp
index cd69f7bf38..c2be17ac88 100644
--- a/plugins/TipperYM/src/subst.cpp
+++ b/plugins/TipperYM/src/subst.cpp
@@ -338,7 +338,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int
else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg_reltime")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out_reltime")) {
DWORD ts = LastMessageTimestamp(hContact, recv);
if (ts == 0) return false;
- DWORD t = (DWORD)time(nullptr);
+ DWORD t = (DWORD)time(0);
DWORD diff = (t - ts);
int d = (diff / 60 / 60 / 24);
int h = (diff - d * 60 * 60 * 24) / 60 / 60;
@@ -366,7 +366,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int
if (i > 0)
hTmpContact = db_mc_getSub(hContact, i);
dwRecountTs = db_get_dw(hTmpContact, MODULE, "LastCountTS", 0);
- dwTime = (DWORD)time(nullptr);
+ dwTime = (DWORD)time(0);
dwDiff = (dwTime - dwRecountTs);
if (dwDiff > (60 * 60 * 24 * 3)) {
db_set_dw(hTmpContact, MODULE, "LastCountTS", dwTime);
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp
index 5a8d31192f..a28b8a7798 100644
--- a/plugins/TipperYM/src/tipper.cpp
+++ b/plugins/TipperYM/src/tipper.cpp
@@ -266,7 +266,7 @@ int ModulesLoaded(WPARAM, LPARAM)
CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
// set Miranda start timestamp
- db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(nullptr));
+ db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(0));
return 0;
}
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp
index bff2e51d8b..8a487fd6a2 100644
--- a/plugins/TipperYM/src/translations.cpp
+++ b/plugins/TipperYM/src/translations.cpp
@@ -105,7 +105,7 @@ wchar_t* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, cons
wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
- DWORD t = (DWORD)time(nullptr);
+ DWORD t = (DWORD)time(0);
if (ts == 0) return nullptr;
DWORD diff = (ts > t) ? 0 : (t - ts);
@@ -481,7 +481,7 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam
if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
if (GetInt(dbv, &month)) {
db_free(&dbv);
- time_t now = time(nullptr);
+ time_t now = time(0);
struct tm *ti = localtime(&now);
int yday_now = ti->tm_yday;
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp
index f74a5c1795..9b49a2c261 100644
--- a/plugins/UserInfoEx/src/mir_contactqueue.cpp
+++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp
@@ -38,7 +38,7 @@ CContactQueue::CContactQueue(int initialSize) :
_hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
_status = RUNNING;
- mir_forkthread((pThreadFunc)CContactQueue::ThreadProc, this);
+ mir_forkThread<CContactQueue>(CContactQueue::ThreadProc, this);
}
CContactQueue::~CContactQueue()
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.h b/plugins/UserInfoEx/src/mir_contactqueue.h
index ce1e388f80..f40553ede6 100644
--- a/plugins/UserInfoEx/src/mir_contactqueue.h
+++ b/plugins/UserInfoEx/src/mir_contactqueue.h
@@ -138,7 +138,7 @@ protected:
// This is a static method to redirect the thread's callback function
// to the desired class object.
- static void ThreadProc(CContactQueue* obj)
+ static void __cdecl ThreadProc(CContactQueue* obj)
{
obj->Thread();
}
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index e81a75d802..d60c02cebf 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -617,7 +617,7 @@ static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
wchar_t ret[128];
- return mir_wstrdup(TimeZone_ToStringT(time(nullptr), L"d s", ret, _countof(ret)));
+ return mir_wstrdup(TimeZone_ToStringT(time(0), L"d s", ret, _countof(ret)));
}
static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp
index e37684b920..913bc19f84 100755
--- a/plugins/Watrack_MPD/src/main.cpp
+++ b/plugins/Watrack_MPD/src/main.cpp
@@ -43,7 +43,7 @@ void ReStart(void*)
if(ghConnection)
Netlib_CloseHandle(ghConnection);
Sleep(500);
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
}
int Parser()
@@ -56,7 +56,7 @@ int Parser()
nlpr.dwTimeout = 5;
if(!ghConnection)
{
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
}
if(ghConnection)
{
@@ -68,7 +68,7 @@ int Parser()
recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
if(recvResult == SOCKET_ERROR)
{
- mir_forkthread(&ReStart, nullptr);
+ mir_forkthread(&ReStart);
// ReStart();
return 1;
}
@@ -81,7 +81,7 @@ int Parser()
recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
if(recvResult == SOCKET_ERROR)
{
- mir_forkthread(&ReStart, nullptr);
+ mir_forkthread(&ReStart);
return 1;
}
}
@@ -91,14 +91,14 @@ int Parser()
recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
if(recvResult == SOCKET_ERROR)
{
- mir_forkthread(&ReStart, nullptr);
+ mir_forkthread(&ReStart);
return 1;
}
Netlib_Send(ghConnection, "currentsong\n", (int)mir_strlen("currentsong\n"), 0);
recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
if(recvResult == SOCKET_ERROR)
{
- mir_forkthread(&ReStart, nullptr);
+ mir_forkthread(&ReStart);
return 1;
}
nlpr.bytesUsed = nlpr.bytesAvailable;
@@ -266,7 +266,7 @@ void Stop()
int Init()
{
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
return 0;
}
@@ -280,7 +280,7 @@ HWND CheckPlayer(HWND, int)
{
if(!ghConnection)
{
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
return nullptr;
}
if(Parser())
@@ -294,7 +294,7 @@ int GetStatus(HWND)
{
if(!ghConnection)
{
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
return 0;
}
return Parser() ? -1 : gbState;
@@ -304,7 +304,7 @@ WCHAR* GetFileName(HWND, int)
{
if(!ghConnection)
{
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
return nullptr;
}
return nullptr;
@@ -314,7 +314,7 @@ int GetPlayerInfo(LPSONGINFO info, int)
{
if(!ghConnection)
{
- mir_forkthread(&Start, nullptr);
+ mir_forkthread(&Start);
return 0;
}
if(Parser())
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 45afe6cfcd..e683f561ac 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -160,7 +160,7 @@ INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
sttSID[_countof(sttSID) - 1] = 0;
sttSearchId = 1;
// create a thread for the ID search
- mir_forkthread(BasicSearchTimerProc, nullptr);
+ mir_forkthread(BasicSearchTimerProc);
return sttSearchId;
}
@@ -214,7 +214,7 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
// search for the weather station using a thread
- mir_forkthread(NameSearchTimerProc, nullptr);
+ mir_forkthread(NameSearchTimerProc);
return sttSearchId;
}
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index 91a1755ede..d5540d041c 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -191,7 +191,7 @@ int UpdateWeather(MCONTACT hContact)
DBEVENTINFO dbei = {};
dbei.szModule = WEATHERPROTONAME;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.pBlob = szMessage;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index 3359fe2cdf..ee0660d813 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -267,7 +267,7 @@ void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD)
if (!(db_get_b(NULL, MODULENAME, OFFLINE_STATUS, 1)))
if (!(db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)))
- mir_forkthread(ContactLoop, nullptr);
+ mir_forkthread(ContactLoop);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
}
@@ -350,7 +350,7 @@ int ModulesLoaded(WPARAM, LPARAM)
// get data on startup
if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
- mir_forkthread(StartUpdate, nullptr);
+ mir_forkthread(StartUpdate);
return 0;
}
@@ -394,7 +394,7 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
/*****************************************************************************/
INT_PTR UpdateAllMenuCommand(WPARAM, LPARAM)
{
- mir_forkthread(ContactLoop, nullptr);
+ mir_forkthread(ContactLoop);
return 0;
}
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h
index eb6ffbf572..ced8d87a81 100644
--- a/plugins/WebView/src/webview.h
+++ b/plugins/WebView/src/webview.h
@@ -222,7 +222,6 @@ void NumSymbols(char *truncated);
INT_PTR AutoUpdateMCmd(WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void AckFunc(void *dummy);
int SiteDeleted(WPARAM wParam, LPARAM lParam);
int WErrorPopup(MCONTACT hContact, wchar_t *textdisplay);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index 0610c9be34..2cf0cdaf5a 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -226,7 +226,7 @@ void SaveToFile(MCONTACT hContact, char *truncated)
char timestring[128], timeprefix[32];
char temptime1[32], temptime2[32];
- time_t ftime = time(nullptr);
+ time_t ftime = time(0);
struct tm *nTime = localtime(&ftime);
mir_snprintf(timeprefix, " %s ", Translate("Last updated on"));
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index ef9ba7fa7e..7340f6a58c 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -270,7 +270,7 @@ void GetData(void *param)
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
memset(&temptime, 0, sizeof(temptime));
memset(&tstr, 0, sizeof(tstr));
- ftime = time(nullptr);
+ ftime = time(0);
nTime = localtime(&ftime);
// 12 hour
if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -289,7 +289,7 @@ void GetData(void *param)
db_get_ws(hContact, "CList", "MyHandle", &dbv);
memset(&temptime, 0, sizeof(temptime));
memset(&tstr, 0, sizeof(tstr));
- ftime = time(nullptr);
+ ftime = time(0);
nTime = localtime(&ftime);
// 12 hour
if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -306,7 +306,7 @@ void GetData(void *param)
db_free(&dbv);
}
- ftime = time(nullptr);
+ ftime = time(0);
nTime = localtime(&ftime);
strncpy_s(timeprefix, _countof(timeprefix), Translate("Last updated on"), _TRUNCATE);
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 0784da7750..5830d5ea65 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -66,7 +66,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
}
if (invalidpresent) {
- srand((unsigned)time(nullptr));
+ srand((unsigned)time(0));
wchar_t ranStr[7];
_itow((int)10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
mir_wstrcat(nick, ranStr);
@@ -298,11 +298,11 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM)
}
/*****************************************************************************/
-static void __cdecl BasicSearchTimerProc(void *pszNick)
+static void __cdecl BasicSearchTimerProc(wchar_t *pszNick)
{
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UNICODE;
- psr.nick.w = (wchar_t*)pszNick;
+ psr.nick.w = pszNick;
// broadcast the search result
ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
@@ -310,7 +310,7 @@ static void __cdecl BasicSearchTimerProc(void *pszNick)
// exit the search
searchId = -1;
- mir_free(psr.nick.w);
+ mir_free(pszNick);
}
INT_PTR BasicSearch(WPARAM, LPARAM lParam)
@@ -321,7 +321,7 @@ INT_PTR BasicSearch(WPARAM, LPARAM lParam)
searchId = 1;
// create a thread for the ID search
- mir_forkthread(BasicSearchTimerProc, mir_wstrdup((const wchar_t*)lParam));
+ mir_forkThread<wchar_t>(BasicSearchTimerProc, mir_wstrdup((const wchar_t*)lParam));
return searchId;
}
@@ -415,7 +415,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
if ((sameurl > 0) || (samename > 0)) // contact has the same url or name as another contact, add rand num to name
{
- srand((unsigned) time(nullptr));
+ srand((unsigned) time(0));
wchar_t ranStr[10];
_itow((int) 10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
@@ -445,15 +445,15 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
}
/*****************************************************************************/
-INT_PTR GetInfo(WPARAM, LPARAM)
-{
- mir_forkthread(AckFunc, nullptr);
- return 1;
-}
-/*****************************************************************************/
-void AckFunc(void*)
+static void __cdecl AckFunc(void*)
{
for (auto &hContact : Contacts(MODULENAME))
ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
+
+INT_PTR GetInfo(WPARAM, LPARAM)
+{
+ mir_forkthread(AckFunc);
+ return 1;
+}
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp
index 897f2af0eb..325f5dc895 100644
--- a/plugins/WhenWasIt/src/date_utils.cpp
+++ b/plugins/WhenWasIt/src/date_utils.cpp
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
time_t Today()
{
- time_t now = time(nullptr);
+ time_t now = time(0);
struct tm* date = localtime(&now);
date->tm_hour = date->tm_min = date->tm_sec = 0;
return mktime(date);
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index efe7248156..4a1c23b575 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -184,7 +184,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*)
INT_PTR RefreshUserDetailsService(WPARAM, LPARAM)
{
- mir_forkthread(RefreshUserDetailsWorkerThread, nullptr);
+ mir_forkthread(RefreshUserDetailsWorkerThread);
return 0;
}
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index 9c807e8643..9d3c338627 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -39,7 +39,7 @@ int Log(char *format, ...)
if (!fout)
return -1;
- time_t tNow = time(nullptr);
+ time_t tNow = time(0);
struct tm *now = localtime(&tNow);
strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now);
fputs(str, fout);
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
index f915b42d00..d3a30d33fa 100644
--- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp
+++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
@@ -212,7 +212,7 @@ void ThreadProc(LPVOID)
static INT_PTR WumfShowConnections(WPARAM,LPARAM)
{
- mir_forkthread(ThreadProc, nullptr);
+ mir_forkthread(ThreadProc);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hWumfBut, 0);
return 0;
}
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp
index 894b0bace0..276d45ef4b 100644
--- a/plugins/YAMN/src/browser/badconnect.cpp
+++ b/plugins/YAMN/src/browser/badconnect.cpp
@@ -286,7 +286,7 @@ INT_PTR RunBadConnectionSvc(WPARAM wParam, LPARAM lParam)
HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
Param->ThreadRunningEV = ThreadRunningEV;
- HANDLE NewThread = mir_forkthread(BadConnection, (void*)Param);
+ HANDLE NewThread = mir_forkthread(BadConnection, Param);
if (nullptr == NewThread)
return 0;
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index d9143ab624..a3d2ace7b4 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -69,7 +69,7 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM)
pd_out->opaque = pd_in->PluginData;
pd_out->timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
+ lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
@@ -110,7 +110,7 @@ static INT_PTR CreatePopupW(WPARAM wParam, LPARAM)
pd_out->opaque = pd_in->PluginData;
pd_out->timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
+ lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
@@ -149,7 +149,7 @@ void ShowPopup(PopupData &pd_in)
StripBBCodesInPlace(pd_out->pwzTitle);
StripBBCodesInPlace(pd_out->pwzText);
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
+ lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
mir_free(pd_out->pwzTitle);
@@ -275,7 +275,7 @@ static INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam)
pd_out.opaque = pd_in->PluginData;
pd_out.timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(nullptr));
+ lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(0));
SendMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)&pd_out);
}
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 53c561aaf2..aa31c69f5f 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -144,7 +144,7 @@ void CDiscordProto::OnCommandChannelUpdated(const JSONNode &pRoot)
GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
gce.ptszText = wszTopic;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
}
}
@@ -226,7 +226,7 @@ void CDiscordProto::OnCommandGuildMemberRemoved(const JSONNode &pRoot)
continue;
GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_PART };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszUID = wszUserId;
Chat_Event(&gce);
}
@@ -260,7 +260,7 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot)
}
GCEVENT gce = { m_szModuleName, it->wszUsername, GC_EVENT_NICK };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszUID = wszUserId;
gce.ptszNick = wszOldNick;
gce.ptszText = gm->wszNick;
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 78eb0a1507..0bb61ed52a 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -114,7 +114,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
Chat_SetStatusbarText(m_szModuleName, wszChannelId, wszTopic);
GCEVENT gce = { m_szModuleName, wszChannelId, GC_EVENT_TOPIC };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszText = wszTopic;
Chat_Event(&gce);
}
@@ -151,7 +151,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
void CDiscordProto::AddUserToChannel(const CDiscordUser &pChannel, const CDiscordGuildMember &pUser)
{
GCEVENT gce = { m_szModuleName, pChannel.wszUsername, GC_EVENT_JOIN };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.dwFlags = GCEF_SILENT;
wchar_t wszUserId[100];
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 5be21385ec..cd890f2514 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -37,7 +37,7 @@ time_t StringToDate(const CMStringW &str)
struct tm T = { 0 };
int boo;
if (swscanf(str, L"%04d-%02d-%02dT%02d:%02d:%02d.%d", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7)
- return time(nullptr);
+ return time(0);
T.tm_year -= 1900;
T.tm_mon--;
@@ -241,7 +241,7 @@ void CDiscordProto::ProcessType(CDiscordUser *pUser, const JSONNode &pRoot)
DB_AUTH_BLOB blob(pUser->hContact, T2Utf(pUser->wszUsername), nullptr, nullptr, szId, nullptr);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(pUser->hContact, PSR_AUTH, 0, (LPARAM)&pre);
diff --git a/protocols/EmLanProto/src/lan.cpp b/protocols/EmLanProto/src/lan.cpp
index 301e2a8284..d7737b2479 100644
--- a/protocols/EmLanProto/src/lan.cpp
+++ b/protocols/EmLanProto/src/lan.cpp
@@ -131,8 +131,8 @@ void CLan::StartListen()
return;
}
- m_hListenThread = mir_forkthread(ListenProc, (void*)this);
- m_hAcceptTCPThread = mir_forkthread(AcceptTCPProc, (void*)this);
+ m_hListenThread = mir_forkthread(ListenProc, this);
+ m_hAcceptTCPThread = mir_forkthread(AcceptTCPProc, this);
if (m_hListenThread == nullptr || m_hAcceptTCPThread == nullptr) {
m_mode = LM_ON;
m_status = LS_CANT_CREATE_THREADS;
@@ -216,7 +216,7 @@ void CLan::AcceptTCP()
tcp_conn->m_addr = addrFrom.sin_addr.S_un.S_addr;
tcp_conn->m_lan = this;
tcp_conn->m_socket = in_socket;
- mir_forkthread(OnInTCPConnectionProc, (void*)tcp_conn);
+ mir_forkthread(OnInTCPConnectionProc, tcp_conn);
Sleep(100);
}
m_hAcceptTCPThread = nullptr;
@@ -252,8 +252,7 @@ SOCKET CLan::CreateTCPConnection(u_long addr, LPVOID lpParameter)
tcp_conn->m_lan = this;
tcp_conn->m_addr = addr;
tcp_conn->m_lpParameter = lpParameter;
-
- mir_forkthread(OnOutTCPConnectionProc, (void*)tcp_conn);
+ mir_forkthread(OnOutTCPConnectionProc, tcp_conn);
return out_socket;
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index e7e6b8963d..948f011e52 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -126,7 +126,7 @@ void CMLan::StartChecking()
for (TContact *cont = m_pRootContact; cont; cont = cont->m_prev)
cont->m_time = MLAN_CHECK + MLAN_TIMEOUT;
- m_hCheckThread = mir_forkthread(CheckProc, (void*)this);
+ m_hCheckThread = mir_forkthread(CheckProc, this);
StartListen();
RequestStatus(true);
}
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index 85aba15848..61c6fcd14a 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -57,7 +57,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE };
gce.ptszText = ttext;
- gce.time = timestamp ? timestamp : ::time(nullptr);
+ gce.time = timestamp ? timestamp : ::time(0);
if (id != nullptr)
gce.bIsMe = !mir_strcmp(id, facy.self_.user_id.c_str());
gce.dwFlags |= GCEF_ADDTOLOG;
@@ -180,7 +180,7 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa
gce.dwFlags = addToLog ? GCEF_ADDTOLOG : 0;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
gce.bIsMe = (user.role == ROLE_ME);
if (user.is_former) {
@@ -213,7 +213,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
gce.bIsMe = false;
Chat_Event(&gce);
@@ -390,7 +390,7 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
GCEVENT gce = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE };
gce.ptszText = messageT;
- gce.time = notification->time ? notification->time : ::time(nullptr);
+ gce.time = notification->time ? notification->time : ::time(0);
gce.bIsMe = false;
gce.dwFlags |= GCEF_ADDTOLOG;
gce.ptszNick = TranslateT("Notifications");
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index ee1049079f..de12e9075f 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -922,7 +922,7 @@ bool facebook_client::activity_ping()
http::response resp = sendRequest(channelRequest(PING));
// Remember this last ping time
- parent->m_pingTS = ::time(nullptr);
+ parent->m_pingTS = ::time(0);
if (resp.data.empty() || resp.data.find("\"t\":\"pong\"") == resp.data.npos) {
// Something went wrong
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 4b54c41187..79a0f5e03b 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -108,7 +108,7 @@ void FacebookProto::ChangeStatus(void*)
if (getByte(FACEBOOK_KEY_EVENT_ON_THIS_DAY_ENABLE, DEFAULT_EVENT_ON_THIS_DAY_ENABLE))
ForkThread(&FacebookProto::ProcessMemories, nullptr);
- setDword(FACEBOOK_KEY_LOGON_TS, (DWORD)time(nullptr));
+ setDword(FACEBOOK_KEY_LOGON_TS, (DWORD)time(0));
ForkThread(&FacebookProto::UpdateLoop, nullptr);
ForkThread(&FacebookProto::MessageLoop, nullptr);
@@ -146,7 +146,7 @@ void FacebookProto::ChangeStatus(void*)
bool isAwayOrInvisible = (new_status == ID_STATUS_AWAY || new_status == ID_STATUS_INVISIBLE);
if (!wasAwayOrInvisible && isAwayOrInvisible) {
// Switching from "not-away" to "away" state, remember timestamp of this change (and if we are idle already, use the idle time)
- m_awayTS = (m_idleTS > 0 ? m_idleTS : ::time(nullptr));
+ m_awayTS = (m_idleTS > 0 ? m_idleTS : ::time(0));
}
else if (wasAwayOrInvisible && !isAwayOrInvisible) {
// Switching from "away" to "not-away" state, reset the timestamp
@@ -182,7 +182,7 @@ bool FacebookProto::NegotiateConnection()
password = mir_utf8encode(password);
// Refresh last time of feeds update
- facy.last_feeds_update_ = ::time(nullptr);
+ facy.last_feeds_update_ = ::time(0);
// Generate random clientid for this connection
facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_);
@@ -196,7 +196,7 @@ bool FacebookProto::NegotiateConnection()
void FacebookProto::UpdateLoop(void *)
{
- time_t tim = ::time(nullptr);
+ time_t tim = ::time(0);
debugLogA(">>> Entering Facebook::UpdateLoop[%d]", tim);
for (int i = -1; !isOffline(); i = (i + 1) % 50) {
@@ -216,7 +216,7 @@ void FacebookProto::UpdateLoop(void *)
void FacebookProto::MessageLoop(void *)
{
- time_t tim = ::time(nullptr);
+ time_t tim = ::time(0);
debugLogA(">>> Entering Facebook::MessageLoop[%d]", tim);
while (facy.channel()) {
@@ -224,7 +224,7 @@ void FacebookProto::MessageLoop(void *)
break;
// If we're not idle, send activity_ping every few minutes...
- if (!m_idleTS && (::time(nullptr) - m_pingTS) > FACEBOOK_PING_TIME) {
+ if (!m_idleTS && (::time(0) - m_pingTS) > FACEBOOK_PING_TIME) {
debugLogA("*** FacebookProto::MessageLoop[%d] pinging...", tim);
facy.activity_ping();
}
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index e3b1bd553a..0fbb9a07ed 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -297,7 +297,7 @@ void FacebookProto::DeleteContactFromServer(void *data)
if (hContact != 0) {
setWord(hContact, "Status", ID_STATUS_OFFLINE);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE);
- setDword(hContact, FACEBOOK_KEY_DELETED, ::time(nullptr));
+ setDword(hContact, FACEBOOK_KEY_DELETED, ::time(0));
}
NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), 0, EVENT_FRIENDSHIP);
diff --git a/protocols/FacebookRM/src/feeds.cpp b/protocols/FacebookRM/src/feeds.cpp
index 9f18df8ec7..e101944654 100644
--- a/protocols/FacebookRM/src/feeds.cpp
+++ b/protocols/FacebookRM/src/feeds.cpp
@@ -52,7 +52,7 @@ HttpRequest* facebook_client::memoriesRequest()
<< CHAR_PARAM("last_section_key", "regular_story")
<< INT_PARAM("__be", -1)
<< CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT64_PARAM("timestamp", ::time(nullptr) * 1000)
+ << INT64_PARAM("timestamp", ::time(0) * 1000)
<< CHAR_PARAM("__dyn", __dyn())
<< CHAR_PARAM("__req", __req())
<< CHAR_PARAM("__rev", __rev())
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 7d6c1c207b..51112635f5 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -979,7 +979,7 @@ int FacebookProto::ParseMessages(std::string &pData, std::vector<facebook_messag
if (!buddyList)
continue;
- time_t offlineThreshold = time(nullptr) - 15 * 60; // contacts last active more than 15 minutes will be marked offline
+ time_t offlineThreshold = time(0) - 15 * 60; // contacts last active more than 15 minutes will be marked offline
for (auto &itNodes : buddyList) {
// Facebook now sends info also about some nonfriends, so we just ignore status change of contacts we don't have in list
@@ -1041,7 +1041,7 @@ int FacebookProto::ParseMessages(std::string &pData, std::vector<facebook_messag
if (!overlay_)
continue;
- time_t offlineThreshold = time(nullptr) - 15 * 60; // contacts last active more than 15 minutes will be marked offline
+ time_t offlineThreshold = time(0) - 15 * 60; // contacts last active more than 15 minutes will be marked offline
for (auto &itNodes : overlay_) {
MCONTACT hContact = ContactIDToHContact(itNodes.name());
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index cb1d42f23b..c8b764ba09 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -81,7 +81,7 @@ extern "C" int __declspec(dllexport) Load(void)
g_strUserAgent = agent.str();
// Initialize random generator (used only as fallback in utils)
- srand(::time(nullptr));
+ srand(::time(0));
return 0;
}
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index b502a1f471..4801f61a56 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -382,7 +382,7 @@ HttpRequest* facebook_client::exitThreadRequest(facebook_chatroom *fbc)
<< CHAR_PARAM("source", "source:chat:web")
<< CHAR_PARAM("thread_fbid", fbc->thread_id.substr(3).c_str())
<< CHAR_PARAM("fb_dtsg", dtsg_.c_str())
- << INT64_PARAM("timestamp", ::time(nullptr) * 1000)
+ << INT64_PARAM("timestamp", ::time(0) * 1000)
<< CHAR_PARAM("__user", self_.user_id.c_str())
<< CHAR_PARAM("__dyn", __dyn())
<< CHAR_PARAM("__req", __req())
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index f52f9087a6..47eba0b4b7 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -122,7 +122,7 @@ void FacebookProto::ProcessFriendList(void*)
// Wasn't we already been notified about this contact?
if (!getDword(hContact, FACEBOOK_KEY_DELETED, 0)) {
- setDword(hContact, FACEBOOK_KEY_DELETED, ::time(nullptr));
+ setDword(hContact, FACEBOOK_KEY_DELETED, ::time(0));
// Notify it, if user wants to be notified
if (getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) {
@@ -1019,7 +1019,7 @@ void FacebookProto::ProcessFriendRequests(void *p)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = ::time(nullptr);
+ dbei.timestamp = ::time(0);
dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = blob.size();
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index d494385cf4..e1c7f3764a 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -31,7 +31,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
update_loop_event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
// Initialize random seed for this client
- facy.random_ = ::time(nullptr) + PtrToUint(&facy);
+ facy.random_ = ::time(0) + PtrToUint(&facy);
m_enableChat = DEFAULT_ENABLE_CHATS;
@@ -362,7 +362,7 @@ int FacebookProto::OnIdleChanged(WPARAM, LPARAM lParam)
Idle_GetInfo(mii);
// Compute time when user really became idle
- m_idleTS = time(nullptr) - mii.idleTime * 60;
+ m_idleTS = time(0) - mii.idleTime * 60;
setDword("IdleTS", m_idleTS);
}
else {
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 6cef8a3e8a..56a834df6d 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -76,9 +76,9 @@ public:
inline int IdleSeconds()
{
if ((m_iStatus == ID_STATUS_AWAY || m_iStatus == ID_STATUS_INVISIBLE) && m_awayTS)
- return time(nullptr) - m_awayTS;
+ return time(0) - m_awayTS;
- return m_idleTS ? time(nullptr) - m_idleTS : 0;
+ return m_idleTS ? time(0) - m_idleTS : 0;
}
bool m_invisible;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index ca86944985..56d81d38fe 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -467,7 +467,7 @@ retry:
}
else {
// Successfully connected
- logonTime = time(nullptr);
+ logonTime = time(0);
setDword(GG_KEY_LOGONTIME, logonTime);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 15, "sess_mutex", 1);
m_sess = local_sess;
@@ -636,7 +636,7 @@ retry:
mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
@@ -698,7 +698,7 @@ retry:
delSetting(GG_KEY_PD_FAMILYCITY);
if (__birthyear) {
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
if (br > 0)
@@ -815,7 +815,7 @@ retry:
UIN2IDT(e->event.msg.sender, id);
GCEVENT gce = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- time_t t = time(nullptr);
+ time_t t = time(0);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
@@ -830,7 +830,7 @@ retry:
// Check if not empty message ( who needs it? )
else if (!e->event.msg.recipients_count && e->event.msg.message && *e->event.msg.message && mir_strcmp(e->event.msg.message, "\xA0\0")) {
PROTORECVEVENT pre = { 0 };
- time_t t = time(nullptr);
+ time_t t = time(0);
pre.timestamp = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
pre.szMessage = e->event.msg.message;
ProtoChainRecvMsg(getcontact(e->event.msg.sender, 1, 0, nullptr), &pre);
@@ -949,7 +949,7 @@ retry:
sessions_updatedlg();
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
{
- const wchar_t* szText = time(nullptr) - logonTime > 3
+ const wchar_t* szText = time(0) - logonTime > 3
? TranslateT("You have logged in at another location")
: TranslateT("You are logged in at another location");
for (i = 0; i < e->event.multilogon_info.count; i++)
@@ -1041,7 +1041,7 @@ retry:
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)dcc7;
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index eb25e14c6d..6a8ff9ee89 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -113,7 +113,7 @@ HANDLE ftfail(GaduProto *gg, MCONTACT hContact)
#ifdef DEBUGMODE
gg->debugLogA("ftfail(): Failing file transfer...");
#endif
- srand(time(nullptr));
+ srand(time(0));
ft->hProcess = (HANDLE)rand();
ft->hContact = hContact;
#ifdef DEBUGMODE
@@ -397,7 +397,7 @@ void __cdecl GaduProto::dccmainthread(void*)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)local_dcc;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 513e99df61..cca61e74bb 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -414,7 +414,7 @@ HWND GaduProto::SearchAdvanced(HWND hwndDlg)
if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
int ay = lt->tm_year + 1900;
char age[16];
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index d46c8584df..1b76e3b09e 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -168,7 +168,7 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam)
while (lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc--] = 0;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->ptszID, gch->ptszText);
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 2dc6c14b41..eb534d71b9 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -867,7 +867,7 @@ int GaduProto::img_displayasmsg(MCONTACT hContact, void *img)
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.szMessage = szMessage;
ProtoChainRecvMsg(hContact, &pre);
debugLogW(L"img_displayasmsg(): Image saved to %s.", szPath);
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index caa854ff6a..400e7a5ed8 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -210,7 +210,7 @@ char* oauth_generate_nonce()
char randnum[16];
Utils_GetRandom(randnum, sizeof(randnum));
- CMStringA str(FORMAT, "%ld%s", time(nullptr), randnum);
+ CMStringA str(FORMAT, "%ld%s", time(0), randnum);
BYTE digest[16];
mir_md5_hash((BYTE*)str.GetString(), str.GetLength(), digest);
@@ -243,7 +243,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD
};
char timestamp[22];
- mir_snprintf(timestamp, "%ld", time(nullptr));
+ mir_snprintf(timestamp, "%ld", time(0));
oauth_setparam(oauth_parameters, "oauth_timestamp", timestamp);
oauth_setparam(oauth_parameters, "oauth_nonce", ptrA(oauth_generate_nonce()));
if (token != nullptr && *token)
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp
index 5a63f88825..821a94c7d0 100644
--- a/protocols/ICQCorp/src/protocol.cpp
+++ b/protocols/ICQCorp/src/protocol.cpp
@@ -696,7 +696,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(nullptr));
+ processSystemMessage(packet, checkUin, newCommand, time(0));
break;
case ICQ_CMDxRCV_SYSxMSGxDONE: // end of system messages
@@ -777,7 +777,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(nullptr));
+ processSystemMessage(packet, checkUin, newCommand, time(0));
break;
case ICQ_CMDxRCV_BROADCASTxDONE:
@@ -1773,7 +1773,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addMessage(u, message, time(nullptr));
+ addMessage(u, message, time(0));
break;
case ICQ_CMDxTCP_CHAT:
@@ -1794,7 +1794,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addUrl(u, message, time(nullptr));
+ addUrl(u, message, time(0));
break;
case ICQ_CMDxTCP_FILE:
@@ -1810,7 +1810,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
Netlib_Logf(hNetlibUser, "[tcp] file transfer request from %d (%d)\n", checkUin, theTCPSequence);
- addFileReq(u, message, fileName, size, theTCPSequence, time(nullptr));
+ addFileReq(u, message, fileName, size, theTCPSequence, time(0));
delete[] fileName;
break;
@@ -1894,7 +1894,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
case ICQ_CMDxTCP_READxDNDxMSG:
case ICQ_CMDxTCP_READxFREECHATxMSG:
packet >> theTCPSequence;
- addAwayMsg(u, message, theTCPSequence, time(nullptr));
+ addAwayMsg(u, message, theTCPSequence, time(0));
break;
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 52d369a5ba..081d6d6e0a 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -73,7 +73,7 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
if (!ppro->m_info.sServerName.IsEmpty())
mir_snwprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
else
- mir_snwprintf(temp2, L"PING %u", time(nullptr));
+ mir_snwprintf(temp2, L"PING %u", time(0));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -226,7 +226,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.pBlob = (PBYTE)mir_utf8encodeW(S);
dbei.cbBlob = (DWORD)mir_strlen((char*)dbei.pBlob) + 1;
@@ -704,7 +704,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage *pmsg)
MCONTACT hContact = CList_AddContact(&user, false, true);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = mir_utf8encodeW(mess);
setWString(hContact, "User", pmsg->prefix.sUser);
setWString(hContact, "Host", pmsg->prefix.sHost);
@@ -843,7 +843,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
// incoming TIME
else if (pmsg->m_bIncoming && command == L"time") {
wchar_t temp[300];
- time_t tim = time(nullptr);
+ time_t tim = time(0);
mir_wstrncpy(temp, _wctime(&tim), 25);
PostIrcMessage(L"/NOTICE %s \001TIME %s\001", pmsg->prefix.sNick.c_str(), temp);
@@ -1163,7 +1163,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.fileCount = 1;
pre.files.w = &tszTemp;
pre.lParam = (LPARAM)di;
@@ -1204,7 +1204,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
}
if (pmsg->m_bIncoming && command == L"ping") {
SetActiveWindow(m_whoisDlg->GetHwnd());
- int s = (int)time(nullptr) - (int)_wtol(GetWordAddress(mess, 1));
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess, 1));
wchar_t szTmp[30];
if (s == 1)
mir_snwprintf(szTmp, TranslateT("%u second"), s);
@@ -1219,7 +1219,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
//... else show the reply in the current window
if (pmsg->m_bIncoming && command == L"ping") {
- int s = (int)time(nullptr) - (int)_wtol(GetWordAddress(mess, 1));
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess, 1));
mir_snwprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false);
}
@@ -1316,7 +1316,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg)
else
btOwnMode = 0;
}
- gce.time = gce.bIsMe ? time(nullptr) : 0;
+ gce.time = gce.bIsMe ? time(0) : 0;
Chat_Event(&gce);
DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp, nullptr, nullptr, nullptr, ID_STATUS_ONLINE, FALSE, FALSE);
@@ -2393,7 +2393,7 @@ int CIrcProto::DoPerform(const char* event)
if (!my_strstri(dbv.ptszVal, L"/away"))
PostIrcMessageWnd(nullptr, NULL, dbv.ptszVal);
else
- mir_forkthread(AwayWarningThread, nullptr);
+ mir_forkthread(AwayWarningThread);
db_free(&dbv);
return 1;
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 8b7bec22e7..169dbc4153 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -585,7 +585,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
// if it is not dcc or if it is dcc and a local ip exist
if (mir_wstrcmpi(two.c_str(), L"dcc") != 0 || ulAdr) {
if (mir_wstrcmpi(two.c_str(), L"ping") == 0)
- mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(nullptr));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(0));
else
mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
PostIrcMessageWnd(window, hContact, szTemp);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index 5ffb9c22f1..04b56f2c6a 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -574,11 +574,11 @@ void CIrcProto::CheckDCCTimeout(void)
mir_cslock lck(m_dcc);
for (auto &p : m_dcc_chats)
- if (time(nullptr) > p->tLastActivity + DCCCHATTIMEOUT)
+ if (time(0) > p->tLastActivity + DCCCHATTIMEOUT)
p->Disconnect();
for (auto &p : m_dcc_xfers)
- if (time(nullptr) > p->tLastActivity + DCCSENDTIMEOUT)
+ if (time(0) > p->tLastActivity + DCCSENDTIMEOUT)
p->Disconnect();
}
@@ -719,7 +719,7 @@ CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) :
con(nullptr),
hBindPort(nullptr)
{
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
di = pdci; // Setup values passed to the constructor
@@ -783,7 +783,7 @@ CDccSession::~CDccSession() // destroy all that needs destroying
int CDccSession::NLSend(const unsigned char* buf, int cbBuf)
{
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
if (con)
return Netlib_Send(con, (const char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP);
@@ -798,7 +798,7 @@ int CDccSession::NLReceive(const unsigned char* buf, int cbBuf)
if (con)
n = Netlib_Recv(con, (char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP);
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
return n;
}
@@ -863,7 +863,7 @@ int CDccSession::SetupConnection()
pfts.pszFiles.w = file;
pfts.totalProgress = 0;
pfts.currentFileProgress = 0;
- pfts.currentFileTime = (unsigned long)time(nullptr);
+ pfts.currentFileTime = (unsigned long)time(0);
}
// create a listening socket for outgoing chat/send requests. The remote computer connects to this computer. Used for both chat and filetransfer.
@@ -1084,7 +1084,7 @@ void CDccSession::DoSendFile()
// initial ack to set the 'percentage-ready meter' to the correct value
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
// create a packet receiver to handle receiving ack's from the remote computer.
HANDLE hPackrcver = Netlib_CreatePacketReceiver(con, sizeof(DWORD));
@@ -1155,8 +1155,8 @@ void CDccSession::DoSendFile()
}
// update the filetransfer dialog's 'percentage-ready meter' once per second only to save cpu
- if (tLastPercentageUpdate < time(nullptr)) {
- tLastPercentageUpdate = time(nullptr);
+ if (tLastPercentageUpdate < time(0)) {
+ tLastPercentageUpdate = time(0);
pfts.totalProgress = dwTotal;
pfts.currentFileProgress = dwTotal;
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
@@ -1177,7 +1177,7 @@ void CDccSession::DoSendFile()
}
// ack the progress one final time
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
pfts.totalProgress = dwTotal;
pfts.currentFileProgress = dwTotal;
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
@@ -1252,8 +1252,8 @@ void CDccSession::DoReceiveFile()
// sets the 'last update time' to check for timed out connections, and also make sure we only
// ack the 'percentage-ready meter' only once a second to save CPU.
- if (tLastPercentageUpdate < time(nullptr)) {
- tLastPercentageUpdate = time(nullptr);
+ if (tLastPercentageUpdate < time(0)) {
+ tLastPercentageUpdate = time(0);
pfts.totalProgress = dwTotal;
pfts.currentFileProgress = dwTotal;
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
@@ -1323,7 +1323,7 @@ void CDccSession::DoChatReceive()
if (*pStart) {
// send it off to some messaging module
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = pStart;
ProtoChainRecvMsg(di->hContact, &pre);
}
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index ee3c57ab90..8de2060953 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -64,11 +64,10 @@ static void __stdcall OnHook(void * pi)
delete gch;
}
-static void __cdecl GuiOutThread(LPVOID di)
+static void __cdecl GuiOutThread(GCHOOK *gch)
{
Thread_SetName("IRC: GuiOutThread");
- GCHOOK* gch = (GCHOOK*)di;
- CallFunctionAsync(OnHook, (void*)gch);
+ CallFunctionAsync(OnHook, gch);
}
INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
@@ -100,7 +99,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
else
gchook->pszModule = nullptr;
- mir_forkthread(GuiOutThread, gchook);
+ mir_forkThread<GCHOOK>(GuiOutThread, gchook);
return 0;
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 96434c7150..311e5bf494 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -395,7 +395,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
gce.dwItemData = dwItemData;
if (timestamp == 1)
- gce.time = time(nullptr);
+ gce.time = time(0);
else
gce.time = timestamp;
gce.bIsMe = bIsMe;
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 0529e63153..72831b3a3c 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -126,7 +126,7 @@ void CWhoisDlg::OnPing(CCtrlButton*)
wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
- m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(nullptr));
+ m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(0));
}
void CWhoisDlg::OnUserInfo(CCtrlButton*)
diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp
index 41e3046a55..05cbc27d74 100644
--- a/protocols/IcqOscarJ/src/chan_05ping.cpp
+++ b/protocols/IcqOscarJ/src/chan_05ping.cpp
@@ -33,7 +33,7 @@ void CIcqProto::handlePingChannel(BYTE*, size_t)
void CIcqProto::StartKeepAlive(serverthread_info *info)
{
if (getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED))
- info->tmPing = time(nullptr) + KEEPALIVE_INTERVAL;
+ info->tmPing = time(0) + KEEPALIVE_INTERVAL;
else
info->tmPing = -1;
}
@@ -48,7 +48,7 @@ void CIcqProto::CheckKeepAlive(serverthread_info *info)
if (info->tmPing == -1)
return;
- if (time(nullptr) >= info->tmPing) {
+ if (time(0) >= info->tmPing) {
// Send a keep alive packet to server
icq_packet packet = { 0 };
write_flap(&packet, ICQ_PING_CHAN);
diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp
index 0eb4dcc2fd..f63b6d35c8 100644
--- a/protocols/IcqOscarJ/src/cookies.cpp
+++ b/protocols/IcqOscarJ/src/cookies.cpp
@@ -31,7 +31,7 @@
void CIcqProto::RemoveExpiredCookies()
{
- time_t tNow = time(nullptr);
+ time_t tNow = time(0);
auto T = cookies.rev_iter();
for (auto &it : T)
@@ -53,7 +53,7 @@ DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, MCONTACT hContact, void
p->dwCookie = dwThisSeq;
p->hContact = hContact;
p->pvExtra = pvExtra;
- p->dwTime = time(nullptr);
+ p->dwTime = time(0);
cookies.insert(p);
return dwThisSeq;
@@ -210,7 +210,7 @@ void CIcqProto::InitMessageCookie(cookie_message_data *pCookie)
do {
// ensure that message ids are unique
- dwMsgID1 = time(nullptr);
+ dwMsgID1 = time(0);
dwMsgID2 = RandRange(0, 0x0FFFF);
}
while (FindMessageCookie(dwMsgID1, dwMsgID2, nullptr, nullptr, nullptr));
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index c77b939f51..9d1c54a498 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -272,7 +272,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade
if (dwValue) setDword("MemberTS", dwValue);
dwValue = chain->getDWord(0x03, 1);
- setDword("LogonTS", dwValue ? dwValue : time(nullptr));
+ setDword("LogonTS", dwValue ? dwValue : time(0));
disposeChain(&chain);
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp
index 60ce774fd8..b1ba4e3b0b 100644
--- a/protocols/IcqOscarJ/src/fam_02location.cpp
+++ b/protocols/IcqOscarJ/src/fam_02location.cpp
@@ -248,7 +248,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, size_t wLen, DWORD dwCook
PROTORECVEVENT pre = { 0 };
pre.szMessage = szMsg ? szMsg : (char *)"";
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = dwCookie;
ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp
index 19fcabec05..403e515182 100644
--- a/protocols/IcqOscarJ/src/fam_03buddy.cpp
+++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp
@@ -624,7 +624,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen)
void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, oscar_tlv_chain *pChain)
{
- DWORD dwStatusNoteTS = time(nullptr);
+ DWORD dwStatusNoteTS = time(0);
BYTE *pStatusNoteTS, *pStatusNote;
WORD wStatusNoteTSLen, wStatusNoteLen;
BYTE bStatusNoteFlags;
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp
index 71ac7a1a8e..5f56395682 100644
--- a/protocols/IcqOscarJ/src/fam_04message.cpp
+++ b/protocols/IcqOscarJ/src/fam_04message.cpp
@@ -318,7 +318,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char
}
}
- dwRecvTime = (DWORD)time(nullptr);
+ dwRecvTime = (DWORD)time(0);
{ // Check if the message was received as offline
cookie_offline_messages *cookie;
@@ -346,7 +346,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char
debugLogA("Message (format 1) received");
// Save tick value
- setDword(hContact, "TickTS", time(nullptr) - (dwMsgID1 / 1000));
+ setDword(hContact, "TickTS", time(0) - (dwMsgID1 / 1000));
}
else debugLogA("Message (format %u) - Ignoring empty message", 1);
@@ -457,7 +457,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char
// Save tick value
BYTE bClientID = getByte(hContact, "ClientID", 0);
if (bClientID == CLID_GENERIC || bClientID == CLID_ICQ6)
- setDword(hContact, "TickTS", time(nullptr) - (dwMsgID1 / 1000));
+ setDword(hContact, "TickTS", time(0) - (dwMsgID1 / 1000));
else
setDword(hContact, "TickTS", 0);
}
@@ -687,7 +687,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, size_t wLen, MCONTACT hContac
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = bMsgType;
pMsgAck.bFlags = bFlags;
- handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, bMsgType, bFlags, wAckType, wLen, wMsgLen, (char*)pDataBuf, 0, &pMsgAck);
+ handleMessageTypes(dwUin, szUID, time(0), dwMsgID1, dwMsgID2, wCookie, wVersion, bMsgType, bFlags, wAckType, wLen, wMsgLen, (char*)pDataBuf, 0, &pMsgAck);
break;
}
}
@@ -852,7 +852,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUi
if (m_iStatus == ID_STATUS_NA)
nMsgType = MTYPE_AUTONA;
}
- handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, nMsgType, bFlags, wAckType, dwLengthToEnd, 0, (char*)pDataBuf, MTF_PLUGIN | MTF_STATUS_EXTENDED, nullptr);
+ handleMessageTypes(dwUin, szUID, time(0), dwMsgID1, dwMsgID2, wCookie, wVersion, nMsgType, bFlags, wAckType, dwLengthToEnd, 0, (char*)pDataBuf, MTF_PLUGIN | MTF_STATUS_EXTENDED, nullptr);
}
else if (nTypeId) {
if (!dwUin) { // AIM cannot send this, just sanity
@@ -868,7 +868,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUi
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = nTypeId;
pMsgAck.bFlags = bFlags;
- handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, nTypeId, bFlags, wAckType, dwLengthToEnd, dwDataLen, (char*)pDataBuf, MTF_PLUGIN, &pMsgAck);
+ handleMessageTypes(dwUin, szUID, time(0), dwMsgID1, dwMsgID2, wCookie, wVersion, nTypeId, bFlags, wAckType, dwLengthToEnd, dwDataLen, (char*)pDataBuf, MTF_PLUGIN, &pMsgAck);
}
else debugLogA("Unsupported plugin message type %d", nTypeId);
}
@@ -1035,7 +1035,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c
icq_sendContactsAck(dwUin, szUID, dwID1, dwID2);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = (char *)contacts;
pre.lParam = nContacts;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
@@ -1105,7 +1105,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, size_t wLen, DWORD dwUin, char
debugLogA("User %u probably checks his ignore state.", dwUin);
else {
cookie_offline_messages *cookie;
- DWORD dwRecvTime = (DWORD)time(nullptr);
+ DWORD dwRecvTime = (DWORD)time(0);
if (!(dwRef & 0x80000000) && FindCookie(dwRef, nullptr, (void**)&cookie)) {
WORD wTimeTLVType;
@@ -1414,7 +1414,7 @@ void CIcqProto::handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DW
// it is probably UTF-8 status reply
PROTORECVEVENT pre = { 0 };
pre.szMessage = (char*)szMsg;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = wCookie;
ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
}
@@ -2496,7 +2496,7 @@ void CIcqProto::handleMissedMsg(BYTE *buf, size_t wLen)
// Create event to notify user
int bAdded;
- AddEvent(HContactFromUID(dwUin, szUid, &bAdded), ICQEVENTTYPE_MISSEDMESSAGE, time(nullptr), 0, sizeof(wError), (PBYTE)&wError);
+ AddEvent(HContactFromUID(dwUin, szUid, &bAdded), ICQEVENTTYPE_MISSEDMESSAGE, time(0), 0, sizeof(wError), (PBYTE)&wError);
}
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 55053359fb..823156c3b1 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -1398,7 +1398,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, size_t wLen)
// TODO: Change for new auth system, include all known informations
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -1458,7 +1458,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen)
*(char*)pCurBlob = 0;
// TODO: Change for new auth system
- AddEvent(NULL, EVENTTYPE_ADDED, time(nullptr), 0, cbBlob, pBlob);
+ AddEvent(NULL, EVENTTYPE_ADDED, time(0), 0, cbBlob, pBlob);
}
void CIcqProto::handleRecvAuthResponse(unsigned char *buf, size_t wLen)
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
index 3a58297543..d21d3de17f 100644
--- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp
+++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
@@ -910,7 +910,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain
else if (bHasMetaToken || !hContact)
writeDbInfoSettingTLVDouble(hContact, DBSETTING_METAINFO_SAVED, cDetails, 0x1CC);
else
- setDword(hContact, DBSETTING_METAINFO_SAVED, time(nullptr));
+ setDword(hContact, DBSETTING_METAINFO_SAVED, time(0));
}
if (wReplySubType == META_DIRECTORY_RESPONSE)
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index c3d6b5792f..d05ed0d772 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -875,7 +875,7 @@ void avatars_server_connection::checkRequestQueue()
void avatars_server_connection::connectionThread()
{
// This is the "infinite" loop that receives the packets from the ICQ avatar server
- DWORD dwLastKeepAlive = time(nullptr) + KEEPALIVE_INTERVAL;
+ DWORD dwLastKeepAlive = time(0) + KEEPALIVE_INTERVAL;
hPacketRecver = Netlib_CreatePacketReceiver(hConnection, 65536);
@@ -893,14 +893,14 @@ void avatars_server_connection::connectionThread()
if (Miranda_IsTerminated())
break;
- if (time(nullptr) >= dwLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well)
+ if (time(0) >= dwLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well)
if (!ppro->m_bGatewayMode && ppro->getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED)) { // send keep-alive packet
icq_packet packet;
packet.wLen = 0;
write_flap(&packet, ICQ_PING_CHAN);
sendServerPacket(&packet);
}
- dwLastKeepAlive = time(nullptr) + KEEPALIVE_INTERVAL;
+ dwLastKeepAlive = time(0) + KEEPALIVE_INTERVAL;
}
// check if we got something to request
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp
index 9872dbd9d6..77f34665a0 100644
--- a/protocols/IcqOscarJ/src/icq_direct.cpp
+++ b/protocols/IcqOscarJ/src/icq_direct.cpp
@@ -190,7 +190,7 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi)
size_t nSkipPacketBytes = 0;
DWORD dwReqMsgID1 = 0, dwReqMsgID2 = 0;
- srand(time(nullptr));
+ srand(time(0));
{
// add to DC connection list
mir_cslock l(directConnListMutex);
diff --git a/protocols/IcqOscarJ/src/icq_directmsg.cpp b/protocols/IcqOscarJ/src/icq_directmsg.cpp
index 2b880cfb58..60c056c866 100644
--- a/protocols/IcqOscarJ/src/icq_directmsg.cpp
+++ b/protocols/IcqOscarJ/src/icq_directmsg.cpp
@@ -136,7 +136,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen)
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = bMsgType;
pMsgAck.bFlags = bMsgFlags;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 0, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, &pMsgAck);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 0, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, &pMsgAck);
break;
}
}
@@ -148,7 +148,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen)
buf -= wTextLen;
wLen += wTextLen;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 2, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, nullptr);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 2, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, nullptr);
}
else {
MCONTACT hCookieContact;
@@ -251,7 +251,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t
pMsgAck.pDC = dc;
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = typeId;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, typeId, 0, 0, dwLengthToEnd, dwDataLength, (char*)buf, MTF_PLUGIN | MTF_DIRECT, &pMsgAck);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, typeId, 0, 0, dwLengthToEnd, dwDataLength, (char*)buf, MTF_PLUGIN | MTF_DIRECT, &pMsgAck);
}
else if (typeId == MTYPE_STATUSMSGEXT && wCommand == DIRECT_ACK) { // especially for icq2003b
NetLog_Direct("This is extended status reply");
@@ -261,7 +261,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t
szMsg[dwDataLength] = '\0';
uid_str szUID;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)(qt + 0xE7), 3, 2, wLen, dwDataLength, szMsg, MTF_PLUGIN | MTF_DIRECT, nullptr);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, (int)(qt + 0xE7), 3, 2, wLen, dwDataLength, szMsg, MTF_PLUGIN | MTF_DIRECT, nullptr);
}
else if (typeId && wCommand == DIRECT_ACK) {
MCONTACT hCookieContact;
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp
index 9af0b9203c..c6452896f3 100644
--- a/protocols/IcqOscarJ/src/icq_filerequests.cpp
+++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp
@@ -157,7 +157,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp
index 4bfafdb33c..518e496b92 100644
--- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp
+++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp
@@ -81,7 +81,7 @@ BOOL CIcqProto::icq_QueueUser(MCONTACT hContact)
if (dwUin) {
m_infoUpdateList[nFirstFree].dwUin = dwUin;
m_infoUpdateList[nFirstFree].hContact = hContact;
- m_infoUpdateList[nFirstFree].queued = time(nullptr);
+ m_infoUpdateList[nFirstFree].queued = time(0);
nInfoUserCount++;
debugLogA("Queued user %u, place %u, count %u", dwUin, nFirstFree, nInfoUserCount);
@@ -179,7 +179,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* )
continue; // we can't send requests now
if (nInfoUserCount && icqOnline()) {
- time_t now = time(nullptr);
+ time_t now = time(0);
BOOL bNotReady = FALSE, bTimeOuted = FALSE;
// Check the list, take only users that were there for at least 5sec
diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp
index dfc42bbe7c..c34acddfc8 100644
--- a/protocols/IcqOscarJ/src/icq_rates.cpp
+++ b/protocols/IcqOscarJ/src/icq_rates.cpp
@@ -299,10 +299,9 @@ rates_queue::~rates_queue()
cleanup();
}
-static void rateDelayThread(void *param)
+static void rateDelayThread(rates_queue *pQueue)
{
Thread_SetName("ICQ: rateDelayThread");
- rates_queue *pQueue = (rates_queue*)param;
pQueue->handleDelay();
}
@@ -311,7 +310,7 @@ void rates_queue::initDelay(int nDelay)
ppro->debugLogA("Rates: Delay %dms", nDelay);
scheduledDelay = nDelay;
- mir_forkthread(rateDelayThread, this);
+ mir_forkThread<rates_queue>(rateDelayThread, this);
}
void rates_queue::handleDelay()
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp
index 2839d7c435..942a9e0d73 100644
--- a/protocols/IcqOscarJ/src/icq_server.cpp
+++ b/protocols/IcqOscarJ/src/icq_server.cpp
@@ -45,7 +45,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
// store server port
info.wServerPort = infoParam->nloc.wPort;
- srand(time(nullptr));
+ srand(time(0));
ResetSettingsOnConnect();
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index 1720be39bb..9e9bb3ad6b 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -84,7 +84,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param)
// first check if the state is calm
while (*queueState) {
int i;
- time_t tNow = time(nullptr);
+ time_t tNow = time(0);
int bFound = FALSE;
for (i = 0; i < servlistQueueCount; i++) { // check if we do not have some expired items to handle, otherwise keep sleeping
@@ -285,7 +285,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT
}
if (!pItem) { // compatible item was not found, create new one, add to queue
pItem = (ssiqueueditems*)SAFE_MALLOC(sizeof(ssiqueueditems));
- pItem->tAdded = time(nullptr);
+ pItem->tAdded = time(0);
pItem->dwTimeout = dwTimeout;
if (servlistQueueCount == servlistQueueSize) { // resize the queue - it is too small
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp
index 0782eedecd..960a0baa9a 100644
--- a/protocols/IcqOscarJ/src/icq_xtraz.cpp
+++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp
@@ -330,7 +330,7 @@ void CIcqProto::handleXtrazData(DWORD dwUin, char* szMsg, BOOL bThruDC)
// Create message to notify user
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.szMessage = szWork;
int bAdded;
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
index 3dc43813fe..1a5f54c28b 100644
--- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp
+++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
@@ -425,7 +425,7 @@ int CIcqProto::OnIdleChanged(WPARAM, LPARAM lParam)
if (bPrivacy)
return 0;
- setDword("IdleTS", bIdle ? time(nullptr) : 0);
+ setDword("IdleTS", bIdle ? time(0) : 0);
if (m_bTempVisListEnabled) // remove temporary visible users
sendEntireListServ(ICQ_BOS_FAMILY, ICQ_CLI_REMOVETEMPVISIBLE, BUL_TEMPVISIBLE);
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index bf88320592..3f6a516c70 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -78,7 +78,7 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- srand(time(nullptr));
+ srand(time(0));
_tzset();
// Initialize charset conversion routines
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index 22e6d6dcd1..4c1d7cc317 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -479,7 +479,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp
index b9b97b89a8..f098af95cb 100644
--- a/protocols/IcqOscarJ/src/stdpackets.cpp
+++ b/protocols/IcqOscarJ/src/stdpackets.cpp
@@ -1342,7 +1342,7 @@ DWORD CIcqProto::icq_sendSMSServ(const char *szPhoneNumber, const char *szMsg)
WORD wBufferLen;
char *szBuffer = nullptr;
char szTime[30];
- time_t now = time(nullptr);
+ time_t now = time(0);
strftime(szTime, sizeof(szTime), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
/* Sun, 00 Jan 0000 00:00:00 GMT */
@@ -1571,7 +1571,7 @@ void CIcqProto::icq_sendAuthResponseServ(DWORD dwUin, char* szUid, int auth, con
void CIcqProto::icq_sendYouWereAddedServ(DWORD dwUin, DWORD dwMyUin)
{
- DWORD dwID1 = time(nullptr);
+ DWORD dwID1 = time(0);
DWORD dwID2 = RandRange(0, 0x00FF);
icq_packet packet;
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index cc3ce357b1..9e6c898bd1 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -946,7 +946,7 @@ int CIcqProto::IsMetaInfoChanged(MCONTACT hContact)
db_free(&infoSaved);
- if ((time(nullptr) - dwInfoTime) > 14 * 3600 * 24) {
+ if ((time(0) - dwInfoTime) > 14 * 3600 * 24) {
res = 3; // threshold exceeded
}
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index e989a1e4d3..c7a739b642 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -234,7 +234,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
gce.ptszUID = user->m_tszResourceName;
gce.ptszText = buf;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
}
}
@@ -263,7 +263,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
gce.ptszText = szReason;
if (item->bChatActive == 2) {
gce.dwFlags |= GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
}
switch (gce.iType = action) {
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 3316875e72..f8bf39701c 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -189,7 +189,7 @@ int CJabberProto::OnIdleChanged(WPARAM, LPARAM lParam)
if (lParam & IDF_ISIDLE) {
MIRANDA_IDLE_INFO mii;
Idle_GetInfo(mii);
- m_tmJabberIdleStartTime = time(nullptr) - mii.idleTime * 60;
+ m_tmJabberIdleStartTime = time(0) - mii.idleTime * 60;
}
else m_tmJabberIdleStartTime = 0;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index b729e79206..698248a5f3 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -377,7 +377,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.files.w = (wchar_t**)&filename;
pre.lParam = (LPARAM)ft;
if ((n = XmlGetChild(fileNode, "desc")) != nullptr)
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 89c1f215ed..4deab1e08d 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -800,7 +800,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *
GCEVENT gce = { m_szModuleName, item->jid, GC_EVENT_NICK };
if (jid != nullptr)
gce.ptszUserInfo = jid;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszNick = oldNick;
gce.ptszUID = newNick;
gce.ptszText = newNick;
@@ -1095,7 +1095,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
}
bool isHistory = msgTime != 0;
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime || msgTime > now)
msgTime = now;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 92f4492ee4..942e257746 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -57,7 +57,7 @@ BOOL CJabberProto::OnIqRequestLastActivity(HXML, CJabberIqInfo *pInfo)
{
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo) << XQUERY(JABBER_FEAT_LAST_ACTIVITY)
- << XATTRI(L"seconds", m_tmJabberIdleStartTime ? time(nullptr) - m_tmJabberIdleStartTime : 0));
+ << XATTRI(L"seconds", m_tmJabberIdleStartTime ? time(0) - m_tmJabberIdleStartTime : 0));
return TRUE;
}
@@ -376,7 +376,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
PROTORECVFILE pre;
pre.dwFlags = PRFF_UNICODE;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = desc;
pre.files.w = &str2;
pre.fileCount = 1;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index e98ae24c1e..099b8b8d7f 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -174,7 +174,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq)
void CJabberProto::OnLoggedIn()
{
m_bJabberOnline = true;
- m_tmJabberLoggedInTime = time(nullptr);
+ m_tmJabberLoggedInTime = time(0);
m_ThreadInfo->dwLoginRqs = 0;
@@ -1587,7 +1587,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo)
if (szSeconds) {
int nSeconds = _wtoi(szSeconds);
if (nSeconds > 0)
- lastActivity = time(nullptr) - nSeconds;
+ lastActivity = time(0) - nSeconds;
}
const wchar_t *szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 440cf657cf..d3a9570255 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -52,7 +52,7 @@ void CJabberProto::DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = blob.size();
@@ -123,7 +123,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType)
dbei.cbBlob = sizeof(btEventType);
dbei.eventType = EVENTTYPE_JABBER_PRESENCE;
dbei.flags = DBEF_READ;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.szModule = m_szModuleName;
db_event_add(hContact, &dbei);
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp
index f03d80d3fb..f52b0340fc 100755
--- a/protocols/JabberG/src/jabber_omemo.cpp
+++ b/protocols/JabberG/src/jabber_omemo.cpp
@@ -590,7 +590,7 @@ namespace omemo {
session_signed_pre_key* signed_pre_key;
{
const unsigned int signed_pre_key_id = 1;
- signal_protocol_key_helper_generate_signed_pre_key(&signed_pre_key, new_dev->device_key, signed_pre_key_id, time(nullptr), global_context);
+ signal_protocol_key_helper_generate_signed_pre_key(&signed_pre_key, new_dev->device_key, signed_pre_key_id, time(0), global_context);
SIGNAL_UNREF(new_dev->device_key);
signal_buffer *serialized_signed_pre_key;
session_signed_pre_key_serialize(&serialized_signed_pre_key, signed_pre_key);
@@ -1868,7 +1868,7 @@ bool CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime)
}
}
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime)
msgTime = now;
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 9ea5605e9c..1808615c7e 100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -590,7 +590,7 @@ private:
void cbServer_OnDropdown(CCtrlCombo*)
{
if (!m_gotservers)
- mir_forkthread(QueryServerListThread, this);
+ mir_forkThread<CDlgOptAccount>(QueryServerListThread, this);
}
void chkManualHost_OnChange(CCtrlData *sender)
@@ -710,11 +710,10 @@ private:
mir_free(server);
}
- static void QueryServerListThread(void *arg)
+ static void __cdecl QueryServerListThread(CDlgOptAccount *wnd)
{
Thread_SetName("Jabber: QueryServerListThread");
- CDlgOptAccount *wnd = (CDlgOptAccount *)arg;
HWND hwnd = wnd->GetHwnd();
bool bIsError = true;
@@ -1853,7 +1852,7 @@ private:
void cbServer_OnDropdown(CCtrlCombo*)
{
if (!m_gotservers)
- mir_forkthread(QueryServerListThread, this);
+ mir_forkThread<CJabberDlgAccMgrUI>(QueryServerListThread, this);
}
void cbType_OnChange(CCtrlData *sender)
@@ -1897,334 +1896,315 @@ private:
}
}
- void CheckRegistration();
- void setupConnection(int type);
- void setupPublic();
- void setupSecure();
- void setupSecureSSL();
- void setupGoogle();
- void setupHipchat();
- void setupLJ();
- void setupLOLEN();
- void setupLOLEW();
- void setupLOLOC();
- void setupLOLUS();
- void setupOK();
- void setupSMS();
- void RefreshServers(HXML node);
- static void QueryServerListThread(void *arg);
-};
+ void CheckRegistration()
+ {
+ if (!m_canregister) {
+ m_btnRegister.Disable();
+ return;
+ }
-void CJabberDlgAccMgrUI::CheckRegistration()
-{
- if (!m_canregister) {
- m_btnRegister.Disable();
- return;
+ JABBER_CONN_DATA regInfo;
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
+ regInfo.port = m_txtPort.GetInt();
+ if (m_chkManualHost.GetState() == BST_CHECKED)
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
+ else
+ regInfo.manualHost[0] = '\0';
+
+ if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port > 0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0]))
+ m_btnRegister.Enable();
+ else
+ m_btnRegister.Disable();
}
- JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
- m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
- regInfo.port = m_txtPort.GetInt();
- if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
- else
- regInfo.manualHost[0] = '\0';
+ void setupConnection(int type)
+ {
+ switch (type) {
+ case ACC_PUBLIC: setupPublic(); break;
+ case ACC_TLS: setupSecure(); break;
+ case ACC_SSL: setupSecureSSL(); break;
+ case ACC_GTALK: setupGoogle(); break;
+ case ACC_HIPCHAT: setupHipchat(); break;
+ case ACC_LJTALK: setupLJ(); break;
+ case ACC_LOL_EN: setupLOLEN(); break;
+ case ACC_LOL_EW: setupLOLEW(); break;
+ case ACC_LOL_OC: setupLOLOC(); break;
+ case ACC_LOL_US: setupLOLUS(); break;
+ case ACC_OK: setupOK(); break;
+ case ACC_SMS: setupSMS(); break;
+ }
+ }
- if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port > 0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0]))
+ void setupPublic()
+ {
+ m_canregister = true;
+ m_gotservers = false;
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Enable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
m_btnRegister.Enable();
- else
- m_btnRegister.Disable();
-}
+ }
-void CJabberDlgAccMgrUI::setupConnection(int type)
-{
- switch (type) {
- case ACC_PUBLIC: setupPublic(); break;
- case ACC_TLS: setupSecure(); break;
- case ACC_SSL: setupSecureSSL(); break;
- case ACC_GTALK: setupGoogle(); break;
- case ACC_HIPCHAT: setupHipchat(); break;
- case ACC_LJTALK: setupLJ(); break;
- case ACC_LOL_EN: setupLOLEN(); break;
- case ACC_LOL_EW: setupLOLEW(); break;
- case ACC_LOL_OC: setupLOLOC(); break;
- case ACC_LOL_US: setupLOLUS(); break;
- case ACC_OK: setupOK(); break;
- case ACC_SMS: setupSMS(); break;
+ void setupSecure()
+ {
+ m_canregister = true;
+ m_gotservers = false;
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Enable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Enable();
}
-}
-void CJabberDlgAccMgrUI::setupPublic()
-{
- m_canregister = true;
- m_gotservers = false;
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Enable();
- m_chkManualHost.Enable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Enable();
-}
+ void setupSecureSSL()
+ {
+ m_canregister = true;
+ m_gotservers = false;
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Enable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Enable();
+ }
-void CJabberDlgAccMgrUI::setupSecure()
-{
- m_canregister = true;
- m_gotservers = false;
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Enable();
- m_chkManualHost.Enable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Enable();
-}
+ void setupGoogle()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.AddStringA("gmail.com");
+ m_cbServer.AddStringA("googlemail.com");
+ m_cbServer.SetTextA("gmail.com");
+ m_chkManualHost.SetState(BST_CHECKED);
+ m_txtManualHost.SetTextA("talk.google.com");
+ m_txtPort.SetInt(443);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupSecureSSL()
-{
- m_canregister = true;
- m_gotservers = false;
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Enable();
- m_chkManualHost.Enable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Enable();
-}
+ void setupHipchat()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("chat.hipchat.com");
+ m_cbServer.AddStringA("chat.hipchat.com");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupGoogle()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.AddStringA("gmail.com");
- m_cbServer.AddStringA("googlemail.com");
- m_cbServer.SetTextA("gmail.com");
- m_chkManualHost.SetState(BST_CHECKED);
- m_txtManualHost.SetTextA("talk.google.com");
- m_txtPort.SetInt(443);
-
- m_cbServer.Enable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- //m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLJ()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("livejournal.com");
+ m_cbServer.AddStringA("livejournal.com");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupHipchat()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("chat.hipchat.com");
- m_cbServer.AddStringA("chat.hipchat.com");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLEN()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.eun1.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLJ()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("livejournal.com");
- m_cbServer.AddStringA("livejournal.com");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLEW()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.euw1.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLEN()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.eun1.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLOC()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.oc1.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLEW()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.euw1.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLUS()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.na2.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLOC()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.oc1.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupOK()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("xmpp.odnoklassniki.ru");
+ m_cbServer.AddStringA("xmpp.odnoklassniki.ru");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLUS()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.na2.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupSMS()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("S.ms");
+ m_cbServer.AddStringA("S.ms");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupOK()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("xmpp.odnoklassniki.ru");
- m_cbServer.AddStringA("xmpp.odnoklassniki.ru");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void RefreshServers(HXML node)
+ {
+ m_gotservers = node != nullptr;
-void CJabberDlgAccMgrUI::setupSMS()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("S.ms");
- m_cbServer.AddStringA("S.ms");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ wchar_t *server = m_cbServer.GetText();
+ bool bDropdown = m_cbServer.GetDroppedState();
+ if (bDropdown) m_cbServer.ShowDropdown(false);
-void CJabberDlgAccMgrUI::RefreshServers(HXML node)
-{
- m_gotservers = node != nullptr;
+ m_cbServer.ResetContent();
+ if (node) {
+ for (int i = 0;; i++) {
+ HXML n = XmlGetChild(node, i);
+ if (!n)
+ break;
- wchar_t *server = m_cbServer.GetText();
- bool bDropdown = m_cbServer.GetDroppedState();
- if (bDropdown) m_cbServer.ShowDropdown(false);
+ if (!mir_wstrcmp(XmlGetName(n), L"item"))
+ if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
+ if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
+ m_cbServer.AddString(jid);
+ }
+ }
- m_cbServer.ResetContent();
- if (node) {
- for (int i = 0;; i++) {
- HXML n = XmlGetChild(node, i);
- if (!n)
- break;
+ m_cbServer.SetText(server);
- if (!mir_wstrcmp(XmlGetName(n), L"item"))
- if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
- if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
- m_cbServer.AddString(jid);
- }
+ if (bDropdown) m_cbServer.ShowDropdown();
+ mir_free(server);
}
- m_cbServer.SetText(server);
+ static void __cdecl QueryServerListThread(CJabberDlgAccMgrUI *wnd)
+ {
+ HWND hwnd = wnd->GetHwnd();
+ bool bIsError = true;
- if (bDropdown) m_cbServer.ShowDropdown();
- mir_free(server);
-}
+ NETLIBHTTPREQUEST request = { 0 };
+ request.cbSize = sizeof(request);
+ request.requestType = REQUEST_GET;
+ request.flags = NLHRF_HTTP11;
+ request.szUrl = JABBER_SERVER_URL;
-void CJabberDlgAccMgrUI::QueryServerListThread(void *arg)
-{
- CDlgOptAccount *wnd = (CDlgOptAccount *)arg;
- HWND hwnd = wnd->GetHwnd();
- bool bIsError = true;
-
- NETLIBHTTPREQUEST request = { 0 };
- request.cbSize = sizeof(request);
- request.requestType = REQUEST_GET;
- request.flags = NLHRF_HTTP11;
- request.szUrl = JABBER_SERVER_URL;
-
- NETLIBHTTPREQUEST *result = Netlib_HttpTransaction(wnd->GetProto()->m_hNetlibUser, &request);
- if (result && IsWindow(hwnd)) {
- if ((result->resultCode == 200) && result->dataLength && result->pData) {
- wchar_t *ptszText = mir_a2u(result->pData);
- XmlNode node(ptszText, nullptr, nullptr);
- if (node) {
- HXML queryNode = XmlGetChild(node, L"query");
- if (queryNode && IsWindow(hwnd)) {
- SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode);
- bIsError = false;
+ NETLIBHTTPREQUEST *result = Netlib_HttpTransaction(wnd->GetProto()->m_hNetlibUser, &request);
+ if (result && IsWindow(hwnd)) {
+ if ((result->resultCode == 200) && result->dataLength && result->pData) {
+ wchar_t *ptszText = mir_a2u(result->pData);
+ XmlNode node(ptszText, nullptr, nullptr);
+ if (node) {
+ HXML queryNode = XmlGetChild(node, L"query");
+ if (queryNode && IsWindow(hwnd)) {
+ SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode);
+ bIsError = false;
+ }
}
+ mir_free(ptszText);
}
- mir_free(ptszText);
}
- }
- if (result)
- Netlib_FreeHttpRequest(result);
- if (bIsError)
- SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0);
-}
+ if (result)
+ Netlib_FreeHttpRequest(result);
+ if (bIsError)
+ SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0);
+ }
+};
INT_PTR CJabberProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index de7141ecf6..38aae073ee 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1238,7 +1238,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
dbei.cbBlob = 1;
dbei.eventType = EVENTTYPE_JABBER_CHATSTATES;
dbei.flags = DBEF_READ;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.szModule = m_szModuleName;
db_event_add(hContact, &dbei);
}
@@ -1490,7 +1490,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
hContact = CreateTemporaryContact(from, chatItem);
CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime)
msgTime = now;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 9679ee23ca..b4b4537de5 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -447,7 +447,7 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con
}
if (m_tmJabberIdleStartTime)
- p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI(L"seconds", time(nullptr) - m_tmJabberIdleStartTime);
+ p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI(L"seconds", time(0) - m_tmJabberIdleStartTime);
if (m_bEnableAvatars) {
HXML x = p << XCHILDNS(L"x", L"vcard-temp:x:update");
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 1b2ec046c2..91dd706532 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -872,14 +872,13 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode
/////////////////////////////////////////////////////////////////////////////////////////
-static void FakeThread(void* param)
+static void __cdecl FakeThread(ACKDATA *ack)
{
Thread_SetName("MRA: ProtoBroadcastAckAsync");
Sleep(100);
- ACKDATA *ack = (ACKDATA*)param;
ProtoBroadcastAck(ack->szModule, ack->hContact, ack->type, ack->result, ack->hProcess, ack->lParam);
- mir_free(param);
+ mir_free(ack);
}
DWORD CMraProto::ProtoBroadcastAckAsync(MCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam)
@@ -891,7 +890,7 @@ DWORD CMraProto::ProtoBroadcastAckAsync(MCONTACT hContact, int type, int hResult
ack->result = hResult;
ack->hProcess = hProcess;
ack->lParam = lParam;
- mir_forkthread(FakeThread, ack);
+ mir_forkThread<ACKDATA>(FakeThread, ack);
return 0;
}
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index 135ffaf6c1..e8c1fa4602 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -302,7 +302,7 @@ bool SkypeToken::Refresh(bool bForce)
time_t tExpires = (*root)["expiresIn"].as_int();
if (tExpires == 0)
tExpires = 86400;
- SetToken("skype_token " + szToken, time(nullptr) + tExpires);
+ SetToken("skype_token " + szToken, time(0) + tExpires);
bRet = true;
}
}
@@ -353,7 +353,7 @@ int CMsnProto::MSN_GetPassportAuth(void)
szPassword[99] = 0;
- time_t ts = time(nullptr);
+ time_t ts = time(0);
wchar_t szTs1[64], szTs2[64];
TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, L"I", szTs1, _countof(szTs1), 0);
@@ -404,7 +404,7 @@ int CMsnProto::MSN_GetPassportAuth(void)
ezxml_t xml_expires = ezxml_get(tokr, "wst:Lifetime", 0, "wsu:Expires", -1);
time_t expires;
- expires = xml_expires ? IsoToUnixTime(ezxml_txt(xml_expires)) : time(nullptr) + 86400;
+ expires = xml_expires ? IsoToUnixTime(ezxml_txt(xml_expires)) : time(0) + 86400;
if (mir_strcmp(addr, "http://Passport.NET/tb") == 0) {
@@ -722,7 +722,7 @@ bool CMsnProto::RefreshOAuth(const char *pszRefreshToken, const char *pszService
if (*ptExpires == 0)
bRet = false;
else
- *ptExpires += time(nullptr);
+ *ptExpires += time(0);
}
}
}
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 61397d677b..681a931702 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -482,7 +482,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? L"" : dbv.ptszVal;
gce.ptszUID = mir_a2u(MyOptions.szEmail);
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
Chat_Event(&gce);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 5b0e0cd946..088e9acba3 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -233,7 +233,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
}
if (cnt) {
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = (char *)psr;
pre.lParam = cnt;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
@@ -283,7 +283,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
ezxml_free(xmli);
}
}
- else MSN_GCAddMessage(mChatID, hContact, email, time(nullptr), sentMsg, msgBody);
+ else MSN_GCAddMessage(mChatID, hContact, email, time(0), sentMsg, msgBody);
}
else if (hContact) {
if (!sentMsg) {
@@ -292,7 +292,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
PROTORECVEVENT pre = { 0 };
pre.szMessage = (char*)msgBody;
pre.flags = (isRtl ? PREF_RTL : 0);
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.lParam = 0;
ProtoChainRecvMsg(hContact, &pre);
}
@@ -303,7 +303,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (haveWnd ? 0 : DBEF_READ) | (isRtl ? DBEF_RTL : 0);
dbei.szModule = m_szModuleName;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (unsigned)mir_strlen(msgBody) + 1;
dbei.pBlob = (PBYTE)msgBody;
db_event_add(hContact, &dbei);
@@ -459,7 +459,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment;
pre.files.w = &ft->std.szCurrentFile.w;
pre.lParam = (LPARAM)ft;
@@ -477,7 +477,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
ezxml_t urllnk;
if (urllnk=ezxml_child(xmli, "a")) msgtxt.AppendFormat(" %s", ezxml_txt(urllnk));
pre.szMessage = (char*)(const char*)msgtxt;
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
ProtoChainRecvMsg(hContact, &pre);
}
}
@@ -579,7 +579,7 @@ void CMsnProto::MSN_ProcessNLN(const char *userStatus, const char *wlid, char *u
int newStatus = MSNStatusToMiranda(userStatus);
setWord(hContact, "Status", newStatus != ID_STATUS_IDLE ? newStatus : ID_STATUS_AWAY);
- setDword(hContact, "IdleTS", newStatus != ID_STATUS_IDLE ? 0 : time(nullptr));
+ setDword(hContact, "IdleTS", newStatus != ID_STATUS_IDLE ? 0 : time(0));
}
if (cont) {
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp
index 5ff16d857c..c8780d771a 100644
--- a/protocols/MSN/src/msn_libstr.cpp
+++ b/protocols/MSN/src/msn_libstr.cpp
@@ -403,7 +403,7 @@ time_t MsnTSToUnixtime(const char *pszTS)
{
char szTS[16];
- if (!*pszTS) return time(nullptr);
+ if (!*pszTS) return time(0);
strncpy(szTS, pszTS, 10);
return (time_t)atoi(szTS);
}
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index 7673fd7a9f..30262e49c5 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -94,7 +94,7 @@ void CMsnProto::getOIMs(ezxml_t xmli)
MimeHeaders mailInfo;
const char* mailbody = mailInfo.readFromBuffer((char*)ezxml_txt(body));
- time_t evtm = time(nullptr);
+ time_t evtm = time(0);
const char* arrTime = mailInfo["X-OriginalArrivalTime"];
if (arrTime != nullptr) {
char szTime[32], *p;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 4e09b187f7..8912cc133a 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -86,7 +86,7 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch
DB_AUTH_BLOB blob(hContact, nick, nullptr, nullptr, email, reason);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -710,7 +710,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url)
if (p)
*p = 0;
- CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(nullptr), ptrA(mir_urlEncode(url))));
+ CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(0), ptrA(mir_urlEncode(url))));
if (!post.IsEmpty()) {
CMStringA hippy(passport);
hippy.AppendFormat("/ppsecure/sha1auth.srf?lc=%d&token=%s", itoa(langpref, passport, 10), ptrA(mir_urlEncode(post)));
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h
index dc4567fc45..a96e8a8efa 100644
--- a/protocols/MSN/src/stdafx.h
+++ b/protocols/MSN/src/stdafx.h
@@ -692,7 +692,7 @@ public:
bool Load();
void Save();
virtual bool Refresh(bool = false) { return false; }
- bool Expired(time_t t = time(nullptr));
+ bool Expired(time_t t = time(0));
void Clear();
const char *Token();
__forceinline operator char*() const { return m_pszToken; }
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index 7fd96f73e2..8fbb976428 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -90,7 +90,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name)
ptrW tname(mir_a2u_cp(name, CP_UTF8));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
@@ -112,7 +112,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.bIsMe = (m_nick == name);
Chat_Event(&gce);
@@ -144,7 +144,7 @@ void MinecraftDynmapProto::SetTopic(const char *topic)
ptrW ttopic(mir_a2u_cp(topic, CP_UTF8));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
gce.ptszText = ttopic;
Chat_Event( &gce);
diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp
index 0c9109fa9c..2124715301 100644
--- a/protocols/MinecraftDynmap/src/communication.cpp
+++ b/protocols/MinecraftDynmap/src/communication.cpp
@@ -372,7 +372,7 @@ void MinecraftDynmapProto::SignOnWorker(void*)
m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- setDword("LogonTS", (DWORD)time(nullptr));
+ setDword("LogonTS", (DWORD)time(0));
ClearChat();
OnJoinChat(0, false);
@@ -422,7 +422,7 @@ void MinecraftDynmapProto::EventsLoop(void *)
{
ScopedLock s(events_loop_lock_);
- time_t tim = ::time(nullptr);
+ time_t tim = ::time(0);
debugLogA(">>>>> Entering %s[%d]", __FUNCTION__, tim);
while (doEvents())
diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h
index 9979e62ed8..00e7803932 100644
--- a/protocols/MinecraftDynmap/src/proto.h
+++ b/protocols/MinecraftDynmap/src/proto.h
@@ -66,7 +66,7 @@ public:
// Chat handling
void AddChat(const char *id, const char *name);
- void UpdateChat(const char *name, const char *message, const time_t timestamp = time(nullptr), bool addtochat = true);
+ void UpdateChat(const char *name, const char *message, const time_t timestamp = time(0), bool addtochat = true);
void AddChatContact(const char *nick);
void DeleteChatContact(const char *name);
void SetChatStatus(int);
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 5af8301681..a65ac5b839 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -28,7 +28,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a
utils::text::treplace_all(&smessage, L"%", L"%%");
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
gce.ptszText = smessage.c_str();
if (name == nullptr) {
@@ -227,7 +227,7 @@ Chat_Event(WINDOW_CLEARLOG,&gce);
void OmegleProto::AddChatContact(const wchar_t *name)
{
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
@@ -251,7 +251,7 @@ void OmegleProto::DeleteChatContact(const wchar_t *name)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
if (name == nullptr)
gce.bIsMe = false;
else
@@ -284,7 +284,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
void OmegleProto::SetTopic(const wchar_t *topic)
{
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
if (topic == nullptr)
gce.ptszText = TranslateT("Omegle is a great way of meeting new friends!");
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index bd05f3e174..096656e31a 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -172,7 +172,7 @@ std::string Omegle_client::get_server(bool not_last)
server = 0;
if (server == 0) {
- srand(::time(nullptr));
+ srand(::time(0));
server = (rand() % (_countof(servers) - 1 - q)) + 1;
}
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp
index 5f04a00bed..b8e71ab95d 100644
--- a/protocols/Omegle/src/connection.cpp
+++ b/protocols/Omegle/src/connection.cpp
@@ -34,7 +34,7 @@ void OmegleProto::SignOn(void*)
m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- setDword("LogonTS", (DWORD)time(nullptr));
+ setDword("LogonTS", (DWORD)time(0));
ClearChat();
OnJoinChat(0, false);
@@ -172,7 +172,7 @@ void OmegleProto::EventsLoop(void *)
{
ScopedLock s(events_loop_lock_);
- time_t tim = ::time(nullptr);
+ time_t tim = ::time(0);
debugLogA(">>>>> Entering Omegle::EventsLoop[%d]", tim);
while (facy.events())
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp
index d96ca4e66d..1df4c0570f 100644
--- a/protocols/Sametime/src/conference.cpp
+++ b/protocols/Sametime/src/conference.cpp
@@ -184,7 +184,7 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user)
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
- gce.time = (DWORD)time(nullptr);
+ gce.time = (DWORD)time(0);
Chat_Event( &gce);
@@ -209,7 +209,7 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user)
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
- gce.time = (DWORD)time(nullptr);
+ gce.time = (DWORD)time(0);
Chat_Event(&gce);
}
@@ -229,7 +229,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh
gce.ptszText = textT;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
- gce.time = (DWORD)time(nullptr);
+ gce.time = (DWORD)time(0);
Chat_Event(&gce);
}
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp
index e7d206c4fc..080e23fcc4 100644
--- a/protocols/Sametime/src/files.cpp
+++ b/protocols/Sametime/src/files.cpp
@@ -41,7 +41,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft)
PROTORECVFILE pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = descriptionT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -52,12 +52,12 @@ void mwFileTransfer_offered(mwFileTransfer* ft)
}
//returns 0 if finished with current file
-int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientData* ftcd) {
- DWORD bytes_read;
-
+int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientData* ftcd)
+{
if (!ftcd || !ftcd->buffer)
return 0;
+ DWORD bytes_read;
if (!ReadFile(ftcd->hFile, ftcd->buffer, FILE_BUFF_SIZE, &bytes_read, nullptr)) {
proto->debugLogW(L"Sametime closing file transfer (SendFileChunk)");
mwFileTransfer_close(ft, mwFileTransfer_SUCCESS);
@@ -72,9 +72,8 @@ int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientD
return bytes_read;
}
-void __cdecl SendThread(LPVOID param) {
-
- mwFileTransfer* ft = (mwFileTransfer*)param;
+void __cdecl SendThread(mwFileTransfer* ft)
+{
if (!ft) return;
CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft);
@@ -113,7 +112,6 @@ void __cdecl SendThread(LPVOID param) {
delete ftcd;
proto->debugLogW(L"SendThread() end");
- return;
}
/** a file transfer has been fully initiated */
@@ -124,10 +122,9 @@ void mwFileTransfer_opened(mwFileTransfer* ft)
proto->debugLogW(L"Sametime mwFileTransfer_opened start");
- if (ftcd->sending) {
- // create a thread to send chunks - since it seems not all clients send acks for each of our chunks!
- mir_forkthread(SendThread, ft);
- }
+ // create a thread to send chunks - since it seems not all clients send acks for each of our chunks!
+ if (ftcd->sending)
+ mir_forkThread<mwFileTransfer>(SendThread, ft);
}
/** a file transfer has been closed. Check the status of the file
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp
index 9b0fa0b9fb..cc79c8b9dc 100644
--- a/protocols/Sametime/src/messaging.cpp
+++ b/protocols/Sametime/src/messaging.cpp
@@ -82,7 +82,7 @@ void mwIm_conversation_recv(mwConversation* conv, mwImSendType type, gconstpoint
return;
PROTORECVEVENT pre = { 0 };
- time_t t = time(nullptr);
+ time_t t = time(0);
pre.timestamp = t;
pre.szMessage = (char*)msg;
ProtoChainRecvMsg(hContact, &pre);
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index 3246dccc53..3c67736302 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -111,9 +111,8 @@ void ReleaseIconEx(const char* name, bool big)
}
// Copied from MSN plugin - sent acks need to be from different thread
-void __cdecl sttFakeAckInfoSuccessThread(void *param)
+void __cdecl sttFakeAckInfoSuccessThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttFakeAckInfoSuccessThread() start");
@@ -124,9 +123,8 @@ void __cdecl sttFakeAckInfoSuccessThread(void *param)
mir_free(tParam);
}
-void __cdecl sttFakeAckMessageSuccessThread(void *param)
+void __cdecl sttFakeAckMessageSuccessThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttFakeAckMessageSuccessThread() start");
@@ -137,9 +135,8 @@ void __cdecl sttFakeAckMessageSuccessThread(void *param)
mir_free(tParam);
}
-void __cdecl sttFakeAckMessageFailedThread(void *param)
+void __cdecl sttFakeAckMessageFailedThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttFakeAckMessageFailedThread() start");
@@ -150,9 +147,8 @@ void __cdecl sttFakeAckMessageFailedThread(void *param)
mir_free(tParam);
}
-void __cdecl sttRecvAwayThread(void *param)
+void __cdecl sttRecvAwayThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttRecvAwayThread() start");
diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h
index b0e807489b..ccf1c920e8 100644
--- a/protocols/Sametime/src/sametime.h
+++ b/protocols/Sametime/src/sametime.h
@@ -47,10 +47,17 @@ void ReleaseIconEx(const char* name, bool big);
// services (async thread functions)
-void __cdecl sttFakeAckInfoSuccessThread(void* param);
-void __cdecl sttFakeAckMessageFailedThread(void* param);
-void __cdecl sttFakeAckMessageSuccessThread(void* param);
-void __cdecl sttRecvAwayThread(void* param);
+struct TFakeAckParams
+{
+ struct CSametimeProto* proto;
+ MCONTACT hContact;
+ LPARAM lParam;
+};
+
+void __cdecl sttFakeAckInfoSuccessThread(TFakeAckParams* tParam);
+void __cdecl sttFakeAckMessageFailedThread(TFakeAckParams* tParam);
+void __cdecl sttFakeAckMessageSuccessThread(TFakeAckParams* tParam);
+void __cdecl sttRecvAwayThread(TFakeAckParams* tParam);
//sametime structs
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index 9b6abed685..f84ed684e3 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -147,7 +147,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType)
tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = NULL;
- mir_forkthread(sttFakeAckInfoSuccessThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttFakeAckInfoSuccessThread, tfap);
return 0;
}
@@ -219,7 +219,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg)
tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = 0;
- mir_forkthread(sttFakeAckMessageFailedThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttFakeAckMessageFailedThread, tfap);
return 0;
}
@@ -232,7 +232,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg)
tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = (LPARAM)ret;
- mir_forkthread(sttFakeAckMessageSuccessThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttFakeAckMessageSuccessThread, tfap);
return ret;
}
@@ -262,7 +262,7 @@ HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact)
tfap = (TFakeAckParams*)malloc(sizeof(TFakeAckParams));
tfap->proto = this;
tfap->hContact = hContact;
- mir_forkthread(sttRecvAwayThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttRecvAwayThread, tfap);
return (HANDLE)1;
}
return nullptr;
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h
index 84407541de..242f68cf6c 100644
--- a/protocols/Sametime/src/sametime_proto.h
+++ b/protocols/Sametime/src/sametime_proto.h
@@ -14,7 +14,6 @@ struct CSametimeProto : public PROTO<CSametimeProto>
// PROTO_INTERFACE
//====================================================================================
-
MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override;
HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath) override;
@@ -121,6 +120,9 @@ struct CSametimeProto : public PROTO<CSametimeProto>
void DeinitAwayMsg();
void InitMeanwhileServices();
void DeinitMeanwhileServices();
+
+ void __cdecl KeepAliveThread(void*);
+ void __cdecl SessionThread(void*);
// options.cpp
int __cdecl OptInit(WPARAM wParam, LPARAM lParam);
@@ -198,14 +200,8 @@ struct CMPlugin : public ACCPROTOPLUGIN<CSametimeProto>
}
};
-typedef struct tag_TFakeAckParams {
- CSametimeProto* proto;
- MCONTACT hContact;
- LPARAM lParam;
-} TFakeAckParams;
-
-
-struct SendAnnouncementFunc_arg {
+struct SendAnnouncementFunc_arg
+{
CSametimeProto* proto;
wchar_t msg[MAX_MESSAGE_SIZE];
GList* recipients;
@@ -213,13 +209,15 @@ struct SendAnnouncementFunc_arg {
typedef void (*SendAnnouncementFunc)(SendAnnouncementFunc_arg* ad);
-struct SessionAnnounceDialogProc_arg {
+struct SessionAnnounceDialogProc_arg
+{
CSametimeProto* proto;
SendAnnouncementFunc sendAnnouncementFunc;
};
-struct PopupData {
+struct PopupData
+{
SametimePopupEnum flag;
wchar_t* title;
wchar_t* text;
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index fc029ee5ea..5cdf633385 100644
--- a/protocols/Sametime/src/sametime_session.cpp
+++ b/protocols/Sametime/src/sametime_session.cpp
@@ -245,7 +245,7 @@ int CSametimeProto::SetSessionStatus(int status)
if (idle_timerid) KillTimer(nullptr, idle_timerid);
- us.time = (DWORD)time(nullptr);
+ us.time = (DWORD)time(0);
//us.time = 0;
switch (status) {
@@ -286,7 +286,7 @@ VOID CALLBACK IdleTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime
if (proto->idle_status) {
struct mwUserStatus us;
- us.time = (DWORD)time(nullptr);
+ us.time = (DWORD)time(0);
us.status = mwStatus_IDLE;
us.desc = nullptr;
mwSession_setUserStatus(proto->session, &us);
@@ -341,19 +341,18 @@ void WakeThread(HANDLE hThread)
QueueUserAPC(NullAPC, hThread, 0);
}
-void __cdecl KeepAliveThread(LPVOID param)
+void __cdecl CSametimeProto::KeepAliveThread(void*)
{
- CSametimeProto* proto = (CSametimeProto*)param;
int i = 120;
- proto->debugLogW(L"KeepAliveThread() start");
+ debugLogW(L"KeepAliveThread() start");
while (1) {
if (i <= 0) {
i = 120;
// send keepalive every 120 * 250 = 30000[ms]
- if (mwSession_isStarted(proto->session) && proto->session) {
- mwSession_sendKeepalive(proto->session);
+ if (mwSession_isStarted(session) && session) {
+ mwSession_sendKeepalive(session);
}
}
@@ -361,9 +360,9 @@ void __cdecl KeepAliveThread(LPVOID param)
SleepEx(250, TRUE);
- mir_cslock lck(proto->session_cs);
- if (Miranda_IsTerminated() || !proto->session) {
- proto->debugLogW(L"KeepAliveThread() end");
+ mir_cslock lck(session_cs);
+ if (Miranda_IsTerminated() || !session) {
+ debugLogW(L"KeepAliveThread() end");
break;
}
}
@@ -376,65 +375,64 @@ int waitcallback(unsigned int* timeout)
return continue_connect ? 1 : 0;
}
-void __cdecl SessionThread(LPVOID param)
+void __cdecl CSametimeProto::SessionThread(LPVOID)
{
- CSametimeProto* proto = (CSametimeProto*)param;
- proto->debugLogW(L"SessionThread() start");
+ debugLogW(L"SessionThread() start");
continue_connect = true;
- proto->BroadcastNewStatus(ID_STATUS_CONNECTING);
+ BroadcastNewStatus(ID_STATUS_CONNECTING);
// setup
NETLIBOPENCONNECTION conn_data = { 0 };
conn_data.cbSize = sizeof(NETLIBOPENCONNECTION);
conn_data.flags = NLOCF_V2;
- conn_data.szHost = proto->options.server_name;
- conn_data.wPort = proto->options.port;
+ conn_data.szHost = options.server_name;
+ conn_data.wPort = options.port;
conn_data.timeout = 20;
conn_data.waitcallback = waitcallback;
- proto->server_connection = Netlib_OpenConnection(proto->m_hNetlibUser, &conn_data);
+ server_connection = Netlib_OpenConnection(m_hNetlibUser, &conn_data);
- if (!proto->server_connection) {
+ if (!server_connection) {
- proto->BroadcastNewStatus(ID_STATUS_OFFLINE);
+ BroadcastNewStatus(ID_STATUS_OFFLINE);
if (continue_connect) {
// real timeout - not user cancelled
- proto->showPopup(TranslateT("No server connection!"), SAMETIME_POPUP_ERROR);
+ showPopup(TranslateT("No server connection!"), SAMETIME_POPUP_ERROR);
}
- proto->debugLogW(L"SessionThread() end, no server_connection, continue_connect=[%d]", continue_connect);
+ debugLogW(L"SessionThread() end, no server_connection, continue_connect=[%d]", continue_connect);
return;
}
mwSessionHandler handler = {};
- handler.clear = SessionClear;
- handler.io_write = SessionWrite;
- handler.io_close = SessionClose;
- handler.on_stateChange = SessionStateChange;
- handler.on_admin = SessionAdmin;
- handler.on_announce = SessionAnnounce;
- handler.on_setPrivacyInfo = SessionSetPrivacyInfo;
- handler.on_setUserStatus = SessionSetUserStatus;
+ handler.clear = ::SessionClear;
+ handler.io_write = ::SessionWrite;
+ handler.io_close = ::SessionClose;
+ handler.on_stateChange = ::SessionStateChange;
+ handler.on_admin = ::SessionAdmin;
+ handler.on_announce = ::SessionAnnounce;
+ handler.on_setPrivacyInfo = ::SessionSetPrivacyInfo;
+ handler.on_setUserStatus = ::SessionSetUserStatus;
{
- mir_cslock lck(proto->session_cs);
- proto->session = mwSession_new(&handler);
+ mir_cslock lck(session_cs);
+ session = mwSession_new(&handler);
- proto->InitMeanwhileServices();
+ InitMeanwhileServices();
- mwSession_start(proto->session);
+ mwSession_start(session);
}
- mir_forkthread(KeepAliveThread, proto);
+ ForkThread(&CSametimeProto::KeepAliveThread);
unsigned char* recv_buffer = (unsigned char*)mir_alloc(1024 * 32);
int bytes;
//while(session && server_connection && mwSession_getState(session) != mwSession_STOPPED) {
- while (proto->server_connection) {// && session) {// && !mwSession_isStopped(session)) { // break on error
- bytes = Netlib_Recv(proto->server_connection, (char *)recv_buffer, 1024 * 32, 0);
- proto->debugLogW(L"SessionThread() Netlib_Recv'ed bytes=[%d]", bytes);
+ while (server_connection) {// && session) {// && !mwSession_isStopped(session)) { // break on error
+ bytes = Netlib_Recv(server_connection, (char *)recv_buffer, 1024 * 32, 0);
+ debugLogW(L"SessionThread() Netlib_Recv'ed bytes=[%d]", bytes);
if (bytes == 0) {
break;
@@ -444,23 +442,23 @@ void __cdecl SessionThread(LPVOID param)
break;
}
else {
- mir_cslock lck(proto->session_cs);
- mwSession_recv(proto->session, recv_buffer, bytes);
+ mir_cslock lck(session_cs);
+ mwSession_recv(session, recv_buffer, bytes);
}
}
mir_free(recv_buffer);
- mir_cslock lck2(proto->session_cs);
- proto->DeinitMeanwhileServices();
- mwSession* old_session = proto->session;
- proto->session = nullptr; // kills keepalive thread, if awake
+ mir_cslock lck2(session_cs);
+ DeinitMeanwhileServices();
+ mwSession* old_session = session;
+ session = nullptr; // kills keepalive thread, if awake
mwSession_free(old_session);
- proto->BroadcastNewStatus(ID_STATUS_OFFLINE);
- proto->SetAllOffline();
- proto->first_online = true;
+ BroadcastNewStatus(ID_STATUS_OFFLINE);
+ SetAllOffline();
+ first_online = true;
- proto->debugLogW(L"SessionThread() end");
+ debugLogW(L"SessionThread() end");
return;
}
@@ -496,7 +494,7 @@ int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser)
login_status = ls;
- mir_forkthread(SessionThread, this);
+ ForkThread(&CSametimeProto::SessionThread);
return 0;
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp
index f155fa6cb0..1d01d15e24 100644
--- a/protocols/Sametime/src/userlist.cpp
+++ b/protocols/Sametime/src/userlist.cpp
@@ -529,7 +529,7 @@ void mwAwareList_on_aware(mwAwareList* list, mwAwareSnapshot* aware)
new_status = ID_STATUS_AWAY;
db_set_w(hContact, proto->m_szModuleName, "Status", new_status);
}
- db_set_dw(hContact, proto->m_szModuleName, "IdleTS", (DWORD)time(nullptr));
+ db_set_dw(hContact, proto->m_szModuleName, "IdleTS", (DWORD)time(0));
break;
case mwStatus_BUSY:
new_status = ID_STATUS_DND;
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
index 6ed47aa00c..ed64a40447 100644
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ b/protocols/SkypeWeb/src/request_queue.cpp
@@ -41,7 +41,7 @@ void RequestQueue::Start()
isTerminated = false;
if (hRequestQueueThread == nullptr)
- hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this);
+ hRequestQueueThread = mir_forkThread<RequestQueue>(&RequestQueue::WorkerThread, this);
}
void RequestQueue::Stop()
@@ -70,7 +70,7 @@ void RequestQueue::Push(HttpRequest *request, HttpResponseCallback response, voi
void RequestQueue::Send(HttpRequest *request, HttpResponseCallback response, void *arg)
{
RequestQueueItem *item = new RequestQueueItem(request, response, arg);
- mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, nullptr);
+ mir_forkthreadowner(&RequestQueue::AsyncSendThread, this, item, nullptr);
}
void RequestQueue::Execute(RequestQueueItem *item)
@@ -83,20 +83,17 @@ void RequestQueue::Execute(RequestQueueItem *item)
delete item;
}
-unsigned int RequestQueue::AsyncSendThread(void *owner, void *arg)
+unsigned RequestQueue::AsyncSendThread(void *owner, void *arg)
{
RequestQueue *that = (RequestQueue*)owner;
RequestQueueItem *item = (RequestQueueItem*)arg;
that->Execute(item);
-
return 0;
}
-unsigned int RequestQueue::WorkerThread(void *arg)
+void RequestQueue::WorkerThread(RequestQueue *queue)
{
- RequestQueue *queue = (RequestQueue*)arg;
-
while (true) {
queue->hRequestQueueEvent.Wait();
if (queue->isTerminated)
@@ -119,5 +116,4 @@ unsigned int RequestQueue::WorkerThread(void *arg)
}
queue->hRequestQueueThread = nullptr;
- return 0;
-} \ No newline at end of file
+}
diff --git a/protocols/SkypeWeb/src/request_queue.h b/protocols/SkypeWeb/src/request_queue.h
index f4a60e826d..1f2c5a014a 100644
--- a/protocols/SkypeWeb/src/request_queue.h
+++ b/protocols/SkypeWeb/src/request_queue.h
@@ -51,8 +51,8 @@ class RequestQueue
void Execute(RequestQueueItem *item);
- static unsigned int __cdecl AsyncSendThread(void*, void*);
- static unsigned int __cdecl WorkerThread(void*);
+ static unsigned __cdecl AsyncSendThread(void*, void*);
+ static void __cdecl WorkerThread(RequestQueue *queue);
public:
RequestQueue(HNETLIBUSER nlu);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 9a810d3d16..2ff7f8140a 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -198,7 +198,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
gce.ptszUID = gch->ptszUID;
gce.ptszText = tnick_new;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
if (!reset)
@@ -351,7 +351,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
gce.ptszNick = tszId;
gce.ptszUID = tszId;
gce.ptszText = tszInitiator;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateT("Admin");
Chat_Event(&gce);
@@ -372,9 +372,9 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM
ptrA szMessage(mir_utf8encodeW(buf));
if (strncmp(szMessage, "/me ", 4) == 0)
- SendRequest(new SendChatActionRequest(szChatId, time(nullptr), szMessage, li));
+ SendRequest(new SendChatActionRequest(szChatId, time(0), szMessage, li));
else
- SendRequest(new SendChatMessageRequest(szChatId, time(nullptr), szMessage, li));
+ SendRequest(new SendChatMessageRequest(szChatId, time(0), szMessage, li));
}
void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
@@ -512,7 +512,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = !isChange ? time(nullptr) : NULL;
+ gce.time = !isChange ? time(0) : NULL;
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateW(role);
@@ -533,13 +533,13 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con
gce.ptszUID = tid;
gce.ptszNick = tnick;
gce.ptszStatus = tinitiator;
- gce.time = time(nullptr);
+ gce.time = time(0);
}
else {
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = IsMe(id);
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index d345821194..14a718b391 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -122,7 +122,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response)
DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, skypename.c_str(), reason.c_str());
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index 6df167f3b4..7dfd901ae1 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -35,7 +35,7 @@ void CSkypeProto::Login()
}
m_bHistorySynced = m_bThreadsTerminated = false;
- if ((tokenExpires - 1800) > time(nullptr))
+ if ((tokenExpires - 1800) > time(0))
OnLoginSuccess();
PushRequest(new OAuthRequest(), &CSkypeProto::OnOAuthStart);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index f1381333f2..9ca334c122 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -52,7 +52,7 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage)
SendMessageParam *param = new SendMessageParam();
param->hContact = hContact;
- param->hMessage = time(nullptr);
+ param->hMessage = time(0);
ptrA username(getStringA(hContact, "Skypename"));
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp
index c89b9954a1..65e4108808 100644
--- a/protocols/SkypeWeb/src/skype_trouter.cpp
+++ b/protocols/SkypeWeb/src/skype_trouter.cpp
@@ -95,9 +95,9 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response)
m_hTrouterEvent.Set();
m_hTrouterHealthEvent.Set();
- if ((time(nullptr) - TRouter.lastRegistrationTime) >= 3600) {
+ if ((time(0) - TRouter.lastRegistrationTime) >= 3600) {
SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str()));
- TRouter.lastRegistrationTime = time(nullptr);
+ TRouter.lastRegistrationTime = time(0);
}
}
@@ -186,7 +186,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
if (!uid.empty()) {
MCONTACT hContact = AddContact(uid.c_str(), true);
- MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(nullptr), DBEF_READ, gp.c_str(), callId.c_str());
+ MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(0), DBEF_READ, gp.c_str(), callId.c_str());
Skin_PlaySound("skype_inc_call");
CLISTEVENT cle = {};
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index 1f48146cb7..9eb34490c8 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -59,7 +59,7 @@ extern HANDLE hExtraXStatus;
#define STEAM_DB_GETEVENTTEXT_CHATSTATES "/GetEventText2000"
#define STEAM_DB_EVENT_CHATSTATES_GONE 1
-#define now() time(nullptr)
+#define now() time(0)
#include "steam_dialogs.h"
#include "steam_options.h"
diff --git a/protocols/Tox/libtox/src/toxcore/Messenger.c b/protocols/Tox/libtox/src/toxcore/Messenger.c
index 2408c84484..0ea7894ec8 100644
--- a/protocols/Tox/libtox/src/toxcore/Messenger.c
+++ b/protocols/Tox/libtox/src/toxcore/Messenger.c
@@ -2520,7 +2520,7 @@ static void do_friends(Messenger *m, void *userdata)
do_receipts(m, i, userdata);
do_reqchunk_filecb(m, i, userdata);
- m->friendlist[i].last_seen_time = (uint64_t) time(nullptr);
+ m->friendlist[i].last_seen_time = (uint64_t) time(0);
}
}
}
diff --git a/protocols/Tox/libtox/src/toxcore/util.c b/protocols/Tox/libtox/src/toxcore/util.c
index b7a8fda653..853899909f 100644
--- a/protocols/Tox/libtox/src/toxcore/util.c
+++ b/protocols/Tox/libtox/src/toxcore/util.c
@@ -48,7 +48,7 @@ static uint64_t unix_base_time_value;
void unix_time_update(void)
{
if (unix_base_time_value == 0) {
- unix_base_time_value = ((uint64_t)time(nullptr) - (current_time_monotonic() / 1000ULL));
+ unix_base_time_value = ((uint64_t)time(0) - (current_time_monotonic() / 1000ULL));
}
unix_time_value = (current_time_monotonic() / 1000ULL) + unix_base_time_value;
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index 124fc96b0b..1e444e9b9d 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -42,7 +42,7 @@
struct CToxProto;
-#define now() time(nullptr)
+#define now() time(0)
#define MODULE "Tox"
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp
index a28c44f351..6ff50e7b28 100644
--- a/protocols/Twitter/src/chat.cpp
+++ b/protocols/Twitter/src/chat.cpp
@@ -92,7 +92,7 @@ void TwitterProto::AddChatContact(const char *name, const char *nick)
ptrW wszNick(mir_a2u(nick ? nick : name));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.ptszNick = wszNick;
gce.ptszUID = wszId;
gce.ptszStatus = L"Normal";
@@ -104,7 +104,7 @@ void TwitterProto::DeleteChatContact(const char *name)
ptrW wszId(mir_a2u(name));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.ptszNick = wszId;
gce.ptszUID = gce.ptszNick;
Chat_Event(&gce);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 78408b5e3e..54b9f87f8f 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -142,7 +142,7 @@ char* ExpUrlEncode(const char *szUrl, bool strict)
void CVkProto::ClearAccessToken()
{
debugLogA("CVkProto::ClearAccessToken");
- setDword("LastAccessTokenTime", (DWORD)time(nullptr));
+ setDword("LastAccessTokenTime", (DWORD)time(0));
m_szAccessToken = nullptr;
delSetting("AccessToken");
ShutdownSession();
@@ -288,7 +288,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode)
break;
}
- if (time(nullptr) - getDword("LastAccessTokenTime", 0) > 60 * 60 * 24) {
+ if (time(0) - getDword("LastAccessTokenTime", 0) > 60 * 60 * 24) {
debugLogA("CVkProto::CheckJsonResult VKERR_ACCESS_DENIED (AccessToken fail?)");
ClearAccessToken();
return false;
@@ -583,7 +583,7 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.flags = DBEF_UTF;
dbei.eventType = added ? EVENTTYPE_ADDED : EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = blob.size();
@@ -1372,7 +1372,7 @@ void CVkProto::SetInvisible(MCONTACT hContact)
db_set_dw(hContact, "BuddyExpectator", "LastStatus", ID_STATUS_INVISIBLE);
debugLogA("CVkProto::SetInvisible %d set ID_STATUS_INVISIBLE", getDword(hContact, "ID", VK_INVALID_USER));
}
- time_t now = time(nullptr);
+ time_t now = time(0);
db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)now);
setDword(hContact, "InvisibleTS", (DWORD)now);
}
@@ -1514,7 +1514,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.eventType = VK_USER_DEACTIVATE_ACTION;
dbei.cbBlob = (DWORD)mir_strlen(vkDeactivateEvent[iDEIdx].szDescription) + 1;
dbei.pBlob = (PBYTE)mir_strdup(vkDeactivateEvent[iDEIdx].szDescription);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 08d89269d6..4d76ddf50e 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -185,7 +185,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
GCEVENT gce = { m_szModuleName, cc->m_wszId, GC_EVENT_PART };
gce.ptszUID = wszId;
gce.dwFlags = GCEF_NOTNOTIFY;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu->m_wszNick, wszId));
Chat_Event(&gce);
@@ -258,7 +258,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode &
bool bIsAction = false;
int msgTime = jnMsg["date"].as_int();
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime || msgTime > now)
msgTime = now;
@@ -736,7 +736,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
gce.ptszUID = wszId;
gce.ptszText = mir_wstrdup(wszNewNick);
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
cu->m_wszNick = mir_wstrdup(wszNewNick);
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp
index 86884a79ce..87fea21168 100644
--- a/protocols/VKontakte/src/vk_feed.cpp
+++ b/protocols/VKontakte/src/vk_feed.cpp
@@ -544,7 +544,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser
LONG iUserId = !jnItem["invited_by"] ? 0 : jnItem["invited_by"].as_int();
CVKNewsItem *vkNotification = new CVKNewsItem();
- vkNotification->tDate = time(nullptr);
+ vkNotification->tDate = time(0);
vkNotification->vkUser = GetVkUserInfo(iUserId, vkUsers);
vkNotification->wszType = wszType;
vkNotification->wszId = wszId;
@@ -577,8 +577,8 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime)
if (!IsOnline())
return;
- time_t tLastNewsReqTime = getDword("LastNewsReqTime", time(nullptr) - 24 * 60 * 60);
- if (time(nullptr) - tLastNewsReqTime < 3 * 60)
+ time_t tLastNewsReqTime = getDword("LastNewsReqTime", time(0) - 24 * 60 * 60);
+ if (time(0) - tLastNewsReqTime < 3 * 60)
return;
CMStringA szFilter;
@@ -623,7 +623,7 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime)
<< CHAR_PARAM("filters", szFilter)
<< CHAR_PARAM("source_ids", szSource));
- setDword("LastNewsReqTime", (DWORD)time(nullptr));
+ setDword("LastNewsReqTime", (DWORD)time(0));
}
static int sttCompareVKNewsItems(const CVKNewsItem *p1, const CVKNewsItem *p2)
@@ -688,7 +688,7 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p
if (bNewsAdded)
AddCListEvent(true);
- setDword("LastNewsTime", time(nullptr));
+ setDword("LastNewsTime", time(0));
vkNews.destroy();
vkUsers.destroy();
@@ -702,8 +702,8 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime)
if (!IsOnline())
return;
- time_t tLastNotificationsReqTime = getDword("LastNotificationsReqTime", time(nullptr) - 24 * 60 * 60);
- if (time(nullptr) - tLastNotificationsReqTime < 3 * 60)
+ time_t tLastNotificationsReqTime = getDword("LastNotificationsReqTime", time(0) - 24 * 60 * 60);
+ if (time(0) - tLastNotificationsReqTime < 3 * 60)
return;
CMStringW code(FORMAT, L"return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s",
@@ -714,7 +714,7 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime)
<< WCHAR_PARAM("code", code)
);
- setDword("LastNotificationsReqTime", (DWORD)time(nullptr));
+ setDword("LastNotificationsReqTime", (DWORD)time(0));
}
bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isCommented)
@@ -813,7 +813,7 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR
if (bNotificationAdded)
AddCListEvent(false);
- setDword("LastNotificationsTime", time(nullptr));
+ setDword("LastNotificationsTime", time(0));
if (m_vkOptions.bNotificationsMarkAsViewed && bNotificationCommentAdded)
NotificationMarkAsViewed();
@@ -827,12 +827,12 @@ void CVkProto::RetrieveUnreadEvents()
if (!IsOnline() || (!m_vkOptions.bNotificationsEnabled && !m_vkOptions.bNewsEnabled))
return;
- time_t tLastNotificationsTime = getDword("LastNotificationsTime", time(nullptr) - 24 * 60 * 60);
- if (time(nullptr) - tLastNotificationsTime - m_vkOptions.iNotificationsInterval * 60 >= -3 && m_vkOptions.bNotificationsEnabled)
+ time_t tLastNotificationsTime = getDword("LastNotificationsTime", time(0) - 24 * 60 * 60);
+ if (time(0) - tLastNotificationsTime - m_vkOptions.iNotificationsInterval * 60 >= -3 && m_vkOptions.bNotificationsEnabled)
RetrieveUnreadNotifications(tLastNotificationsTime);
- time_t tLastNewsTime = getDword("LastNewsTime", time(nullptr) - 24 * 60 * 60);
- if (time(nullptr) - tLastNewsTime - m_vkOptions.iNewsInterval * 60 >= -3 && m_vkOptions.bNewsEnabled)
+ time_t tLastNewsTime = getDword("LastNewsTime", time(0) - 24 * 60 * 60);
+ if (time(0) - tLastNewsTime - m_vkOptions.iNewsInterval * 60 >= -3 && m_vkOptions.bNewsEnabled)
RetrieveUnreadNews(tLastNewsTime);
NewsClearHistory();
@@ -849,7 +849,7 @@ INT_PTR CVkProto::SvcLoadVKNews(WPARAM, LPARAM)
AddFeedSpecialUser();
}
- time_t tLastNewsTime = getDword("LastNewsTime", time(nullptr) - 24 * 60 * 60);
+ time_t tLastNewsTime = getDword("LastNewsTime", time(0) - 24 * 60 * 60);
RetrieveUnreadNews(tLastNewsTime);
return 0;
@@ -862,7 +862,7 @@ void CVkProto::NewsClearHistory()
if (hContact == 0 || !m_vkOptions.bNewsAutoClearHistory)
return;
- time_t tTime = time(nullptr) - m_vkOptions.iNewsAutoClearHistoryInterval;
+ time_t tTime = time(0) - m_vkOptions.iNewsAutoClearHistoryInterval;
MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp
index a3d62b62c6..68fbe7da09 100644
--- a/protocols/VKontakte/src/vk_files.cpp
+++ b/protocols/VKontakte/src/vk_files.cpp
@@ -176,7 +176,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *
// Boundary
int iboundary;
Utils_GetRandom(&iboundary, sizeof(iboundary));
- boundary.AppendFormat("Miranda%dNG%d", iboundary, time(nullptr));
+ boundary.AppendFormat("Miranda%dNG%d", iboundary, time(0));
// Header
header.AppendFormat("multipart/form-data; boundary=%s", boundary.c_str());
pUploadReq->AddHeader("Content-Type", header);
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index 008afc32dd..c18fcd86af 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -102,7 +102,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay)
return;
setByte(hContact, "ActiveHistoryTask", 1);
- time_t tTime = time(nullptr) - 60 * 60 * 24 * NDay;
+ time_t tTime = time(0) - 60 * 60 * 24 * NDay;
MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index 839066adb1..62d6168b67 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -49,7 +49,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int, const char *szMsg)
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true,
bIsChat ? &CVkProto::OnSendChatMsg : &CVkProto::OnSendMessage, AsyncHttpRequest::rpHigh)
<< INT_PARAM(bIsChat ? "chat_id" : "peer_id", iUserID)
- << INT_PARAM("random_id", ((LONG)time(nullptr)) * 100 + uMsgId % 100);
+ << INT_PARAM("random_id", ((LONG)time(0)) * 100 + uMsgId % 100);
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
if (StickerId)
@@ -300,7 +300,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
recv.flags |= PREF_CREATEREAD;
if (isOut)
recv.flags |= PREF_SENT;
- else if (m_vkOptions.bUserForceInvisibleOnActivity && time(nullptr) - datetime < 60 * m_vkOptions.iInvisibleInterval)
+ else if (m_vkOptions.bUserForceInvisibleOnActivity && time(0) - datetime < 60 * m_vkOptions.iInvisibleInterval)
SetInvisible(hContact);
bool bEdited = CheckMid(m_editedIds, mid);
@@ -332,7 +332,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
}
T2Utf pszBody(wszBody);
- recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(nullptr) : datetime);
+ recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(0) : datetime);
recv.szMessage = pszBody;
recv.lParam = isOut;
recv.pCustomData = szMid;
@@ -351,7 +351,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
}
else if (m_vkOptions.bLoadSentAttachments && !wszAttachmentDescr.IsEmpty() && isOut) {
T2Utf pszAttach(wszAttachmentDescr);
- recv.timestamp = time(nullptr); // only local time
+ recv.timestamp = time(0); // only local time
recv.szMessage = pszAttach;
ProtoChainRecvMsg(hContact, &recv);
}
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp
index 49c9b017eb..8f92639ab8 100644
--- a/protocols/VKontakte/src/vk_pollserver.cpp
+++ b/protocols/VKontakte/src/vk_pollserver.cpp
@@ -93,9 +93,9 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates)
hContact = FindUser(uid);
if (hContact != 0 && (flags & VKFLAG_MSGUNREAD) && !CheckMid(m_incIds, msgid)) {
- setDword(hContact, "LastMsgReadTime", time(nullptr));
+ setDword(hContact, "LastMsgReadTime", time(0));
if (ServiceExists(MS_MESSAGESTATE_UPDATE)) {
- MessageReadData data(time(nullptr), MRD_TYPE_READTIME);
+ MessageReadData data(time(0), MRD_TYPE_READTIME);
CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data);
}
else
@@ -132,9 +132,9 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates)
uid = jnChild[1].as_int();
hContact = FindUser(uid);
if (hContact != 0) {
- setDword(hContact, "LastMsgReadTime", time(nullptr));
+ setDword(hContact, "LastMsgReadTime", time(0));
if (ServiceExists(MS_MESSAGESTATE_UPDATE)) {
- MessageReadData data(time(nullptr), MRD_TYPE_READTIME);
+ MessageReadData data(time(0), MRD_TYPE_READTIME);
CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data);
}
else
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 1986b3a240..1c39094afd 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -371,7 +371,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, VKContactTy
setWord(hContact, "Status", iNewStatus);
if (iNewStatus == ID_STATUS_ONLINE) {
- db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)time(nullptr));
+ db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)time(0));
db_set_dw(hContact, "BuddyExpectator", "LastStatus", ID_STATUS_ONLINE);
int online_app = _wtoi(jnItem["online_app"].as_mstring());
@@ -621,7 +621,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
int iContactStatus = getWord(cc, "Status", ID_STATUS_OFFLINE);
if ((iContactStatus == ID_STATUS_ONLINE)
- || (iContactStatus == ID_STATUS_INVISIBLE && time(nullptr) - getDword(cc, "InvisibleTS", 0) >= m_vkOptions.iInvisibleInterval * 60LL)) {
+ || (iContactStatus == ID_STATUS_INVISIBLE && time(0) - getDword(cc, "InvisibleTS", 0) >= m_vkOptions.iInvisibleInterval * 60LL)) {
setWord(cc, "Status", ID_STATUS_OFFLINE);
SetMirVer(cc, -1);
db_unset(cc, m_szModuleName, "ListeningTo");
diff --git a/src/core/stdemail/src/email.cpp b/src/core/stdemail/src/email.cpp
index c7b1dde4e0..10787993bc 100644
--- a/src/core/stdemail/src/email.cpp
+++ b/src/core/stdemail/src/email.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static HGENMENU hEMailMenuItem;
-void SendEmailThread(void *szUrl)
+void __cdecl SendEmailThread(char *szUrl)
{
ShellExecuteA(nullptr, "open", (char*)szUrl, "", "", SW_SHOW);
mir_free(szUrl);
@@ -46,7 +46,7 @@ static INT_PTR SendEMailCommand(WPARAM hContact, LPARAM lParam)
mir_strcpy(szUrl, "mailto:");
mir_strcat(szUrl, dbv.pszVal);
mir_free(dbv.pszVal);
- mir_forkthread(SendEmailThread, szUrl);
+ mir_forkThread<char>(SendEmailThread, szUrl);
return 0;
}
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 98c6f36fba..7cfd4097ad 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -78,7 +78,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
dbei.szModule = GetContactProto(dat->hContact);
dbei.eventType = EVENTTYPE_FILE;
dbei.flags = DBEF_SENT;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
char *szFileNames = Utf8EncodeW(dat->szFilenames), *szMsg = Utf8EncodeW(dat->szMsg);
dbei.flags |= DBEF_UTF;
@@ -522,12 +522,11 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
PostMessage(hwndDlg, M_VIRUSSCANDONE, dat->transferStatus.currentFileNumber, 0);
else {
- virusscanthreadstartinfo *vstsi;
- vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
+ virusscanthreadstartinfo *vstsi = (virusscanthreadstartinfo*)mir_alloc(sizeof(virusscanthreadstartinfo));
vstsi->hwndReply = hwndDlg;
vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]);
vstsi->returnCode = dat->transferStatus.currentFileNumber;
- mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi);
+ mir_forkThread<virusscanthreadstartinfo>(RunVirusScannerThread, vstsi);
}
}
break;
@@ -670,19 +669,18 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT);
if (vstsi)
- mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi);
+ mir_forkThread<virusscanthreadstartinfo>(RunVirusScannerThread, vstsi);
}
else dat->fs = nullptr; /* protocol will free structure */
dat->transferStatus.currentFileNumber = dat->transferStatus.totalFiles;
- } // else dat->send
-
- } // else ack->result
+ }
+ }
PostMessage(GetParent(hwndDlg), WM_FT_COMPLETED, ack->result, (LPARAM)hwndDlg);
break;
- } // switch ack->result
- } // case HM_RECVEVENT
+ }
+ }
break;
case M_VIRUSSCANDONE:
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 2f5e77c79e..55ca576727 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -205,9 +205,8 @@ void CChatRoomDlg::LoadSettings()
/////////////////////////////////////////////////////////////////////////////////////////
-static void __cdecl phase2(void *lParam)
+static void __cdecl phase2(SESSION_INFO *si)
{
- SESSION_INFO *si = (SESSION_INFO*)lParam;
Sleep(30);
if (si && si->pDlg)
si->pDlg->RedrawLog2();
@@ -229,7 +228,7 @@ void CChatRoomDlg::RedrawLog()
index++;
}
StreamInEvents(pLog, true);
- mir_forkthread(phase2, m_si);
+ mir_forkThread<SESSION_INFO>(phase2, m_si);
}
else StreamInEvents(m_si->pLogEnd, true);
}
@@ -641,8 +640,8 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0)) {
- if (m_iLastEnterTime + 2 < time(nullptr))
- m_iLastEnterTime = time(nullptr);
+ if (m_iLastEnterTime + 2 < time(0))
+ m_iLastEnterTime = time(0);
else {
m_message.SendMsg(WM_KEYDOWN, VK_BACK, 0);
m_message.SendMsg(WM_KEYUP, VK_BACK, 0);
@@ -672,7 +671,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0))
- if (m_iLastEnterTime + 2 >= time(nullptr))
+ if (m_iLastEnterTime + 2 >= time(0))
return 0;
break;
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index 62f57de562..726eb7a9dc 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -92,7 +92,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & PREF_RTL ? DBEF_RTL : 0);
dbei.szModule = GetContactProto(hContact);
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (DWORD)(mir_strlen(p->szMsg) + 1);
dbei.pBlob = (PBYTE)p->szMsg;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 85ef7b2a55..ee4230632b 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -172,7 +172,7 @@ void CSrmmWindow::OnInitDialog()
case LOADHISTORY_TIME:
DBEVENTINFO dbei = {};
if (m_hDbEventFirst == 0)
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
else
db_event_get(m_hDbEventFirst, &dbei);
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index ddddbf99da..fb94c7e26b 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -135,11 +135,10 @@ typedef struct {
HWND hwnd;
} THistoryThread;
-static void FillHistoryThread(void* param)
+static void FillHistoryThread(THistoryThread *hInfo)
{
Thread_SetName("HistoryWindow::FillHistoryThread");
- THistoryThread *hInfo = (THistoryThread*)param;
HWND hwndList = GetDlgItem(hInfo->hwnd, IDC_LIST);
SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_RESETCONTENT, 0, 0);
@@ -221,7 +220,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
EnableWindow(GetDlgItem(hwndDlg, IDC_LIST), FALSE);
hInfo->hContact = hContact;
hInfo->hwnd = hwndDlg;
- mir_forkthread(FillHistoryThread, hInfo);
+ mir_forkThread<THistoryThread>(FillHistoryThread, hInfo);
}
return TRUE;
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index d210d62d31..705d74a125 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -285,7 +285,7 @@ void SetIndentSize()
LOGFONT lf;
LoadMsgDlgFont(0, &lf, nullptr);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = Chat_GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(nullptr)), hFont, TRUE);
+ int iText = Chat_GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(0)), hFont, TRUE);
DeleteObject(hFont);
g_Settings->LogTextIndent = iText * 12 / 10;
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index c7def6e4d8..71d0a830ea 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -519,7 +519,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
long trimlimit = g_Settings->LoggingLimit * 1024;
if (dwSize > trimlimit) {
- time_t now = time(nullptr);
+ time_t now = time(0);
wchar_t tszTimestamp[20];
wcsftime(tszTimestamp, 20, L"%Y%m%d-%H%M%S", _localtime32((__time32_t *)&now));
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 86649645e4..135f979d8d 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -188,9 +188,8 @@ struct TFakeAckParams
char msg[512];
};
-static void __cdecl sttFakeAckFail(void *param)
+static void __cdecl sttFakeAckFail(TFakeAckParams *tParam)
{
- TFakeAckParams *tParam = (TFakeAckParams*)param;
WaitForSingleObject(tParam->hEvent, INFINITE);
Sleep(100);
@@ -243,7 +242,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam)
tfap->id = 10;
strncpy(tfap->msg, Translate("No online contacts found."), _countof(tfap->msg) - 1);
- CloseHandle(mir_forkthread(sttFakeAckFail, (void*)tfap));
+ mir_forkThread<TFakeAckParams>(sttFakeAckFail, tfap);
SetEvent(hEvent);
return 10;
}
diff --git a/src/mir_app/src/netlibautoproxy.cpp b/src/mir_app/src/netlibautoproxy.cpp
index 04b70cabbf..e005643e7f 100644
--- a/src/mir_app/src/netlibautoproxy.cpp
+++ b/src/mir_app/src/netlibautoproxy.cpp
@@ -176,9 +176,8 @@ struct IeProxyParam
char *szProxy;
};
-static void NetlibIeProxyThread(void *arg)
+static void __cdecl NetlibIeProxyThread(IeProxyParam *param)
{
- IeProxyParam *param = (IeProxyParam*)arg;
param->szProxy = nullptr;
if (!bAutoProxyInit) {
@@ -261,7 +260,7 @@ char* NetlibGetIeProxy(char *szUrl)
if (szAutoUrlStr[0]) {
IeProxyParam param = { szUrl, szHost, nullptr };
- HANDLE hThread = mir_forkthread(NetlibIeProxyThread, &param);
+ HANDLE hThread = mir_forkThread<IeProxyParam>(NetlibIeProxyThread, &param);
WaitForSingleObject(hThread, INFINITE);
res = param.szProxy;
}
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp
index e71ac0a92b..2a592dce89 100644
--- a/src/mir_app/src/netlibbind.cpp
+++ b/src/mir_app/src/netlibbind.cpp
@@ -119,9 +119,8 @@ int NetlibFreeBoundPort(NetlibBoundPort *nlbp)
return 1;
}
-static void NetlibBindAcceptThread(void* param)
+static void __cdecl NetlibBindAcceptThread(NetlibBoundPort *nlbp)
{
- NetlibBoundPort *nlbp = (NetlibBoundPort*)param;
Netlib_Logf(nlbp->nlu, "(%u) Port %u opened for incoming connections", nlbp->s, nlbp->wPort);
while (true) {
@@ -281,7 +280,7 @@ LBL_Error:
nlb->dwExternalIP = nlb->dwInternalIP;
}
- nlbp->hThread = mir_forkthread(NetlibBindAcceptThread, nlbp);
+ nlbp->hThread = mir_forkThread<NetlibBoundPort>(NetlibBindAcceptThread, nlbp);
return nlbp;
}
diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp
index cdc0668fdf..920334e467 100644
--- a/src/mir_app/src/netlibupnp.cpp
+++ b/src/mir_app/src/netlibupnp.cpp
@@ -644,10 +644,10 @@ static void discoverUPnP(void)
static bool findUPnPGateway(void)
{
- if ((time(nullptr) - lastDiscTime) >= expireTime) {
+ if ((time(0) - lastDiscTime) >= expireTime) {
WaitForSingleObject(portListMutex, INFINITE);
- time_t curTime = time(nullptr);
+ time_t curTime = time(0);
if ((curTime - lastDiscTime) >= expireTime) {
gatewayFound = false;
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index 15174fc395..1d3037eb61 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -337,7 +337,7 @@ struct DeactivationThreadParam
pfnUninitProto GetProtocolDestructor(char *szProto);
-static int DeactivationThread(DeactivationThreadParam* param)
+static void __cdecl DeactivationThread(DeactivationThreadParam *param)
{
PROTO_INTERFACE *p = (PROTO_INTERFACE*)param->ppro;
p->SetStatus(ID_STATUS_OFFLINE);
@@ -366,7 +366,6 @@ static int DeactivationThread(DeactivationThreadParam* param)
EraseAccount(szModuleName);
delete param;
- return 0;
}
void DeactivateAccount(PROTOACCOUNT *pa, int flags)
@@ -394,7 +393,7 @@ void DeactivateAccount(PROTOACCOUNT *pa, int flags)
param->flags = flags;
pa->ppro = nullptr;
if (flags & DAF_FORK)
- mir_forkthread((pThreadFunc)DeactivationThread, param);
+ mir_forkThread<DeactivationThreadParam>(DeactivationThread, param);
else
DeactivationThread(param);
}
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp
index 7b8ba22fdd..333e4c74fd 100644
--- a/src/mir_app/src/searchresults.cpp
+++ b/src/mir_app/src/searchresults.cpp
@@ -179,17 +179,16 @@ void FreeSearchResults(HWND hwndResults)
}
// on its own thread
-static void BeginSearchFailed(void *arg)
+static void __cdecl BeginSearchFailed(wchar_t *protoName)
{
- wchar_t buf[128];
- if (arg != nullptr) {
- const wchar_t *protoName = (wchar_t*)arg;
- mir_snwprintf(buf,
+ CMStringW buf;
+ if (protoName != nullptr) {
+ buf.Format(
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
protoName, protoName);
- mir_free((char*)arg);
+ mir_free(protoName);
}
- else mir_wstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
+ else buf = TranslateT("Could not search on any of the protocols, are you online?");
MessageBox(nullptr, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
@@ -215,7 +214,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha
if (failures) {
// infuriatingly vague error message. fixme.
if (dat->searchCount == 0) {
- mir_forkthread(BeginSearchFailed);
+ mir_forkThread<wchar_t>(BeginSearchFailed, nullptr);
mir_free(dat->search);
dat->search = nullptr;
return 1;
@@ -230,7 +229,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha
if (dat->search[0].hProcess == nullptr) {
// infuriatingly vague error message. fixme.
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- mir_forkthread(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
+ mir_forkThread<wchar_t>(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
mir_free(dat->search);
dat->search = nullptr;
dat->searchCount = 0;
diff --git a/src/mir_core/src/openurl.cpp b/src/mir_core/src/openurl.cpp
index 3e0e5e757f..2fcd374dce 100644
--- a/src/mir_core/src/openurl.cpp
+++ b/src/mir_core/src/openurl.cpp
@@ -36,10 +36,8 @@ struct TOpenUrlInfo
int newWindow;
};
-static void OpenURLThread(void *arg)
+static void __cdecl OpenURLThread(TOpenUrlInfo *hUrlInfo)
{
- TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)arg;
-
// wack a protocol on it
CMStringW tszUrl;
if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\')
@@ -68,11 +66,11 @@ static void OpenURLThread(void *arg)
MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow)
{
if (pszUrl)
- mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_a2u(pszUrl), bOpenInNewWindow));
+ mir_forkThread<TOpenUrlInfo>(OpenURLThread, new TOpenUrlInfo(mir_a2u(pszUrl), bOpenInNewWindow));
}
MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow)
{
if (pszUrl)
- mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_wstrdup(pszUrl), bOpenInNewWindow));
+ mir_forkThread<TOpenUrlInfo>(OpenURLThread, new TOpenUrlInfo(mir_wstrdup(pszUrl), bOpenInNewWindow));
}
diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp
index a6b972ae38..db0d4f5a1b 100644
--- a/src/mir_core/src/timezones.cpp
+++ b/src/mir_core/src/timezones.cpp
@@ -496,7 +496,7 @@ void GetLocalizedString(HKEY hSubKey, const wchar_t *szName, wchar_t *szBuf, DWO
void RecalculateTime(void)
{
GetTimeZoneInformation(&myInfo.myTZ.tzi);
- myInfo.timestamp = time(nullptr);
+ myInfo.timestamp = time(0);
myInfo.myTZ.offset = INT_MIN;
bool found = false;
diff --git a/src/mir_core/src/utils.cpp b/src/mir_core/src/utils.cpp
index a6be2b153e..df90e62d2a 100644
--- a/src/mir_core/src/utils.cpp
+++ b/src/mir_core/src/utils.cpp
@@ -530,7 +530,7 @@ MIR_CORE_DLL(void) Utils_GetRandom(void *pszDest, size_t cbLen)
if (pfnRtlGenRandom != nullptr)
pfnRtlGenRandom(pszDest, (ULONG)cbLen);
else {
- srand(time(nullptr));
+ srand(time(0));
BYTE *p = (BYTE*)pszDest;
for (size_t i = 0; i < cbLen; i++)
p[i] = rand() & 0xFF;
diff --git a/utils/std_string_utils.cpp b/utils/std_string_utils.cpp
index ff53b18585..cde856307c 100644
--- a/utils/std_string_utils.cpp
+++ b/utils/std_string_utils.cpp
@@ -44,7 +44,7 @@ std::string utils::url::decode(std::string data)
std::string utils::time::unix_timestamp()
{
- time_t in = ::time(nullptr);
+ time_t in = ::time(0);
return utils::conversion::to_string((void*)&in, UTILS_CONV_TIME_T);
}