diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdemail/src/email.cpp | 4 | ||||
-rw-r--r-- | src/core/stdfile/src/filexferdlg.cpp | 18 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 11 | ||||
-rw-r--r-- | src/core/stdmsg/src/cmdlist.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | src/core/stduihist/src/history.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/chat_opts.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/meta_services.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/netlibautoproxy.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/netlibbind.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/netlibupnp.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/proto_accs.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/searchresults.cpp | 17 | ||||
-rw-r--r-- | src/mir_core/src/openurl.cpp | 8 | ||||
-rw-r--r-- | src/mir_core/src/timezones.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/src/utils.cpp | 2 |
17 files changed, 44 insertions, 55 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;
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index d210d62d31..705d74a125 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -285,7 +285,7 @@ void SetIndentSize() LOGFONT lf;
LoadMsgDlgFont(0, &lf, nullptr);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = Chat_GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(nullptr)), hFont, TRUE);
+ int iText = Chat_GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(0)), hFont, TRUE);
DeleteObject(hFont);
g_Settings->LogTextIndent = iText * 12 / 10;
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index c7def6e4d8..71d0a830ea 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -519,7 +519,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) long trimlimit = g_Settings->LoggingLimit * 1024;
if (dwSize > trimlimit) {
- time_t now = time(nullptr);
+ time_t now = time(0);
wchar_t tszTimestamp[20];
wcsftime(tszTimestamp, 20, L"%Y%m%d-%H%M%S", _localtime32((__time32_t *)&now));
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 86649645e4..135f979d8d 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -188,9 +188,8 @@ struct TFakeAckParams char msg[512];
};
-static void __cdecl sttFakeAckFail(void *param)
+static void __cdecl sttFakeAckFail(TFakeAckParams *tParam)
{
- TFakeAckParams *tParam = (TFakeAckParams*)param;
WaitForSingleObject(tParam->hEvent, INFINITE);
Sleep(100);
@@ -243,7 +242,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) tfap->id = 10;
strncpy(tfap->msg, Translate("No online contacts found."), _countof(tfap->msg) - 1);
- CloseHandle(mir_forkthread(sttFakeAckFail, (void*)tfap));
+ mir_forkThread<TFakeAckParams>(sttFakeAckFail, tfap);
SetEvent(hEvent);
return 10;
}
diff --git a/src/mir_app/src/netlibautoproxy.cpp b/src/mir_app/src/netlibautoproxy.cpp index 04b70cabbf..e005643e7f 100644 --- a/src/mir_app/src/netlibautoproxy.cpp +++ b/src/mir_app/src/netlibautoproxy.cpp @@ -176,9 +176,8 @@ struct IeProxyParam char *szProxy;
};
-static void NetlibIeProxyThread(void *arg)
+static void __cdecl NetlibIeProxyThread(IeProxyParam *param)
{
- IeProxyParam *param = (IeProxyParam*)arg;
param->szProxy = nullptr;
if (!bAutoProxyInit) {
@@ -261,7 +260,7 @@ char* NetlibGetIeProxy(char *szUrl) if (szAutoUrlStr[0]) {
IeProxyParam param = { szUrl, szHost, nullptr };
- HANDLE hThread = mir_forkthread(NetlibIeProxyThread, ¶m);
+ HANDLE hThread = mir_forkThread<IeProxyParam>(NetlibIeProxyThread, ¶m);
WaitForSingleObject(hThread, INFINITE);
res = param.szProxy;
}
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp index e71ac0a92b..2a592dce89 100644 --- a/src/mir_app/src/netlibbind.cpp +++ b/src/mir_app/src/netlibbind.cpp @@ -119,9 +119,8 @@ int NetlibFreeBoundPort(NetlibBoundPort *nlbp) return 1;
}
-static void NetlibBindAcceptThread(void* param)
+static void __cdecl NetlibBindAcceptThread(NetlibBoundPort *nlbp)
{
- NetlibBoundPort *nlbp = (NetlibBoundPort*)param;
Netlib_Logf(nlbp->nlu, "(%u) Port %u opened for incoming connections", nlbp->s, nlbp->wPort);
while (true) {
@@ -281,7 +280,7 @@ LBL_Error: nlb->dwExternalIP = nlb->dwInternalIP;
}
- nlbp->hThread = mir_forkthread(NetlibBindAcceptThread, nlbp);
+ nlbp->hThread = mir_forkThread<NetlibBoundPort>(NetlibBindAcceptThread, nlbp);
return nlbp;
}
diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp index cdc0668fdf..920334e467 100644 --- a/src/mir_app/src/netlibupnp.cpp +++ b/src/mir_app/src/netlibupnp.cpp @@ -644,10 +644,10 @@ static void discoverUPnP(void) static bool findUPnPGateway(void)
{
- if ((time(nullptr) - lastDiscTime) >= expireTime) {
+ if ((time(0) - lastDiscTime) >= expireTime) {
WaitForSingleObject(portListMutex, INFINITE);
- time_t curTime = time(nullptr);
+ time_t curTime = time(0);
if ((curTime - lastDiscTime) >= expireTime) {
gatewayFound = false;
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index 15174fc395..1d3037eb61 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -337,7 +337,7 @@ struct DeactivationThreadParam pfnUninitProto GetProtocolDestructor(char *szProto);
-static int DeactivationThread(DeactivationThreadParam* param)
+static void __cdecl DeactivationThread(DeactivationThreadParam *param)
{
PROTO_INTERFACE *p = (PROTO_INTERFACE*)param->ppro;
p->SetStatus(ID_STATUS_OFFLINE);
@@ -366,7 +366,6 @@ static int DeactivationThread(DeactivationThreadParam* param) EraseAccount(szModuleName);
delete param;
- return 0;
}
void DeactivateAccount(PROTOACCOUNT *pa, int flags)
@@ -394,7 +393,7 @@ void DeactivateAccount(PROTOACCOUNT *pa, int flags) param->flags = flags;
pa->ppro = nullptr;
if (flags & DAF_FORK)
- mir_forkthread((pThreadFunc)DeactivationThread, param);
+ mir_forkThread<DeactivationThreadParam>(DeactivationThread, param);
else
DeactivationThread(param);
}
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 7b8ba22fdd..333e4c74fd 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -179,17 +179,16 @@ void FreeSearchResults(HWND hwndResults) }
// on its own thread
-static void BeginSearchFailed(void *arg)
+static void __cdecl BeginSearchFailed(wchar_t *protoName)
{
- wchar_t buf[128];
- if (arg != nullptr) {
- const wchar_t *protoName = (wchar_t*)arg;
- mir_snwprintf(buf,
+ CMStringW buf;
+ if (protoName != nullptr) {
+ buf.Format(
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
protoName, protoName);
- mir_free((char*)arg);
+ mir_free(protoName);
}
- else mir_wstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
+ else buf = TranslateT("Could not search on any of the protocols, are you online?");
MessageBox(nullptr, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
@@ -215,7 +214,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (failures) {
// infuriatingly vague error message. fixme.
if (dat->searchCount == 0) {
- mir_forkthread(BeginSearchFailed);
+ mir_forkThread<wchar_t>(BeginSearchFailed, nullptr);
mir_free(dat->search);
dat->search = nullptr;
return 1;
@@ -230,7 +229,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (dat->search[0].hProcess == nullptr) {
// infuriatingly vague error message. fixme.
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- mir_forkthread(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
+ mir_forkThread<wchar_t>(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
mir_free(dat->search);
dat->search = nullptr;
dat->searchCount = 0;
diff --git a/src/mir_core/src/openurl.cpp b/src/mir_core/src/openurl.cpp index 3e0e5e757f..2fcd374dce 100644 --- a/src/mir_core/src/openurl.cpp +++ b/src/mir_core/src/openurl.cpp @@ -36,10 +36,8 @@ struct TOpenUrlInfo int newWindow;
};
-static void OpenURLThread(void *arg)
+static void __cdecl OpenURLThread(TOpenUrlInfo *hUrlInfo)
{
- TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)arg;
-
// wack a protocol on it
CMStringW tszUrl;
if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\')
@@ -68,11 +66,11 @@ static void OpenURLThread(void *arg) MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow)
{
if (pszUrl)
- mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_a2u(pszUrl), bOpenInNewWindow));
+ mir_forkThread<TOpenUrlInfo>(OpenURLThread, new TOpenUrlInfo(mir_a2u(pszUrl), bOpenInNewWindow));
}
MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow)
{
if (pszUrl)
- mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_wstrdup(pszUrl), bOpenInNewWindow));
+ mir_forkThread<TOpenUrlInfo>(OpenURLThread, new TOpenUrlInfo(mir_wstrdup(pszUrl), bOpenInNewWindow));
}
diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp index a6b972ae38..db0d4f5a1b 100644 --- a/src/mir_core/src/timezones.cpp +++ b/src/mir_core/src/timezones.cpp @@ -496,7 +496,7 @@ void GetLocalizedString(HKEY hSubKey, const wchar_t *szName, wchar_t *szBuf, DWO void RecalculateTime(void)
{
GetTimeZoneInformation(&myInfo.myTZ.tzi);
- myInfo.timestamp = time(nullptr);
+ myInfo.timestamp = time(0);
myInfo.myTZ.offset = INT_MIN;
bool found = false;
diff --git a/src/mir_core/src/utils.cpp b/src/mir_core/src/utils.cpp index a6be2b153e..df90e62d2a 100644 --- a/src/mir_core/src/utils.cpp +++ b/src/mir_core/src/utils.cpp @@ -530,7 +530,7 @@ MIR_CORE_DLL(void) Utils_GetRandom(void *pszDest, size_t cbLen) if (pfnRtlGenRandom != nullptr)
pfnRtlGenRandom(pszDest, (ULONG)cbLen);
else {
- srand(time(nullptr));
+ srand(time(0));
BYTE *p = (BYTE*)pszDest;
for (size_t i = 0; i < cbLen; i++)
p[i] = rand() & 0xFF;
|