summaryrefslogtreecommitdiff
path: root/src/core
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 /src/core
parent9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff)
mir_forkThread<typename> - stronger typizatioin for thread function parameter
Diffstat (limited to 'src/core')
-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
6 files changed, 19 insertions, 23 deletions
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;