diff options
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r-- | protocols/Gadu-Gadu/src/avatar.cpp | 42 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 112 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/dialogs.cpp | 26 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/dynstuff.cpp | 24 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/filetransfer.cpp | 50 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.cpp | 18 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 28 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 40 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/icolib.cpp | 3 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/image.cpp | 86 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/import.cpp | 32 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/keepalive.cpp | 10 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/links.cpp | 18 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/oauth.cpp | 52 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/ownerinfo.cpp | 4 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/popups.cpp | 16 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/services.cpp | 16 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/sessions.cpp | 18 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/token.cpp | 12 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/userutils.cpp | 50 |
20 files changed, 329 insertions, 328 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 24ac5b6e68..975d3720b4 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -58,7 +58,7 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
{
- *avatarurl = *avatarts = NULL;
+ *avatarurl = *avatarts = nullptr;
char szUrl[128];
mir_snprintf(szUrl, "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
@@ -69,7 +69,7 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
- if (resp == NULL) {
+ if (resp == nullptr) {
debugLogA("getAvatarFileInfo(): No response from HTTP request");
return false;
}
@@ -84,18 +84,18 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) //if this url returned xml data (before and after 11.2013 gg convention)
wchar_t *xmlAction = mir_a2u(resp->pData);
- HXML hXml = xmlParseString(xmlAction, 0, L"result");
- if (hXml != NULL) {
+ HXML hXml = xmlParseString(xmlAction, nullptr, L"result");
+ if (hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0);
- const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
- if (blank != NULL && mir_wstrcmp(blank, L"1")) {
+ const wchar_t *blank = (node != nullptr) ? xmlGetAttrValue(node, L"blank") : nullptr;
+ if (blank != nullptr && mir_wstrcmp(blank, L"1")) {
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0);
- *avatarts = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ *avatarts = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/bigavatar", 0); //new gg convention
- if (node == NULL){
+ if (node == nullptr){
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/originBigAvatar", 0); //old gg convention
}
- *avatarurl = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ *avatarurl = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
}
xmlDestroyNode(hXml);
}
@@ -133,8 +133,8 @@ char *gg_avatarhash(char *param) {
char *result;
- if (param == NULL || (result = (char *)mir_alloc(MIR_SHA1_HASH_SIZE * 2 + 1)) == NULL)
- return NULL;
+ if (param == nullptr || (result = (char *)mir_alloc(MIR_SHA1_HASH_SIZE * 2 + 1)) == nullptr)
+ return nullptr;
BYTE digest[MIR_SHA1_HASH_SIZE];
mir_sha1_hash((BYTE*)param, (int)mir_strlen(param), digest);
@@ -168,7 +168,7 @@ void GGPROTO::requestAvatarInfo(MCONTACT hContact, int iWaitFor) if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS))
return;
- GGREQUESTAVATARDATA *data = NULL;
+ GGREQUESTAVATARDATA *data = nullptr;
gg_EnterCriticalSection(&avatar_mutex, "requestAvatarInfo", 2, "avatar_mutex", 1);
if (avatar_requests.getIndex((GGREQUESTAVATARDATA*)&hContact) == -1) {
data = (GGREQUESTAVATARDATA*)mir_alloc(sizeof(GGREQUESTAVATARDATA));
@@ -178,7 +178,7 @@ void GGPROTO::requestAvatarInfo(MCONTACT hContact, int iWaitFor) }
gg_LeaveCriticalSection(&avatar_mutex, "requestAvatarInfo", 2, 1, "avatar_mutex", 1);
- if (data != NULL)
+ if (data != nullptr)
setByte(hContact, GG_KEY_AVATARREQUESTED, 1);
}
@@ -202,14 +202,14 @@ void __cdecl GGPROTO::avatarrequestthread(void*) char *AvatarURL, *AvatarTs;
if (!getAvatarFileInfo(uin, &AvatarURL, &AvatarTs)) {
if (iWaitFor)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, nullptr, 0);
}
else {
- if (AvatarURL == NULL && AvatarTs == NULL){
+ if (AvatarURL == nullptr && AvatarTs == nullptr){
delSetting(hContact, GG_KEY_AVATARURL);
delSetting(hContact, GG_KEY_AVATARTS);
if (iWaitFor)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr, 0);
}
else {
setString(hContact, GG_KEY_AVATARURL, AvatarURL);
@@ -221,11 +221,11 @@ void __cdecl GGPROTO::avatarrequestthread(void*) ai.hContact = hContact;
INT_PTR res = getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&ai);
if (res == GAIR_NOAVATAR)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr, 0);
else if (res == GAIR_SUCCESS)
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
- else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, 0, 0);
+ else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
delSetting(hContact, GG_KEY_AVATARREQUESTED);
}
}
@@ -314,7 +314,7 @@ void GGPROTO::initavatarrequestthread() #ifdef DEBUGMODE
debugLogA("initavatarrequestthread(): ForkThreadEx 1 GGPROTO::avatarrequestthread");
#endif
- pth_avatar.hThread = ForkThreadEx(&GGPROTO::avatarrequestthread, NULL, &pth_avatar.dwThreadId);
+ pth_avatar.hThread = ForkThreadEx(&GGPROTO::avatarrequestthread, nullptr, &pth_avatar.dwThreadId);
}
}
@@ -324,7 +324,7 @@ void __cdecl GGPROTO::getOwnAvatarThread(void*) char *AvatarURL, *AvatarTs;
if (getAvatarFileInfo(getDword(GG_KEY_UIN, 0), &AvatarURL, &AvatarTs)) {
- if (AvatarURL != NULL && AvatarTs != NULL) {
+ if (AvatarURL != nullptr && AvatarTs != nullptr) {
setString(GG_KEY_AVATARURL, AvatarURL);
setString(GG_KEY_AVATARTS, AvatarTs);
mir_free(AvatarURL); mir_free(AvatarTs);
@@ -348,7 +348,7 @@ void GGPROTO::getOwnAvatar() #ifdef DEBUGMODE
debugLogA("getOwnAvatar(): ForkThread 2 GGPROTO::getOwnAvatarThread");
#endif
- ForkThread(&GGPROTO::getOwnAvatarThread, NULL);
+ ForkThread(&GGPROTO::getOwnAvatarThread, nullptr);
}
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 0fb92afbe2..a9048fe0c8 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -43,7 +43,7 @@ int GGPROTO::isonline() int isonline;
gg_EnterCriticalSection(&sess_mutex, "isonline", 76, "sess_mutex", 1);
- isonline = (sess != NULL);
+ isonline = (sess != nullptr);
gg_LeaveCriticalSection(&sess_mutex, "isonline", 76, 1, "sess_mutex", 1);
return isonline;
@@ -58,7 +58,7 @@ void GGPROTO::disconnect() if (isonline())
{
// Fetch proper status msg
- char *szMsg = NULL;
+ char *szMsg = nullptr;
// Loadup status
if (getByte(GG_KEY_LEAVESTATUSMSG, GG_KEYDEF_LEAVESTATUSMSG))
@@ -184,8 +184,8 @@ typedef struct int gg_decodehosts(char *var, GGHOST *hosts, int max)
{
int hp = 0;
- char *hostname = NULL;
- char *portname = NULL;
+ char *hostname = nullptr;
+ char *portname = nullptr;
while(var && *var && hp < max)
{
@@ -212,8 +212,8 @@ int gg_decodehosts(char *var, GGHOST *hosts, int max) hp ++;
// Zero the names
- hostname = NULL;
- portname = NULL;
+ hostname = nullptr;
+ portname = nullptr;
}
else
var ++;
@@ -294,7 +294,7 @@ void __cdecl GGPROTO::mainthread(void *) gg_proxy_username = nlus.szProxyAuthUser;
gg_proxy_password = nlus.szProxyAuthPassword;
}
- else gg_proxy_username = gg_proxy_password = NULL;
+ else gg_proxy_username = gg_proxy_password = nullptr;
}
else {
debugLogA("mainthread() (%x): Failed loading proxy settings.", this);
@@ -344,7 +344,7 @@ void __cdecl GGPROTO::mainthread(void *) ////////////////////////////// DCC STARTUP /////////////////////////////
// Uin is ok so startup dcc if not started already
if (!dcc) {
- hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dccstart();
// Wait for DCC
@@ -352,7 +352,7 @@ void __cdecl GGPROTO::mainthread(void *) debugLogA("mainthread() (%x): Waiting DCC service to start...", this);
#endif
while (WaitForSingleObjectEx(hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
- CloseHandle(hEvent); hEvent = NULL;
+ CloseHandle(hEvent); hEvent = nullptr;
}
// Check if dcc is running and setup forwarding port
@@ -379,7 +379,7 @@ retry: gg_EnterCriticalSection(&modemsg_mutex, "mainthread", 13, "modemsg_mutex", 1);
p.status_descr = mir_utf8encodeW(getstatusmsg(m_iDesiredStatus));
- p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL);
+ p.status = status_m2gg(m_iDesiredStatus, p.status_descr != nullptr);
debugLogW(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus,
p.status_descr ? getstatusmsg(m_iDesiredStatus) : L"<none>");
@@ -414,7 +414,7 @@ retry: // Check if connection attempt wasn't cancelled by the user
if (m_iDesiredStatus != ID_STATUS_OFFLINE)
{
- wchar_t error[128], *perror = NULL;
+ wchar_t error[128], *perror = nullptr;
// Lookup for error desciption
if (errno == EACCES) {
for (int i = 0; reason[i].type; i++) if (reason[i].type == gg_failno) {
@@ -438,13 +438,13 @@ retry: DWORD dwInterval = getDword(GG_KEY_RECONNINTERVAL, GG_KEYDEF_RECONNINTERVAL), dwResult;
BOOL bRetry = TRUE;
- hConnStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hConnStopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dwResult = WaitForSingleObjectEx(hConnStopEvent, dwInterval, TRUE);
if ((dwResult == WAIT_OBJECT_0 && m_iDesiredStatus == ID_STATUS_OFFLINE)
|| (dwResult == WAIT_IO_COMPLETION && Miranda_IsTerminated()))
bRetry = FALSE;
CloseHandle(hConnStopEvent);
- hConnStopEvent = NULL;
+ hConnStopEvent = nullptr;
// Reconnect to the next server on the list
if (bRetry)
@@ -466,7 +466,7 @@ retry: else
{
// Successfully connected
- logonTime = time(NULL);
+ logonTime = time(nullptr);
setDword(GG_KEY_LOGONTIME, logonTime);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 15, "sess_mutex", 1);
sess = local_sess;
@@ -510,7 +510,7 @@ retry: debugLogA("mainthread() (%x): Connection closed.", this);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 16, "sess_mutex", 1);
gg_free_session(sess);
- sess = NULL;
+ sess = nullptr;
gg_LeaveCriticalSection(&sess_mutex, "mainthread", 16, 1, "sess_mutex", 1);
break;
}
@@ -533,7 +533,7 @@ retry: case GG_EVENT_DISCONNECT:
gg_EnterCriticalSection(&sess_mutex, "mainthread", 17, "sess_mutex", 1);
gg_free_session(sess);
- sess = NULL;
+ sess = nullptr;
gg_LeaveCriticalSection(&sess_mutex, "mainthread", 17, 1, "sess_mutex", 1);
break;
@@ -547,7 +547,7 @@ retry: case GG_EVENT_ACK:
if (e->event.ack.seq && e->event.ack.recipient)
{
- ProtoBroadcastAck(getcontact((DWORD)e->event.ack.recipient, 0, 0, NULL),
+ ProtoBroadcastAck(getcontact((DWORD)e->event.ack.recipient, 0, 0, nullptr),
ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)e->event.ack.seq, 0);
}
break;
@@ -562,7 +562,7 @@ retry: for (; n->uin; n++)
{
- wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeW(e->event.notify_descr.descr) : NULL;
+ wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeW(e->event.notify_descr.descr) : nullptr;
changecontactstatus(n->uin, n->status, descrT, 0, n->remote_ip, n->remote_port, n->version);
if (descrT) mir_free(descrT);
}
@@ -580,7 +580,7 @@ retry: e->event.notify60[i].time, e->event.notify60[i].remote_ip, e->event.notify60[i].remote_port,
e->event.notify60[i].version);
mir_free(descrT);
- requestAvatarInfo(getcontact(e->event.notify60[i].uin, 0, 0, NULL), 0);
+ requestAvatarInfo(getcontact(e->event.notify60[i].uin, 0, 0, nullptr), 0);
}
break;
}
@@ -628,7 +628,7 @@ retry: const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS);
uin_t uin = __fmnumber ? atoi(__fmnumber) : 0;
- MCONTACT hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, NULL);
+ MCONTACT hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, nullptr);
debugLogA("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq);
if (res->seq == GG_SEQ_SEARCH)
{
@@ -641,7 +641,7 @@ retry: mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
@@ -704,7 +704,7 @@ retry: if (__birthyear)
{
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
if (br > 0)
@@ -766,7 +766,7 @@ retry: // Status (version >= 6.0)
case GG_EVENT_STATUS60:
{
- MCONTACT hContact = getcontact(e->event.status60.uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(e->event.status60.uin, 0, 0, nullptr);
int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE);
uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0);
@@ -796,15 +796,15 @@ retry: case GG_USERLIST_GET_REPLY:
if (e->event.userlist.reply) {
parsecontacts(e->event.userlist.reply);
- MessageBox(NULL, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
break;
case GG_USERLIST_PUT_REPLY:
if (is_list_remove)
- MessageBox(NULL, TranslateT("List remove successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List remove successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
else
- MessageBox(NULL, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
break;
}
break;
@@ -829,11 +829,11 @@ retry: UIN2IDT(e->event.msg.sender, id);
GCEVENT gce = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- time_t t = time(NULL);
+ time_t t = time(nullptr);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
- gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0);
+ gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, nullptr), 0);
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id);
@@ -845,16 +845,16 @@ retry: else if (!e->event.msg.recipients_count && e->event.msg.message && *e->event.msg.message && mir_strcmp(e->event.msg.message, "\xA0\0"))
{
PROTORECVEVENT pre = {0};
- time_t t = time(NULL);
+ time_t t = time(nullptr);
pre.timestamp = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
pre.szMessage = e->event.msg.message;
- ProtoChainRecvMsg( getcontact(e->event.msg.sender, 1, 0, NULL), &pre);
+ ProtoChainRecvMsg( getcontact(e->event.msg.sender, 1, 0, nullptr), &pre);
}
// RichEdit format included (image)
if (e->event.msg.formats_length &&
getByte(GG_KEY_IMGRECEIVE, GG_KEYDEF_IMGRECEIVE) &&
- !(db_get_dw(getcontact(e->event.msg.sender, 1, 0, NULL), "Ignore", "Mask1", 0) & IGNOREEVENT_MESSAGE))
+ !(db_get_dw(getcontact(e->event.msg.sender, 1, 0, nullptr), "Ignore", "Mask1", 0) & IGNOREEVENT_MESSAGE))
{
char *formats = (char*)e->event.msg.formats;
int len = 0, formats_len = e->event.msg.formats_length, add_ptr;
@@ -921,7 +921,7 @@ retry: dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)mir_strlen(e->event.multilogon_msg.message) + 1;
dbei.pBlob = (PBYTE)e->event.multilogon_msg.message;
- db_event_add( getcontact(e->event.multilogon_msg.sender, 1, 0, NULL), &dbei);
+ db_event_add( getcontact(e->event.multilogon_msg.sender, 1, 0, nullptr), &dbei);
}
break;
@@ -929,7 +929,7 @@ retry: case GG_EVENT_MULTILOGON_INFO:
{
list_t l;
- int* iIndexes = NULL, i;
+ int* iIndexes = nullptr, i;
debugLogA("mainthread(): Concurrent sessions count: %d.", e->event.multilogon_info.count);
if (e->event.multilogon_info.count > 0)
iIndexes = (int*)mir_calloc(e->event.multilogon_info.count * sizeof(int));
@@ -949,7 +949,7 @@ retry: mir_free(msess);
}
list_destroy(sessions, 0);
- sessions = NULL;
+ sessions = nullptr;
for (i = 0; i < e->event.multilogon_info.count; i++)
{
gg_multilogon_session* msess = (gg_multilogon_session*)mir_alloc(sizeof(struct gg_multilogon_session));
@@ -963,7 +963,7 @@ retry: sessions_updatedlg();
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
{
- const wchar_t* szText = time(NULL) - logonTime > 3
+ const wchar_t* szText = time(nullptr) - logonTime > 3
? TranslateT("You have logged in at another location")
: TranslateT("You are logged in at another location");
for (i = 0; i < e->event.multilogon_info.count; i++)
@@ -987,8 +987,8 @@ retry: // Get rid of empty image
if (e->event.image_reply.size && e->event.image_reply.image)
{
- MCONTACT hContact = getcontact(e->event.image_reply.sender, 1, 0, NULL);
- void *img = (void *)img_loadpicture(e, 0);
+ MCONTACT hContact = getcontact(e->event.image_reply.sender, 1, 0, nullptr);
+ void *img = (void *)img_loadpicture(e, nullptr);
if (!img)
break;
@@ -1030,12 +1030,12 @@ retry: {
struct gg_dcc7 *dcc7 = e->event.dcc7_new;
debugLogA("mainthread() (%x): Incoming direct connection.", this);
- dcc7->contact = (void*)getcontact(dcc7->peer_uin, 0, 0, NULL);
+ dcc7->contact = (void*)getcontact(dcc7->peer_uin, 0, 0, nullptr);
// Check if user is on the list and if it is my uin
if (!dcc7->contact || getDword(GG_KEY_UIN, -1) != dcc7->uin) {
gg_dcc7_free(dcc7);
- e->event.dcc7_new = NULL;
+ e->event.dcc7_new = nullptr;
break;
}
@@ -1055,14 +1055,14 @@ retry: PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)dcc7;
ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre);
mir_free(filenameT);
- e->event.dcc7_new = NULL;
+ e->event.dcc7_new = nullptr;
}
break;
@@ -1149,26 +1149,26 @@ retry: xmlAction = mir_a2u(e->event.xml_action.data);
tag = mir_a2u("events");
- hXml = xmlParseString(xmlAction, 0, tag);
+ hXml = xmlParseString(xmlAction, nullptr, tag);
- if (hXml != NULL) {
+ if (hXml != nullptr) {
HXML node;
char *type, *sender;
mir_free(tag);
tag = mir_a2u("event/type");
node = xmlGetChildByPath(hXml, tag, 0);
- type = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ type = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
mir_free(tag);
tag = mir_a2u("event/sender");
node = xmlGetChildByPath(hXml, tag, 0);
- sender = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
- debugLogA("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
+ sender = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
+ debugLogA("mainthread() (%x): XML Action type: %s.", this, type != nullptr ? type : "unknown");
// Avatar change notify
- if (type != NULL && !mir_strcmp(type, "28")) {
+ if (type != nullptr && !mir_strcmp(type, "28")) {
debugLogA("mainthread() (%x): Client %s changed his avatar.", this, sender);
- requestAvatarInfo(getcontact(atoi(sender), 0, 0, NULL), 0);
+ requestAvatarInfo(getcontact(atoi(sender), 0, 0, nullptr), 0);
}
mir_free(type);
mir_free(sender);
@@ -1181,7 +1181,7 @@ retry: case GG_EVENT_TYPING_NOTIFICATION:
{
- MCONTACT hContact = getcontact(e->event.typing_notification.uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(e->event.typing_notification.uin, 0, 0, nullptr);
#ifdef DEBUGMODE
debugLogA("mainthread() (%x): Typing notification from %d (%d).", this,
e->event.typing_notification.uin, e->event.typing_notification.length);
@@ -1224,7 +1224,7 @@ retry: mir_free(msess);
}
list_destroy(sessions, 0);
- sessions = NULL;
+ sessions = nullptr;
gg_LeaveCriticalSection(&sessions_mutex, "mainthread", 23, 1, "sessions_mutex", 1);
}
@@ -1310,7 +1310,7 @@ static wchar_t* sttSettingToTchar( DBVARIANT* value ) case DBVT_WCHAR:
return mir_wstrdup(value->pwszVal);
}
- return NULL;
+ return nullptr;
}
int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
@@ -1336,7 +1336,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) if (gc_enabled && !strcmp(cws->szModule, m_szModuleName) && !strcmp(cws->szSetting, GG_KEY_NICK)){
wchar_t* ptszVal = sttSettingToTchar(&(cws->value));
- if(ptszVal==NULL) return 0;
+ if(ptszVal==nullptr) return 0;
// Groupchat window contact is being renamed
DBVARIANT dbv;
@@ -1366,7 +1366,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) // If name changed... change nick
if (!strcmp(cws->szSetting, "MyHandle")){
wchar_t* ptszVal = sttSettingToTchar(&(cws->value));
- if(ptszVal==NULL) return 0;
+ if(ptszVal==nullptr) return 0;
setWString(hContact, GG_KEY_NICK, ptszVal);
mir_free(ptszVal);
}
@@ -1471,7 +1471,7 @@ void GGPROTO::notifyall() if (count == 0) {
if (isonline()) {
gg_EnterCriticalSection(&sess_mutex, "notifyall", 29, "sess_mutex", 1);
- gg_notify_ex(sess, NULL, NULL, 0);
+ gg_notify_ex(sess, nullptr, nullptr, 0);
gg_LeaveCriticalSection(&sess_mutex, "notifyall", 29, 1, "sess_mutex", 1);
}
return;
@@ -1583,7 +1583,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1);
wchar_t *szMsg = mir_wstrdup(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1);
- changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0);
+ changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != nullptr), szMsg, 0, 0, 0, 0);
mir_free(szMsg);
}
}
@@ -1680,7 +1680,7 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const wchar_t *idescr, #ifdef DEBUGMODE
debugLogA("changecontactstatus(): uin=%d status=%d", uin, status);
#endif
- MCONTACT hContact = getcontact(uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(uin, 0, 0, nullptr);
// Check if contact is on list
if (!hContact) return;
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 1abf79e361..ad35aeb2de 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -39,12 +39,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule { DBVARIANT dbv = {0}; wchar_t str[256]; - wchar_t *ptstr = NULL; - wchar_t* valT = NULL; + wchar_t *ptstr = nullptr; + wchar_t* valT = nullptr; int unspecified = 0; dbv.type = DBVT_DELETED; - if (szModule == NULL) unspecified = 1; + if (szModule == nullptr) unspecified = 1; else unspecified = db_get(hContact, szModule, szSetting, &dbv); if (!unspecified) { switch (dbv.type) { @@ -75,7 +75,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule case DBVT_WORD: if (special == SVS_COUNTRY) { char* pstr = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, dbv.wVal, 0); - if (pstr == NULL){ + if (pstr == nullptr){ unspecified = 1; } else { ptstr = str; @@ -93,7 +93,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule struct in_addr ia; ia.S_un.S_addr = htonl(dbv.dVal); char* pstr = inet_ntoa(ia); - if (pstr == NULL){ + if (pstr == nullptr){ unspecified = 1; } else { ptstr = str; @@ -309,9 +309,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, uin = atoi(email); GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email)); if (!mir_strlen(email)) - MessageBox(NULL, TranslateT("You need to specify your registration e-mail first."), + MessageBox(nullptr, TranslateT("You need to specify your registration e-mail first."), gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION); - else if (MessageBox(NULL, + else if (MessageBox(nullptr, TranslateT("Your password will be sent to your registration e-mail.\nDo you want to continue?"), gg->m_tszUserName, MB_OKCANCEL | MB_ICONQUESTION) == IDOK) @@ -323,7 +323,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (gg->isonline()) { if (MessageBox( - NULL, + nullptr, TranslateT("You should disconnect before making any permanent changes with your account.\nDo you want to disconnect now?"), gg->m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL) @@ -705,14 +705,14 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, // Show updated message if (dat->updating) { - MessageBox(NULL, TranslateT("Your details has been uploaded to the public directory."), + MessageBox(nullptr, TranslateT("Your details has been uploaded to the public directory."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION); dat->updating = FALSE; break; } char *szProto = (hContact == NULL) ? gg->m_szModuleName : GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) break; // Disable when updating @@ -790,7 +790,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!gg->isonline()) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("You have to be logged in before you can change your details."), gg->m_tszUserName, MB_OK | MB_ICONSTOP); break; @@ -799,7 +799,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_SAVE), FALSE); gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_WRITE); - if (req == NULL) + if (req == nullptr) break; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); @@ -910,7 +910,7 @@ int GGPROTO::details_init(WPARAM wParam, LPARAM lParam) } else { // Other user details char* szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return 0; if (mir_strcmp(szProto, m_szModuleName) || isChatRoom(hContact)) return 0; diff --git a/protocols/Gadu-Gadu/src/dynstuff.cpp b/protocols/Gadu-Gadu/src/dynstuff.cpp index 9c9656da84..275a273aff 100644 --- a/protocols/Gadu-Gadu/src/dynstuff.cpp +++ b/protocols/Gadu-Gadu/src/dynstuff.cpp @@ -42,13 +42,13 @@ void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparisio {
if (!list) {
errno = EFAULT;
- return NULL;
+ return nullptr;
}
list_t newlist = (list_t)malloc(sizeof(struct list));
newlist->data = data;
- newlist->next = NULL;
+ newlist->next = nullptr;
if (alloc_size) {
newlist->data = malloc(alloc_size);
@@ -64,7 +64,7 @@ void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparisio tmp = tmp->next;
tmp->next = newlist;
} else {
- list_t prev = NULL;
+ list_t prev = nullptr;
while (comparision(newlist->data, tmp->data) > 0) {
prev = tmp;
@@ -94,7 +94,7 @@ void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparisio */
void *list_add(list_t *list, void *data, int alloc_size)
{
- return list_add_sorted(list, data, alloc_size, NULL);
+ return list_add_sorted(list, data, alloc_size, nullptr);
}
/*
@@ -108,7 +108,7 @@ void *list_add(list_t *list, void *data, int alloc_size) */
int list_remove(list_t *list, void *data, int free_data)
{
- list_t tmp, last = NULL;
+ list_t tmp, last = nullptr;
if (!list || !*list) {
errno = EFAULT;
@@ -350,10 +350,10 @@ void string_clear(string_t s) */
char *string_free(string_t s, int free_string)
{
- char *tmp = NULL;
+ char *tmp = nullptr;
if (!s)
- return NULL;
+ return nullptr;
if (free_string)
free(s->str);
@@ -411,7 +411,7 @@ const char *ditoa(long int i) char **array_make(const char *string, const char *sep, int max, int trim, int quotes)
{
const char *p, *q;
- char **result = NULL;
+ char **result = nullptr;
int items = 0, last = 0;
if (!string || !sep)
@@ -419,7 +419,7 @@ char **array_make(const char *string, const char *sep, int max, int trim, int qu for (p = string; ; ) {
int len = 0;
- char *token = NULL;
+ char *token = nullptr;
if (max && items >= max - 1)
last = 1;
@@ -487,7 +487,7 @@ char **array_make(const char *string, const char *sep, int max, int trim, int qu result = (char**)realloc(result, (items + 2) * sizeof(char*));
result[items] = token;
- result[++items] = NULL;
+ result[++items] = nullptr;
if (!*p)
break;
@@ -532,7 +532,7 @@ void array_add(char ***array, char *string) int count = array_count(*array);
*array = (char**)realloc(*array, (count + 2) * sizeof(char*));
- (*array)[count + 1] = NULL;
+ (*array)[count + 1] = nullptr;
(*array)[count] = string;
}
@@ -552,7 +552,7 @@ char *array_join(char **array, const char *sep) if (!array)
return _strdup("");
- string_t s = string_init(NULL);
+ string_t s = string_init(nullptr);
for (int i = 0; array[i]; i++) {
if (i)
string_append(s, sep);
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 682e3656d0..4b9f547930 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -54,13 +54,13 @@ void GGPROTO::dccstart() #ifdef DEBUGMODE
debugLogA("dccstart(): ForkThreadEx 4 GGPROTO::dccmainthread");
#endif
- pth_dcc.hThread = ForkThreadEx(&GGPROTO::dccmainthread, NULL, &pth_dcc.dwThreadId);
+ pth_dcc.hThread = ForkThreadEx(&GGPROTO::dccmainthread, nullptr, &pth_dcc.dwThreadId);
}
void GGPROTO::dccconnect(uin_t uin)
{
struct gg_dcc *local_dcc;
- MCONTACT hContact = getcontact(uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(uin, 0, 0, nullptr);
DWORD ip, myuin; WORD port;
debugLogA("dccconnect(): Connecting to uin %d.", uin);
@@ -110,7 +110,7 @@ HANDLE ftfail(GGPROTO *gg, MCONTACT hContact) #ifdef DEBUGMODE
gg->debugLogA("ftfail(): Failing file transfer...");
#endif
- srand(time(NULL));
+ srand(time(nullptr));
ft->hProcess = (HANDLE)rand();
ft->hContact = hContact;
#ifdef DEBUGMODE
@@ -139,7 +139,7 @@ void __cdecl GGPROTO::dccmainthread(void*) char szFilename[MAX_PATH];
// Zero up lists
- watches = transfers = requests = l = NULL;
+ watches = transfers = requests = l = nullptr;
debugLogA("dccmainthread(): started. DCC Server Thread Starting");
@@ -206,7 +206,7 @@ void __cdecl GGPROTO::dccmainthread(void*) }
// Wait for data on selects
- ret = select(maxfd + 1, &rd, &wd, NULL, &tv);
+ ret = select(maxfd + 1, &rd, &wd, nullptr, &tv);
// Check for select error
if (ret == -1)
@@ -248,7 +248,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_dcc_socket_free(local_dcc);
// Check if it's main socket
- if (local_dcc == dcc) dcc = NULL;
+ if (local_dcc == dcc) dcc = nullptr;
continue;
} else {
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
@@ -260,7 +260,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Client connected
case GG_EVENT_DCC_NEW:
list_add(&watches, e->event.dcc_new, 0);
- e->event.dcc_new = NULL;
+ e->event.dcc_new = nullptr;
break;
//
@@ -275,7 +275,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc->contact;
pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc->file_info.size;
@@ -305,7 +305,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc->contact;
pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc->file_info.size;
@@ -324,7 +324,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
}
// Free dcc
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
break;
// Client error
@@ -364,7 +364,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
}
// Free dcc
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
break;
// Need file acknowledgement
@@ -380,13 +380,13 @@ void __cdecl GGPROTO::dccmainthread(void*) // Add file recv request
{
// Make new ggtransfer struct
- local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL);
+ local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, nullptr);
wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)local_dcc;
@@ -403,13 +403,13 @@ void __cdecl GGPROTO::dccmainthread(void*) case GG_EVENT_DCC_CLIENT_ACCEPT:
debugLogA("dccmainthread(): Client: %d, Client accept.", local_dcc->peer_uin);
// Check if user is on the list and if it is my uin
- if (getcontact(local_dcc->peer_uin, 0, 0, NULL) &&
+ if (getcontact(local_dcc->peer_uin, 0, 0, nullptr) &&
getDword(GG_KEY_UIN, -1) == local_dcc->uin)
break;
// Kill unauthorized dcc
list_remove(&watches, dcc, 0);
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
break;
// Client connected as we wished to (callback)
@@ -454,7 +454,7 @@ void __cdecl GGPROTO::dccmainthread(void*) debugLogA("dccmainthread(): Unknown request to client %d.", local_dcc->peer_uin);
// Kill unauthorized dcc
list_remove(&watches, local_dcc, 0);
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
}
break;
}
@@ -503,7 +503,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc7->contact;
pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc7->size;
@@ -533,7 +533,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc7->contact;
pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc7->size;
@@ -625,7 +625,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_dcc_socket_free(local_dcc);
// Check if it's main socket
- if (local_dcc == dcc) dcc = NULL;
+ if (local_dcc == dcc) dcc = nullptr;
}
}
// Close all waiting for aknowledgle transfers
@@ -683,7 +683,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0);
// Free transfer
gg_free_dcc(dcc);
- return 0;
+ return nullptr;
}
// Put an offset to the file
@@ -719,7 +719,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0);
// Free transfer
gg_dcc7_free(dcc7);
- return 0;
+ return nullptr;
}
// Open file for appending and check if ok
@@ -733,7 +733,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0);
// Free transfer
gg_dcc7_free(dcc7);
- return 0;
+ return nullptr;
}
// Put an offset to the file
@@ -855,7 +855,7 @@ HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath) // Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
if (!c)
- return NULL;
+ return nullptr;
if (c->type == GG_SESSION_DCC7_GET)
return dcc7fileallow(hTransfer, szPath);
@@ -930,7 +930,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles if ((ver & 0x00ffffff) >= 0x29 || !ver) {
gg_EnterCriticalSection(&sess_mutex, "SendFile", 46, "sess_mutex", 1);
- struct gg_dcc7 *dcc7 = gg_dcc7_send_file(sess, uin, filename, NULL, NULL);
+ struct gg_dcc7 *dcc7 = gg_dcc7_send_file(sess, uin, filename, nullptr, nullptr);
if (!dcc7) {
gg_LeaveCriticalSection(&sess_mutex, "SendFile", 46, 1, "sess_mutex", 1);
debugLogA("SendFile(): Failed to send file \"%s\".", filename);
@@ -967,7 +967,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles }
// Try to connect if not ask user to connect me
- struct gg_dcc *dcc = NULL;
+ struct gg_dcc *dcc = nullptr;
if ((ip && port >= 10 && !(dcc = gg_dcc_send_file(ip, port, myuin, uin))) || (port < 10 && port > 0))
{
// Make fake dcc structure
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index cf2ec94613..9f343b52cd 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -47,8 +47,8 @@ int hLangpack; LIST<GGPROTO> g_Instances(1, PtrKeySortT);
// Event hooks
-static HANDLE hHookModulesLoaded = NULL;
-static HANDLE hHookPreShutdown = NULL;
+static HANDLE hHookModulesLoaded = nullptr;
+static HANDLE hHookPreShutdown = nullptr;
static unsigned long crc_table[256];
@@ -63,7 +63,7 @@ wchar_t* ws_strerror(int code) if (code == 0)
{
wchar_t buff[128];
- int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
+ int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, WSAGetLastError(), 0, buff, _countof(buff), nullptr);
if (len == 0)
mir_snwprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
else
@@ -83,7 +83,7 @@ char* as_strerror(int code) if (code == 0)
{
char buff[128];
- int len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
+ int len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, WSAGetLastError(), 0, buff, _countof(buff), nullptr);
if (len == 0)
mir_snprintf(err_desc, "WinSock %u: Unknown error.", WSAGetLastError());
else
@@ -216,14 +216,14 @@ static int gg_modulesloaded(WPARAM, LPARAM) static GGPROTO* gg_getprotoinstance(MCONTACT hContact)
{
char* szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
for (int i=0; i < g_Instances.getCount(); i++)
if (mir_strcmp(szProto, g_Instances[i]->m_szModuleName) == 0)
return g_Instances[i];
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////
@@ -232,7 +232,7 @@ static GGPROTO* gg_getprotoinstance(MCONTACT hContact) static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM)
{
GGPROTO* gg = gg_getprotoinstance(hContact);
- if (gg == NULL)
+ if (gg == nullptr)
return 0;
if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
@@ -442,7 +442,7 @@ void gg_debughandler(int level, const char *format, va_list ap) memcpy(szText, prefix, PREFIXLEN);
mir_vsnprintf(szText + mir_strlen(szText), sizeof(szText) - mir_strlen(szText), szFormat, ap);
- Netlib_Log(NULL, szText);
+ Netlib_Log(nullptr, szText);
free(szFormat);
}
#endif
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 3fe2a9d605..d0ff63102f 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -254,14 +254,14 @@ void __cdecl GGPROTO::searchthread(void *) HANDLE GGPROTO::SearchBasic(const wchar_t *id)
{
if (!isonline())
- return 0;
+ return nullptr;
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
if (!req) {
#ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HANDLE)1;
}
@@ -275,7 +275,7 @@ HANDLE GGPROTO::SearchBasic(const wchar_t *id) #ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 11 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HANDLE)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 2, "sess_mutex", 1);
@@ -292,17 +292,17 @@ HANDLE GGPROTO::SearchByName(const wchar_t *nick, const wchar_t *firstName, cons {
// Check if connected and if there's a search data
if (!isonline())
- return 0;
+ return nullptr;
if (!nick && !firstName && !lastName)
- return 0;
+ return nullptr;
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
- if (req == NULL) {
+ if (req == nullptr) {
#ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 12 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HANDLE)1;
}
@@ -343,7 +343,7 @@ HANDLE GGPROTO::SearchByName(const wchar_t *nick, const wchar_t *firstName, cons #ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 13 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
}
else
{
@@ -362,14 +362,14 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) {
// Check if connected
if (!isonline())
- return 0;
+ return nullptr;
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
if (!req) {
#ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HWND)1;
}
@@ -413,7 +413,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
int ay = lt->tm_year + 1900;
char age[16];
@@ -459,7 +459,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // No data entered
if (szQuery.GetLength() <= 7 || (szQuery.GetLength() == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED))) {
gg_pubdir50_free(req);
- return 0;
+ return nullptr;
}
// Count crc & check if the data was equal if yes do same search with shift
@@ -479,7 +479,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) #ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HWND)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 2, "sess_mutex", 1);
@@ -663,7 +663,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) else {
if (*msgPtr)
mir_free(*msgPtr);
- *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : NULL;
+ *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : nullptr;
#ifdef DEBUGMODE
debugLogA("SetAwayMsg(): Message changed.");
#endif
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index f916ee62fd..e88190e763 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -86,7 +86,7 @@ int GGPROTO::gc_destroy() GGGC *chat = (GGGC *)l->data;
free(chat->recipients);
}
- list_destroy(chats, 1); chats = NULL;
+ list_destroy(chats, 1); chats = nullptr;
return 1;
}
@@ -102,13 +102,13 @@ GGGC* GGPROTO::gc_lookup(const wchar_t *id) return chat;
}
- return NULL;
+ return nullptr;
}
int GGPROTO::gc_event(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK *)lParam;
- GGGC *chat = NULL;
+ GGGC *chat = nullptr;
uin_t uin;
// Check if we got our protocol, and fields are set
@@ -164,7 +164,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc --] = 0;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->ptszID, gch->ptszText);
@@ -182,7 +182,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) if (gch->iType == GC_USER_PRIVMESS)
{
MCONTACT hContact = NULL;
- if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
+ if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, nullptr)))
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
}
debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->iType, chat, uin, gch->ptszText);
@@ -209,7 +209,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou uin_t uin;
debugLogA("gc_getchat(): Count %d.", recipients_count);
- if (!recipients) return NULL;
+ if (!recipients) return nullptr;
// Look for existing chat
for(l = chats; l; l = l->next)
@@ -240,7 +240,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou debugLogW(L"gc_getchat(): Ignoring existing id %s, size %d.", chat->id, chat->recipients_count);
else
debugLogW(L"gc_getchat(): Returning existing id %s, size %d.", chat->id, chat->recipients_count);
- return !(chat->ignore) ? chat->id : NULL;
+ return !(chat->ignore) ? chat->id : nullptr;
}
}
}
@@ -253,10 +253,10 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou // Check groupchat policy (new) / only for incoming
if (sender)
{
- int unknown = (getcontact(sender, 0, 0, NULL) == NULL),
+ int unknown = (getcontact(sender, 0, 0, nullptr) == NULL),
unknownSender = unknown;
for(int i = 0; i < recipients_count; i++)
- if (!getcontact(recipients[i], 0, 0, NULL))
+ if (!getcontact(recipients[i], 0, 0, nullptr))
unknown ++;
if ((getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 2) ||
(getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL) == 2 &&
@@ -271,11 +271,11 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou unknown >= getWord(GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN))))
{
wchar_t *senderName = unknownSender ?
- TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0);
+ TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, nullptr), 0);
wchar_t error[256];
mir_snwprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
senderName, recipients_count + 1, unknown);
- chat->ignore = MessageBox(NULL, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
+ chat->ignore = MessageBox(nullptr, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
}
if (chat->ignore)
{
@@ -288,7 +288,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou if (sender) chat->recipients[i] = sender;
debugLogW(L"gc_getchat(): Ignoring new chat %s, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
- return NULL;
+ return nullptr;
}
}
@@ -297,12 +297,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t *senderName;
if (sender)
{
- senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
+ senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, nullptr), 0);
mir_snwprintf(status, TranslateT("%s initiated the conference.") , senderName);
}
else
{
- senderName = NULL;
+ senderName = nullptr;
mir_snwprintf(status, TranslateT("This is my own conference."));
}
@@ -346,7 +346,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou // Add contacts
for(i = 0; i < chat->recipients_count; i++) {
- MCONTACT hContact = getcontact(chat->recipients[i], 1, 0, NULL);
+ MCONTACT hContact = getcontact(chat->recipients[i], 1, 0, nullptr);
UIN2IDT(chat->recipients[i], id);
if (hContact)
gce.ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
@@ -431,7 +431,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa // Check if connected
if (!gg->isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected to open new conference."),
gg->m_tszUserName, MB_OK | MB_ICONSTOP);
}
@@ -500,7 +500,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa uin = (uin_t)gg->getDword(hContact, GG_KEY_UIN, 0);
}
- if (szProto == NULL || mir_strcmp(szProto, gg->m_szModuleName) || !uin || uin == gg->getDword(GG_KEY_UIN, 0))
+ if (szProto == nullptr || mir_strcmp(szProto, gg->m_szModuleName) || !uin || uin == gg->getDword(GG_KEY_UIN, 0))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
}
@@ -556,7 +556,7 @@ INT_PTR GGPROTO::gc_clearignored(WPARAM, LPARAM) cleared = TRUE;
}
}
- MessageBox( NULL,
+ MessageBox( nullptr,
cleared ?
TranslateT("All ignored conferences are now unignored and the conference policy will act again.") :
TranslateT("There are no ignored conferences."),
@@ -571,14 +571,14 @@ INT_PTR GGPROTO::gc_openconf(WPARAM, LPARAM) // Check if connected
if (!isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected to open new conference."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
return 0;
}
- CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), NULL, gg_gc_openconfdlg, (LPARAM)this);
+ CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this);
return 1;
}
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index 3a5d05451a..b4cf97f5bf 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -58,7 +58,8 @@ HANDLE GetIconHandle(int iconId) for(int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+
+ return nullptr;
}
void ReleaseIconEx(const char* name, bool big)
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 1c5b90f3df..0cfef60aed 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -159,7 +159,7 @@ int gg_img_paint(HWND hwnd, GGIMAGEENTRY *dat) if (dat->hBitmap)
{
- HDC hdcBmp = NULL;
+ HDC hdcBmp = nullptr;
int nWidth, nHeight;
BITMAP bmp;
@@ -224,10 +224,10 @@ wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize) // Make up filter
wcsncpy(pFilter, szFilterName, nSize);
pFilter += mir_wstrlen(pFilter) + 1;
- if (pFilter >= szFilter + nSize) return NULL;
+ if (pFilter >= szFilter + nSize) return nullptr;
wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
pFilter += mir_wstrlen(pFilter) + 1;
- if (pFilter >= szFilter + nSize) return NULL;
+ if (pFilter >= szFilter + nSize) return nullptr;
*pFilter = 0;
return szFilter;
@@ -287,7 +287,7 @@ BOOL gg_img_fit(HWND hwndDlg) int rWidth = 0, rHeight = 0;
int oWidth = 0, oHeight = 0;
BITMAP bmp;
- GGIMAGEENTRY *img = NULL;
+ GGIMAGEENTRY *img = nullptr;
HDC hdc;
// Check if image is loaded
@@ -340,7 +340,7 @@ BOOL gg_img_fit(HWND hwndDlg) oHeight = dlgRect.bottom - dlgRect.top;
oWidth = wrkRect.right - wrkRect.left;
}
- SetWindowPos(hwndDlg, NULL,
+ SetWindowPos(hwndDlg, nullptr,
(wrkRect.left + wrkRect.right - oWidth) / 2,
(wrkRect.top + wrkRect.bottom - oHeight) / 2,
oWidth, oHeight,
@@ -434,7 +434,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_SIZE:
Utils_ResizeDialog(hwndDlg, hInstance, dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer);
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
return 0;
case WM_SIZING:
@@ -536,7 +536,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->nImg > 1)
{
dat->nImg--;
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
return TRUE;
@@ -544,7 +544,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->nImg < dat->nImgTotal)
{
dat->nImg++;
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
return TRUE;
@@ -573,7 +573,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if ((-- dat->nImgTotal) == 0)
EndDialog(hwndDlg, 0);
else
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
gg_img_releasepicture(del);
}
@@ -603,8 +603,8 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->lpImages && gg->isonline())
{
uin_t uin = (uin_t)gg->getDword(dat->hContact, GG_KEY_UIN, 0);
- struct gg_msg_richtext_format *r = NULL;
- struct gg_msg_richtext_image *p = NULL;
+ struct gg_msg_richtext_format *r = nullptr;
+ struct gg_msg_richtext_image *p = nullptr;
int len;
((struct gg_msg_richtext*)format)->flag = 2;
@@ -654,7 +654,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
// Fit window to image
if (!gg_img_fit(hwndDlg))
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
return TRUE;
case WM_CHOOSEIMG:
@@ -677,13 +677,13 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
if (dat->lpImages)
gg_img_releasepicture(dat->lpImages);
- if (!(dat->lpImages = (GGIMAGEENTRY *)dat->gg->img_loadpicture(0, szFileName)))
+ if (!(dat->lpImages = (GGIMAGEENTRY *)dat->gg->img_loadpicture(nullptr, szFileName)))
{
EndDialog(hwndDlg, 0);
return FALSE;
}
if (!gg_img_fit(hwndDlg))
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
else
{
@@ -702,7 +702,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP //
void __cdecl GGPROTO::img_dlgcallthread(void *param)
{
- HWND hMIWnd = 0;
+ HWND hMIWnd = nullptr;
debugLogA("img_dlgcallthread(): started.");
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)param;
@@ -722,7 +722,7 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, MCONTACT hContact) // Create dialog data
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)calloc(1, sizeof(GGIMAGEDLGDATA));
dat->hContact = hContact;
- dat->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dat->hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dat->bReceiving = TRUE;
dat->gg = gg;
ResetEvent(dat->hEvent);
@@ -771,10 +771,10 @@ int gg_img_isexists(wchar_t *szPath, GGIMAGEENTRY *dat) //
wchar_t *gg_img_hasextension(wchar_t *filename)
{
- if (filename != NULL && *filename != '\0')
+ if (filename != nullptr && *filename != '\0')
{
wchar_t *imgtype = wcsrchr(filename, '.');
- if (imgtype != NULL)
+ if (imgtype != nullptr)
{
size_t len = mir_wstrlen(imgtype);
imgtype++;
@@ -787,7 +787,7 @@ wchar_t *gg_img_hasextension(wchar_t *filename) return --imgtype;
}
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -800,7 +800,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) size_t tPathLen;
int i, res;
- if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
+ if (hImagesFolder == nullptr || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsW( L"%miranda_userdata%");
tPathLen = mir_snwprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
@@ -823,7 +823,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) }
mir_snwprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
- if ((pImgext = gg_img_hasextension(szPath)) == NULL)
+ if ((pImgext = gg_img_hasextension(szPath)) == nullptr)
pImgext = szPath + mir_wstrlen(szPath);
wcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
@@ -853,7 +853,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.szMessage = szMessage;
ProtoChainRecvMsg(hContact, &pre);
debugLogW(L"img_displayasmsg(): Image saved to %s.", szPath);
@@ -885,7 +885,7 @@ BOOL GGPROTO::img_opened(uin_t uin) int GGPROTO::img_display(MCONTACT hContact, void *img)
{
list_t l = imagedlgs;
- GGIMAGEDLGDATA *dat = NULL;
+ GGIMAGEDLGDATA *dat = nullptr;
if (!img) return FALSE;
@@ -899,7 +899,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) l = l->next;
}
- if (!l) dat = NULL;
+ if (!l) dat = nullptr;
if (!dat)
{
@@ -908,7 +908,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) while (WaitForSingleObjectEx(dat->hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(dat->hEvent);
- dat->hEvent = NULL;
+ dat->hEvent = nullptr;
list_add(&imagedlgs, dat, 0);
}
@@ -917,7 +917,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) SendMessage(dat->hWnd, WM_ADDIMAGE, 0, (LPARAM)img);
if (/*db_get_b(NULL, "Chat", "bFlashWindowHighlight", 0) != 0 && */
GetActiveWindow() != dat->hWnd && GetForegroundWindow() != dat->hWnd)
- SetTimer(dat->hWnd, TIMERID_FLASHWND, 900, NULL);
+ SetTimer(dat->hWnd, TIMERID_FLASHWND, 900, nullptr);
return TRUE;
}
@@ -927,7 +927,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) //
const wchar_t *gg_img_guessfileextension(const char *lpData)
{
- if (lpData != NULL)
+ if (lpData != nullptr)
{
if (memcmp(lpData, "BM", 2) == 0)
return L".bmp";
@@ -948,11 +948,11 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) {
if (!szFileName &&
(!e || !e->event.image_reply.size || !e->event.image_reply.image || !e->event.image_reply.filename))
- return NULL;
+ return nullptr;
GGIMAGEENTRY *dat = (GGIMAGEENTRY *)calloc(1, sizeof(GGIMAGEENTRY));
- if (dat == NULL)
- return NULL;
+ if (dat == nullptr)
+ return nullptr;
// Copy the file name
if (szFileName)
@@ -964,7 +964,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) wchar_t error[512];
mir_snwprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
- return NULL;
+ return nullptr;
}
fseek(fp, 0, SEEK_END);
dat->nSize = ftell(fp);
@@ -973,7 +973,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) fclose(fp);
free(dat);
debugLogW(L"img_loadpicture(): Zero file size \"%s\" failed.", szFileName);
- return NULL;
+ return nullptr;
}
// Maximum acceptable image size
if (dat->nSize > 255 * 1024)
@@ -981,8 +981,8 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) fclose(fp);
free(dat);
debugLogW(L"img_loadpicture(): Image size of \"%s\" exceeds 255 KB.", szFileName);
- MessageBox(NULL, TranslateT("Image exceeds maximum allowed size of 255 KB."), m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
- return NULL;
+ MessageBox(nullptr, TranslateT("Image exceeds maximum allowed size of 255 KB."), m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
+ return nullptr;
}
fseek(fp, 0, SEEK_SET);
dat->lpData = (char*)malloc(dat->nSize);
@@ -992,7 +992,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) fclose(fp);
free(dat);
debugLogW(L"img_loadpicture(): Reading file \"%s\" failed.", szFileName);
- return NULL;
+ return nullptr;
}
fclose(fp);
dat->lpszFileName = wcsdup(szFileName);
@@ -1010,14 +1010,14 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_wstrlen(tmpFileName) + mir_wstrlen(szImgType) + 1);
- if (dat->lpszFileName != NULL) {
+ if (dat->lpszFileName != nullptr) {
mir_wstrcpy(dat->lpszFileName, tmpFileName);
mir_wstrcat(dat->lpszFileName, szImgType);
}
}
}
- if (dat->lpszFileName == NULL)
+ if (dat->lpszFileName == nullptr)
dat->lpszFileName = wcsdup( _A2T( e->event.image_reply.filename));
}
@@ -1048,7 +1048,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) free(dat->lpszFileName);
free(dat);
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////
@@ -1076,7 +1076,7 @@ INT_PTR GGPROTO::img_recvimage(WPARAM wParam, LPARAM lParam) //
int gg_img_remove(GGIMAGEDLGDATA *dat)
{
- GGIMAGEENTRY *temp = NULL, *img = NULL;
+ GGIMAGEENTRY *temp = nullptr, *img = nullptr;
GGPROTO *gg;
if (!dat) return FALSE;
@@ -1129,7 +1129,7 @@ GGIMAGEDLGDATA* gg_img_find(GGPROTO *gg, uin_t uin, uint32_t crc32) gg->gg_LeaveCriticalSection(&gg->img_mutex, "gg_img_find", 62, 2, "img_mutex", 1);
gg->debugLogA("gg_img_find(): Image not found on the list. It might be released before calling this function.");
- return NULL;
+ return nullptr;
}
@@ -1158,14 +1158,14 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e) //
INT_PTR GGPROTO::img_sendimg(WPARAM hContact, LPARAM)
{
- GGIMAGEDLGDATA *dat = NULL;
+ GGIMAGEDLGDATA *dat = nullptr;
gg_EnterCriticalSection(&img_mutex, "img_sendimg", 64, "img_mutex", 1);
if (!dat)
{
dat = (GGIMAGEDLGDATA *)calloc(1, sizeof(GGIMAGEDLGDATA));
dat->hContact = hContact;
- dat->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dat->hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dat->gg = this;
ResetEvent(dat->hEvent);
@@ -1177,7 +1177,7 @@ INT_PTR GGPROTO::img_sendimg(WPARAM hContact, LPARAM) while (WaitForSingleObjectEx(dat->hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(dat->hEvent);
- dat->hEvent = NULL;
+ dat->hEvent = nullptr;
list_add(&imagedlgs, dat, 0);
}
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index b2b686b4dc..d80dc75a35 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -22,7 +22,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
{
- string_t s = string_init(NULL);
+ string_t s = string_init(nullptr);
char *contacts;
// Readup contacts
@@ -125,7 +125,7 @@ char *strndup(char *str, int c) void GGPROTO::parsecontacts(char *contacts)
{
- char *p = strchr(contacts, ':'), *n = NULL;
+ char *p = strchr(contacts, ':'), *n = nullptr;
char *strFirstName, *strLastName, *strNickname, *strNick, *strPhone, *strGroup, *strUin, *strMail;
uin_t uin;
@@ -136,7 +136,7 @@ void GGPROTO::parsecontacts(char *contacts) while(p)
{
// Processing line
- strFirstName = strLastName = strNickname = strNick = strPhone = strGroup = strUin = strMail = NULL;
+ strFirstName = strLastName = strNickname = strNick = strPhone = strGroup = strUin = strMail = nullptr;
uin = 0;
// FirstName
@@ -205,7 +205,7 @@ void GGPROTO::parsecontacts(char *contacts) n = strchr(p, '\n');
p = (n + 1);
}
- if (!n) p = NULL;
+ if (!n) p = nullptr;
// Loadup contact
if (uin && strNick)
@@ -256,7 +256,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) // Check if connected
if (!isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
@@ -274,12 +274,12 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) // Making contacts list
gg_EnterCriticalSection(&sess_mutex, "import_server", 65, "sess_mutex", 1);
- if (gg_userlist_request(sess, GG_USERLIST_GET, NULL) == -1)
+ if (gg_userlist_request(sess, GG_USERLIST_GET, nullptr) == -1)
{
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1);
mir_snwprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 2, "sess_mutex", 1);
@@ -294,7 +294,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) {
// Check if connected
if (!isonline()) {
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
@@ -312,12 +312,12 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) // Making contacts list
gg_EnterCriticalSection(&sess_mutex, "remove_server", 66, "sess_mutex", 1);
- if (gg_userlist_request(sess, GG_USERLIST_PUT, NULL) == -1)
+ if (gg_userlist_request(sess, GG_USERLIST_PUT, nullptr) == -1)
{
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1);
mir_snwprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 2, "sess_mutex", 1);
@@ -384,14 +384,14 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) parsecontacts(contacts);
mir_free(contacts);
- MessageBox(NULL, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
return 0;
}
else
{
wchar_t error[256];
mir_snwprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
if (f)
fclose(f);
@@ -447,13 +447,13 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) fclose(f);
free(contacts);
- MessageBox(NULL, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
else
{
wchar_t error[128];
mir_snwprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
}
@@ -468,7 +468,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) // Check if connected
if (!isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
@@ -497,7 +497,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1);
mir_snwprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 2, "sess_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/keepalive.cpp b/protocols/Gadu-Gadu/src/keepalive.cpp index f55a224cb6..426f72d0f0 100644 --- a/protocols/Gadu-Gadu/src/keepalive.cpp +++ b/protocols/Gadu-Gadu/src/keepalive.cpp @@ -24,7 +24,7 @@ * does not get full pointer but just 2 byte lower bytes.
*/
#define MAX_TIMERS 8
-GGPROTO *g_timers[MAX_TIMERS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+GGPROTO *g_timers[MAX_TIMERS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
static VOID CALLBACK gg_keepalive(HWND, UINT, UINT_PTR idEvent, DWORD)
{
@@ -55,13 +55,13 @@ void GGPROTO::keepalive_init() if (getByte(GG_KEY_KEEPALIVE, GG_KEYDEF_KEEPALIVE))
{
int i;
- for(i = 0; i < MAX_TIMERS && g_timers[i] != NULL; i++);
+ for(i = 0; i < MAX_TIMERS && g_timers[i] != nullptr; i++);
if (i < MAX_TIMERS)
{
#ifdef DEBUGMODE
debugLogA("keepalive_init(): Initializing Timer %d", i);
#endif
- timer = SetTimer(NULL, 0, 1000 * 30, gg_keepalive);
+ timer = SetTimer(nullptr, 0, 1000 * 30, gg_keepalive);
g_timers[i] = this;
}
}
@@ -75,10 +75,10 @@ void GGPROTO::keepalive_destroy() if (timer)
{
int i;
- KillTimer(NULL, timer);
+ KillTimer(nullptr, timer);
for(i = 0; i < MAX_TIMERS; i++)
if (g_timers[i] == this) {
- g_timers[i] = NULL;
+ g_timers[i] = nullptr;
break;
}
timer = 0;
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 6fc1a996ca..6463c5ccf6 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -45,12 +45,12 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) if (g_Instances.getCount() == 0)
return 0;
- if (arg == NULL)
+ if (arg == nullptr)
return 1;
arg = strchr(arg, ':');
- if (arg == NULL)
+ if (arg == nullptr)
return 1;
for (++arg; *arg == '/'; ++arg);
@@ -59,13 +59,13 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) if (!uin)
return 1;
- GGPROTO *gg = NULL;
+ GGPROTO *gg = nullptr;
for (int i=0; i < g_Instances.getCount(); i++) {
gg = g_Instances[i];
if (gg->m_iStatus > ID_STATUS_OFFLINE) {
++items;
- Menu_ModifyItem(gg->hInstanceMenuItem, NULL, Skin_LoadProtoIcon(gg->m_szModuleName, gg->m_iStatus));
+ Menu_ModifyItem(gg->hInstanceMenuItem, nullptr, Skin_LoadProtoIcon(gg->m_szModuleName, gg->m_iStatus));
}
else Menu_ShowItem(gg->hInstanceMenuItem, false);
}
@@ -76,17 +76,17 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) HMENU hMenu = CreatePopupMenu();
Menu_Build(hMenu, hInstanceMenu);
- int cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ int cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, nullptr);
DestroyMenu(hMenu);
if (cmd)
Menu_ProcessCommandById(cmd, (LPARAM)&gg);
}
- if (gg == NULL)
+ if (gg == nullptr)
return 0;
- MCONTACT hContact = gg->getcontact(uin, 1, 0, NULL);
+ MCONTACT hContact = gg->getcontact(uin, 1, 0, nullptr);
if (hContact != NULL)
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
return 0;
@@ -95,13 +95,13 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) void gg_links_instancemenu_init()
{
CreateServiceFunction(GGS_MENUCHOOSE, gg_menuchoose);
- hInstanceMenu = Menu_AddObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), 0, GGS_MENUCHOOSE);
+ hInstanceMenu = Menu_AddObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), nullptr, GGS_MENUCHOOSE);
CMenuItem mi;
mi.name.a = "Cancel";
mi.position = 9999999;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
- Menu_AddItem(hInstanceMenu, &mi, NULL);
+ Menu_AddItem(hInstanceMenu, &mi, nullptr);
}
void gg_links_init()
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 52074931a6..5c0f21cf74 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -57,7 +57,7 @@ char *oauth_uri_escape(const char *str) char *res;
int size, ix = 0;
- if (str == NULL) return mir_strdup("");
+ if (str == nullptr) return mir_strdup("");
size = (int)mir_strlen(str) + 1;
res = (char *)mir_alloc(size);
@@ -86,7 +86,7 @@ char *oauth_generate_signature(LIST<OAUTHPARAMETER> ¶ms, const char *httpmet OAUTHPARAMETER *p;
int i, ix = 0, size;
- if (httpmethod == NULL || url == NULL || !params.getCount()) return mir_strdup("");
+ if (httpmethod == nullptr || url == nullptr || !params.getCount()) return mir_strdup("");
urlnorm = (char *)mir_alloc(mir_strlen(url) + 1);
while (*url) {
@@ -95,9 +95,9 @@ char *oauth_generate_signature(LIST<OAUTHPARAMETER> ¶ms, const char *httpmet url++;
}
urlnorm[ix] = 0;
- if ((res = strstr(urlnorm, ":80")) != NULL)
+ if ((res = strstr(urlnorm, ":80")) != nullptr)
memmove(res, res + 3, mir_strlen(res) - 2);
- else if ((res = strstr(urlnorm, ":443")) != NULL)
+ else if ((res = strstr(urlnorm, ":443")) != nullptr)
memmove(res, res + 4, mir_strlen(res) - 3);
urlenc = oauth_uri_escape(urlnorm);
@@ -135,7 +135,7 @@ char *oauth_getparam(LIST<OAUTHPARAMETER> ¶ms, const char *name) OAUTHPARAMETER *p;
int i;
- if (name == NULL) return NULL;
+ if (name == nullptr) return nullptr;
for (i = 0; i < params.getCount(); i++) {
p = params[i];
@@ -143,7 +143,7 @@ char *oauth_getparam(LIST<OAUTHPARAMETER> ¶ms, const char *name) return p->value;
}
- return NULL;
+ return nullptr;
}
void oauth_setparam(LIST<OAUTHPARAMETER> ¶ms, const char *name, const char *value)
@@ -151,7 +151,7 @@ void oauth_setparam(LIST<OAUTHPARAMETER> ¶ms, const char *name, const char * OAUTHPARAMETER *p;
int i;
- if (name == NULL) return;
+ if (name == nullptr) return;
for (i = 0; i < params.getCount(); i++) {
p = params[i];
@@ -183,12 +183,12 @@ void oauth_freeparams(LIST<OAUTHPARAMETER> ¶ms) int oauth_sign_request(LIST<OAUTHPARAMETER> ¶ms, const char *httpmethod, const char *url,
const char *consumer_secret, const char *token_secret)
{
- char *sign = NULL, *signmethod;
+ char *sign = nullptr, *signmethod;
if (!params.getCount()) return -1;
signmethod = oauth_getparam(params, "oauth_signature_method");
- if (signmethod == NULL) return -1;
+ if (signmethod == nullptr) return -1;
if (!mir_strcmp(signmethod, "HMAC-SHA1")) {
ptrA text( oauth_generate_signature(params, httpmethod, url));
@@ -224,7 +224,7 @@ char* oauth_generate_nonce() char randnum[16];
Utils_GetRandom(randnum, sizeof(randnum));
- CMStringA str(FORMAT, "%ld%s", time(NULL), randnum);
+ CMStringA str(FORMAT, "%ld%s", time(nullptr), randnum);
BYTE digest[16];
mir_md5_hash((BYTE*)str.GetString(), str.GetLength(), digest);
@@ -238,7 +238,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD int i, size;
char *res, timestamp[22];
- if (httpmethod == NULL || url == NULL) return NULL;
+ if (httpmethod == nullptr || url == nullptr) return nullptr;
LIST<OAUTHPARAMETER> oauth_parameters(1, paramsortFunc);
oauth_setparam(oauth_parameters, "oauth_consumer_key", consumer_key);
@@ -248,15 +248,15 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD case RSASHA1: oauth_setparam(oauth_parameters, "oauth_signature_method", "RSA-SHA1"); break;
default: oauth_setparam(oauth_parameters, "oauth_signature_method", "PLAINTEXT"); break;
};
- mir_snprintf(timestamp, "%ld", time(NULL));
+ mir_snprintf(timestamp, "%ld", time(nullptr));
oauth_setparam(oauth_parameters, "oauth_timestamp", timestamp);
oauth_setparam(oauth_parameters, "oauth_nonce", ptrA(oauth_generate_nonce()));
- if (token != NULL && *token)
+ if (token != nullptr && *token)
oauth_setparam(oauth_parameters, "oauth_token", token);
if (oauth_sign_request(oauth_parameters, httpmethod, url, consumer_secret, token_secret)) {
oauth_freeparams(oauth_parameters);
- return NULL;
+ return nullptr;
}
size = 7;
@@ -284,9 +284,9 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD int GGPROTO::oauth_receivetoken()
{
- char szUrl[256], uin[32], *str, *token = NULL, *token_secret = NULL;
+ char szUrl[256], uin[32], *str, *token = nullptr, *token_secret = nullptr;
int res = 0;
- HNETLIBCONN nlc = NULL;
+ HNETLIBCONN nlc = nullptr;
UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
char *password = getStringA(GG_KEY_PASSWORD);
@@ -294,7 +294,7 @@ int GGPROTO::oauth_receivetoken() // 1. Obtaining an Unauthorized Request Token
debugLogA("oauth_receivetoken(): Obtaining an Unauthorized Request Token...");
mir_strcpy(szUrl, "http://api.gadu-gadu.pl/request_token");
- str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, NULL, NULL);
+ str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, nullptr, nullptr);
NETLIBHTTPHEADER httpHeaders[3];
httpHeaders[0].szName = "User-Agent";
@@ -316,13 +316,13 @@ int GGPROTO::oauth_receivetoken() nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
wchar_t *xmlAction = mir_a2u(resp->pData);
- HXML hXml = xmlParseString(xmlAction, 0, L"result");
- if (hXml != NULL) {
+ HXML hXml = xmlParseString(xmlAction, nullptr, L"result");
+ if (hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ token = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ token_secret = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
xmlDestroyNode(hXml);
}
@@ -369,8 +369,8 @@ int GGPROTO::oauth_receivetoken() str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, token, token_secret);
mir_free(token);
mir_free(token_secret);
- token = NULL;
- token_secret = NULL;
+ token = nullptr;
+ token_secret = nullptr;
memset(&req, 0, sizeof(req));
req.cbSize = sizeof(req);
@@ -387,8 +387,8 @@ int GGPROTO::oauth_receivetoken() if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
wchar_t *xmlAction = mir_a2u(resp->pData);
- HXML hXml = xmlParseString(xmlAction, 0, L"result");
- if (hXml != NULL) {
+ HXML hXml = xmlParseString(xmlAction, nullptr, L"result");
+ if (hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
token = mir_u2a(xmlGetText(node));
@@ -408,7 +408,7 @@ int GGPROTO::oauth_receivetoken() mir_free(password);
mir_free(str);
- if (token != NULL && token_secret != NULL) {
+ if (token != nullptr && token_secret != nullptr) {
setString(GG_KEY_TOKEN, token);
setString(GG_KEY_TOKENSECRET, token_secret);
debugLogA("oauth_receivetoken(): Access Token obtained successfully.");
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 6a11db6a33..49b70004f5 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -58,14 +58,14 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno));
}
else
{
gg_pubdir_free(h);
debugLogA("remindpasswordthread(): Password remind successful.");
- MessageBox(NULL, TranslateT("Password was sent to your e-mail."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Password was sent to your e-mail."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
free(rp);
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index dcc88ee18c..a1527e3b46 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -38,7 +38,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND:
{
PopupData* puData = (PopupData*)PUGetPluginData(hWnd);
- if (puData != NULL)
+ if (puData != nullptr)
{
if (puData->flags & GG_POPUP_MULTILOGON)
puData->gg->sessions_view(0, 0);
@@ -54,7 +54,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case UM_FREEPLUGINDATA:
{
PopupData* puData = (PopupData*)PUGetPluginData(hWnd);
- if (puData != NULL && puData != (PopupData*)CALLSERVICE_NOTFOUND)
+ if (puData != nullptr && puData != (PopupData*)CALLSERVICE_NOTFOUND)
{
mir_free(puData->title);
mir_free(puData->text);
@@ -94,7 +94,7 @@ void GGPROTO::initpopups() puc.colorBack = RGB(191, 0, 0); // Red
puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
- puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
+ puc.hIcon = (HICON)LoadImage(nullptr, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
@@ -129,19 +129,19 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) BOOL bShow = TRUE;
if (puData->flags & GG_POPUP_ONCE) {
- HWND hWnd = FindWindow(NULL, gg->m_tszUserName);
- while (hWnd != NULL) {
- if (FindWindowEx(hWnd, NULL, NULL, puData->text) != NULL) {
+ HWND hWnd = FindWindow(nullptr, gg->m_tszUserName);
+ while (hWnd != nullptr) {
+ if (FindWindowEx(hWnd, nullptr, nullptr, puData->text) != nullptr) {
bShow = FALSE;
break;
}
- hWnd = FindWindowEx(NULL, hWnd, NULL, gg->m_tszUserName);
+ hWnd = FindWindowEx(nullptr, hWnd, nullptr, gg->m_tszUserName);
}
}
if (bShow) {
UINT uIcon = puData->flags & GG_POPUP_ERROR ? MB_ICONERROR : puData->flags & GG_POPUP_WARNING ? MB_ICONEXCLAMATION : MB_ICONINFORMATION;
- MessageBox(NULL, puData->text, gg->m_tszUserName, MB_OK | uIcon);
+ MessageBox(nullptr, puData->text, gg->m_tszUserName, MB_OK | uIcon);
}
}
mir_free(puData->title);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 78542d1802..cd060f3609 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -38,7 +38,7 @@ char *gg_status2db(int status, const char *suffix) case ID_STATUS_INVISIBLE: prefix = "Inv"; break;
case ID_STATUS_ONTHEPHONE: prefix = "Otp"; break;
case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
- default: return NULL;
+ default: return nullptr;
}
static char str[64];
@@ -95,11 +95,11 @@ int GGPROTO::refreshstatus(int status) debugLogA("refreshstatus(): Waiting pth_sess thread - OK");
debugLogA("refreshstatus(): ForkThreadEx 21 GGPROTO::mainthread");
#endif
- pth_sess.hThread = ForkThreadEx(&GGPROTO::mainthread, NULL, &pth_sess.dwThreadId);
+ pth_sess.hThread = ForkThreadEx(&GGPROTO::mainthread, nullptr, &pth_sess.dwThreadId);
}
else
{
- wchar_t *szMsg = NULL;
+ wchar_t *szMsg = nullptr;
// Select proper msg
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 69, "modemsg_mutex", 1);
szMsg = getstatusmsg(status);
@@ -118,7 +118,7 @@ int GGPROTO::refreshstatus(int status) gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 71, 1, "sess_mutex", 1);
}
// Change status of the contact with our own UIN (if got yourself added to the contact list)
- changecontactstatus( getDword(GG_KEY_UIN, 0), status_m2gg(status, szMsg != NULL), szMsg, 0, 0, 0, 0);
+ changecontactstatus( getDword(GG_KEY_UIN, 0), status_m2gg(status, szMsg != nullptr), szMsg, 0, 0, 0, 0);
broadcastnewstatus(status);
}
@@ -212,7 +212,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) pai->format = getByte(pai->hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE);
- ptrA AvatarHash(NULL);
+ ptrA AvatarHash(nullptr);
ptrA AvatarURL( getStringA(pai->hContact, GG_KEY_AVATARURL));
ptrA AvatarTs( getStringA(pai->hContact, GG_KEY_AVATARTS));
if (AvatarURL != NULL && AvatarTs != NULL) {
@@ -287,7 +287,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) wchar_t *szFilename = (wchar_t*)wParam;
int len = (int)lParam;
- if (szFilename == NULL || len <= 0) {
+ if (szFilename == nullptr || len <= 0) {
debugLogA("getmyavatar(): Incoming request for self avatar information. szFilename == NULL. return -1 (error)");
return -1;
}
@@ -319,8 +319,8 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS))
return -2;
- if (szFilename == NULL) {
- MessageBox(NULL,
+ if (szFilename == nullptr) {
+ MessageBox(nullptr,
TranslateT("To remove your Gadu-Gadu avatar, you must use the gg.pl website."),
m_tszUserName, MB_OK | MB_ICONINFORMATION);
return -1;
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 724c2c9cef..f13ddecb2b 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -148,7 +148,7 @@ static BOOL IsOverAction(HWND hwndDlg) return (hti.pt.x > textPosX && hti.pt.x < textPosX + textSize.cx);
}
-static HCURSOR hHandCursor = NULL;
+static HCURSOR hHandCursor = nullptr;
#define WM_MULTILOGONINFO (WM_USER + 10)
#define HM_PROTOACK (WM_USER + 11)
@@ -172,8 +172,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w SetWindowText(hwndDlg, newTitle);
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS));
- if (hHandCursor == NULL)
- hHandCursor = LoadCursor(NULL, IDC_HAND);
+ if (hHandCursor == nullptr)
+ hHandCursor = LoadCursor(nullptr, IDC_HAND);
hProtoAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hProtoAckEvent);
@@ -242,7 +242,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w RECT rc;
HWND hwndHeader = ListView_GetHeader(nm->nmcd.hdr.hwndFrom);
GetClientRect(nm->nmcd.hdr.hwndFrom, &rc);
- if (hwndHeader != NULL) {
+ if (hwndHeader != nullptr) {
RECT rcHeader;
GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
@@ -251,7 +251,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w SIZE textSize;
GetTextExtentPoint32(nm->nmcd.hdc, szText, cbLen, &textSize);
int textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
- ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, cbLen, NULL);
+ ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, cbLen, nullptr);
}
// FALL THROUGH
@@ -316,7 +316,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w hMenu = CreatePopupMenu();
AppendMenu(hMenu, MFT_STRING, 10001, TranslateT("Copy Text"));
AppendMenu(hMenu, MFT_STRING, 10002, TranslateT("Whois"));
- iSelection = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ iSelection = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr);
switch (iSelection) {
case 10001:
{
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
mir_snwprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
- if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != NULL)
+ if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != nullptr)
{
mir_wstrcpy((wchar_t*)GlobalLock(hData), szText);
GlobalUnlock(hData);
@@ -382,7 +382,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w {
HANDLE hProtoAckEvent = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hProtoAckEvent) UnhookEvent(hProtoAckEvent);
- gg->hwndSessionsDlg = NULL;
+ gg->hwndSessionsDlg = nullptr;
Window_FreeIcon_IcoLib(hwndDlg);
break;
}
@@ -397,7 +397,7 @@ INT_PTR GGPROTO::sessions_view(WPARAM, LPARAM) SetForegroundWindow(hwndSessionsDlg);
SetFocus(hwndSessionsDlg);
}
- else CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_SESSIONS), NULL, gg_sessions_viewdlg, (LPARAM)this);
+ else CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 351b0df053..be13895b5d 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -76,7 +76,7 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (dat && dat->hBitmap)
{
- HDC hdcBmp = NULL;
+ HDC hdcBmp = nullptr;
int nWidth, nHeight;
BITMAP bmp;
@@ -115,7 +115,7 @@ int GGPROTO::gettoken(GGTOKEN *token) if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
@@ -124,7 +124,7 @@ int GGPROTO::gettoken(GGTOKEN *token) if (!t || !h->body) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
@@ -142,15 +142,15 @@ int GGPROTO::gettoken(GGTOKEN *token) memio.fif = FIF_UNKNOWN; /* detect */
memio.flags = 0;
dat.hBitmap = (HBITMAP) CallService(MS_IMG_LOADFROMMEM, (WPARAM) &memio, 0);
- if (dat.hBitmap == NULL)
+ if (dat.hBitmap == nullptr)
{
- MessageBox(NULL, TranslateT("Could not load token image."), m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("Could not load token image."), m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
// Load token dialog
- if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_TOKEN), NULL, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
+ if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
return FALSE;
// Fillup patterns
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 6fea4ce96e..8136cd8552 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -26,24 +26,24 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail)
{
// Connection handles
- struct gg_http *h = NULL;
- struct gg_pubdir *s = NULL;
+ struct gg_http *h = nullptr;
+ struct gg_pubdir *s = nullptr;
GGTOKEN token;
#ifdef DEBUGMODE
gg->debugLogA("gg_doregister(): Starting.");
#endif
- if (!newPass || !newEmail) return NULL;
+ if (!newPass || !newEmail) return nullptr;
// Load token
- if (!gg->gettoken(&token)) return NULL;
+ if (!gg->gettoken(&token)) return nullptr;
if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Registration rejected") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_doregister(): Cannot register. errno=%d: %s", errno, ws_strerror(errno));
}
else {
@@ -53,7 +53,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) gg->setString(GG_KEY_EMAIL, newEmail);
gg_pubdir_free(h);
gg->debugLogA("gg_doregister(): Account registration succesful.");
- MessageBox( NULL,
+ MessageBox( nullptr,
TranslateT("You have registered new account.\nPlease fill up your personal details in \"Main menu -> View/change my details...\""),
gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
@@ -62,7 +62,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) gg->debugLogA("gg_doregister(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -72,16 +72,16 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) {
// Connection handles
struct gg_http *h;
- struct gg_pubdir *s = NULL;
+ struct gg_pubdir *s = nullptr;
GGTOKEN token;
#ifdef DEBUGMODE
gg->debugLogA("gg_dounregister(): Starting.");
#endif
- if (!uin || !password) return NULL;
+ if (!uin || !password) return nullptr;
// Load token
- if (!gg->gettoken(&token)) return NULL;
+ if (!gg->gettoken(&token)) return nullptr;
if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin)
{
@@ -89,7 +89,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) mir_snwprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Bad number or password") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_dounregister(): Cannot remove account. errno=%d: %s", errno, ws_strerror(errno));
}
else
@@ -98,14 +98,14 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) gg->delSetting(GG_KEY_PASSWORD);
gg->delSetting(GG_KEY_UIN);
gg->debugLogA("gg_dounregister(): Account %d has been removed.", uin);
- MessageBox(NULL, TranslateT("Your account has been removed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Your account has been removed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
gg->debugLogA("gg_dounregister(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -117,13 +117,13 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) char email[255] = "\0"; DBVARIANT dbv_email;
// Connection handles
struct gg_http *h;
- struct gg_pubdir *s = NULL;
+ struct gg_pubdir *s = nullptr;
GGTOKEN token;
#ifdef DEBUGMODE
gg->debugLogA("gg_dochpass(): Starting.");
#endif
- if (!uin || !password || !newPass) return NULL;
+ if (!uin || !password || !newPass) return nullptr;
if (!gg->getString(GG_KEY_EMAIL, &dbv_email))
{
@@ -133,7 +133,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) // Load token
if (!gg->gettoken(&token))
- return NULL;
+ return nullptr;
if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
{
@@ -141,7 +141,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) mir_snwprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Invalid data entered") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_dochpass(): Cannot change password. errno=%d: %s", errno, ws_strerror(errno));
}
else
@@ -149,14 +149,14 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) gg_pubdir_free(h);
gg->setString(GG_KEY_PASSWORD, newPass);
gg->debugLogA("gg_dochpass(): Password change succesful.");
- MessageBox(NULL, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
gg->debugLogA("gg_dochpass(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -167,22 +167,22 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne #ifdef DEBUGMODE
gg->debugLogA("gg_dochemail(): Starting.");
#endif
- if (!uin || !email || !newEmail) return NULL;
+ if (!uin || !email || !newEmail) return nullptr;
// Load token
GGTOKEN token;
if (!gg->gettoken(&token))
- return NULL;
+ return nullptr;
// Connection handles
- struct gg_pubdir *s = NULL;
+ struct gg_pubdir *s = nullptr;
struct gg_http *h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0);
if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
mir_snwprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno));
}
else
@@ -190,14 +190,14 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne gg_pubdir_free(h);
gg->setString(GG_KEY_EMAIL, newEmail);
gg->debugLogA("gg_dochemail(): E-mail change succesful.");
- MessageBox(NULL, TranslateT("Your e-mail has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Your e-mail has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
gg->debugLogA("gg_dochemail(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
|