summaryrefslogtreecommitdiff
path: root/protocols/ICQCorp
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /protocols/ICQCorp
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'protocols/ICQCorp')
-rw-r--r--protocols/ICQCorp/src/corp.cpp8
-rw-r--r--protocols/ICQCorp/src/event.cpp8
-rw-r--r--protocols/ICQCorp/src/options.cpp4
-rw-r--r--protocols/ICQCorp/src/packet.cpp4
-rw-r--r--protocols/ICQCorp/src/protocol.cpp86
-rw-r--r--protocols/ICQCorp/src/services.cpp18
-rw-r--r--protocols/ICQCorp/src/socket.cpp2
-rw-r--r--protocols/ICQCorp/src/transfer.cpp34
-rw-r--r--protocols/ICQCorp/src/user.cpp16
9 files changed, 90 insertions, 90 deletions
diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp
index cd6388e59d..72d9de6ee7 100644
--- a/protocols/ICQCorp/src/corp.cpp
+++ b/protocols/ICQCorp/src/corp.cpp
@@ -104,13 +104,13 @@ void T(char *format, ...)
static HANDLE hFile = INVALID_HANDLE_VALUE;
if (hFile == INVALID_HANDLE_VALUE) {
- hFile = CreateFile("ICQ Corp.log", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL);
- SetFilePointer(hFile, 0, 0, FILE_END);
+ hFile = CreateFile("ICQ Corp.log", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, 0, nullptr);
+ SetFilePointer(hFile, 0, nullptr, FILE_END);
}
DWORD result;
- WriteFile(hFile, bufferTime, (DWORD)mir_strlen(bufferTime), &result, NULL);
- WriteFile(hFile, buffer, (DWORD)mir_strlen(buffer), &result, NULL);
+ WriteFile(hFile, bufferTime, (DWORD)mir_strlen(bufferTime), &result, nullptr);
+ WriteFile(hFile, buffer, (DWORD)mir_strlen(buffer), &result, nullptr);
}
#endif
diff --git a/protocols/ICQCorp/src/event.cpp b/protocols/ICQCorp/src/event.cpp
index 70ccbedf3f..6499a1d37b 100644
--- a/protocols/ICQCorp/src/event.cpp
+++ b/protocols/ICQCorp/src/event.cpp
@@ -25,7 +25,7 @@ std::vector <ICQEvent *> icqEvents;
static void WINAPI eventTimerProc(HWND, UINT, UINT_PTR hTimer, DWORD)
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
for (size_t i = 0; i < icqEvents.size(); i++)
if (hTimer == icqEvents[i]->hTimer)
@@ -40,7 +40,7 @@ ICQEvent* getEvent(SOCKET hSocket, unsigned int sequence)
if (icqEvents[i]->isEvent(hSocket, sequence))
return icqEvents[i];
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -77,7 +77,7 @@ bool ICQEvent::start()
return false;
if (cmd != ICQ_CMDxTCP_START)
- hTimer = SetTimer(NULL, 0, MAX_WAIT_ACK, eventTimerProc);
+ hTimer = SetTimer(nullptr, 0, MAX_WAIT_ACK, eventTimerProc);
return true;
}
@@ -86,7 +86,7 @@ bool ICQEvent::start()
void ICQEvent::stop()
{
if (hTimer) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
}
diff --git a/protocols/ICQCorp/src/options.cpp b/protocols/ICQCorp/src/options.cpp
index 7aa7a49ec1..dbe5e9189c 100644
--- a/protocols/ICQCorp/src/options.cpp
+++ b/protocols/ICQCorp/src/options.cpp
@@ -45,12 +45,12 @@ static INT_PTR CALLBACK icqOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_dw(NULL, protoName, "UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, NULL, FALSE));
+ db_set_dw(NULL, protoName, "UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, nullptr, FALSE));
GetDlgItemText(hWnd, IDC_OPT_PASSWORD, str, sizeof(str));
db_set_s(NULL, protoName, "Password", str);
GetDlgItemText(hWnd, IDC_OPT_SERVER, str, sizeof(str));
db_set_s(NULL, protoName, "Server", str);
- db_set_w(NULL, protoName, "Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, NULL, FALSE));
+ db_set_w(NULL, protoName, "Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, nullptr, FALSE));
return TRUE;
}
break;
diff --git a/protocols/ICQCorp/src/packet.cpp b/protocols/ICQCorp/src/packet.cpp
index bce974f68a..9fe991e557 100644
--- a/protocols/ICQCorp/src/packet.cpp
+++ b/protocols/ICQCorp/src/packet.cpp
@@ -159,9 +159,9 @@ Packet& Packet::operator >> (char *&in)
unsigned short s;
operator >> (s);
- if (nextData + s > buff + sizeVal) in = 0;
+ if (nextData + s > buff + sizeVal) in = nullptr;
else {
- if (in == NULL) in = new char[s];
+ if (in == nullptr) in = new char[s];
memcpy(in, nextData, s);
nextData += s;
}
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp
index 4193dc2091..e38e9b9e31 100644
--- a/protocols/ICQCorp/src/protocol.cpp
+++ b/protocols/ICQCorp/src/protocol.cpp
@@ -150,7 +150,7 @@ bool ICQ::load()
WSADATA data;
if (WSAStartup(MAKEWORD(2, 2), &data)) {
- MessageBox(NULL, Translate("ICQ Corporate plugin used only WinSock v2.2 or later."), protoName, MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, Translate("ICQ Corporate plugin used only WinSock v2.2 or later."), protoName, MB_ICONWARNING | MB_OK);
return false;
}
@@ -161,11 +161,11 @@ bool ICQ::load()
awayMessage = new char[1];
awayMessage[0] = 0;
- WNDCLASS wc = { 0, messageWndProc, 0, 0, hInstance, NULL, NULL, NULL, NULL, protoName };
+ WNDCLASS wc = { 0, messageWndProc, 0, 0, hInstance, nullptr, nullptr, nullptr, nullptr, protoName };
if (!RegisterClass(&wc)) return false;
- hWnd = CreateWindowEx(0, protoName, NULL, 0, 0, 0, 0, 0, (unsigned short)GetVersion() >= 5 ? HWND_MESSAGE : 0, NULL, hInstance, NULL);
- if (hWnd == NULL) return false;
+ hWnd = CreateWindowEx(0, protoName, nullptr, 0, 0, 0, 0, 0, (unsigned short)GetVersion() >= 5 ? HWND_MESSAGE : nullptr, nullptr, hInstance, nullptr);
+ if (hWnd == nullptr) return false;
return true;
}
@@ -176,7 +176,7 @@ void ICQ::unload()
{
if (statusVal != ID_STATUS_OFFLINE) logoff(false);
- KillTimer(NULL, pingTimer);
+ KillTimer(nullptr, pingTimer);
pingTimer = NULL;
delete[] awayMessage;
@@ -199,7 +199,7 @@ bool ICQ::logon(unsigned short logonStatus)
db_free(&dbv);
}
else {
- MessageBox(NULL, Translate("You need specify ICQ Corporate login server."), protoName, MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, Translate("You need specify ICQ Corporate login server."), protoName, MB_ICONWARNING | MB_OK);
return false;
}
@@ -213,7 +213,7 @@ bool ICQ::logon(unsigned short logonStatus)
}
if (pingTimer == NULL)
- pingTimer = SetTimer(NULL, 0, PING_FREQUENCY, pingTimerProc);
+ pingTimer = SetTimer(nullptr, 0, PING_FREQUENCY, pingTimerProc);
updateContactList();
@@ -323,7 +323,7 @@ ICQEvent *ICQ::sendICQ(Socket &socket, Packet &packet, unsigned short cmd, unsig
ICQEvent *result;
if (!socket.connected())
- return NULL;
+ return nullptr;
if (cmd != ICQ_CMDxTCP_START)
sequenceVal++;
@@ -331,7 +331,7 @@ ICQEvent *ICQ::sendICQ(Socket &socket, Packet &packet, unsigned short cmd, unsig
icqEvents.push_back(result = new ICQEvent(cmd, subCmd, sequence, uin, &socket, &packet, reply));
if (!result->start()) {
cancelEvent(result);
- return NULL;
+ return nullptr;
}
return result;
}
@@ -432,7 +432,7 @@ void ICQ::cancelEvent(ICQEvent *&e)
icqEvents.pop_back();
delete e;
- e = NULL;
+ e = nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -442,7 +442,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
unsigned short version, command, newCommand, theSequence, theSequence1, searchSequence, junkShort;
unsigned int checkUin, userIP, realIP, junkl, newStatus, userPort, timedataStamp;
unsigned char junkChar;
- char *message = NULL;
+ char *message = nullptr;
ICQUser *u;
ICQEvent *e;
@@ -467,7 +467,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> message;
T("%s\n", message);
- MessageBox(NULL, message, protoName, MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, message, protoName, MB_ICONERROR | MB_OK);
delete[] message;
break;
@@ -477,7 +477,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
T("[udp] user %d is online\n", checkUin);
ackUDP(theSequence);
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
packet >> userIP
>> userPort
@@ -499,7 +499,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
T("[udp] user %d is offline\n", checkUin);
ackUDP(theSequence);
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
u->setStatus(ID_STATUS_OFFLINE);
u->socket.closeConnection();
@@ -514,9 +514,9 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
T("[udp] user information packet (%d)\n", theSequence);
ackUDP(theSequence);
- if ((e = getEvent(udpSocket.handleVal, theSequence1)) == NULL) break;
+ if ((e = getEvent(udpSocket.handleVal, theSequence1)) == nullptr) break;
checkUin = e->uin;
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
char *buffer;
buffer = new char[1024];
@@ -603,7 +603,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
break;
}
- if (e->reply == 0) ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, 0, 0);
+ if (e->reply == 0) ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr, 0);
doneEvent(true, udpSocket.handleVal, theSequence1);
delete[] buffer;
break;
@@ -612,7 +612,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
T("[udp] invalid uin\n");
ackUDP(theSequence);
- if ((e = getEvent(udpSocket.handleVal, theSequence1)) == NULL) break;
+ if ((e = getEvent(udpSocket.handleVal, theSequence1)) == nullptr) break;
checkUin = e->uin;
T("invalid uin: %d\n", checkUin);
@@ -626,7 +626,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> newStatus;
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
u->setStatus(toIdStatus(newStatus));
break;
@@ -642,10 +642,10 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
char *alias, *firstName, *lastName, *email;
unsigned char auth;
- alias = NULL;
- firstName = NULL;
- lastName = NULL;
- email = NULL;
+ alias = nullptr;
+ firstName = nullptr;
+ lastName = nullptr;
+ email = nullptr;
packet >> checkUin >> alias >> firstName >> lastName >> email >> auth;
{
ICQSEARCHRESULT psr = { 0 };
@@ -696,7 +696,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(NULL));
+ processSystemMessage(packet, checkUin, newCommand, time(nullptr));
break;
case ICQ_CMDxRCV_SYSxMSGxDONE: // end of system messages
@@ -778,7 +778,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(NULL));
+ processSystemMessage(packet, checkUin, newCommand, time(nullptr));
break;
case ICQ_CMDxRCV_BROADCASTxDONE:
@@ -822,8 +822,8 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
case ICQ_CMDxRCV_WRONGxPASSWD: // incorrect password sent in logon
T("[udp] incorrect password.\n");
- ProtoBroadcastAck(protoName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
- MessageBox(NULL, Translate("Your ICQ Corp number and password combination was rejected by the ICQ Corporate server. Please go to Options -> Network -> ICQCorp and try again."), protoName, MB_ICONERROR | MB_OK);
+ ProtoBroadcastAck(protoName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
+ MessageBox(nullptr, Translate("Your ICQ Corp number and password combination was rejected by the ICQ Corporate server. Please go to Options -> Network -> ICQCorp and try again."), protoName, MB_ICONERROR | MB_OK);
break;
case ICQ_CMDxRCV_BUSY: // server too busy to respond
@@ -849,7 +849,7 @@ void ICQ::processSystemMessage(Packet &packet, unsigned long checkUin, unsigned
u = getUserByUIN(checkUin);
- message = NULL;
+ message = nullptr;
packet >> message;
switch (newCommand) {
@@ -1023,7 +1023,7 @@ ICQUser *ICQ::getUserByUIN(unsigned long uin, bool allowAdd)
}
T("ICQ sent unknown user %d\n", uin);
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1040,7 +1040,7 @@ ICQUser *ICQ::getUserByContact(MCONTACT hContact)
u = icqUsers[i];
if (u->hContact == hContact) return u;
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1118,7 +1118,7 @@ void ICQ::updateContactList()
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
proto = GetContactProto(hContact);
if (proto && !mir_strcmp(proto, protoName)) {
- if ((u = getUserByContact(hContact)) == NULL) {
+ if ((u = getUserByContact(hContact)) == nullptr) {
u = new ICQUser();
u->hContact = hContact;
u->uin = db_get_dw(hContact, protoName, "UIN", 0);
@@ -1361,7 +1361,7 @@ ICQEvent *ICQ::send(ICQUser *u, unsigned short cmd, char *cmdStr, char *m)
{
ICQEvent *result;
- if (u->statusVal > ID_STATUS_OFFLINE && (result = sendTCP(u, cmd, cmdStr, m)) != NULL) return result;
+ if (u->statusVal > ID_STATUS_OFFLINE && (result = sendTCP(u, cmd, cmdStr, m)) != nullptr) return result;
else return sendUDP(u, cmd, cmdStr, m);
}
@@ -1408,7 +1408,7 @@ bool ICQ::openConnection(TCPSocket &socket)
ICQEvent *ICQ::sendTCP(ICQUser *u, unsigned short cmd, char *cmdStr, char *m)
{
if (!u->socket.connected() && !openConnection(u->socket))
- return NULL;
+ return nullptr;
unsigned int status;
switch (statusVal) {
@@ -1540,7 +1540,7 @@ ICQEvent *ICQ::sendReadAwayMsg(ICQUser *u)
case ID_STATUS_NA: cmd = ICQ_CMDxTCP_READxNAxMSG; break;
case ID_STATUS_OCCUPIED: cmd = ICQ_CMDxTCP_READxOCCUPIEDxMSG; break;
case ID_STATUS_FREECHAT: cmd = ICQ_CMDxTCP_READxFREECHATxMSG; break;
- default: return NULL;
+ default: return nullptr;
}
return sendTCP(u, cmd, "away message request", "");
@@ -1551,7 +1551,7 @@ ICQEvent *ICQ::sendReadAwayMsg(ICQUser *u)
ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsigned int size, char **files)
{
if (!u->socket.connected() && !openConnection(u->socket))
- return NULL;
+ return nullptr;
unsigned int i;
@@ -1560,7 +1560,7 @@ ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsign
for (i = 0; files[i]; i++);
transfer->files = new char*[i + 1];
for (i = 0; files[i]; i++) transfer->files[i] = _strdup(files[i]);
- transfer->files[i] = 0;
+ transfer->files[i] = nullptr;
transfer->description = _strdup(description);
transfer->count = i;
@@ -1568,7 +1568,7 @@ ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsign
transfer->path = _strdup(transfer->files[0]);
char *s = strrchr(transfer->path, '\\');
- if (s != NULL)
+ if (s != nullptr)
*s = 0;
icqTransfers.push_back(transfer);
@@ -1752,7 +1752,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
unsigned int i, checkUin, senderIp, localIp, userStatus, senderPort, junkLong, thePort, theTCPSequence = 0;
unsigned short version, command, junkShort, newCommand, /*messageLen,*/ cicqVersion;
unsigned char cicqChar, junkChar;
- char *message = NULL;
+ char *message = nullptr;
ICQUser *u;
static unsigned int chatUin, chatSequence;
@@ -1779,7 +1779,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addMessage(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_MSG, theTCPSequence, time(NULL));
+ addMessage(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_MSG, theTCPSequence, time(nullptr));
break;
case ICQ_CMDxTCP_CHAT:
@@ -1800,14 +1800,14 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addUrl(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_URL, theTCPSequence, time(NULL));
+ addUrl(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_URL, theTCPSequence, time(nullptr));
break;
case ICQ_CMDxTCP_FILE:
unsigned int size;
char *fileName;
- fileName = NULL;
+ fileName = nullptr;
packet >> junkLong
>> fileName
>> size
@@ -1816,7 +1816,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
T("[tcp] file transfer request from %d (%d)\n", checkUin, theTCPSequence);
- addFileReq(u, message, fileName, size, ICQ_CMDxTCP_START, ICQ_CMDxTCP_FILE, theTCPSequence, time(NULL));
+ addFileReq(u, message, fileName, size, ICQ_CMDxTCP_START, ICQ_CMDxTCP_FILE, theTCPSequence, time(nullptr));
delete[] fileName;
break;
@@ -1901,7 +1901,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
case ICQ_CMDxTCP_READxDNDxMSG:
case ICQ_CMDxTCP_READxFREECHATxMSG:
packet >> theTCPSequence;
- addAwayMsg(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_READxAWAYxMSG, theTCPSequence, time(NULL));
+ addAwayMsg(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_READxAWAYxMSG, theTCPSequence, time(nullptr));
break;
}
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp
index c9a3442b65..d182c0bc33 100644
--- a/protocols/ICQCorp/src/services.cpp
+++ b/protocols/ICQCorp/src/services.cpp
@@ -164,7 +164,7 @@ static INT_PTR icqGetInfo(WPARAM, LPARAM lParam)
CCSDATA *ccs = (CCSDATA *)lParam;
ICQUser *u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || icq.statusVal <= ID_STATUS_OFFLINE)
+ if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
return 1;
icq.getUserInfo(u, ccs->wParam & SGIF_MINIMAL);
@@ -180,7 +180,7 @@ static INT_PTR icqSendMessage(WPARAM, LPARAM lParam)
CCSDATA *ccs = (CCSDATA *)lParam;
ICQUser *u = icq.getUserByContact(ccs->hContact);
// uin = db_get_dw(ccs->hContact, ICQCORP_PROTONAME, "UIN", 0);
- if (u == NULL || icq.statusVal <= ID_STATUS_OFFLINE)
+ if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
return 0;
ICQEvent *icqEvent = icq.sendMessage(u, ptrA(mir_utf8decodeA((char*)ccs->lParam)));
@@ -220,7 +220,7 @@ static INT_PTR icqSendUrl(WPARAM, LPARAM lParam)
T("[ ] send url\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || icq.statusVal <= ID_STATUS_OFFLINE)
+ if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
return 0;
icqEvent = icq.sendUrl(u, (char*)ccs->lParam);
@@ -277,7 +277,7 @@ static INT_PTR icqGetAwayMsg(WPARAM, LPARAM lParam)
T("[ ] send get away msg\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal <= ID_STATUS_ONLINE) return 0;
+ if (u == nullptr || u->statusVal <= ID_STATUS_ONLINE) return 0;
icqEvent = icq.sendReadAwayMsg(u);
return icqEvent ? icqEvent->sequence : 0;
@@ -308,7 +308,7 @@ static INT_PTR icqSendFile(WPARAM, LPARAM lParam)
T("[ ] send file\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE || icq.statusVal <= ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE || icq.statusVal <= ID_STATUS_OFFLINE) return 0;
unsigned long filesCount, directoriesCount, filesSize = 0;
char filename[MAX_PATH], format[32];
@@ -347,7 +347,7 @@ static INT_PTR icqFileAllow(WPARAM, LPARAM lParam)
T("[ ] send accept file request\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE) return 0;
t->path = _strdup((char*)ccs->lParam);
@@ -366,7 +366,7 @@ static INT_PTR icqFileDeny(WPARAM, LPARAM lParam)
T("[ ] send refuse file request\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE) return 0;
icq.refuseFile(u, t->sequence, (char*)ccs->lParam);
@@ -393,7 +393,7 @@ static INT_PTR icqFileCancel(WPARAM, LPARAM lParam)
T("[ ] file cancel\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE) return 0;
// icq.refuseFile(u, t->sequence, (char*)ccs->lParam);
@@ -485,7 +485,7 @@ static int icqContactDeleted(WPARAM wParam, LPARAM)
T("[ ] contact deleted\n");
- if ((u = icq.getUserByContact((MCONTACT)wParam)) != NULL) icq.removeUser(u);
+ if ((u = icq.getUserByContact((MCONTACT)wParam)) != nullptr) icq.removeUser(u);
return 0;
}
diff --git a/protocols/ICQCorp/src/socket.cpp b/protocols/ICQCorp/src/socket.cpp
index eae8642411..7b32969a38 100644
--- a/protocols/ICQCorp/src/socket.cpp
+++ b/protocols/ICQCorp/src/socket.cpp
@@ -111,7 +111,7 @@ unsigned long Socket::lookup(char *h)
// try and resolve hostname
struct hostent *host = gethostbyname(h);
- if (host == NULL) // Couldn't resolve hostname/ip
+ if (host == nullptr) // Couldn't resolve hostname/ip
return 0;
// return the ip
diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp
index a6c6b992e6..3bf64e3c1e 100644
--- a/protocols/ICQCorp/src/transfer.cpp
+++ b/protocols/ICQCorp/src/transfer.cpp
@@ -25,7 +25,7 @@ std::vector <ICQTransfer *> icqTransfers;
void WINAPI transferTimerProc(HWND, UINT, UINT_PTR hTimer, DWORD)
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
for (size_t i = 0; i < icqTransfers.size(); i++)
if (hTimer == icqTransfers[i]->hTimer)
@@ -40,14 +40,14 @@ ICQTransfer::ICQTransfer(ICQUser *u, unsigned int theSequence) :
uin = u->uin;
hContact = u->hContact;
sequence = theSequence;
- files = NULL;
- description = NULL;
- path = NULL;
+ files = nullptr;
+ description = nullptr;
+ path = nullptr;
sending = 0;
speed = 100;
count = 0;
current = -1;
- fileName = NULL;
+ fileName = nullptr;
fileSize = 0;
fileProgress = 0;
totalSize = 0;
@@ -70,7 +70,7 @@ void ICQTransfer::processTcpPacket(Packet &packet)
{
unsigned int /*i,*/ status, junkLong;
unsigned char cmd/*, junkChar*/;
- char *name = NULL, *directoryName = NULL;
+ char *name = nullptr, *directoryName = nullptr;
packet >> cmd;
switch (cmd) {
@@ -160,7 +160,7 @@ void ICQTransfer::processTcpPacket(Packet &packet)
case 0x06:
unsigned long result;
- WriteFile(hFile, packet.data(), packet.dataSize(), &result, NULL);
+ WriteFile(hFile, packet.data(), packet.dataSize(), &result, nullptr);
fileProgress += result;
totalProgress += result;
@@ -283,7 +283,7 @@ void ICQTransfer::sendPacket0x06()
packet << (unsigned char)0x06;
unsigned long result;
- ReadFile(hFile, packet.data(), 2048, &result, NULL);
+ ReadFile(hFile, packet.data(), 2048, &result, nullptr);
if (result == 0)
return;
@@ -354,7 +354,7 @@ void ICQTransfer::process()
ack(ACKRESULT_DATA);
if (fileProgress < fileSize)
- hTimer = SetTimer(NULL, 0, 1, transferTimerProc);
+ hTimer = SetTimer(nullptr, 0, 1, transferTimerProc);
else if (current < count - 1)
sendPacket0x02();
}
@@ -425,29 +425,29 @@ void ICQTransfer::openFile()
}
directory = 0;
- hFile = CreateFile(fileName, sending ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL);
+ hFile = CreateFile(fileName, sending ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
char msg[2048];
T("can't open file %s\n", fileName);
sprintf(msg, "%s\n%s", sending ? Translate("Your file transfer has been aborted because one of the files that you selected to send is no longer readable from the disk. You may have deleted or moved it.") : Translate("Your file receive has been aborted because Miranda could not open the destination file in order to write to it. You may be trying to save to a read-only folder."), fileName);
- MessageBox(NULL, msg, Translate(protoName), MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, msg, Translate(protoName), MB_ICONWARNING | MB_OK);
return;
}
__int64 fileTime;
if (sending) {
fileProgress = 0;
- fileSize = GetFileSize(hFile, NULL);
+ fileSize = GetFileSize(hFile, nullptr);
- GetFileTime(hFile, NULL, NULL, (LPFILETIME)&fileTime);
+ GetFileTime(hFile, nullptr, nullptr, (LPFILETIME)&fileTime);
fileDate = fileTime / 10000000 - 11644473600i64;
}
else {
- fileProgress = GetFileSize(hFile, NULL);
+ fileProgress = GetFileSize(hFile, nullptr);
fileTime = (11644473600i64 + (__int64)fileDate) * 10000000;
- SetFileTime(hFile, NULL, NULL, (LPFILETIME)&fileTime);
+ SetFileTime(hFile, nullptr, nullptr, (LPFILETIME)&fileTime);
}
}
@@ -464,7 +464,7 @@ void ICQTransfer::closeFile()
void ICQTransfer::setFilePosition()
{
if (hFile != INVALID_HANDLE_VALUE)
- SetFilePointer(hFile, fileProgress, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, fileProgress, nullptr, FILE_BEGIN);
}
///////////////////////////////////////////////////////////////////////////////
@@ -475,7 +475,7 @@ void ICQTransfer::createDirectory()
SetCurrentDirectory(path);
fileName = files[current];
- CreateDirectory(fileName, NULL);
+ CreateDirectory(fileName, nullptr);
fileProgress = 0;
}
diff --git a/protocols/ICQCorp/src/user.cpp b/protocols/ICQCorp/src/user.cpp
index c66eec6539..576210c16a 100644
--- a/protocols/ICQCorp/src/user.cpp
+++ b/protocols/ICQCorp/src/user.cpp
@@ -92,7 +92,7 @@ static char* iptoa(unsigned int ip)
static void setTextValue(HWND hWnd, int id, char *value)
{
- bool unspecified = value == NULL;
+ bool unspecified = value == nullptr;
EnableWindow(GetDlgItem(hWnd, id), !unspecified);
SetDlgItemText(hWnd, id, unspecified ? Translate("<not specified>") : value);
@@ -120,18 +120,18 @@ static INT_PTR CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L
setTextValue(hWnd, IDC_INFO_UIN, buffer);
ip = db_get_dw(hContact, protoName, "IP", 0);
- setTextValue(hWnd, IDC_INFO_IP, ip ? iptoa(ip) : NULL);
+ setTextValue(hWnd, IDC_INFO_IP, ip ? iptoa(ip) : nullptr);
ip = db_get_dw(hContact, protoName, "RealIP", 0);
- setTextValue(hWnd, IDC_INFO_REALIP, ip ? iptoa(ip) : NULL);
+ setTextValue(hWnd, IDC_INFO_REALIP, ip ? iptoa(ip) : nullptr);
port = db_get_w(hContact, protoName, "Port", 0);
_itoa(port, buffer, 10);
- setTextValue(hWnd, IDC_INFO_PORT, port ? buffer : NULL);
+ setTextValue(hWnd, IDC_INFO_PORT, port ? buffer : nullptr);
- setTextValue(hWnd, IDC_INFO_VERSION, NULL);
- setTextValue(hWnd, IDC_INFO_MIRVER, NULL);
- setTextValue(hWnd, IDC_INFO_PING, NULL);
+ setTextValue(hWnd, IDC_INFO_VERSION, nullptr);
+ setTextValue(hWnd, IDC_INFO_MIRVER, nullptr);
+ setTextValue(hWnd, IDC_INFO_PING, nullptr);
}
break;
@@ -147,7 +147,7 @@ static INT_PTR CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L
int icqUserInfoInitialise(WPARAM wParam, LPARAM lParam)
{
char *proto = GetContactProto(lParam);
- if ((proto == NULL || mir_strcmp(proto, protoName)) && lParam)
+ if ((proto == nullptr || mir_strcmp(proto, protoName)) && lParam)
return 0;
OPTIONSDIALOGPAGE odp = { 0 };