diff options
Diffstat (limited to 'protocols/Tox')
-rw-r--r-- | protocols/Tox/src/main.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_accounts.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_avatars.cpp | 12 | ||||
-rw-r--r-- | protocols/Tox/src/tox_bootstrap.cpp | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_connection.cpp | 8 | ||||
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 14 | ||||
-rw-r--r-- | protocols/Tox/src/tox_icons.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_messages.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_multimedia.cpp | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_netlib.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_options.cpp | 28 | ||||
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 6 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_search.cpp | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_transfer.cpp | 40 | ||||
-rw-r--r-- | protocols/Tox/src/tox_utils.cpp | 8 |
16 files changed, 85 insertions, 85 deletions
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp index 66979d3bdb..de5356a18a 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -4,7 +4,7 @@ int hLangpack; CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; HINSTANCE g_hInstance; -HMODULE g_hToxLibrary = NULL; +HMODULE g_hToxLibrary = nullptr; PLUGININFOEX pluginInfo = { @@ -38,7 +38,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC extern "C" int __declspec(dllexport) Load(void) { g_hToxLibrary = LoadLibrary(TOX_LIBRARY); - if (g_hToxLibrary == NULL) + if (g_hToxLibrary == nullptr) return 1; if (!TOX_VERSION_IS_ABI_COMPATIBLE()) diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index fa4120abfe..b1bfa58490 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -26,7 +26,7 @@ CToxProto* CToxProto::GetContactAccount(MCONTACT hContact) for (int i = 0; i < Accounts.getCount(); i++)
if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0)
return Accounts[i];
- return NULL;
+ return nullptr;
}
int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 871276e288..3e41c796f6 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -77,14 +77,14 @@ void CToxProto::SetToxAvatar(const wchar_t* path) debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
+ uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
mir_free(data);
debugLogA(__FUNCTION__": failed to set new avatar (%d)", error);
return;
}
- AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
+ AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, nullptr, length);
transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
@@ -149,7 +149,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) debugLogA(__FUNCTION__": setting avatar");
wchar_t *path = (wchar_t*)lParam;
ptrW avatarPath(GetAvatarFilePath());
- if (path != NULL) {
+ if (path != nullptr) {
debugLogA(__FUNCTION__": copy new avatar");
if (!CopyFile(path, avatarPath, FALSE)) {
debugLogA(__FUNCTION__": failed to copy new avatar to avatar cache");
@@ -173,7 +173,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, &error);
+ tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
debugLogA(__FUNCTION__": failed to unset avatar (%d)", error);
return 0;
@@ -199,7 +199,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) transfers.Remove(transfer);
delSetting(hConact, TOX_SETTINGS_AVATAR_HASH);
- ProtoBroadcastAck(hConact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
+ ProtoBroadcastAck(hConact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr, 0);
return;
}
@@ -228,7 +228,7 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) mir_wstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
fclose(transfer->hFile);
- transfer->hFile = NULL;
+ transfer->hFile = nullptr;
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
transfers.Remove(transfer);
diff --git a/protocols/Tox/src/tox_bootstrap.cpp b/protocols/Tox/src/tox_bootstrap.cpp index 6617044e73..5f1ae93dc1 100644 --- a/protocols/Tox/src/tox_bootstrap.cpp +++ b/protocols/Tox/src/tox_bootstrap.cpp @@ -5,7 +5,7 @@ void CToxProto::BootstrapUdpNode(Tox *tox, const char *address, int port, const if (!toxThread) return; - if (address == NULL || hexKey == NULL) + if (address == nullptr || hexKey == nullptr) return; ToxBinAddress binKey(hexKey, TOX_PUBLIC_KEY_SIZE * 2); @@ -19,7 +19,7 @@ void CToxProto::BootstrapTcpRelay(Tox *tox, const char *address, int port, const if (!toxThread) return; - if (address == NULL || hexKey == NULL) + if (address == nullptr || hexKey == nullptr) return; ToxBinAddress binKey(hexKey, TOX_PUBLIC_KEY_SIZE * 2); @@ -65,7 +65,7 @@ void CToxProto::BootstrapNodesFromJson(Tox *tox, bool isIPv6) if (IsFileExists(path)) { FILE *hFile = _wfopen(path, L"r"); - if (hFile != NULL) { + if (hFile != nullptr) { _fseeki64(hFile, 0, SEEK_END); size_t size = _ftelli64(hFile); json = (char*)mir_calloc(size); @@ -141,8 +141,8 @@ void CToxProto::UpdateNodes() ptrW path(mir_wstrdup((wchar_t*)VARSW(_A2W(TOX_JSON_PATH)))); if (!IsFileExists(path)) { - HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (hProfile == NULL) { + HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); + if (hProfile == nullptr) { debugLogA(__FUNCTION__": failed to create tox.json"); return; } diff --git a/protocols/Tox/src/tox_connection.cpp b/protocols/Tox/src/tox_connection.cpp index d01879f065..4c578a9696 100644 --- a/protocols/Tox/src/tox_connection.cpp +++ b/protocols/Tox/src/tox_connection.cpp @@ -24,7 +24,7 @@ void CToxProto::TryConnect(Tox *tox) int maxConnectRetries = getByte("MaxConnectRetries", TOX_MAX_CONNECT_RETRIES); if (m_iStatus++ > maxConnectRetries) { SetStatus(ID_STATUS_OFFLINE); - ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK); + ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NONETWORK); debugLogA(__FUNCTION__": failed to connect to DHT"); return; } @@ -82,7 +82,7 @@ void CToxProto::PollingThread(void*) Tox_Options *options = GetToxOptions(); if (!options) { SetStatus(ID_STATUS_OFFLINE); - ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL); + ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr); debugLogA(__FUNCTION__": leaving"); return; } @@ -113,8 +113,8 @@ void CToxProto::PollingThread(void*) } UninitToxCore(toxThread.Tox()); - this->toxThread = NULL; - hPollingThread = NULL; + this->toxThread = nullptr; + hPollingThread = nullptr; debugLogA(__FUNCTION__": leaving"); }
\ No newline at end of file diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 80caaf0a00..3b76b37407 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -246,10 +246,10 @@ void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *mess proto->delSetting(hContact, "Auth");
- DB_AUTH_BLOB blob(hContact, 0, 0, 0, (LPCSTR)address, (LPCSTR)message);
+ DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, (LPCSTR)address, (LPCSTR)message);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -339,14 +339,14 @@ void CToxProto::OnConnectionStatusChanged(Tox *tox, uint32_t friendNumber, TOX_C proto->debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
+ uint32_t fileNumber = tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to set new avatar");
fclose(hFile);
return;
}
- AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
+ AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, nullptr, length);
transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
@@ -355,7 +355,7 @@ void CToxProto::OnConnectionStatusChanged(Tox *tox, uint32_t friendNumber, TOX_C }
else {
proto->debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber);
- tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, NULL);
+ tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, nullptr);
}
}
@@ -366,7 +366,7 @@ int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) MCONTACT hContact = lParam;
char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, m_szModuleName)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.hInstance = g_hInstance;
@@ -413,7 +413,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar case PSN_APPLY:
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
char *szProto = (hContact == NULL) ? proto->m_szModuleName : GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
wchar_t dnsId[MAX_PATH];
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index 87ebdaa925..a96e7984d4 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -20,5 +20,5 @@ HANDLE CToxProto::GetIconHandle(int iconId) if (Icons[i].defIconID == iconId)
return Icons[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 9ed494e289..761294cbf7 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -21,7 +21,7 @@ void CToxProto::OnFriendMessage(Tox *tox, uint32_t friendNumber, TOX_MESSAGE_TYP rawMessage[length] = 0;
PROTORECVEVENT recv = { 0 };
- recv.timestamp = time(NULL);
+ recv.timestamp = time(nullptr);
recv.szMessage = rawMessage;
recv.lParam = type == TOX_MESSAGE_TYPE_NORMAL ? EVENTTYPE_MESSAGE : DB_EVENT_ACTION;
ProtoChainRecvMsg(hContact, &recv);
@@ -73,7 +73,7 @@ void CToxProto::SendMessageAsync(void *arg) int CToxProto::OnSendMessage(MCONTACT hContact, const char *szMessage)
{
if (!IsOnline()) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("You cannot send when you are offline."));
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("You cannot send when you are offline."));
return 0;
}
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index cb8f17fdb9..c9c840274a 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -61,7 +61,7 @@ void CToxIncomingCall::OnInitDialog() void CToxIncomingCall::OnClose()
{
- toxav_call_control(m_proto->toxThread->ToxAV(), m_proto->calls[hContact], TOXAV_CALL_CONTROL_CANCEL, NULL);
+ toxav_call_control(m_proto->toxThread->ToxAV(), m_proto->calls[hContact], TOXAV_CALL_CONTROL_CANCEL, nullptr);
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "IncomingCallWindow_");
CToxCallDlgBase::OnClose();
}
@@ -141,13 +141,13 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) }
//mir_free(cSettings);
- char *message = NULL;
+ char *message = nullptr;
wchar_t title[MAX_PATH];
if (GetWindowText(m_hwnd, title, _countof(title)))
message = mir_utf8encodeW(title);
else
message = mir_utf8encode("Outgoing call");
- m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
+ m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(nullptr), DBEF_UTF, (PBYTE)message, mir_strlen(message));
call.Enable(FALSE);
SetIcon("audio_call");
@@ -163,7 +163,7 @@ void CToxOutgoingCall::OnCancel(CCtrlBase*) }
if (!call.Enabled())
- toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, NULL);
+ toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, nullptr);
}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -188,7 +188,7 @@ void CToxCallDialog::OnClose() return;
}
- toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, NULL);
+ toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, nullptr);
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CallWindow_");
CToxCallDlgBase::OnClose();
}
diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp index f41f312722..ab76d7d815 100644 --- a/protocols/Tox/src/tox_netlib.cpp +++ b/protocols/Tox/src/tox_netlib.cpp @@ -17,5 +17,5 @@ void CToxProto::InitNetlib() void CToxProto::UninitNetlib()
{
Netlib_CloseHandle(m_hNetlibUser);
- m_hNetlibUser = NULL;
+ m_hNetlibUser = nullptr;
}
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 07cb3b2f31..bf4aeea940 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -71,15 +71,15 @@ void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
{
- Tox_Options *options = NULL;
+ Tox_Options *options = nullptr;
tox_options_default(options);
- Tox *tox = tox_new(options, NULL);
+ Tox *tox = tox_new(options, nullptr);
tox_options_free(options);
ptrW profilePath(m_proto->GetToxProfilePath());
if (!m_proto->IsFileExists(profilePath)) {
- HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- if (hProfile == NULL) {
+ HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
+ if (hProfile == nullptr) {
m_proto->debugLogA(__FUNCTION__": failed to create tox profile");
return;
}
@@ -128,7 +128,7 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(profilePath, defaultProfilePath, FALSE);
- Tox_Options *options = tox_options_new(NULL);
+ Tox_Options *options = tox_options_new(nullptr);
if (m_proto->LoadToxProfile(options)) {
CToxThread toxThread(options);
@@ -214,7 +214,7 @@ CToxOptionsMultimedia::CToxOptionsMultimedia(CToxProto *proto) void CToxOptionsMultimedia::EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator *pEnumerator, EDataFlow dataFlow, const char* setting)
{
- LPWSTR pwszDefID = NULL;
+ LPWSTR pwszDefID = nullptr;
ptrW wszDefID(m_proto->getWStringA(setting));
if (wszDefID != NULL) {
size_t len = mir_wstrlen(wszDefID) + 1;
@@ -222,29 +222,29 @@ void CToxOptionsMultimedia::EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator * mir_wstrncpy(pwszDefID, wszDefID, len);
}
else {
- CComPtr<IMMDevice> pDevice = NULL;
+ CComPtr<IMMDevice> pDevice = nullptr;
if (FAILED(pEnumerator->GetDefaultAudioEndpoint(dataFlow, eConsole, &pDevice))) return;
if (FAILED(pDevice->GetId(&pwszDefID))) return;
}
- CComPtr<IMMDeviceCollection> pDevices = NULL;
+ CComPtr<IMMDeviceCollection> pDevices = nullptr;
EXIT_ON_ERROR(pEnumerator->EnumAudioEndpoints(dataFlow, DEVICE_STATE_ACTIVE, &pDevices));
UINT count;
EXIT_ON_ERROR(pDevices->GetCount(&count));
for (UINT i = 0; i < count; i++) {
- CComPtr<IMMDevice> pDevice = NULL;
+ CComPtr<IMMDevice> pDevice = nullptr;
EXIT_ON_ERROR(pDevices->Item(i, &pDevice));
- CComPtr<IPropertyStore> pProperties = NULL;
+ CComPtr<IPropertyStore> pProperties = nullptr;
EXIT_ON_ERROR(pDevice->OpenPropertyStore(STGM_READ, &pProperties));
PROPVARIANT varName;
PropVariantInit(&varName);
EXIT_ON_ERROR(pProperties->GetValue(PKEY_Device_FriendlyName, &varName));
- LPWSTR pwszID = NULL;
+ LPWSTR pwszID = nullptr;
EXIT_ON_ERROR(pDevice->GetId(&pwszID));
combo.InsertString(varName.pwszVal, i, (LPARAM)mir_wstrdup(pwszID));
if (mir_wstrcmpi(pwszID, pwszDefID) == 0)
@@ -262,8 +262,8 @@ void CToxOptionsMultimedia::OnInitDialog() {
CToxDlgBase::OnInitDialog();
- CComPtr<IMMDeviceEnumerator> pEnumerator = NULL;
- if (FAILED(CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator)))
+ CComPtr<IMMDeviceEnumerator> pEnumerator = nullptr;
+ if (FAILED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator)))
return;
EnumDevices(m_audioInput, pEnumerator, eCapture, "AudioInputDeviceID");
@@ -521,7 +521,7 @@ void CToxOptionsNodeList::ReloadNodeList() ptrA json;
FILE *hFile = _wfopen(path, L"r");
- if (hFile != NULL) {
+ if (hFile != nullptr) {
_fseeki64(hFile, 0, SEEK_END);
size_t size = _ftelli64(hFile);
json = (char*)mir_calloc(size);
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 885769f154..a144eebee2 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -27,7 +27,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) return false;
FILE *profile = _wfopen(profilePath, L"rb");
- if (profile == NULL) {
+ if (profile == nullptr) {
ShowNotification(TranslateT("Unable to open Tox profile"), MB_ICONERROR);
debugLogA(__FUNCTION__": failed to open tox profile");
return false;
@@ -111,7 +111,7 @@ void CToxProto::SaveToxProfile(Tox *tox) ptrW profilePath(GetToxProfilePath());
FILE *profile = _wfopen(profilePath, L"wb");
- if (profile == NULL) {
+ if (profile == nullptr) {
debugLogA(__FUNCTION__": failed to open tox profile");
mir_free(data);
return;
@@ -129,7 +129,7 @@ INT_PTR CToxProto::OnCopyToxID(WPARAM, LPARAM) {
ptrA address(getStringA(TOX_SETTINGS_ID));
size_t length = mir_strlen(address) + 1;
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
EmptyClipboard();
HGLOBAL hMemory = GlobalAlloc(GMEM_FIXED, length);
memcpy(GlobalLock(hMemory), address, length);
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 5b05d878c2..5b6d345c9c 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -2,8 +2,8 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName)
: PROTO<CToxProto>(protoName, userName),
- toxThread(NULL), isTerminated(false),
- hCheckingThread(NULL), hPollingThread(NULL),
+ toxThread(nullptr), isTerminated(false),
+ hCheckingThread(nullptr), hPollingThread(nullptr),
hMessageProcess(1)
{
InitNetlib();
@@ -33,7 +33,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) // hAudioDialogs = WindowList_Create();
- hTerminateEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hTerminateEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
CToxProto::~CToxProto()
@@ -173,7 +173,7 @@ int CToxProto::SetStatus(int iNewStatus) // login
isTerminated = false;
m_iStatus = ID_STATUS_CONNECTING;
- hPollingThread = ForkThreadEx(&CToxProto::PollingThread, NULL, NULL);
+ hPollingThread = ForkThreadEx(&CToxProto::PollingThread, nullptr, nullptr);
}
else {
// set tox status
@@ -192,7 +192,7 @@ HANDLE CToxProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)hContact;
}
- return 0;
+ return nullptr;
}
int CToxProto::SetAwayMsg(int, const wchar_t *msg)
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 81724f482f..d03d3a091a 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -38,8 +38,8 @@ ToxHexAddress ResolveToxAddressFromDns(const char *dnsQuery) {
ToxHexAddress address = ToxHexAddress::Empty();
- DNS_RECORDA *record = NULL;
- DNS_STATUS status = DnsQuery_A(dnsQuery, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD*)&record, NULL);
+ DNS_RECORDA *record = nullptr;
+ DNS_STATUS status = DnsQuery_A(dnsQuery, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, nullptr, (PDNS_RECORD*)&record, nullptr);
while (status == ERROR_SUCCESS && record) {
DNS_TXT_DATAA *txt = &record->Data.Txt;
if (record->wType == DNS_TYPE_TEXT && txt->dwStringCount) {
@@ -210,7 +210,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) {
if (!IsOnline()) {
// we cannot add someone to friend list while tox is offline
- return NULL;
+ return nullptr;
}
std::smatch match;
@@ -233,14 +233,14 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) CallService(MS_ADDCONTACT_SHOW, (WPARAM)owner, (LPARAM)&acs);
- ForkThread(&CToxProto::SearchFailedAsync, NULL);
+ ForkThread(&CToxProto::SearchFailedAsync, nullptr);
}
else {
regex = "^\\s*(([^ @/:;()\"']+)(@[A-Za-z]+.[A-Za-z]{2,6})?)\\s*$";
if (std::regex_search(query, match, regex))
ForkThread(&CToxProto::SearchByNameAsync, mir_strdup(query.c_str()));
else
- ForkThread(&CToxProto::SearchFailedAsync, NULL);
+ ForkThread(&CToxProto::SearchFailedAsync, nullptr);
}
return (HWND)1;
}
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 055be5d330..3fb9ad77b7 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -52,7 +52,7 @@ void CToxProto::OnFriendFile(Tox *tox, uint32_t friendNumber, uint32_t fileNumbe PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = L"";
pre.files.w = &name;
pre.lParam = (LPARAM)transfer;
@@ -82,7 +82,7 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t int action = FILERESUME_OVERWRITE;
const wchar_t **szFilename = (const wchar_t**)mir_alloc(sizeof(wchar_t*) * 2);
szFilename[0] = fullPath;
- szFilename[1] = NULL;
+ szFilename[1] = nullptr;
OnFileResume(hTransfer, &action, szFilename);
mir_free(szFilename);
}
@@ -96,7 +96,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil FileTransferParam *transfer = (FileTransferParam*)hTransfer;
if (*action == FILERESUME_SKIP) {
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return 0;
}
@@ -109,7 +109,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil wchar_t *mode = *action == FILERESUME_OVERWRITE ? L"wb" : L"ab";
if (!transfer->OpenFile(mode)) {
debugLogA(__FUNCTION__": failed to open file (%d) from %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return NULL;
}
@@ -119,7 +119,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error)) {
debugLogA(__FUNCTION__": failed to start receiving of file(%d) from %s(%d) cause (%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
}
@@ -152,7 +152,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu ToxHexAddress pubKey = proto->GetContactPublicKey(tox, friendNumber);
FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber);
- if (transfer == NULL) {
+ if (transfer == nullptr) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to find transfer (%d) from %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
return;
}
@@ -166,7 +166,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu MCONTACT hContact = proto->GetContact(tox, friendNumber);
if (hContact == NULL) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": cannot find contact %s(%d)", (const char*)pubKey, friendNumber);
- tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -177,7 +177,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu if (fwrite(data, sizeof(uint8_t), length, transfer->hFile) != length) {
proto->debugLogA(__FUNCTION__": failed write to file (%d)", fileNumber);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(proto->toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(proto->toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -192,12 +192,12 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFi {
int32_t friendNumber = GetToxFriendNumber(hContact);
if (friendNumber == UINT32_MAX)
- return NULL;
+ return nullptr;
FILE *hFile = _wfopen(ppszFiles[0], L"rb");
- if (hFile == NULL) {
+ if (hFile == nullptr) {
debugLogA(__FUNCTION__": cannot open file %s", ppszFiles[0]);
- return NULL;
+ return nullptr;
}
wchar_t *fileName = wcsrchr(ppszFiles[0], '\\') + 1;
@@ -214,12 +214,12 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFi char *name = mir_utf8encodeW(fileName);
TOX_ERR_FILE_SEND sendError;
- uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_DATA, fileSize, NULL, (uint8_t*)name, mir_strlen(name), &sendError);
+ uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_DATA, fileSize, nullptr, (uint8_t*)name, mir_strlen(name), &sendError);
if (sendError != TOX_ERR_FILE_SEND_OK) {
debugLogA(__FUNCTION__": failed to send file (%d) to %s(%d) cause (%d)", fileNumber, (const char*)pubKey, friendNumber, sendError);
mir_free(fileDir);
mir_free(name);
- return NULL;
+ return nullptr;
}
debugLogA(__FUNCTION__": start sending file (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
@@ -243,7 +243,7 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber);
if (!transfer) {
proto->debugLogA(__FUNCTION__": failed to find transfer (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
- tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -266,7 +266,7 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum if (fread(data, sizeof(uint8_t), length, transfer->hFile) != length) {
proto->debugLogA(__FUNCTION__": failed to read from file (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
mir_free(data);
return;
}
@@ -279,7 +279,7 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum }
proto->debugLogA(__FUNCTION__": failed to send file chunk (%d) to %s(%d) cause (%d)", fileNumber, (const char*)pubKey, friendNumber, error);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(proto->toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(proto->toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
mir_free(data);
return;
}
@@ -296,7 +296,7 @@ int CToxProto::CancelTransfer(MCONTACT, HANDLE hTransfer) {
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
debugLogA(__FUNCTION__": Transfer (%d) is canceled", transfer->fileNumber);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return 0;
@@ -314,7 +314,7 @@ void CToxProto::PauseOutgoingTransfers(uint32_t friendNumber) TOX_ERR_FILE_CONTROL error;
if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_PAUSE, &error)) {
debugLogA(__FUNCTION__": failed to pause the transfer (%d) to %s(%d) cause(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
}
}
}
@@ -342,7 +342,7 @@ void CToxProto::CancelAllTransfers(Tox *tox) {
for (size_t i = 0; i < transfers.Count(); i++) {
FileTransferParam *transfer = transfers.GetAt(i);
- tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DENIED, (HANDLE)transfer, 0);
transfers.Remove(transfer);
}
@@ -355,7 +355,7 @@ void CToxProto::OnFileRequest(Tox *tox, uint32_t friendNumber, uint32_t fileNumb MCONTACT hContact = proto->GetContact(tox, friendNumber);
if (hContact) {
FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber);
- if (transfer == NULL) {
+ if (transfer == nullptr) {
proto->debugLogA(__FUNCTION__": failed to find transfer (%d)", fileNumber);
return;
}
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 6ef9a5b0fb..722517c427 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -115,7 +115,7 @@ void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message, return;
}
- MessageBox(NULL, message, caption, MB_OK | flags);
+ MessageBox(nullptr, message, caption, MB_OK | flags);
}
void CToxProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
@@ -149,17 +149,17 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) if (Accounts.getCount() == 0)
return 1;
- CToxProto *proto = NULL;
+ CToxProto *proto = nullptr;
for (int i = 0; i < Accounts.getCount(); i++) {
if (Accounts[i]->IsOnline()) {
proto = Accounts[i];
break;
}
}
- if (proto == NULL)
+ if (proto == nullptr)
return 1;
- if (wcschr(uri, '@') != NULL)
+ if (wcschr(uri, '@') != nullptr)
return 1;
PROTOSEARCHRESULT psr = { sizeof(psr) };
|