summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/sendqueue.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-07 23:14:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-07 23:14:08 +0300
commit4dde6e6a9b6176050f31df13e91d248b5d7c62b2 (patch)
treef449a243e576cec7968efcca842a7c4db8b6bd85 /plugins/Scriver/src/sendqueue.cpp
parent0bc0ec3803c1d95798e551ec7c1d431d2ac98075 (diff)
code cleaning
Diffstat (limited to 'plugins/Scriver/src/sendqueue.cpp')
-rw-r--r--plugins/Scriver/src/sendqueue.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp
index 46159a9919..dde4e2270d 100644
--- a/plugins/Scriver/src/sendqueue.cpp
+++ b/plugins/Scriver/src/sendqueue.cpp
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static MessageSendQueueItem *global_sendQueue = NULL;
+static MessageSendQueueItem *global_sendQueue = nullptr;
static mir_cs queueMutex;
wchar_t* GetSendBufferMsg(MessageSendQueueItem *item)
@@ -38,7 +38,7 @@ MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender)
mir_cslock lck(queueMutex);
item->hwndSender = hwndSender;
item->next = global_sendQueue;
- if (global_sendQueue != NULL)
+ if (global_sendQueue != nullptr)
global_sendQueue->prev = item;
global_sendQueue = item;
@@ -48,21 +48,21 @@ MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender)
MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, MCONTACT hContact)
{
mir_cslock lck(queueMutex);
- for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next)
- if (item->hwndSender == hwndSender && item->hContact == hContact && item->hwndErrorDlg == NULL)
+ for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next)
+ if (item->hwndSender == hwndSender && item->hContact == hContact && item->hwndErrorDlg == nullptr)
return item;
- return NULL;
+ return nullptr;
}
MessageSendQueueItem* FindSendQueueItem(MCONTACT hContact, HANDLE hSendId)
{
mir_cslock lock(queueMutex);
- for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next)
+ for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next)
if (item->hContact == hContact && item->hSendId == hSendId)
return item;
- return NULL;
+ return nullptr;
}
BOOL RemoveSendQueueItem(MessageSendQueueItem* item)
@@ -70,19 +70,19 @@ BOOL RemoveSendQueueItem(MessageSendQueueItem* item)
HWND hwndSender = item->hwndSender;
mir_cslock lock(queueMutex);
- if (item->prev != NULL)
+ if (item->prev != nullptr)
item->prev->next = item->next;
else
global_sendQueue = item->next;
- if (item->next != NULL)
+ if (item->next != nullptr)
item->next->prev = item->prev;
mir_free(item->sendBuffer);
mir_free(item->proto);
mir_free(item);
- for (item = global_sendQueue; item != NULL; item = item->next)
+ for (item = global_sendQueue; item != nullptr; item = item->next)
if (item->hwndSender == hwndSender)
return FALSE;
@@ -96,13 +96,13 @@ void ReportSendQueueTimeouts(HWND hwndSender)
mir_cslock lock(queueMutex);
- for (item = global_sendQueue; item != NULL; item = item2) {
+ for (item = global_sendQueue; item != nullptr; item = item2) {
item2 = item->next;
if (item->timeout < timeout) {
item->timeout += 1000;
if (item->timeout >= timeout) {
- if (item->hwndSender == hwndSender && item->hwndErrorDlg == NULL) {
- if (hwndSender != NULL) {
+ if (item->hwndSender == hwndSender && item->hwndErrorDlg == nullptr) {
+ if (hwndSender != nullptr) {
ErrorWindowData *ewd = (ErrorWindowData *)mir_alloc(sizeof(ErrorWindowData));
ewd->szName = mir_wstrdup(pcli->pfnGetContactDisplayName(item->hContact, 0));
ewd->szDescription = mir_wstrdup(TranslateT("The message send timed out."));
@@ -125,13 +125,13 @@ void ReleaseSendQueueItems(HWND hwndSender)
{
mir_cslock lock(queueMutex);
- for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) {
+ for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next) {
if (item->hwndSender == hwndSender) {
- item->hwndSender = NULL;
- if (item->hwndErrorDlg != NULL)
+ item->hwndSender = nullptr;
+ if (item->hwndErrorDlg != nullptr)
DestroyWindow(item->hwndErrorDlg);
- item->hwndErrorDlg = NULL;
+ item->hwndErrorDlg = nullptr;
}
}
}
@@ -142,8 +142,8 @@ int ReattachSendQueueItems(HWND hwndSender, MCONTACT hContact)
mir_cslock lock(queueMutex);
- for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) {
- if (item->hContact == hContact && item->hwndSender == NULL) {
+ for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next) {
+ if (item->hContact == hContact && item->hwndSender == nullptr) {
item->hwndSender = hwndSender;
item->timeout = 0;
count++;
@@ -156,7 +156,7 @@ void RemoveAllSendQueueItems()
{
MessageSendQueueItem *item, *item2;
mir_cslock lock(queueMutex);
- for (item = global_sendQueue; item != NULL; item = item2) {
+ for (item = global_sendQueue; item != nullptr; item = item2) {
item2 = item->next;
RemoveSendQueueItem(item);
}
@@ -167,14 +167,14 @@ void SendSendQueueItem(MessageSendQueueItem* item)
mir_cslockfull lock(queueMutex);
item->timeout = 0;
- if (item->prev != NULL) {
+ if (item->prev != nullptr) {
item->prev->next = item->next;
- if (item->next != NULL)
+ if (item->next != nullptr)
item->next->prev = item->prev;
item->next = global_sendQueue;
- item->prev = NULL;
- if (global_sendQueue != NULL)
+ item->prev = nullptr;
+ if (global_sendQueue != nullptr)
global_sendQueue->prev = item;
global_sendQueue = item;