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 /protocols/SkypeWeb/src | |
parent | 9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff) |
mir_forkThread<typename> - stronger typizatioin for thread function parameter
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/request_queue.cpp | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/request_queue.h | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 6 |
7 files changed, 20 insertions, 24 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 6ed47aa00c..ed64a40447 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -41,7 +41,7 @@ void RequestQueue::Start() isTerminated = false;
if (hRequestQueueThread == nullptr)
- hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this);
+ hRequestQueueThread = mir_forkThread<RequestQueue>(&RequestQueue::WorkerThread, this);
}
void RequestQueue::Stop()
@@ -70,7 +70,7 @@ void RequestQueue::Push(HttpRequest *request, HttpResponseCallback response, voi void RequestQueue::Send(HttpRequest *request, HttpResponseCallback response, void *arg)
{
RequestQueueItem *item = new RequestQueueItem(request, response, arg);
- mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, nullptr);
+ mir_forkthreadowner(&RequestQueue::AsyncSendThread, this, item, nullptr);
}
void RequestQueue::Execute(RequestQueueItem *item)
@@ -83,20 +83,17 @@ void RequestQueue::Execute(RequestQueueItem *item) delete item;
}
-unsigned int RequestQueue::AsyncSendThread(void *owner, void *arg)
+unsigned RequestQueue::AsyncSendThread(void *owner, void *arg)
{
RequestQueue *that = (RequestQueue*)owner;
RequestQueueItem *item = (RequestQueueItem*)arg;
that->Execute(item);
-
return 0;
}
-unsigned int RequestQueue::WorkerThread(void *arg)
+void RequestQueue::WorkerThread(RequestQueue *queue)
{
- RequestQueue *queue = (RequestQueue*)arg;
-
while (true) {
queue->hRequestQueueEvent.Wait();
if (queue->isTerminated)
@@ -119,5 +116,4 @@ unsigned int RequestQueue::WorkerThread(void *arg) }
queue->hRequestQueueThread = nullptr;
- return 0;
-}
\ No newline at end of file +}
diff --git a/protocols/SkypeWeb/src/request_queue.h b/protocols/SkypeWeb/src/request_queue.h index f4a60e826d..1f2c5a014a 100644 --- a/protocols/SkypeWeb/src/request_queue.h +++ b/protocols/SkypeWeb/src/request_queue.h @@ -51,8 +51,8 @@ class RequestQueue void Execute(RequestQueueItem *item);
- static unsigned int __cdecl AsyncSendThread(void*, void*);
- static unsigned int __cdecl WorkerThread(void*);
+ static unsigned __cdecl AsyncSendThread(void*, void*);
+ static void __cdecl WorkerThread(RequestQueue *queue);
public:
RequestQueue(HNETLIBUSER nlu);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 9a810d3d16..2ff7f8140a 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -198,7 +198,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) gce.ptszUID = gch->ptszUID;
gce.ptszText = tnick_new;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
if (!reset)
@@ -351,7 +351,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) gce.ptszNick = tszId;
gce.ptszUID = tszId;
gce.ptszText = tszInitiator;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateT("Admin");
Chat_Event(&gce);
@@ -372,9 +372,9 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM ptrA szMessage(mir_utf8encodeW(buf));
if (strncmp(szMessage, "/me ", 4) == 0)
- SendRequest(new SendChatActionRequest(szChatId, time(nullptr), szMessage, li));
+ SendRequest(new SendChatActionRequest(szChatId, time(0), szMessage, li));
else
- SendRequest(new SendChatMessageRequest(szChatId, time(nullptr), szMessage, li));
+ SendRequest(new SendChatMessageRequest(szChatId, time(0), szMessage, li));
}
void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
@@ -512,7 +512,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = !isChange ? time(nullptr) : NULL;
+ gce.time = !isChange ? time(0) : NULL;
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateW(role);
@@ -533,13 +533,13 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con gce.ptszUID = tid;
gce.ptszNick = tnick;
gce.ptszStatus = tinitiator;
- gce.time = time(nullptr);
+ gce.time = time(0);
}
else {
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = IsMe(id);
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index d345821194..14a718b391 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -122,7 +122,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, skypename.c_str(), reason.c_str());
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 6df167f3b4..7dfd901ae1 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -35,7 +35,7 @@ void CSkypeProto::Login() }
m_bHistorySynced = m_bThreadsTerminated = false;
- if ((tokenExpires - 1800) > time(nullptr))
+ if ((tokenExpires - 1800) > time(0))
OnLoginSuccess();
PushRequest(new OAuthRequest(), &CSkypeProto::OnOAuthStart);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index f1381333f2..9ca334c122 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -52,7 +52,7 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) SendMessageParam *param = new SendMessageParam();
param->hContact = hContact;
- param->hMessage = time(nullptr);
+ param->hMessage = time(0);
ptrA username(getStringA(hContact, "Skypename"));
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index c89b9954a1..65e4108808 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -95,9 +95,9 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response) m_hTrouterEvent.Set();
m_hTrouterHealthEvent.Set();
- if ((time(nullptr) - TRouter.lastRegistrationTime) >= 3600) {
+ if ((time(0) - TRouter.lastRegistrationTime) >= 3600) {
SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str()));
- TRouter.lastRegistrationTime = time(nullptr);
+ TRouter.lastRegistrationTime = time(0);
}
}
@@ -186,7 +186,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) if (!uid.empty()) {
MCONTACT hContact = AddContact(uid.c_str(), true);
- MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(nullptr), DBEF_READ, gp.c_str(), callId.c_str());
+ MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(0), DBEF_READ, gp.c_str(), callId.c_str());
Skin_PlaySound("skype_inc_call");
CLISTEVENT cle = {};
|