summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/Dropbox/src
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/Dropbox/src')
-rw-r--r--plugins/Dropbox/src/dropbox.cpp2
-rw-r--r--plugins/Dropbox/src/dropbox_commands.cpp8
-rw-r--r--plugins/Dropbox/src/dropbox_icons.cpp4
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp2
-rw-r--r--plugins/Dropbox/src/dropbox_options.cpp4
-rw-r--r--plugins/Dropbox/src/dropbox_services.cpp14
-rw-r--r--plugins/Dropbox/src/dropbox_transfers.cpp2
-rw-r--r--plugins/Dropbox/src/dropbox_utils.cpp10
8 files changed, 23 insertions, 23 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp
index 9bb8612e97..e19cd22b9c 100644
--- a/plugins/Dropbox/src/dropbox.cpp
+++ b/plugins/Dropbox/src/dropbox.cpp
@@ -160,7 +160,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param)
GetAccessTokenRequest request(requestToken);
NLHR_PTR response(request.Send(instance->hNetlibConnection));
- if (response == NULL || response->resultCode != HTTP_STATUS_OK) {
+ if (response == nullptr || response->resultCode != HTTP_STATUS_OK) {
Netlib_Logf(instance->hNetlibConnection, "%s: %s", MODULE, HttpStatusToText(HTTP_STATUS_ERROR));
if (hwndDlg)
SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("server does not respond"));
diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp
index 4388374458..0d6c5e4391 100644
--- a/plugins/Dropbox/src/dropbox_commands.cpp
+++ b/plugins/Dropbox/src/dropbox_commands.cpp
@@ -35,7 +35,7 @@ void CDropbox::CommandList(void *arg)
ListFolderRequest request(token, path);
NLHR_PTR response(request.Send(param->instance->hNetlibConnection));
- if (response == NULL || response->resultCode != HTTP_STATUS_OK) {
+ if (response == nullptr || response->resultCode != HTTP_STATUS_OK) {
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0);
return;
}
@@ -81,7 +81,7 @@ void CDropbox::CommandShare(void *arg)
GetTemporaryLinkRequest request(token, path);
NLHR_PTR response(request.Send(param->instance->hNetlibConnection));
- if (response == NULL || response->resultCode != HTTP_STATUS_OK) {
+ if (response == nullptr || response->resultCode != HTTP_STATUS_OK) {
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0);
return;
}
@@ -102,7 +102,7 @@ void CDropbox::CommandSearch(void *arg)
CommandParam *param = (CommandParam*)arg;
char *query = (char*)param->data;
- if (query == NULL) {
+ if (query == nullptr) {
CMStringA error(FORMAT, T2Utf(TranslateT("\"%s\" command has invalid parameter.\nUse \"/help\" for more info.")), "/search");
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0);
ProtoChainSend(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer());
@@ -114,7 +114,7 @@ void CDropbox::CommandSearch(void *arg)
SearchRequest request(token, query);
NLHR_PTR response(request.Send(param->instance->hNetlibConnection));
- if (response == NULL || response->resultCode != HTTP_STATUS_OK) {
+ if (response == nullptr || response->resultCode != HTTP_STATUS_OK) {
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0);
return;
}
diff --git a/plugins/Dropbox/src/dropbox_icons.cpp b/plugins/Dropbox/src/dropbox_icons.cpp
index b4b8574344..33cc167117 100644
--- a/plugins/Dropbox/src/dropbox_icons.cpp
+++ b/plugins/Dropbox/src/dropbox_icons.cpp
@@ -17,7 +17,7 @@ HANDLE GetIconHandleByName(const char *name)
if (mir_strcmpi(iconList[i].szName, name) == 0)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
HICON LoadIconEx(int iconId, bool big)
@@ -26,5 +26,5 @@ HICON LoadIconEx(int iconId, bool big)
if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
- return NULL;
+ return nullptr;
}
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index c4949ee421..1a96848edd 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -35,7 +35,7 @@ int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
bool bShow = false;
char *proto = GetContactProto(hContact);
- if (proto != NULL) {
+ if (proto != nullptr) {
bool bHasIM = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) != 0;
if (bHasIM && HasAccessToken() && hContact != GetDefaultContact() && !IsAccountIntercepted(proto)) {
bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE;
diff --git a/plugins/Dropbox/src/dropbox_options.cpp b/plugins/Dropbox/src/dropbox_options.cpp
index a4fe771dad..65722da497 100644
--- a/plugins/Dropbox/src/dropbox_options.cpp
+++ b/plugins/Dropbox/src/dropbox_options.cpp
@@ -47,7 +47,7 @@ void CDropboxOptionsMain::RequestCode_OnChange(CCtrlBase*)
void CDropboxOptionsMain::Authorize_OnClick(CCtrlBase*)
{
- mir_forkthreadowner(CDropbox::RequestAccessTokenAsync, m_instance, m_hwnd, 0);
+ mir_forkthreadowner(CDropbox::RequestAccessTokenAsync, m_instance, m_hwnd, nullptr);
}
/////////////////////////////////////////////////////////////////////////////////
@@ -71,7 +71,7 @@ void CDropboxOptionsInterception::OnInitDialog()
PROTOACCOUNT** accounts;
Proto_EnumAccounts(&count, &accounts);
const char *interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedAccounts");
- if (interceptedAccounts == NULL)
+ if (interceptedAccounts == nullptr)
interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedProtos");
for (int i = 0; i < count; i++) {
PROTOACCOUNT *acc = accounts[i];
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp
index d15c691cc2..5457883d60 100644
--- a/plugins/Dropbox/src/dropbox_services.cpp
+++ b/plugins/Dropbox/src/dropbox_services.cpp
@@ -39,7 +39,7 @@ INT_PTR CDropbox::ProtoSendFile(WPARAM, LPARAM lParam)
CCSDATA *pccsd = (CCSDATA*)lParam;
if (!HasAccessToken()) {
- ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send files when you are not authorized.");
+ ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send files when you are not authorized.");
return 0;
}
@@ -59,7 +59,7 @@ INT_PTR CDropbox::ProtoSendFile(WPARAM, LPARAM lParam)
transfers.insert(ftp);
- mir_forkthreadowner(CDropbox::UploadAndReportProgress, this, ftp, 0);
+ mir_forkthreadowner(CDropbox::UploadAndReportProgress, this, ftp, nullptr);
return ftp->GetId();
}
@@ -89,7 +89,7 @@ INT_PTR CDropbox::ProtoCancelFile(WPARAM, LPARAM lParam)
HANDLE hTransfer = (HANDLE)pccsd->wParam;
FileTransferParam *ftp = transfers.find((FileTransferParam*)&hTransfer);
- if (ftp == NULL)
+ if (ftp == nullptr)
return 0;
ftp->Terminate();
@@ -102,7 +102,7 @@ INT_PTR CDropbox::ProtoSendMessage(WPARAM, LPARAM lParam)
CCSDATA *pccsd = (CCSDATA*)lParam;
if (!HasAccessToken()) {
- ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send messages when you are not authorized.");
+ ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send messages when you are not authorized.");
return 0;
}
@@ -144,7 +144,7 @@ INT_PTR CDropbox::ProtoSendMessage(WPARAM, LPARAM lParam)
}
}
- ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, 0, 0);
+ ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, nullptr, 0);
char help[1024];
mir_snprintf(help, Translate("\"%s\" is not valid.\nUse \"/help\" for more info."), szMessage);
ProtoChainSend(GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)help);
@@ -160,7 +160,7 @@ INT_PTR CDropbox::ProtoReceiveMessage(WPARAM, LPARAM lParam)
DBEVENTINFO dbei = {};
dbei.flags = DBEF_UTF;
dbei.szModule = MODULE;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)mir_strlen(message);
dbei.pBlob = (PBYTE)mir_strdup(message);
@@ -221,7 +221,7 @@ INT_PTR CDropbox::UploadToDropboxAsync(WPARAM, LPARAM lParam)
else
ftp->AddFile(uploadInfo->localPath);
- mir_forkthreadowner(CDropbox::UploadAndRaiseEvent, this, ftp, 0);
+ mir_forkthreadowner(CDropbox::UploadAndRaiseEvent, this, ftp, nullptr);
return ftp->GetId();
} \ No newline at end of file
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp
index 6278f2e5fb..177d5768bb 100644
--- a/plugins/Dropbox/src/dropbox_transfers.cpp
+++ b/plugins/Dropbox/src/dropbox_transfers.cpp
@@ -203,7 +203,7 @@ UINT CDropbox::UploadAndRaiseEvent(void *owner, void *arg)
int res = UploadToDropbox(owner, arg);
- DropboxUploadResult ur = { 0 };
+ DropboxUploadResult ur = {};
ur.hProcess = (HANDLE)ftp->GetId();
ur.status = res;
ur.data = T2Utf(ftp->GetData());
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp
index 39b76a9f2e..a4e5d51747 100644
--- a/plugins/Dropbox/src/dropbox_utils.cpp
+++ b/plugins/Dropbox/src/dropbox_utils.cpp
@@ -2,7 +2,7 @@
char* CDropbox::PreparePath(const char *oldPath, char *newPath)
{
- if (oldPath == NULL)
+ if (oldPath == nullptr)
mir_strcpy(newPath, "");
else if (*oldPath != '/')
{
@@ -24,7 +24,7 @@ char* CDropbox::PreparePath(const wchar_t *oldPath, char *newPath)
bool CDropbox::IsAccountIntercepted(const char *module)
{
const char *interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedAccounts");
- if (interceptedAccounts == NULL)
+ if (interceptedAccounts == nullptr)
interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedProtos");
return interceptedAccounts && strstr(interceptedAccounts, module);
}
@@ -59,7 +59,7 @@ char* CDropbox::HttpStatusToText(HTTP_STATUS status)
void CDropbox::HandleHttpResponse(NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
throw DropboxException(HttpStatusToText(HTTP_STATUS_ERROR));
}
@@ -91,7 +91,7 @@ MEVENT CDropbox::AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD c
{
DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.eventType = type;
dbei.cbBlob = cbBlob;
dbei.pBlob = pBlob;
@@ -126,7 +126,7 @@ void CDropbox::PasteToInputArea(MCONTACT hContact, const wchar_t *data)
void CDropbox::PasteToClipboard(const wchar_t *data)
{
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
EmptyClipboard();
size_t size = sizeof(wchar_t) * (mir_wstrlen(data) + 1);