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/TabSRMM | |
parent | 9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff) |
mir_forkThread<typename> - stronger typizatioin for thread function parameter
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 13 | ||||
-rw-r--r-- | plugins/TabSRMM/src/contactcache.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/hotkeyhandler.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/infopanel.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendlater.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.cpp | 14 | ||||
-rw-r--r-- | plugins/TabSRMM/src/templates.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/trayicon.cpp | 4 |
13 files changed, 33 insertions, 34 deletions
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...
|