summaryrefslogtreecommitdiff
path: root/plugins/CloudFile
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/CloudFile
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/CloudFile')
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp4
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp8
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp8
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp8
-rw-r--r--plugins/CloudFile/src/cloud_service.cpp4
-rw-r--r--plugins/CloudFile/src/icons.cpp6
-rw-r--r--plugins/CloudFile/src/srmm.cpp2
-rw-r--r--plugins/CloudFile/src/utils.cpp6
8 files changed, 23 insertions, 23 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp
index 2bdb577c19..f1157a52b2 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -53,7 +53,7 @@ unsigned CDropboxService::RequestAccessTokenThread(void *owner, void *param)
DropboxAPI::GetAccessTokenRequest request(requestToken);
NLHR_PTR response(request.Send(service->hConnection));
- if (response == NULL || response->resultCode != HTTP_CODE_OK) {
+ if (response == nullptr || response->resultCode != HTTP_CODE_OK) {
Netlib_Logf(service->hConnection, "%s: %s", service->GetModule(), service->HttpStatusToError());
//ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
return 0;
@@ -171,7 +171,7 @@ void CDropboxService::CreateSharedLink(const char *path, char *url)
DropboxAPI::CreateSharedLinkRequest shareRequest(token, path);
NLHR_PTR response(shareRequest.Send(hConnection));
- if (response == NULL)
+ if (response == nullptr)
throw Exception(HttpStatusToError());
if (!HTTP_CODE_SUCCESS(response->resultCode) &&
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index 0f5e2c793d..5c5b7703d4 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -26,7 +26,7 @@ bool CGDriveService::IsLoggedIn()
ptrA token(db_get_sa(NULL, GetModule(), "TokenSecret"));
if (!token || token[0] == 0)
return false;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t expiresIn = db_get_dw(NULL, GetModule(), "ExpiresIn");
return now < expiresIn;
}
@@ -45,7 +45,7 @@ void CGDriveService::Login()
db_set_s(NULL, GetModule(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(NULL) + node.as_int();
+ time_t expiresIn = time(nullptr) + node.as_int();
db_set_dw(NULL, GetModule(), "ExpiresIn", expiresIn);
return;
@@ -74,7 +74,7 @@ unsigned CGDriveService::RequestAccessTokenThread(void *owner, void *param)
GDriveAPI::GetAccessTokenRequest request(requestToken);
NLHR_PTR response(request.Send(service->hConnection));
- if (response == NULL || response->resultCode != HTTP_CODE_OK) {
+ if (response == nullptr || response->resultCode != HTTP_CODE_OK) {
const char *error = response->dataLength
? response->pData
: service->HttpStatusToError(response->resultCode);
@@ -103,7 +103,7 @@ unsigned CGDriveService::RequestAccessTokenThread(void *owner, void *param)
db_set_s(NULL, service->GetModule(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(NULL) + node.as_int();
+ time_t expiresIn = time(nullptr) + node.as_int();
db_set_dw(NULL, service->GetModule(), "ExpiresIn", expiresIn);
node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 9f0cb30c7b..38519e6d55 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -26,7 +26,7 @@ bool COneDriveService::IsLoggedIn()
ptrA token(db_get_sa(NULL, GetModule(), "TokenSecret"));
if (!token || token[0] == 0)
return false;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t expiresIn = db_get_dw(NULL, GetModule(), "ExpiresIn");
return now < expiresIn;
}
@@ -45,7 +45,7 @@ void COneDriveService::Login()
db_set_s(NULL, GetModule(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(NULL) + node.as_int();
+ time_t expiresIn = time(nullptr) + node.as_int();
db_set_dw(NULL, GetModule(), "ExpiresIn", expiresIn);
return;
@@ -76,7 +76,7 @@ unsigned COneDriveService::RequestAccessTokenThread(void *owner, void *param)
OneDriveAPI::GetAccessTokenRequest request(requestToken);
NLHR_PTR response(request.Send(service->hConnection));
- if (response == NULL || response->resultCode != HTTP_CODE_OK) {
+ if (response == nullptr || response->resultCode != HTTP_CODE_OK) {
const char *error = response->dataLength
? response->pData
: service->HttpStatusToError(response->resultCode);
@@ -105,7 +105,7 @@ unsigned COneDriveService::RequestAccessTokenThread(void *owner, void *param)
db_set_s(NULL, service->GetModule(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(NULL) + node.as_int();
+ time_t expiresIn = time(nullptr) + node.as_int();
db_set_dw(NULL, service->GetModule(), "ExpiresIn", expiresIn);
node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index d012dd3cc8..1e4d5749cb 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -26,7 +26,7 @@ bool CYandexService::IsLoggedIn()
ptrA token(db_get_sa(NULL, GetModule(), "TokenSecret"));
if (!token || token[0] == 0)
return false;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t expiresIn = db_get_dw(NULL, GetModule(), "ExpiresIn");
return now < expiresIn;
}
@@ -45,7 +45,7 @@ void CYandexService::Login()
db_set_s(NULL, GetModule(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(NULL) + node.as_int();
+ time_t expiresIn = time(nullptr) + node.as_int();
db_set_dw(NULL, GetModule(), "ExpiresIn", expiresIn);
node = root.at("refresh_token");
@@ -77,7 +77,7 @@ unsigned CYandexService::RequestAccessTokenThread(void *owner, void *param)
YandexAPI::GetAccessTokenRequest request(requestToken);
NLHR_PTR response(request.Send(service->hConnection));
- if (response == NULL || response->resultCode != HTTP_CODE_OK) {
+ if (response == nullptr || response->resultCode != HTTP_CODE_OK) {
const char *error = response->dataLength
? response->pData
: service->HttpStatusToError(response->resultCode);
@@ -106,7 +106,7 @@ unsigned CYandexService::RequestAccessTokenThread(void *owner, void *param)
db_set_s(NULL, service->GetModule(), "TokenSecret", node.as_string().c_str());
node = root.at("expires_in");
- time_t expiresIn = time(NULL) + node.as_int();
+ time_t expiresIn = time(nullptr) + node.as_int();
db_set_dw(NULL, service->GetModule(), "ExpiresIn", expiresIn);
node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/cloud_service.cpp b/plugins/CloudFile/src/cloud_service.cpp
index 3ad83d1e2f..90b84c0590 100644
--- a/plugins/CloudFile/src/cloud_service.cpp
+++ b/plugins/CloudFile/src/cloud_service.cpp
@@ -84,7 +84,7 @@ void CCloudService::Report(MCONTACT hContact, const wchar_t *data)
char* CCloudService::PreparePath(const char *oldPath, char *newPath)
{
- if (oldPath == NULL)
+ if (oldPath == nullptr)
mir_strcpy(newPath, "");
else if (*oldPath != '/')
{
@@ -136,7 +136,7 @@ void CCloudService::HttpResponseToError(NETLIBHTTPREQUEST *response)
void CCloudService::HandleHttpError(NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
throw Exception(HttpStatusToError());
if (!HTTP_CODE_SUCCESS(response->resultCode))
diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp
index e22e35e0fa..ae89626884 100644
--- a/plugins/CloudFile/src/icons.cpp
+++ b/plugins/CloudFile/src/icons.cpp
@@ -20,7 +20,7 @@ HANDLE GetIconHandle(int iconId)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
HANDLE GetIconHandle(const char *name)
@@ -29,7 +29,7 @@ HANDLE GetIconHandle(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)
@@ -38,5 +38,5 @@ HICON LoadIconEx(int iconId, bool big)
if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
- return NULL;
+ return nullptr;
} \ No newline at end of file
diff --git a/plugins/CloudFile/src/srmm.cpp b/plugins/CloudFile/src/srmm.cpp
index 58d8ef9708..036ee58601 100644
--- a/plugins/CloudFile/src/srmm.cpp
+++ b/plugins/CloudFile/src/srmm.cpp
@@ -64,7 +64,7 @@ int OnSrmmButtonPressed(WPARAM, LPARAM lParam)
//SetMenuItemBitmaps(hMenu, i, MF_BITMAP, hBitmap, hBitmap);
}
- int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, NULL);
+ int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, nullptr);
if (pos > 0) {
CCloudService *service = Services[pos - 1];
diff --git a/plugins/CloudFile/src/utils.cpp b/plugins/CloudFile/src/utils.cpp
index e4846baf31..44a3149a25 100644
--- a/plugins/CloudFile/src/utils.cpp
+++ b/plugins/CloudFile/src/utils.cpp
@@ -19,7 +19,7 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags,
return;
}
- MessageBox(NULL, message, caption, MB_OK | flags);
+ MessageBox(nullptr, message, caption, MB_OK | flags);
}
void ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
@@ -31,7 +31,7 @@ MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD cbBlob, PBY
{
DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.eventType = type;
dbei.cbBlob = cbBlob;
dbei.pBlob = pBlob;
@@ -84,7 +84,7 @@ void PasteToInputArea(MCONTACT hContact, const wchar_t *data)
void PasteToClipboard(const wchar_t *data)
{
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
EmptyClipboard();
size_t size = sizeof(wchar_t) * (mir_wstrlen(data) + 1);