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/AutoShutdown/src/cpuusage.cpp | 6 ++---- plugins/AutoShutdown/src/frame.cpp | 2 +- plugins/AutoShutdown/src/settingsdlg.cpp | 6 +++--- plugins/AutoShutdown/src/utils.cpp | 5 ++--- 4 files changed, 8 insertions(+), 11 deletions(-) (limited to 'plugins/AutoShutdown') 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(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, ×tamp)) { /* 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, ×tamp)) { /* 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, ×tamp)) - 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(MessageBoxIndirectFree, mbp); } // LocalFree() the return value -- cgit v1.2.3