diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-03 16:02:14 +0200 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-03 16:02:14 +0200 |
commit | 3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a (patch) | |
tree | 412a28ef6a572efc7039df1c363bf47a3dec4b19 /plugins/BasicHistory | |
parent | 9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff) |
mir_forkThread<typename> - stronger typizatioin for thread function parameter
Diffstat (limited to 'plugins/BasicHistory')
-rw-r--r-- | plugins/BasicHistory/src/HistoryWindow.cpp | 13 | ||||
-rw-r--r-- | plugins/BasicHistory/src/HistoryWindow.h | 2 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Options.cpp | 2 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Options.h | 2 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Scheduler.cpp | 14 |
5 files changed, 16 insertions, 17 deletions
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;
|