diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /protocols/AimOscar/src | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r-- | protocols/AimOscar/src/avatars.cpp | 12 | ||||
-rw-r--r-- | protocols/AimOscar/src/away.cpp | 8 | ||||
-rw-r--r-- | protocols/AimOscar/src/chat.cpp | 20 | ||||
-rwxr-xr-x | protocols/AimOscar/src/client.cpp | 28 | ||||
-rwxr-xr-x | protocols/AimOscar/src/connection.cpp | 46 | ||||
-rw-r--r-- | protocols/AimOscar/src/conv.cpp | 50 | ||||
-rw-r--r-- | protocols/AimOscar/src/direct_connect.cpp | 2 | ||||
-rw-r--r-- | protocols/AimOscar/src/file.cpp | 14 | ||||
-rw-r--r-- | protocols/AimOscar/src/links.cpp | 24 | ||||
-rw-r--r-- | protocols/AimOscar/src/popup.cpp | 12 | ||||
-rw-r--r-- | protocols/AimOscar/src/proto.cpp | 42 | ||||
-rw-r--r-- | protocols/AimOscar/src/server.cpp | 92 | ||||
-rw-r--r-- | protocols/AimOscar/src/services.cpp | 36 | ||||
-rw-r--r-- | protocols/AimOscar/src/theme.cpp | 6 | ||||
-rw-r--r-- | protocols/AimOscar/src/thread.cpp | 4 | ||||
-rw-r--r-- | protocols/AimOscar/src/tlv.cpp | 6 | ||||
-rwxr-xr-x | protocols/AimOscar/src/ui.cpp | 72 | ||||
-rwxr-xr-x | protocols/AimOscar/src/utility.cpp | 50 |
18 files changed, 262 insertions, 262 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index fa966348e1..0c8143aa4a 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -74,7 +74,7 @@ void CAimProto::avatar_request_handler(MCONTACT hContact, char* hash, unsigned c setByte(hContact, AIM_KEY_AHT, type);
setString(hContact, AIM_KEY_AH, hash);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
}
else {
@@ -82,7 +82,7 @@ void CAimProto::avatar_request_handler(MCONTACT hContact, char* hash, unsigned c delSetting(hContact, AIM_KEY_AHT);
delSetting(hContact, AIM_KEY_AH);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
}
mir_free(saved_hash);
@@ -131,7 +131,7 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t c db_free(&dbv);
bool found = false;
- if (ext == NULL) {
+ if (ext == nullptr) {
mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L".*");
_tfinddata_t c_file;
@@ -193,9 +193,9 @@ bool get_avatar_hash(const wchar_t* file, char* hash, char** data, unsigned shor void rescale_image(char *data, unsigned short size, char *&data1, unsigned short &size1)
{
- FI_INTERFACE *fei = NULL;
+ FI_INTERFACE *fei = nullptr;
CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
- if (fei == NULL) return;
+ if (fei == nullptr) return;
FIMEMORY *hmem = fei->FI_OpenMemory((BYTE *)data, size);
FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeFromMemory(hmem, 0);
@@ -205,7 +205,7 @@ void rescale_image(char *data, unsigned short size, char *&data1, unsigned short if (fei->FI_GetWidth(dib) > 64) {
FIBITMAP *dib1 = fei->FI_Rescale(dib, 64, 64, FILTER_BSPLINE);
- FIMEMORY *hmem2 = fei->FI_OpenMemory(NULL, 0);
+ FIMEMORY *hmem2 = fei->FI_OpenMemory(nullptr, 0);
fei->FI_SaveToMemory(fif, dib1, hmem2, 0);
BYTE *data2; DWORD size2;
diff --git a/protocols/AimOscar/src/away.cpp b/protocols/AimOscar/src/away.cpp index 12c15f7a2e..96d4847d9b 100644 --- a/protocols/AimOscar/src/away.cpp +++ b/protocols/AimOscar/src/away.cpp @@ -38,17 +38,17 @@ char** CAimProto::get_status_msg_loc(int status) if (modes[i] == status)
return &m_modeMsgs[i];
- return NULL;
+ return nullptr;
}
int CAimProto::aim_set_away(HNETLIBCONN hServerConn, unsigned short &seqno, const char *amsg, bool set)//user info
{
unsigned short offset = 0;
- char *html_msg = NULL;
+ char *html_msg = nullptr;
size_t msg_size = 0;
if (set) {
if (!amsg) return -1;
- setDword(AIM_KEY_LA, (DWORD)time(NULL));
+ setDword(AIM_KEY_LA, (DWORD)time(nullptr));
html_msg = html_encode(amsg && amsg[0] ? amsg : DEFAULT_AWAY_MSG);
msg_size = mir_strlen(html_msg);
}
@@ -96,7 +96,7 @@ int CAimProto::aim_set_statusmsg(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writebartid(2, 4, (unsigned short)(msg_size + 4), msgb, msgoffset, msgbuf);
}
- else aim_writebartid(2, 0, 0, NULL, msgoffset, msgbuf);
+ else aim_writebartid(2, 0, 0, nullptr, msgoffset, msgbuf);
unsigned short offset = 0;
char* buf = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE + msgoffset + 8);
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index 79cb6d6af1..b084f6ca02 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -62,7 +62,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_ gce.bIsMe = _stricmp(sn, m_username) == 0;
gce.ptszStatus = gce.bIsMe ? TranslateT("Me") : TranslateT("Others");
gce.ptszText = msg;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
Chat_Event(&gce);
}
@@ -83,12 +83,12 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) char *id = mir_u2a(gch->ptszID);
chat_list_item* item = find_chat_by_id(id);
- if (item == NULL)
+ if (item == nullptr)
return 0;
switch (gch->iType) {
case GC_SESSION_TERMINATE:
- aim_sendflap(item->hconn, 0x04, 0, NULL, item->seqno);
+ aim_sendflap(item->hconn, 0x04, 0, nullptr, item->seqno);
Netlib_Shutdown(item->hconn);
break;
@@ -98,7 +98,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) break;
case GC_USER_CHANMGR:
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, invite_to_chat_dialog,
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, invite_to_chat_dialog,
LPARAM(new invite_chat_param(item->id, this)));
break;
@@ -114,7 +114,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) case GC_USER_LOGMENU:
switch (gch->dwData) {
case 10:
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, invite_to_chat_dialog,
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, invite_to_chat_dialog,
LPARAM(new invite_chat_param(item->id, this)));
break;
@@ -211,7 +211,7 @@ chat_list_item* CAimProto::find_chat_by_cid(unsigned short cid) if (m_chat_rooms[i].cid == cid)
return &m_chat_rooms[i];
- return NULL;
+ return nullptr;
}
chat_list_item* CAimProto::find_chat_by_id(char* id)
@@ -220,7 +220,7 @@ chat_list_item* CAimProto::find_chat_by_id(char* id) if (mir_strcmp(m_chat_rooms[i].id, id) == 0)
return &m_chat_rooms[i];
- return NULL;
+ return nullptr;
}
chat_list_item* CAimProto::find_chat_by_conn(HANDLE conn)
@@ -229,7 +229,7 @@ chat_list_item* CAimProto::find_chat_by_conn(HANDLE conn) if (m_chat_rooms[i].hconn == conn)
return &m_chat_rooms[i];
- return NULL;
+ return nullptr;
}
void CAimProto::remove_chat_by_ptr(chat_list_item *item)
@@ -247,7 +247,7 @@ void CAimProto::shutdown_chat_conn(void) for (int i = 0; i < m_chat_rooms.getCount(); ++i) {
chat_list_item &item = m_chat_rooms[i];
if (item.hconn) {
- aim_sendflap(item.hconn, 0x04, 0, NULL, item.seqno);
+ aim_sendflap(item.hconn, 0x04, 0, nullptr, item.seqno);
Netlib_Shutdown(item.hconn);
}
}
@@ -259,7 +259,7 @@ void CAimProto::close_chat_conn(void) chat_list_item &item = m_chat_rooms[i];
if (item.hconn) {
Netlib_CloseHandle(item.hconn);
- item.hconn = NULL;
+ item.hconn = nullptr;
}
}
}
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index 2804ed52f7..8299cc5a32 100755 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -30,8 +30,8 @@ int CAimProto::aim_authkey_request(HNETLIBCONN hServerConn, unsigned short &seqn char *buf = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE * 3 + mir_strlen(m_username));
aim_writesnac(0x17, 0x06, offset, buf);
aim_writetlv(0x01, (unsigned short)mir_strlen(m_username), m_username, offset, buf);
- aim_writetlv(0x4B, 0, 0, offset, buf);
- aim_writetlv(0x5A, 0, 0, offset, buf);
+ aim_writetlv(0x4B, 0, nullptr, offset, buf);
+ aim_writetlv(0x5A, 0, nullptr, offset, buf);
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
@@ -61,7 +61,7 @@ int CAimProto::aim_auth_request(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writesnac(0x17, 0x02, offset, buf);
aim_writetlv(0x01, (unsigned short)mir_strlen(username), username, offset, buf);
aim_writetlv(0x25, MD5_HASH_LENGTH, (char*)auth_hash, offset, buf);
- aim_writetlv(0x4C, 0, 0, offset, buf);//signifies new password hash instead of old method
+ aim_writetlv(0x4C, 0, nullptr, offset, buf);//signifies new password hash instead of old method
aim_writetlv(0x03, (unsigned short)client_id_len, client_id, offset, buf);
aim_writetlvshort(0x16, AIM_CLIENT_ID_NUMBER, offset, buf); //in pidgin it's first
@@ -371,10 +371,10 @@ int CAimProto::aim_send_message(HNETLIBCONN hServerConn, unsigned short &seqno, if (!blast) {
if (auto_response)
- aim_writetlv(0x04, 0, 0, offset, buf); // auto-response message
+ aim_writetlv(0x04, 0, nullptr, offset, buf); // auto-response message
else {
- aim_writetlv(0x03, 0, 0, offset, buf); // message ack request
- aim_writetlv(0x06, 0, 0, offset, buf); // offline message storage
+ aim_writetlv(0x03, 0, nullptr, offset, buf); // message ack request
+ aim_writetlv(0x06, 0, nullptr, offset, buf); // offline message storage
}
}
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) ? 0 : *(int*)icbm_cookie & 0x7fffffff;
@@ -405,7 +405,7 @@ int CAimProto::aim_delete_contact(HNETLIBCONN hServerConn, unsigned short &seqno aim_writeshort(item_id, offset, buf); // buddy id
aim_writeshort(list, offset, buf); // buddy type
aim_writeshort(nil ? 4 : 0, offset, buf); // length of extra data
- if (nil) aim_writetlv(0x6a, 0, NULL, offset, buf);
+ if (nil) aim_writetlv(0x6a, 0, nullptr, offset, buf);
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
@@ -559,7 +559,7 @@ int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writetlvshort(0x17, ~port, frag_offset, msg_frag); // port ip check
if (force_proxy)
- aim_writetlv(0x10, 0, 0, frag_offset, msg_frag); // request proxy transfer
+ aim_writetlv(0x10, 0, nullptr, frag_offset, msg_frag); // request proxy transfer
else
aim_writetlvlong(0x03, m_internal_ip, frag_offset, msg_frag); // ip
@@ -578,7 +578,7 @@ int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writetlv(0x0c, desc_len, desc_msg, frag_offset, msg_frag); // invitaion text
}
- aim_writetlv(0x0f, 0, 0, frag_offset, msg_frag); // request host check
+ aim_writetlv(0x0f, 0, nullptr, frag_offset, msg_frag); // request host check
const char* fname = get_fname(ft->file);
const unsigned short fnlen = (unsigned short)mir_strlen(fname);
@@ -609,7 +609,7 @@ int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writechar((unsigned char)sn_length, offset, buf); // screen name length
aim_writegeneric(sn_length, ft->sn, offset, buf); // screen name
aim_writetlv(0x05, frag_offset, msg_frag, offset, buf); // icbm tags
- aim_writetlv(0x03, 0, 0, offset, buf); // request ack
+ aim_writetlv(0x03, 0, nullptr, offset, buf); // request ack
char cip[20];
long_ip_to_char_ip(ip, cip);
@@ -865,8 +865,8 @@ int CAimProto::aim_chat_send_message(HNETLIBCONN hServerConn, unsigned short &se aim_writesnac(0x0e, 0x05, offset, buf);
aim_writegeneric(8, "\0\0\0\0\0\0\0\0", offset, buf); // Message Cookie (can be random)
aim_writeshort(0x03, offset, buf); // Message Channel (Always 3 for chat)
- aim_writetlv(0x01, 0, NULL, offset, buf); // Public/Whisper flag
- aim_writetlv(0x06, 0, NULL, offset, buf); // Enable Reflection flag
+ aim_writetlv(0x01, 0, nullptr, offset, buf); // Public/Whisper flag
+ aim_writetlv(0x06, 0, nullptr, offset, buf); // Enable Reflection flag
aim_writetlv(0x05, tlv_offset, tlv_buf, offset, buf); // Message Information TLV
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
@@ -893,7 +893,7 @@ int CAimProto::aim_chat_invite(HNETLIBCONN hServerConn, unsigned short &seqno, c aim_writegeneric(16, AIM_CAP_CHAT, offset, buf); // Capability
aim_writetlvshort(0x0a, 1, offset, buf); // Sequence Number TLV
- aim_writetlv(0x0f, 0, NULL, offset, buf); // Request Host Caps Check TLV
+ aim_writetlv(0x0f, 0, nullptr, offset, buf); // Request Host Caps Check TLV
aim_writetlv(0x0c, msg_len, msg, offset, buf); // Invitation Message TLV
aim_writeshort(0x2711, offset, buf); // Capability TLV
@@ -972,7 +972,7 @@ int CAimProto::aim_admin_request_info(HNETLIBCONN hServerConn, unsigned short &s unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE];
aim_writesnac(0x07, 0x02, offset, buf);
- aim_writetlv(type, 0, NULL, offset, buf);
+ aim_writetlv(type, 0, nullptr, offset, buf);
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 0d4f47f31b..42b69e9f3d 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -32,7 +32,7 @@ HNETLIBCONN CAimProto::aim_connect(const char* server, unsigned short port, bool if (con && use_ssl) {
if (!Netlib_StartSsl(con, host)) {
Netlib_CloseHandle(con);
- con = NULL;
+ con = nullptr;
}
}
return con;
@@ -61,10 +61,10 @@ void CAimProto::aim_connection_authorization(void) {
if (m_iDesiredStatus != ID_STATUS_OFFLINE) {
char *password = getStringA(AIM_KEY_PW);
- if (password != NULL) {
+ if (password != nullptr) {
mir_free(m_username);
m_username = getStringA(AIM_KEY_SN);
- if (m_username != NULL) {
+ if (m_username != nullptr) {
HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hServerConn, 2048 * 4);
NETLIBPACKETRECVER packetRecv = {};
@@ -107,11 +107,11 @@ void CAimProto::aim_connection_authorization(void) return;
case 2:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
goto exit;
case 3:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
goto exit;
}
}
@@ -133,7 +133,7 @@ void CAimProto::aim_connection_authorization(void) if (m_iStatus != ID_STATUS_OFFLINE)
broadcast_status(ID_STATUS_OFFLINE);
Netlib_CloseHandle(m_hServerConn);
- m_hServerConn = NULL;
+ m_hServerConn = nullptr;
debugLogA("Connection Authorization Thread Ending: End of Thread");
}
@@ -180,7 +180,7 @@ bool parse_clientlogin_response(NETLIBHTTPREQUEST *nlhr, NETLIBHTTPHEADER *my_he secret = _T2A(secret_w);
token = _T2A(token_w);
- hosttime = strtol(_T2A(hosttime_w), NULL, 10);
+ hosttime = strtol(_T2A(hosttime_w), nullptr, 10);
return true;
}
@@ -298,7 +298,7 @@ void CAimProto::aim_connection_clientlogin(void) // reuse NETLIBHTTPREQUEST
req.requestType = REQUEST_GET;
- req.pData = NULL;
+ req.pData = nullptr;
req.flags |= NLHRF_MANUALHOST;
req.dataLength = 0;
req.headersCount = 1;
@@ -339,7 +339,7 @@ void CAimProto::aim_connection_clientlogin(void) - ForkThread(&CAimProto::aim_protocol_negotiation, 0);
+ ForkThread(&CAimProto::aim_protocol_negotiation, nullptr);
}
void __cdecl CAimProto::aim_protocol_negotiation(void*)
@@ -378,7 +378,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) {
aim_send_cookie(m_hServerConn, m_seqno, COOKIE_LENGTH, COOKIE);//cookie challenge
mir_free(COOKIE);
- COOKIE = NULL;
+ COOKIE = nullptr;
COOKIE_LENGTH = 0;
}
else
@@ -404,7 +404,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) aim_sendflap(m_hServerConn, 0x01, offset, buf_, m_seqno);
mir_free(COOKIE);
- COOKIE = NULL;
+ COOKIE = nullptr;
COOKIE_LENGTH = 0;
}
@@ -453,7 +453,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) }
}
else if (flap.cmp(0x04)) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_OTHERLOCATION);
debugLogA("Connection Negotiation Thread Ending: Flap 0x04");
goto exit;
}
@@ -463,8 +463,8 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) exit:
if (m_iStatus != ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
- Netlib_CloseHandle(hServerPacketRecver); hServerPacketRecver = NULL;
- Netlib_CloseHandle(m_hServerConn); m_hServerConn = NULL;
+ Netlib_CloseHandle(hServerPacketRecver); hServerPacketRecver = nullptr;
+ Netlib_CloseHandle(m_hServerConn); m_hServerConn = nullptr;
debugLogA("Connection Negotiation Thread Ending: End of Thread");
offline_contacts();
}
@@ -503,7 +503,7 @@ void __cdecl CAimProto::aim_mail_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hMailConn, m_mail_seqno, MAIL_COOKIE_LENGTH, MAIL_COOKIE);//cookie challenge
mir_free(MAIL_COOKIE);
- MAIL_COOKIE = NULL;
+ MAIL_COOKIE = nullptr;
MAIL_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -528,7 +528,7 @@ exit: debugLogA("Mail Server Connection has ended");
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hMailConn);
- m_hMailConn = NULL;
+ m_hMailConn = nullptr;
}
void __cdecl CAimProto::aim_avatar_negotiation(void*)
@@ -560,7 +560,7 @@ void __cdecl CAimProto::aim_avatar_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hAvatarConn, m_avatar_seqno, AVATAR_COOKIE_LENGTH, AVATAR_COOKIE); // cookie challenge
mir_free(AVATAR_COOKIE);
- AVATAR_COOKIE = NULL;
+ AVATAR_COOKIE = nullptr;
AVATAR_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -585,7 +585,7 @@ void __cdecl CAimProto::aim_avatar_negotiation(void*) exit:
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hAvatarConn);
- m_hAvatarConn = NULL;
+ m_hAvatarConn = nullptr;
ResetEvent(m_hAvatarEvent);
debugLogA("Avatar Server Connection has ended");
}
@@ -629,7 +629,7 @@ void __cdecl CAimProto::aim_chatnav_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hChatNavConn, m_chatnav_seqno, CHATNAV_COOKIE_LENGTH, CHATNAV_COOKIE);//cookie challenge
mir_free(CHATNAV_COOKIE);
- CHATNAV_COOKIE = NULL;
+ CHATNAV_COOKIE = nullptr;
CHATNAV_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -654,7 +654,7 @@ void __cdecl CAimProto::aim_chatnav_negotiation(void*) exit:
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hChatNavConn);
- m_hChatNavConn = NULL;
+ m_hChatNavConn = nullptr;
ResetEvent(m_hChatNavEvent);
debugLogA("Chat Navigation Server Connection has ended");
}
@@ -693,7 +693,7 @@ void __cdecl CAimProto::aim_chat_negotiation(void* param) if (flap.cmp(0x01)) {
aim_send_cookie(item->hconn, item->seqno, item->CHAT_COOKIE_LENGTH, item->CHAT_COOKIE);//cookie challenge
mir_free(item->CHAT_COOKIE);
- item->CHAT_COOKIE = NULL;
+ item->CHAT_COOKIE = nullptr;
item->CHAT_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -752,7 +752,7 @@ void __cdecl CAimProto::aim_admin_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hAdminConn, m_admin_seqno, ADMIN_COOKIE_LENGTH, ADMIN_COOKIE);//cookie challenge
mir_free(ADMIN_COOKIE);
- ADMIN_COOKIE = NULL;
+ ADMIN_COOKIE = nullptr;
ADMIN_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -778,7 +778,7 @@ void __cdecl CAimProto::aim_admin_negotiation(void*) exit:
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hAdminConn);
- m_hAdminConn = NULL;
+ m_hAdminConn = nullptr;
ResetEvent(m_hAdminEvent);
debugLogA("Admin Server Connection has ended");
}
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index ca36a38663..cca0c668ac 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -51,7 +51,7 @@ char* process_status_msg(const char *str, const char* sn) res = (char*)mir_realloc(res, size + 20);
dest = res + off;
size += 20;
- dest += GetDateFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, dest, 20) - 1;
+ dest += GetDateFormatA(LOCALE_USER_DEFAULT, 0, nullptr, nullptr, dest, 20) - 1;
++src;
}
else if (src[0] == '%' && src[1] == 't') {
@@ -59,7 +59,7 @@ char* process_status_msg(const char *str, const char* sn) res = (char*)mir_realloc(res, size + 20);
dest = res + off;
size += 20;
- dest += GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, dest, 20) - 1;
+ dest += GetTimeFormatA(LOCALE_USER_DEFAULT, 0, nullptr, nullptr, dest, 20) - 1;
++src;
}
else *(dest++) = *src;
@@ -73,7 +73,7 @@ void html_decode(char* str) {
char *p, *q;
- if (str == NULL) return;
+ if (str == nullptr) return;
for (p = q = str; *p != '\0'; p++, q++) {
if (*p == '&') {
@@ -124,7 +124,7 @@ char* html_encode(const char* str) const char *p;
int c;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
for (c = 0, p = str; *p != '\0'; p++) {
switch (*p) {
@@ -162,11 +162,11 @@ char* html_to_bbcodes(char *src) char *ptrl;
char *rptr;
char* dest = mir_strdup(src);
- while ((ptr = strstr(dest, "<B>")) != NULL || (ptr = strstr(dest, "<b>")) != NULL) {
+ while ((ptr = strstr(dest, "<B>")) != nullptr || (ptr = strstr(dest, "<b>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 'b';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</B>")) != NULL || (ptr = strstr(dest, "</b>")) != NULL) {
+ if ((ptr = strstr(dest, "</B>")) != nullptr || (ptr = strstr(dest, "</b>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 'b';
*(ptr + 3) = ']';
@@ -176,11 +176,11 @@ char* html_to_bbcodes(char *src) memcpy(&dest[mir_strlen(dest)], "[/b]", 5);
}
}
- while ((ptr = strstr(dest, "<I>")) != NULL || (ptr = strstr(dest, "<i>")) != NULL) {
+ while ((ptr = strstr(dest, "<I>")) != nullptr || (ptr = strstr(dest, "<i>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 'i';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</I>")) != NULL || (ptr = strstr(dest, "</i>")) != NULL) {
+ if ((ptr = strstr(dest, "</I>")) != nullptr || (ptr = strstr(dest, "</i>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 'i';
*(ptr + 3) = ']';
@@ -190,11 +190,11 @@ char* html_to_bbcodes(char *src) memcpy(&dest[mir_strlen(dest)], "[/i]", 5);
}
}
- while ((ptr = strstr(dest, "<U>")) != NULL || (ptr = strstr(dest, "<u>")) != NULL) {
+ while ((ptr = strstr(dest, "<U>")) != nullptr || (ptr = strstr(dest, "<u>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 'u';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</U>")) != NULL || (ptr = strstr(dest, "</u>")) != NULL) {
+ if ((ptr = strstr(dest, "</U>")) != nullptr || (ptr = strstr(dest, "</u>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 'u';
*(ptr + 3) = ']';
@@ -204,11 +204,11 @@ char* html_to_bbcodes(char *src) memcpy(&dest[mir_strlen(dest)], "[/u]", 5);
}
}
- while ((ptr = strstr(dest, "<S>")) != NULL || (ptr = strstr(dest, "<s>")) != NULL) {
+ while ((ptr = strstr(dest, "<S>")) != nullptr || (ptr = strstr(dest, "<s>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 's';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</S>")) != NULL || (ptr = strstr(dest, "</s>")) != NULL) {
+ if ((ptr = strstr(dest, "</S>")) != nullptr || (ptr = strstr(dest, "</s>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 's';
*(ptr + 3) = ']';
@@ -390,42 +390,42 @@ char* bbcodes_to_html(const char *src) char *ptr;
char *rptr;
char* dest = mir_strdup(src);
- while ((ptr = strstr(dest, "[b]")) != NULL) {
+ while ((ptr = strstr(dest, "[b]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 'b';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/b]")) != NULL) {
+ while ((ptr = strstr(dest, "[/b]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 'b';
*(ptr + 3) = '>';
}
- while ((ptr = strstr(dest, "[i]")) != NULL) {
+ while ((ptr = strstr(dest, "[i]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 'i';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/i]")) != NULL) {
+ while ((ptr = strstr(dest, "[/i]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 'i';
*(ptr + 3) = '>';
}
- while ((ptr = strstr(dest, "[u]")) != NULL) {
+ while ((ptr = strstr(dest, "[u]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 'u';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/u]")) != NULL) {
+ while ((ptr = strstr(dest, "[/u]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 'u';
*(ptr + 3) = '>';
}
- while ((ptr = strstr(dest, "[s]")) != NULL) {
+ while ((ptr = strstr(dest, "[s]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 's';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/s]")) != NULL) {
+ while ((ptr = strstr(dest, "[/s]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 's';
*(ptr + 3) = '>';
@@ -668,14 +668,14 @@ char* rtf_to_html(HWND hwndDlg, int DlgItem) void wcs_htons(wchar_t *ch)
{
- if (ch == NULL) return;
+ if (ch == nullptr) return;
for (size_t i = 0; i < mir_wstrlen(ch); i++)
ch[i] = _htons(ch[i]);
}
char* bytes_to_string(char *bytes, int num_bytes)
{
- if (num_bytes == 0) return NULL;
+ if (num_bytes == 0) return nullptr;
char *string = (char*)mir_alloc(num_bytes * 2 + 1);
for (int i = 0; i < num_bytes; i++) {
@@ -699,7 +699,7 @@ void string_to_bytes(char *string, char *bytes) for (size_t i = 0; i < length; i += 2) {
sbyte[0] = string[i];
sbyte[1] = string[i + 1];
- bytes[i / 2] = (char)strtol(sbyte, NULL, 16);
+ bytes[i / 2] = (char)strtol(sbyte, nullptr, 16);
}
}
@@ -736,8 +736,8 @@ wchar_t* get_dir(wchar_t *path) aimString::aimString(char *str)
{
- if (str == NULL) {
- szString = NULL;
+ if (str == nullptr) {
+ szString = nullptr;
size = 0;
unicode = false;
}
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp index b9cfab0508..e79a0f1d9a 100644 --- a/protocols/AimOscar/src/direct_connect.cpp +++ b/protocols/AimOscar/src/direct_connect.cpp @@ -38,7 +38,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(ft->hConn);
- ft->hConn = NULL;
+ ft->hConn = nullptr;
if (result == 0)
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 0a67bea54b..2f8e93f907 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -96,7 +96,7 @@ bool send_init_oft2(file_transfer *ft, char* file) void CAimProto::report_file_error(wchar_t *fname)
{
wchar_t errmsg[512];
- wchar_t* error = mir_a2u(_strerror(NULL));
+ wchar_t* error = mir_a2u(_strerror(nullptr));
mir_snwprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
@@ -108,7 +108,7 @@ bool setup_next_file_send(file_transfer *ft) struct _stati64 statbuf;
for (;;) {
file = ft->pfts.ptszFiles[ft->cf];
- if (file == NULL) return false;
+ if (file == nullptr) return false;
if (_wstat64(file, &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
break;
@@ -264,7 +264,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET bool accepted_file = false;
int fid = -1;
- oft2 *oft = NULL;
+ oft2 *oft = nullptr;
ft->pfts.tszWorkingDir = mir_utf8decodeW(ft->file);
@@ -453,7 +453,7 @@ file_transfer* ft_list_type::find_by_cookie(char* cookie, MCONTACT hContact) if (ft->hContact == hContact && memcmp(ft->icbm_cookie, cookie, 8) == 0)
return ft;
}
- return NULL;
+ return nullptr;
}
file_transfer* ft_list_type::find_by_port(unsigned short port)
@@ -463,7 +463,7 @@ file_transfer* ft_list_type::find_by_port(unsigned short port) if (ft->requester && ft->local_port == port)
return ft;
}
- return NULL;
+ return nullptr;
}
@@ -502,7 +502,7 @@ file_transfer::file_transfer(MCONTACT hCont, char* nick, char* cookie) else
Utils_GetRandom(icbm_cookie, 8);
- hResumeEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hResumeEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
file_transfer::~file_transfer()
@@ -540,7 +540,7 @@ void file_transfer::stop_listen(void) {
if (hDirectBoundPort) {
Netlib_CloseHandle(hDirectBoundPort);
- hDirectBoundPort = NULL;
+ hDirectBoundPort = nullptr;
local_port = 0;
}
}
diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index 13671e8518..b9235bde99 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -59,7 +59,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) /* skip leading prefix */
arg = wcschr(arg, ':');
- if (arg == NULL) return 1; /* parse failed */
+ if (arg == nullptr) return 1; /* parse failed */
for (++arg; *arg == '/'; ++arg);
@@ -74,7 +74,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) break;
}
}
- if (proto == NULL) return 1;
+ if (proto == nullptr) return 1;
/*
add user: aim:addbuddy?screenname=NICK&groupname=GROUP
@@ -84,9 +84,9 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) /* add a contact to the list */
if (!wcsnicmp(arg, L"addbuddy?", 9)) {
wchar_t *tok, *tok2;
- char *sn = NULL, *group = NULL;
+ char *sn = nullptr, *group = nullptr;
- for (tok = arg + 8; tok != NULL; tok = tok2) {
+ for (tok = arg + 8; tok != nullptr; tok = tok2) {
tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
@@ -94,7 +94,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) if (!wcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0)
group = mir_utf8encodeW(url_decode(tok + 10)); /* group is currently ignored */
}
- if (sn == NULL) {
+ if (sn == nullptr) {
mir_free(group);
return 1;
}
@@ -110,10 +110,10 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) }
/* send a message to a contact */
else if (!wcsnicmp(arg, L"goim?", 5)) {
- wchar_t *tok, *tok2, *msg = NULL;
- char *sn = NULL;
+ wchar_t *tok, *tok2, *msg = nullptr;
+ char *sn = nullptr;
- for (tok = arg + 4; tok != NULL; tok = tok2) {
+ for (tok = arg + 4; tok != nullptr; tok = tok2) {
tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
@@ -121,7 +121,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) if (!wcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0)
msg = url_decode(tok + 8);
}
- if (sn == NULL) return 1; /* parse failed */
+ if (sn == nullptr) return 1; /* parse failed */
MCONTACT hContact = proto->contact_from_sn(sn, true, true);
if (hContact)
@@ -134,10 +134,10 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) /* open a chatroom */
else if (!wcsnicmp(arg, L"gochat?", 7)) {
wchar_t *tok, *tok2;
- char *rm = NULL;
+ char *rm = nullptr;
int exchange = 0;
- for (tok = arg + 6; tok != NULL; tok = tok2) {
+ for (tok = arg + 6; tok != nullptr; tok = tok2) {
tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) {
@@ -148,7 +148,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) if (!wcsnicmp(tok, L"exchange=", 9))
exchange = _wtoi(tok + 9);
}
- if (rm == NULL || exchange <= 0) {
+ if (rm == nullptr || exchange <= 0) {
mir_free(rm);
return 1;
}
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index e62a66a174..c6ad5624fd 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -40,8 +40,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM if (HIWORD(wParam) == STN_CLICKED)
{
CAimPopupData* p = (CAimPopupData*)PUGetPluginData(hWnd);
- if (p->url != NULL)
- ShellExecuteA(NULL, "open", p->url, NULL, NULL, SW_SHOW);
+ if (p->url != nullptr)
+ ShellExecuteA(nullptr, "open", p->url, nullptr, nullptr, SW_SHOW);
PUDeletePopup(hWnd);
return 0;
@@ -89,12 +89,12 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
size_t len = mir_wstrlen(ppd.lptzText);
mir_snwprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, L" %s", TranslateT("Open mail account?"));
- if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
- ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
+ if (MessageBox(nullptr, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
+ ShellExecuteA(nullptr, "open", url, nullptr, nullptr, SW_SHOW);
}
else
{
- MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, ppd.lptzText, ppd.lptzContactName, MB_OK | MB_ICONINFORMATION);
}
}
else
@@ -107,7 +107,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) ppd.iSeconds = -1;
}
else
- ppd.PluginData = new CAimPopupData(this, NULL);
+ ppd.PluginData = new CAimPopupData(this, nullptr);
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 7fd35eec98..5857be9f50 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -24,9 +24,9 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : debugLogA("Setting protocol/module name to '%s'", m_szModuleName);
//create some events
- m_hAvatarEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- m_hChatNavEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- m_hAdminEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ m_hAvatarEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ m_hChatNavEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ m_hAdminEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
CreateProtoService(PS_CREATEACCMGRUI, &CAimProto::SvcCreateAccMgrUI);
@@ -170,7 +170,7 @@ HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *s ForkThread(&CAimProto::accept_file_thread, ft);
return ft;
}
- return 0;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -239,7 +239,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** case FILERESUME_SKIP:
mir_free(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = NULL;
+ ft->pfts.tszCurrentFile = nullptr;
break;
default:
@@ -317,7 +317,7 @@ void __cdecl CAimProto::basic_search_ack_success(void *p) HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId)
{
if (m_state != 1)
- return 0;
+ return nullptr;
//duplicating the parameter so that it isn't deleted before it's needed- e.g. this function ends before it's used
ForkThread(&CAimProto::basic_search_ack_success, mir_u2a(szId));
@@ -330,8 +330,8 @@ HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email)
{
// Maximum email size should really be 320, but the char string is limited to 255.
- if (m_state != 1 || email == NULL || mir_wstrlen(email) >= 254)
- return NULL;
+ if (m_state != 1 || email == nullptr || mir_wstrlen(email) >= 254)
+ return nullptr;
char *szEmail = mir_u2a(email);
aim_search_by_email(m_hServerConn, m_seqno, szEmail);
@@ -345,7 +345,7 @@ HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email) int __cdecl CAimProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
{
char *omsg = pre->szMessage;
- char *bbuf = NULL;
+ char *bbuf = nullptr;
if (getByte(AIM_KEY_FI, 1)) {
debugLogA("Converting from html to bbcodes then stripping leftover html.");
pre->szMessage = bbuf = html_to_bbcodes(pre->szMessage);
@@ -365,16 +365,16 @@ int __cdecl CAimProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
if (m_state != 1)
- return 0;
+ return nullptr;
if (hContact && szDescription && ppszFiles) {
DBVARIANT dbv;
if (!getString(hContact, AIM_KEY_SN, &dbv)) {
- file_transfer *ft = new file_transfer(hContact, dbv.pszVal, NULL);
+ file_transfer *ft = new file_transfer(hContact, dbv.pszVal, nullptr);
bool isDir = false;
int count = 0;
- while (ppszFiles[count] != NULL) {
+ while (ppszFiles[count] != nullptr) {
struct _stati64 statbuf;
if (_wstat64(ppszFiles[count++], &statbuf) == 0) {
if (statbuf.st_mode & _S_IFDIR) {
@@ -389,7 +389,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti if (ft->pfts.totalFiles == 0) {
delete ft;
- return NULL;
+ return nullptr;
}
ft->pfts.flags |= PFTS_SENDING;
@@ -397,7 +397,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti ft->file = ft->pfts.totalFiles == 1 || isDir ? mir_utf8encodeW(ppszFiles[0]) : (char*)mir_calloc(1);
ft->sending = true;
- ft->message = szDescription[0] ? mir_utf8encodeW(szDescription) : NULL;
+ ft->message = szDescription[0] ? mir_utf8encodeW(szDescription) : nullptr;
ft->me_force_proxy = getByte(AIM_KEY_FP, 0) != 0;
ft->requester = true;
@@ -417,7 +417,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti }
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -438,7 +438,7 @@ void __cdecl CAimProto::msg_ack_success(void* param) int __cdecl CAimProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
- if (pszSrc == NULL)
+ if (pszSrc == nullptr)
return 0;
if (m_state != 1) {
@@ -449,7 +449,7 @@ int __cdecl CAimProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) }
char *sn = getStringA(hContact, AIM_KEY_SN);
- if (sn == NULL) {
+ if (sn == nullptr) {
msg_ack_param *msg_ack = (msg_ack_param*)mir_calloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
msg_ack->msg = "Screen Name for the contact not available";
@@ -472,7 +472,7 @@ int __cdecl CAimProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) if (!res || blast || 0 == getByte(AIM_KEY_DC, 1)) {
msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
- msg_ack->msg = NULL;
+ msg_ack->msg = nullptr;
msg_ack->id = res;
msg_ack->success = res != 0;
ForkThread(&CAimProto::msg_ack_success, msg_ack);
@@ -564,7 +564,7 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) HANDLE __cdecl CAimProto::GetAwayMsg(MCONTACT hContact)
{
if (m_state != 1)
- return 0;
+ return nullptr;
int status = getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE);
switch (status) {
@@ -574,7 +574,7 @@ HANDLE __cdecl CAimProto::GetAwayMsg(MCONTACT hContact) break;
default:
- return 0;
+ return nullptr;
}
return (HANDLE)1;
@@ -595,7 +595,7 @@ int __cdecl CAimProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* pre) int __cdecl CAimProto::SetAwayMsg(int status, const wchar_t* msg)
{
char **msgptr = get_status_msg_loc(status);
- if (msgptr == NULL) return 1;
+ if (msgptr == nullptr) return 1;
char *nmsg = mir_utf8encodeW(msg);
mir_free(*msgptr); *msgptr = nmsg;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index d5ac1af9da..96038aa8d1 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -35,7 +35,7 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017 int res = 0;
if (snac.subcmp(0x0003)) {
- char* server = NULL;
+ char* server = nullptr;
int address = 0;
unsigned short port;
unsigned char use_ssl = 0;
@@ -47,7 +47,7 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017 else if (tlv.cmp(0x0006)) {
Netlib_CloseHandle(m_hServerConn);
- if (server == NULL) return 3;
+ if (server == nullptr) return 3;
char* delim = strchr(server, ':');
port = delim ? (unsigned short)atoi(delim + 1) : get_default_port();
if (delim) *delim = 0;
@@ -57,7 +57,7 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017 mir_free(COOKIE);
COOKIE_LENGTH = tlv.len();
COOKIE = tlv.dup();
- ForkThread(&CAimProto::aim_protocol_negotiation, 0);
+ ForkThread(&CAimProto::aim_protocol_negotiation, nullptr);
res = 1;
}
else
@@ -165,7 +165,7 @@ void CAimProto::snac_icbm_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsig }
char** msgptr = get_status_msg_loc(m_iDesiredStatus);
- replaceStr(m_last_status_msg, msgptr ? *msgptr: NULL);
+ replaceStr(m_last_status_msg, msgptr ? *msgptr: nullptr);
aim_set_statusmsg(hServerConn, seqno, m_last_status_msg);
if (m_iDesiredStatus == ID_STATUS_AWAY)
@@ -215,7 +215,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 bool caps_included = false;
unsigned long status_type = 0; // 0 = online
- char *hash_sm = NULL, *hash_lg = NULL;
+ char *hash_sm = nullptr, *hash_lg = nullptr;
unsigned char sn_len = snac.ubyte();
char* sn = snac.part(1, sn_len);
@@ -488,7 +488,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
wchar_t* tszMsg = mir_utf8decodeW(msg_s);
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)tszMsg);
mir_free(tszMsg);
mir_free(msg);
mir_free(msg_s);
@@ -727,7 +727,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) tlv_offset += TLV_HEADER_SIZE + tlv.len();
}
if (m_list_received)
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
}
break;
@@ -856,7 +856,7 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset) }
tlv_offset += TLV_HEADER_SIZE + tlv.len();
}
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
}
break;
}
@@ -900,14 +900,14 @@ void CAimProto::delete_ssi_list(SNAC &snac, int &offset) if (mir_strcmp(name, "1")) {
m_avatar_id_sm = 0;
mir_free(m_hash_sm);
- m_hash_sm = NULL;
+ m_hash_sm = nullptr;
}
else if (!mir_strcmp(name, "12")) {
m_avatar_id_lg = 0;
mir_free(m_hash_lg);
- m_hash_lg = NULL;
+ m_hash_lg = nullptr;
}
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
break;
}
mir_free(name);
@@ -947,7 +947,7 @@ void CAimProto::snac_contact_list(SNAC &snac, HNETLIBCONN hServerConn, unsigned if (getByte(AIM_KEY_CM, 0))
aim_new_service_request(hServerConn, seqno, 0x0018);//mail
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
debugLogA("Connection Negotiation Finished");
m_state = 1;
@@ -979,7 +979,7 @@ void CAimProto::snac_message_accepted(SNAC &snac)//family 0x004 msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
msg_ack->id = *(int*)icbm_cookie & 0x7fffffff;
- msg_ack->msg = NULL;
+ msg_ack->msg = nullptr;
msg_ack->success = true;
ForkThread(&CAimProto::msg_ack_success, msg_ack);
}
@@ -999,12 +999,12 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig int offset = 15 + sn_length;
- char *msg_buf = NULL;
+ char *msg_buf = nullptr;
unsigned long offline_timestamp = 0;
bool is_offline = false;
//file transfer stuff
- char *icbm_cookie = NULL;
- char *filename = NULL;
+ char *icbm_cookie = nullptr;
+ char *filename = nullptr;
unsigned __int64 file_size = 0;
bool auto_response = false;
bool force_proxy = false;
@@ -1190,7 +1190,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hMsgContact, 0);
{
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (is_offline) ? offline_timestamp : (DWORD)time(0);
+ pre.timestamp = (is_offline) ? offline_timestamp : (DWORD)time(nullptr);
pre.szMessage = msg_buf;
ProtoChainRecvMsg(hMsgContact, &pre);
}
@@ -1209,7 +1209,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)len;
@@ -1219,7 +1219,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig aim_send_message(hServerConn, seqno, sn, s_msg, true, getBool(hContact, AIM_KEY_BLS, false));
mir_free(s_msg);
}
- setDword(hContact, AIM_KEY_LM, (DWORD)time(NULL));
+ setDword(hContact, AIM_KEY_LM, (DWORD)time(nullptr));
}
}
else if (channel == 2) { // File Transfer
@@ -1245,14 +1245,14 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig m_ft_list.insert(ft);
- if (!descr_included) msg_buf = NULL;
+ if (!descr_included) msg_buf = nullptr;
wchar_t* filenameT = mir_utf8decodeW(filename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = mir_utf8decodeW(msg_buf);
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -1338,7 +1338,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004 msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
- msg_ack->msg = NULL;
+ msg_ack->msg = nullptr;
msg_ack->id = *(int*)icbm_cookie & 0x7fffffff;
msg_ack->success = false;
ForkThread(&CAimProto::msg_ack_success, msg_ack);
@@ -1391,8 +1391,8 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002 if (++i > tlv_count) {
if (tlv.cmp(0x0001)) { //profile encoding
char *enc = tlv.dup();
- profile_unicode = strstr(enc, "unicode-2-0") != NULL;
- profile_utf = strstr(enc, "utf-8") != NULL;
+ profile_unicode = strstr(enc, "unicode-2-0") != nullptr;
+ profile_utf = strstr(enc, "utf-8") != nullptr;
mir_free(enc);
}
else if (tlv.cmp(0x0002)) { //profile message string
@@ -1404,8 +1404,8 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002 }
else if (tlv.cmp(0x0003)) { //away message encoding
char *enc = tlv.dup();
- away_message_unicode = strstr(enc, "unicode-2-0") != NULL;
- away_message_utf = strstr(enc, "utf-8") != NULL;
+ away_message_unicode = strstr(enc, "unicode-2-0") != nullptr;
+ away_message_utf = strstr(enc, "utf-8") != nullptr;
mir_free(enc);
}
else if (tlv.cmp(0x0004)) { // away message string
@@ -1533,9 +1533,9 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013 void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
{
if (snac.subcmp(0x0005)) {
- char* server = NULL;
- char* local_cookie = NULL;
- char* host = NULL;
+ char* server = nullptr;
+ char* local_cookie = nullptr;
+ char* host = nullptr;
int local_cookie_length = 0;
unsigned short family = 0;
unsigned char use_ssl = 0;
@@ -1567,7 +1567,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Mail Server.");
MAIL_COOKIE = local_cookie;
MAIL_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_mail_negotiation, 0);
+ ForkThread(&CAimProto::aim_mail_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Mail Server.");
}
@@ -1577,7 +1577,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Avatar Server.");
AVATAR_COOKIE = local_cookie;
AVATAR_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_avatar_negotiation, 0);
+ ForkThread(&CAimProto::aim_avatar_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Avatar Server.");
}
@@ -1587,7 +1587,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Chat Navigation Server.");
CHATNAV_COOKIE = local_cookie;
CHATNAV_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_chatnav_negotiation, 0);
+ ForkThread(&CAimProto::aim_chatnav_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Chat Navigation Server.");
}
@@ -1611,7 +1611,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Admin Server.");
ADMIN_COOKIE = local_cookie;
ADMIN_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_admin_negotiation, 0);
+ ForkThread(&CAimProto::aim_admin_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Admin Server.");
}
@@ -1623,13 +1623,13 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018
{
if (snac.subcmp(0x0007)) {
- char* sn = NULL;
+ char* sn = nullptr;
time_t time = 0;
unsigned short num_msgs = 0;
unsigned short flags = 0;
char new_mail = 0;
- char* url = NULL;
- char* address = NULL;
+ char* url = nullptr;
+ char* address = nullptr;
int position = 26;
int num_tlvs = snac.ushort(24);
@@ -1666,7 +1666,7 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018 SYSTEMTIME stLocal;
GetLocalTime(&stLocal);
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, NULL, msg + len, _countof(msg) - len);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, nullptr, msg + len, _countof(msg) - len);
ShowPopup((char*)msg, MAIL_POPUP | TCHAR_POPUP, url);
}
@@ -1769,7 +1769,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, // Main TLV info
unsigned short exchange = 0;
unsigned short cookie_len = 0;
- char* cookie = 0;
+ char* cookie = nullptr;
unsigned short instance = 0;
unsigned short num_tlv = 0;
unsigned short tlv_offset = 0;
@@ -1781,7 +1781,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, num_tlv = info_tlv.ushort(6 + cookie_len); // Number of TLVs
tlv_offset = 8 + cookie_len; // We're looking at any remaining TLVs
- char* name = 0;
+ char* name = nullptr;
for (int i = 0; i < num_tlv; i++) // Loop through all the TLVs
{
TLV tlv(info_tlv.val() + tlv_offset);
@@ -1793,7 +1793,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, }
chat_list_item *item = find_chat_by_id(name);
- if (item == NULL) {
+ if (item == nullptr) {
item = new chat_list_item(name, cookie, exchange, instance);
m_chat_rooms.insert(item);
@@ -1834,8 +1834,8 @@ void CAimProto::snac_chat_joined_left_users(SNAC &snac, chat_list_item* item)//f void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//family 0x000E
{
if (snac.subcmp(0x0006)) {
- wchar_t* message = NULL;
- char* sn = NULL;
+ wchar_t* message = nullptr;
+ char* sn = nullptr;
// unsigned long cookie = snac.ulong(0);
// unsigned short channel = snac.ushort(8);
@@ -1882,8 +1882,8 @@ void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//fa }
else if (msg_tlv.cmp(0x0002)) {
char* enc = msg_tlv.dup();
- uni = strstr(enc, "unicode-2-0") != NULL;
- utf = strstr(enc, "utf-8") != NULL;
+ uni = strstr(enc, "unicode-2-0") != nullptr;
+ utf = strstr(enc, "utf-8") != nullptr;
mir_free(enc);
}
@@ -1918,8 +1918,8 @@ void CAimProto::snac_admin_account_infomod(SNAC &snac) //family 0x0007 WORD num_tlv = snac.ushort(2); // Number of TLVs
- char *sn = NULL; // Screen Name
- char *email = NULL; // Email address
+ char *sn = nullptr; // Screen Name
+ char *email = nullptr; // Email address
unsigned short offset = 0;
for (int i = 0; i < num_tlv; i++) // Loop through all the TLVs
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index c108139a3e..1012a1c611 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. INT_PTR CAimProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam)
{
char** msgptr = get_status_msg_loc(wParam ? wParam : m_iStatus);
- if (msgptr == NULL) return 0;
+ if (msgptr == nullptr) return 0;
return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_utf8decodeW(*msgptr) : (INT_PTR)mir_utf8decodeA(*msgptr);
}
@@ -128,22 +128,22 @@ int CAimProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) char *name;
switch (cws->value.type) {
case DBVT_DELETED:
- set_local_nick(hContact, NULL, NULL);
+ set_local_nick(hContact, nullptr, nullptr);
break;
case DBVT_ASCIIZ:
name = mir_utf8encode(cws->value.pszVal);
- set_local_nick(hContact, name, NULL);
+ set_local_nick(hContact, name, nullptr);
mir_free(name);
break;
case DBVT_UTF8:
- set_local_nick(hContact, cws->value.pszVal, NULL);
+ set_local_nick(hContact, cws->value.pszVal, nullptr);
break;
case DBVT_WCHAR:
name = mir_utf8encodeW(cws->value.pwszVal);
- set_local_nick(hContact, name, NULL);
+ set_local_nick(hContact, name, nullptr);
mir_free(name);
break;
}
@@ -191,7 +191,7 @@ int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam) CLISTGROUPCHANGE *grpchg = (CLISTGROUPCHANGE*)lParam;
if (hContact == NULL) {
- if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) {
+ if (grpchg->pszNewName == nullptr && grpchg->pszOldName != nullptr) {
T2Utf szOldName(grpchg->pszOldName);
unsigned short group_id = m_group_list.find_id(szOldName);
if (group_id) {
@@ -200,7 +200,7 @@ int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam) update_server_group("", 0);
}
}
- else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) {
+ else if (grpchg->pszNewName != nullptr && grpchg->pszOldName != nullptr) {
unsigned short group_id = m_group_list.find_id(T2Utf(grpchg->pszOldName));
if (group_id)
update_server_group(T2Utf(grpchg->pszNewName), group_id);
@@ -254,7 +254,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM hContact, LPARAM) }
else {
item_id = m_block_list.add(dbv.pszVal);
- aim_add_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 3, false);
+ aim_add_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 3, nullptr);
}
break;
@@ -281,7 +281,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM hContact, LPARAM) INT_PTR CAimProto::JoinChatUI(WPARAM, LPARAM)
{
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHAT), NULL, join_chat_dialog, LPARAM(this));
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHAT), nullptr, join_chat_dialog, LPARAM(this));
return 0;
}
@@ -316,13 +316,13 @@ INT_PTR CAimProto::OnLeaveChat(WPARAM wParam, LPARAM) INT_PTR CAimProto::InstantIdle(WPARAM, LPARAM)
{
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IDLE), NULL, instant_idle_dialog, LPARAM(this));
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IDLE), nullptr, instant_idle_dialog, LPARAM(this));
return 0;
}
INT_PTR CAimProto::ManageAccount(WPARAM, LPARAM)
{
- ShellExecuteA(NULL, "open", "https://my.screenname.aol.com", NULL, NULL, SW_SHOW);
+ ShellExecuteA(nullptr, "open", "https://my.screenname.aol.com", nullptr, nullptr, SW_SHOW);
return 0;
}
@@ -336,7 +336,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (getByte(AIM_KEY_DA, 0))
return GAIR_NOAVATAR;
- switch (get_avatar_filename(pai->hContact, pai->filename, _countof(pai->filename), NULL)) {
+ switch (get_avatar_filename(pai->hContact, pai->filename, _countof(pai->filename), nullptr)) {
case GAIR_SUCCESS:
if (!(wParam & GAIF_FORCE) || m_state != 1)
return GAIR_SUCCESS;
@@ -394,7 +394,7 @@ INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam) {
wchar_t* buf = (wchar_t*)wParam;
size_t size = (size_t)lParam;
- if (buf == NULL || size <= 0)
+ if (buf == nullptr || size <= 0)
return -1;
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -413,16 +413,16 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) if (m_state != 1)
return 1;
- if (szFileName == NULL) {
+ if (szFileName == nullptr) {
aim_ssi_update(m_hServerConn, m_seqno, true);
aim_delete_avatar_hash(m_hServerConn, m_seqno, 1, 1, m_avatar_id_sm);
aim_delete_avatar_hash(m_hServerConn, m_seqno, 1, 12, m_avatar_id_lg);
aim_ssi_update(m_hServerConn, m_seqno, false);
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
}
else {
- char hash[16], hash1[16], *data, *data1 = NULL;
+ char hash[16], hash1[16], *data, *data1 = nullptr;
unsigned short size, size1 = 0;
if (!get_avatar_hash(szFileName, hash, &data, size)) {
@@ -447,7 +447,7 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) aim_ssi_update(m_hServerConn, m_seqno, false);
}
else {
- mir_free(m_hash_lg); m_hash_lg = NULL;
+ mir_free(m_hash_lg); m_hash_lg = nullptr;
mir_free(m_hash_sm); m_hash_sm = bytes_to_string(hash, sizeof(hash1));
aim_ssi_update(m_hServerConn, m_seqno, true);
@@ -456,7 +456,7 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) aim_ssi_update(m_hServerConn, m_seqno, false);
}
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
avatar_up_req *req = new avatar_up_req(data, size, data1, size1);
ForkThread(&CAimProto::avatar_upload_thread, req);
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 627ffbfdb6..762c841a39 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -73,7 +73,7 @@ HANDLE GetIconHandle(const char *name) if (!mir_strcmp(iconList[i].szName, name))
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(const char *name, bool big)
@@ -113,7 +113,7 @@ static void set_AT_icon(CAimProto* ppro, MCONTACT hContact) if (ppro->isChatRoom(hContact)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_AC, 0) - 1;
- ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : NULL);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : nullptr);
}
static void set_ES_icon(CAimProto* ppro, MCONTACT hContact)
@@ -121,7 +121,7 @@ static void set_ES_icon(CAimProto* ppro, MCONTACT hContact) if (ppro->isChatRoom(hContact)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1;
- ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : NULL);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : nullptr);
}
void set_contact_icon(CAimProto* ppro, MCONTACT hContact)
diff --git a/protocols/AimOscar/src/thread.cpp b/protocols/AimOscar/src/thread.cpp index 35b163f506..3affac892b 100644 --- a/protocols/AimOscar/src/thread.cpp +++ b/protocols/AimOscar/src/thread.cpp @@ -23,7 +23,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file {
file_transfer *ft = (file_transfer*)param;
- HNETLIBCONN hConn = NULL;
+ HNETLIBCONN hConn = nullptr;
if (ft->peer_force_proxy) //peer is forcing proxy
{
hConn = aim_peer_connect(ft->proxy_ip, get_default_port());
@@ -74,7 +74,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file }
}
- if (hConn == NULL) {
+ if (hConn == nullptr) {
if (ft->req_num)
aim_file_ad(m_hServerConn, m_seqno, ft->sn, ft->icbm_cookie, true, 0);
diff --git a/protocols/AimOscar/src/tlv.cpp b/protocols/AimOscar/src/tlv.cpp index 717ef5d4b5..089a0fc17d 100644 --- a/protocols/AimOscar/src/tlv.cpp +++ b/protocols/AimOscar/src/tlv.cpp @@ -28,7 +28,7 @@ TLV::TLV(char* buf) memcpy(value_,&buf[4],length_);
}
else
- value_= NULL;
+ value_= nullptr;
}
TLV::TLV(unsigned short type, unsigned short length, const char* value)
@@ -41,7 +41,7 @@ TLV::TLV(unsigned short type, unsigned short length, const char* value) memcpy(value_, value, length_);
}
else
- value_= NULL;
+ value_= nullptr;
}
TLV::~TLV()
@@ -71,7 +71,7 @@ unsigned char TLV::ubyte(int pos) char* TLV::part(int pos, int length)//returns part of the tlv value
{
- if ((pos + length) > length_) return NULL;
+ if ((pos + length) > length_) return nullptr;
char* value = (char*)mir_alloc(length + 2);
memcpy(value, &value_[pos], length);
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index c2d37f170f..7bf8eed909 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE hThemeButton = NULL;
+HANDLE hThemeButton = nullptr;
COLORREF foreground=0;
COLORREF background=0xffffff;
COLORREF custColours[16]={0};
@@ -45,7 +45,7 @@ void DrawMyControl(HDC hDC, HWND /*hwndButton*/, HANDLE hTheme, UINT iState, REC }
rect.top -= 1;
rect.left -= 1;
- DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON, state, &rect, NULL);
+ DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON, state, &rect, nullptr);
}
else {
if (bIsFocused) {
@@ -169,12 +169,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L _itoa(cfOld.yHeight / 20, size, sizeof(size));
//SetDlgItemText(hwndDlg, IDC_FONTSIZE, size);
SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SELECTSTRING, 1, (LPARAM)size);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_BOLD), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_ITALIC), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_UNDERLINE), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_BOLD), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_ITALIC), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_UNDERLINE), nullptr, FALSE);
}
else if (((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) {
// REQRESIZE* rr= (REQRESIZE*)lParam;
@@ -212,12 +212,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT);
if (isSuper) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sup_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sup_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("sup_scrpt");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsup_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsup_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nsup_scrpt");
}
}
@@ -230,12 +230,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT);
if (!isSub&&!isSuper) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("norm_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("norm_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("norm_scrpt");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nnorm_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nnorm_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nnorm_scrpt");
}
}
@@ -247,12 +247,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isSub = (cfOld.dwEffects & CFE_SUBSCRIPT) && (cfOld.dwMask & CFM_SUBSCRIPT);
if (isSub) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sub_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sub_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("sub_scrpt");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsub_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsub_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nsub_scrpt");
}
}
@@ -264,12 +264,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isBold = (cfOld.dwEffects & CFE_BOLD) && (cfOld.dwMask & CFM_BOLD);
if (!isBold) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nbold"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nbold"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nbold");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("bold"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("bold"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("bold");
}
}
@@ -281,12 +281,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isItalic = (cfOld.dwEffects & CFE_ITALIC) && (cfOld.dwMask & CFM_ITALIC);
if (!isItalic) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_ITALIC), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nitalic"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nitalic"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nitalic");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_ITALIC), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("italic"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("italic"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("italic");
}
}
@@ -298,18 +298,18 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE);
if (!isUnderline) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_UNDERLINE), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nundrln"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nundrln"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nundrln");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_UNDERLINE), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("undrln"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("undrln"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("undrln");
}
}
else if (lpDIS->CtlID == IDC_FOREGROUNDCOLOR) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("foreclr"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("foreclr"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("foreclr");
HBRUSH hbr = CreateSolidBrush(foreground);
HPEN hp = CreatePen(PS_SOLID, 1, ~foreground & 0x00ffffff);
@@ -343,7 +343,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else if (lpDIS->CtlID == IDC_BACKGROUNDCOLOR) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("backclr"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("backclr"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("backclr");
HBRUSH hbr = CreateSolidBrush(background);
HPEN hp = CreatePen(PS_SOLID, 1, ~background & 0x00ffffff);
@@ -405,8 +405,8 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects = CFE_SUPERSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), nullptr, FALSE);
}
break;
@@ -418,8 +418,8 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects &= ~CFE_SUPERSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), nullptr, FALSE);
}
break;
@@ -431,8 +431,8 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects = CFE_SUBSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), nullptr, FALSE);
}
break;
@@ -512,7 +512,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)) {
foreground = cc.rgbResult;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), nullptr, FALSE);
}
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
}
@@ -537,12 +537,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L custColours[1] = background;
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwndDlg;
- cc.hInstance = (HWND)GetModuleHandle(NULL);
+ cc.hInstance = (HWND)GetModuleHandle(nullptr);
cc.lpCustColors = custColours;
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)) {
background = cc.rgbResult;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), nullptr, FALSE);
}
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
}
@@ -703,7 +703,7 @@ int CAimProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::EditProfile(WPARAM, LPARAM)
{
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_AIM), NULL, userinfo_dialog, LPARAM(this));
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_AIM), nullptr, userinfo_dialog, LPARAM(this));
return 0;
}
@@ -866,7 +866,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //End Force Proxy Transfer
//PN
- int port = GetDlgItemInt(hwndDlg, IDC_PN, NULL, FALSE);
+ int port = GetDlgItemInt(hwndDlg, IDC_PN, nullptr, FALSE);
if (port > 0 && port != AIM_DEFAULT_PORT)
ppro->setWord(AIM_KEY_PN, (WORD)port);
else
@@ -1175,8 +1175,8 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND:
{
- unsigned long hours = GetDlgItemInt(hwndDlg, IDC_IIH, 0, 0);
- unsigned short minutes = (unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM, 0, 0);
+ unsigned long hours = GetDlgItemInt(hwndDlg, IDC_IIH, nullptr, 0);
+ unsigned short minutes = (unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM, nullptr, 0);
if (minutes > 59)
minutes = 59;
@@ -1453,5 +1453,5 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR void CALLBACK chat_request_cb(PVOID dwParam)
{
CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE_REQ),
- NULL, chat_request_dialog, (LPARAM)dwParam);
+ nullptr, chat_request_dialog, (LPARAM)dwParam);
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index ee1918bcc4..eeb52b6f26 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -29,42 +29,42 @@ void CAimProto::broadcast_status(int status) shutdown_chat_conn();
if (m_hServerConn) {
- aim_sendflap(m_hServerConn, 0x04, 0, NULL, m_seqno);
+ aim_sendflap(m_hServerConn, 0x04, 0, nullptr, m_seqno);
Netlib_Shutdown(m_hServerConn);
}
if (m_hMailConn && m_hMailConn != (HANDLE)1) {
- aim_sendflap(m_hMailConn, 0x04, 0, NULL, m_mail_seqno);
+ aim_sendflap(m_hMailConn, 0x04, 0, nullptr, m_mail_seqno);
Netlib_Shutdown(m_hMailConn);
}
else if (m_hMailConn == (HANDLE)1)
- m_hMailConn = NULL;
+ m_hMailConn = nullptr;
if (m_hAvatarConn && m_hAvatarConn != (HANDLE)1) {
- aim_sendflap(m_hAvatarConn, 0x04, 0, NULL, m_avatar_seqno);
+ aim_sendflap(m_hAvatarConn, 0x04, 0, nullptr, m_avatar_seqno);
Netlib_Shutdown(m_hAvatarConn);
}
else if (m_hAvatarConn == (HANDLE)1)
- m_hAvatarConn = NULL;
+ m_hAvatarConn = nullptr;
if (m_hChatNavConn && m_hChatNavConn != (HANDLE)1) {
- aim_sendflap(m_hChatNavConn, 0x04, 0, NULL, m_chatnav_seqno);
+ aim_sendflap(m_hChatNavConn, 0x04, 0, nullptr, m_chatnav_seqno);
Netlib_Shutdown(m_hChatNavConn);
}
else if (m_hChatNavConn == (HANDLE)1)
- m_hChatNavConn = NULL;
+ m_hChatNavConn = nullptr;
m_idle = false;
m_instantidle = false;
m_list_received = false;
m_state = 0;
m_iDesiredStatus = ID_STATUS_OFFLINE;
- replaceStr(m_last_status_msg, NULL);
+ replaceStr(m_last_status_msg, nullptr);
m_avatar_id_lg = 0;
m_avatar_id_sm = 0;
- replaceStr(m_hash_lg, NULL);
- replaceStr(m_hash_sm, NULL);
+ replaceStr(m_hash_lg, nullptr);
+ replaceStr(m_hash_sm, nullptr);
m_pd_flags = 0;
m_pd_info_id = 0;
@@ -107,7 +107,7 @@ void CAimProto::start_connection(void*) //if (login_url == NULL) login_url = mir_strdup(use_ssl ? AIM_DEFAULT_SERVER : AIM_DEFAULT_SERVER_NS);
- if (login_url == NULL) login_url = mir_strdup(AIM_DEFAULT_SERVER);
+ if (login_url == nullptr) login_url = mir_strdup(AIM_DEFAULT_SERVER);
m_hServerConn = aim_connect(login_url, get_default_port(), false, login_url); //ssl does not work anymore with old authorization algo
@@ -115,8 +115,8 @@ void CAimProto::start_connection(void*) m_pref1_flags = 0x77ffff;
m_pref1_set_flags = 0x77ffff;
- mir_free(m_pref2_flags); m_pref2_flags = NULL; m_pref2_len = 0;
- mir_free(m_pref2_set_flags); m_pref2_set_flags = NULL; m_pref2_set_len = 0;
+ mir_free(m_pref2_flags); m_pref2_flags = nullptr; m_pref2_len = 0;
+ mir_free(m_pref2_set_flags); m_pref2_set_flags = nullptr; m_pref2_set_len = 0;
if (m_hServerConn)
aim_connection_authorization();
@@ -137,7 +137,7 @@ bool CAimProto::wait_conn(HNETLIBCONN &hConn, HANDLE &hEvent, unsigned short ser return false;
{
mir_cslock lck(connMutex);
- if (hConn == NULL && m_hServerConn) {
+ if (hConn == nullptr && m_hServerConn) {
debugLogA("Starting Connection.");
hConn = (HNETLIBCONN)1; //set so no additional service request attempts are made while aim is still processing the request
aim_new_service_request(m_hServerConn, m_seqno, service);//general service connection!
@@ -163,7 +163,7 @@ unsigned short CAimProto::get_default_port(void) bool CAimProto::is_my_contact(MCONTACT hContact)
{
const char* szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(m_szModuleName, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(m_szModuleName, szProto) == 0;
}
MCONTACT CAimProto::find_chat_contact(const char* room)
@@ -235,7 +235,7 @@ void CAimProto::update_server_group(const char* group, unsigned short group_id) void CAimProto::add_contact_to_group(MCONTACT hContact, const char* new_group)
{
- if (new_group == NULL)
+ if (new_group == nullptr)
return;
unsigned short old_group_id = getGroupId(hContact, 1);
@@ -244,7 +244,7 @@ void CAimProto::add_contact_to_group(MCONTACT hContact, const char* new_group) return;
DBVARIANT dbv;
- char *nick = NULL;
+ char *nick = nullptr;
if (!db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) {
nick = NEWSTR_ALLOCA(dbv.pszVal);
db_free(&dbv);
@@ -319,7 +319,7 @@ void CAimProto::offline_contacts(void) char *normalize_name(const char *s)
{
- if (s == NULL) return NULL;
+ if (s == nullptr) return nullptr;
char* buf = mir_strdup(s);
_strlwr(buf);
@@ -341,7 +341,7 @@ char *normalize_name(const char *s) char* trim_str(char* s)
{
- if (s == NULL) return NULL;
+ if (s == nullptr) return nullptr;
size_t len = mir_strlen(s);
while (len) {
@@ -389,7 +389,7 @@ retry: //returns the size of the list array aquired with data
unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigned short &size)
{
- unsigned short* list = NULL;
+ unsigned short* list = nullptr;
size = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -415,7 +415,7 @@ void CAimProto::upload_nicks(void) for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DBVARIANT dbv;
if (!db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) {
- set_local_nick(hContact, dbv.pszVal, NULL);
+ set_local_nick(hContact, dbv.pszVal, nullptr);
db_free(&dbv);
}
}
@@ -468,7 +468,7 @@ char* BdList::find_name(unsigned short id) if (items[i]->item_id == id)
return items[i]->name;
}
- return NULL;
+ return nullptr;
}
void BdList::remove_by_id(unsigned short id)
@@ -542,7 +542,7 @@ int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD);
if (fid < 0) {
wchar_t errmsg[512];
- mir_snwprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
+ mir_snwprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(nullptr));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
return fid;
@@ -560,7 +560,7 @@ void CAimProto::write_away_message(const char* sn, const char* msg, bool utf) _write(fid, "'s Away Message:</h3>", 21);
_write(fid, s_msg, (unsigned)mir_strlen(s_msg));
_close(fid);
- ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);
mir_free(path);
mir_free(s_msg);
}
@@ -578,7 +578,7 @@ void CAimProto::write_profile(const char* sn, const char* msg, bool utf) _write(fid, "'s Profile:</h3>", 16);
_write(fid, s_msg, (unsigned)mir_strlen(s_msg));
_close(fid);
- ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);
mir_free(path);
mir_free(s_msg);
}
|