From 3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 3 May 2018 16:02:14 +0200 Subject: mir_forkThread - stronger typizatioin for thread function parameter --- plugins/WebView/src/webview.cpp | 6 +++--- plugins/WebView/src/webview.h | 1 - plugins/WebView/src/webview_alerts.cpp | 2 +- plugins/WebView/src/webview_getdata.cpp | 6 +++--- plugins/WebView/src/webview_services.cpp | 26 +++++++++++++------------- 5 files changed, 20 insertions(+), 21 deletions(-) (limited to 'plugins/WebView') 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(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; +} -- cgit v1.2.3