diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/FTPFileYM | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/FTPFileYM')
-rw-r--r-- | plugins/FTPFileYM/src/dbentry.cpp | 12 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/deletetimer.cpp | 12 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/dialog.cpp | 24 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/ftpfile.cpp | 12 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/job_delete.cpp | 6 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/job_generic.cpp | 6 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/job_packer.cpp | 14 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/job_upload.cpp | 26 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/manager.cpp | 24 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/options.cpp | 8 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/serverlist.cpp | 4 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/utils.cpp | 8 |
12 files changed, 78 insertions, 78 deletions
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index 625f0a023a..d592c7c450 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -59,7 +59,7 @@ DBEntry *DBEntry::getNext(DBEntry *entry) }
delete entry;
- return NULL;
+ return nullptr;
}
void DBEntry::cleanupDB()
@@ -67,7 +67,7 @@ void DBEntry::cleanupDB() int count = 0;
DBEntry *entry = getFirst();
- while (entry != NULL) {
+ while (entry != nullptr) {
DB::setByteF(0, MODULE_FILES, "Ftp%d", count, entry->m_iFtpNum);
DB::setAStringF(0, MODULE_FILES, "Filename%d", count, entry->m_szFileName);
if (entry->m_deleteTS != 0)
@@ -96,7 +96,7 @@ DBEntry* DBEntry::get(int fileID) }
}
- return NULL;
+ return nullptr;
}
void DBEntry::remove(int fileID)
@@ -111,7 +111,7 @@ bool DBEntry::entryExists(GenericJob *job) mir_cslock lock(mutexDB);
DBEntry *entry = getFirst();
- while (entry != NULL) {
+ while (entry != nullptr) {
if (entry->m_iFtpNum == job->m_iFtpNum && !strcmp(entry->m_szFileName, job->m_szSafeFileName))
return true;
@@ -132,7 +132,7 @@ void DBEntry::add(GenericJob *job) DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->m_szSafeFileName);
if (job->m_tab->m_iOptAutoDelete != -1) {
- time_t deleteTS = time(NULL);
+ time_t deleteTS = time(nullptr);
deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS);
}
@@ -144,7 +144,7 @@ void DBEntry::add(GenericJob *job) void DBEntry::setDeleteTS(GenericJob *job)
{
if (job->m_tab->m_iOptAutoDelete != -1) {
- time_t deleteTS = time(NULL);
+ time_t deleteTS = time(nullptr);
deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID, deleteTS);
}
diff --git a/plugins/FTPFileYM/src/deletetimer.cpp b/plugins/FTPFileYM/src/deletetimer.cpp index 624d483553..fe642e8a83 100644 --- a/plugins/FTPFileYM/src/deletetimer.cpp +++ b/plugins/FTPFileYM/src/deletetimer.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-DeleteTimer *DeleteTimer::instance = NULL;
+DeleteTimer *DeleteTimer::instance = nullptr;
DeleteTimer &deleteTimer = DeleteTimer::getInstance();
extern Options &opt;
@@ -39,13 +39,13 @@ void DeleteTimer::deinit() void DeleteTimer::start()
{
if (!timerId)
- timerId = SetTimer(NULL, 0, 1000 * 60 * 5, (TIMERPROC)AutoDeleteTimerProc);
+ timerId = SetTimer(nullptr, 0, 1000 * 60 * 5, (TIMERPROC)AutoDeleteTimerProc);
}
void DeleteTimer::stop()
{
if (timerId) {
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
timerId = 0;
}
}
@@ -55,9 +55,9 @@ void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_cslock lock(DBEntry::mutexDB);
DBEntry *entry = DBEntry::getFirst();
- while (entry != NULL) {
- if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(NULL)) {
- DeleteJob *job = new DeleteJob(new DBEntry(entry), NULL);
+ while (entry != nullptr) {
+ if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(nullptr)) {
+ DeleteJob *job = new DeleteJob(new DBEntry(entry), nullptr);
job->start();
}
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index 9fbc7b8b57..2096f0bb60 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-UploadDialog *UploadDialog::instance = NULL;
-UploadDialog *uDlg = NULL;
+UploadDialog *UploadDialog::instance = nullptr;
+UploadDialog *uDlg = nullptr;
mir_cs UploadDialog::mutexTabs;
@@ -27,7 +27,7 @@ extern Options &opt; UploadDialog::UploadDialog()
{
- m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_UPLOAD), 0, UploadDlgProc);
+ m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_UPLOAD), nullptr, UploadDlgProc);
m_hwndTabs = GetDlgItem(m_hwnd, IDC_TAB);
EnableThemeDialogTexture(m_hwnd, ETDT_ENABLETAB);
@@ -40,7 +40,7 @@ UploadDialog::UploadDialog() GetWindowRect(m_hwnd, &rc);
rc.left = mi.rcWork.left + ((mi.rcWork.right - mi.rcWork.left) - (rc.right - rc.left)) / 2;
rc.top = mi.rcWork.top + ((mi.rcWork.bottom - mi.rcWork.top) - (rc.bottom - rc.top)) / 2;
- SetWindowPos(m_hwnd, 0, rc.left, rc.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(m_hwnd, nullptr, rc.left, rc.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
}
UploadDialog::~UploadDialog()
@@ -50,8 +50,8 @@ UploadDialog::~UploadDialog() SendMessage(m_hwnd, WMU_DESTROY, 0, 0);
}
- instance = NULL;
- uDlg = NULL;
+ instance = nullptr;
+ uDlg = nullptr;
}
void UploadDialog::selectTab(int index)
@@ -125,7 +125,7 @@ void UploadDialog::Tab::select() uDlg->m_activeTab = index();
}
m_job->refreshTab(true);
- InvalidateRect(uDlg->m_hwnd, NULL, TRUE);
+ InvalidateRect(uDlg->m_hwnd, nullptr, TRUE);
}
void UploadDialog::Tab::labelCompleted()
@@ -239,7 +239,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar RECT rc;
GetWindowRect((HWND)lParam, &rc);
HMENU hMenu = Menu_BuildContactMenu(hContact);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -255,7 +255,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_BTN_DOWNLOAD:
job = (UploadJob*)uDlg->m_tabs[uDlg->m_activeTab]->m_job;
- ShellExecuteA(NULL, "open", job->m_szFileLink, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecuteA(nullptr, "open", job->m_szFileLink, nullptr, nullptr, SW_SHOWNORMAL);
return TRUE;
case IDC_BTN_FILEMANAGER:
@@ -290,7 +290,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar for (int i = 0; i < _countof(times); i++) {
if (i == 3 || i == 7)
- AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0);
+ AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr);
if (i < 3)
mir_snwprintf(buff, TranslateT("%d minutes"), times[i]);
@@ -315,11 +315,11 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case Options::TR_DAYS: mir_snwprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break;
}
- AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0);
+ AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr);
AppendMenu(hTimeMenu, MF_STRING | bChecked ? MF_UNCHECKED : MF_CHECKED, IDM_CUSTOM, buff);
}
- int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, uDlg->m_hwndTabs, NULL);
+ int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, uDlg->m_hwndTabs, nullptr);
switch (command) {
case IDM_CLOSEDLG:
tab->m_bOptCloseDlg = !tab->m_bOptCloseDlg; break;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 9c42b738db..bc4d4dc996 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -113,7 +113,7 @@ void InitMenuItems() if (DB::getStringF(0, MODULE, "Name%d", i, stzName))
mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1);
- mi.root = (opt.bUseSubmenu) ? hMenu : 0;
+ mi.root = (opt.bUseSubmenu) ? hMenu : nullptr;
mi.hIcolibItem = iconList[i].hIcolib;
hSubMenu[i] = Menu_AddContactMenuItem(&mi);
Menu_ConfigureItem(hSubMenu[i], MCI_OPT_EXECPARAM, i + 1000);
@@ -248,7 +248,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) RECT rc;
GetWindowRect(hwndBtn, &rc);
SetForegroundWindow(cbc->hwndFrom);
- int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0);
+ int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, nullptr);
if (selected != 0) {
int ftpNum = selected & (1 | 2 | 4);
int mode = selected & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER);
@@ -280,7 +280,7 @@ int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode, void ** job = new PackerJob(hContact, m_iFtpNum, mode);
int result;
- if (objects != NULL)
+ if (objects != nullptr)
result = job->getFiles(objects, objCount, flags);
else
result = job->getFiles();
@@ -306,7 +306,7 @@ int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode, void ** int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode)
{
- return UploadFile(hContact, m_iFtpNum, mode, NULL, 0, 0);
+ return UploadFile(hContact, m_iFtpNum, mode, nullptr, 0, 0);
}
//------------ MIRANDA SERVICES ------------//
@@ -314,7 +314,7 @@ int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode) INT_PTR UploadService(WPARAM, LPARAM lParam)
{
FTPUPLOAD *ftpu = (FTPUPLOAD *)lParam;
- if (ftpu == NULL || ftpu->cbSize != sizeof(FTPUPLOAD))
+ if (ftpu == nullptr || ftpu->cbSize != sizeof(FTPUPLOAD))
return 1;
int ftpNum = (ftpu->ftpNum == FNUM_DEFAULT) ? opt.defaultFTP : ftpu->ftpNum - 1;
@@ -389,7 +389,7 @@ extern "C" int __declspec(dllexport) Load(void) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
- CoInitialize(NULL);
+ CoInitialize(nullptr);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp index 3a3238d7cc..0a39dd7ab1 100644 --- a/plugins/FTPFileYM/src/job_delete.cpp +++ b/plugins/FTPFileYM/src/job_delete.cpp @@ -76,19 +76,19 @@ void DeleteJob::run() CURL *hCurl = curl_easy_init();
if (hCurl) {
- struct curl_slist *headerList = NULL;
+ struct curl_slist *headerList = nullptr;
headerList = curl_slist_append(headerList, getDelFileString());
Utils::curlSetOpt(hCurl, m_ftp, getDelUrlString(), headerList, szError);
int result = curl_easy_perform(hCurl);
if (result == CURLE_OK) {
- if (manDlg != NULL && m_treeItem)
+ if (manDlg != nullptr && m_treeItem)
m_treeItem->remove();
else
DBEntry::remove(m_entry->m_fileID);
}
- else if (manDlg != NULL && m_treeItem) {
+ else if (manDlg != nullptr && m_treeItem) {
wchar_t *error = mir_a2u(szError);
mir_wstrcpy(m_treeItem->m_tszToolTip, error);
m_treeItem->setState(Manager::TreeItem::_ERROR());
diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index ddeb5ee282..719da74d3f 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -58,7 +58,7 @@ int GenericJob::openFileDialog() mir_snwprintf(temp, L"%s\0*.*\0", TranslateT("All Files (*.*)"));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFilter = temp;
ofn.nFilterIndex = 1;
ofn.lpstrFile = m_tszFilePath;
@@ -70,11 +70,11 @@ int GenericJob::openFileDialog() int GenericJob::openFolderDialog()
{
- BROWSEINFO bi = { 0 };
+ BROWSEINFO bi = {};
bi.lpszTitle = TranslateT("FTP File - Select a folder");
bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON | BIF_DONTGOBELOWDOMAIN;
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
- if (pidl != 0) {
+ if (pidl != nullptr) {
SHGetPathFromIDList(pidl, m_tszFilePath);
CoTaskMemFree(pidl);
return 1;
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 47c2df2906..8428faf58c 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -114,7 +114,7 @@ void PackerJob::pack() }
setStatus(STATUS_PACKING);
- m_startTS = time(NULL);
+ m_startTS = time(nullptr);
int res = createZipFile();
if (res == ZIP_OK) {
@@ -136,9 +136,9 @@ int PackerJob::createZipFile() {
int result = ZIP_ERRNO;
- zipFile zf = zipOpen2_64(m_tszFilePath, 0, NULL, NULL);
+ zipFile zf = zipOpen2_64(m_tszFilePath, 0, nullptr, nullptr);
- if (zf != NULL) {
+ if (zf != nullptr) {
result = ZIP_OK;
int size_buf = 65536;
@@ -157,7 +157,7 @@ int PackerJob::createZipFile() getFileTime(m_files[i], &zi.tmz_date, &zi.dosDate);
char *file = mir_u2a(Utils::getFileNameFromPath(m_files[i]));
- int err = zipOpenNewFileInZip(zf, file, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, opt.iCompressionLevel);
+ int err = zipOpenNewFileInZip(zf, file, &zi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, opt.iCompressionLevel);
FREE(file);
if (err == ZIP_OK) {
@@ -202,7 +202,7 @@ int PackerJob::createZipFile() }
Cleanup:
- zipClose(zf, NULL);
+ zipClose(zf, nullptr);
FREE(buff);
}
@@ -229,10 +229,10 @@ uLong PackerJob::getFileTime(wchar_t *file, tm_zip*, uLong *dt) void PackerJob::updateStats()
{
DWORD dwNewTick = GetTickCount();
- if (m_uiReaded && (time(NULL) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
+ if (m_uiReaded && (time(nullptr) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
m_lastUpdateTick = dwNewTick;
- double speed = ((double)m_uiReaded / 1024) / (time(NULL) - m_startTS);
+ double speed = ((double)m_uiReaded / 1024) / (time(nullptr) - m_startTS);
mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed);
double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0;
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index a519e897c4..a083225d57 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -27,14 +27,14 @@ extern ServerList &ftpList; UploadJob::UploadJob(MCONTACT _hContact, int _iFtpNum, EMode _mode) :
GenericJob(_hContact, _iFtpNum, _mode),
- m_fp(NULL)
+ m_fp(nullptr)
{
m_szFileLink[0] = 0;
}
UploadJob::UploadJob(UploadJob *job) :
GenericJob(job),
- m_fp(NULL), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0)
+ m_fp(nullptr), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0)
{
mir_strcpy(m_szFileLink, job->m_szFileLink);
for (int i = 0; i < _countof(m_lastSpeed); i++)
@@ -42,7 +42,7 @@ UploadJob::UploadJob(UploadJob *job) : }
UploadJob::UploadJob(PackerJob *job) :
- GenericJob(job), m_fp(NULL), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0)
+ GenericJob(job), m_fp(nullptr), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0)
{
for (int i = 0; i < _countof(m_lastSpeed); i++)
m_lastSpeed[i] = 0;
@@ -82,14 +82,14 @@ void UploadJob::autoSend() return;
char *szProto = GetContactProto(m_hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return;
DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.cbBlob = (DWORD)mir_strlen(m_szFileLink) + 1;
dbei.pBlob = (PBYTE)m_szFileLink;
db_event_add(m_hContact, &dbei);
@@ -131,7 +131,7 @@ void UploadJob::pauseHandler() void UploadJob::resume()
{
m_uiSent = 0;
- m_startTS = time(NULL);
+ m_startTS = time(nullptr);
if (!isCompleted()) {
curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
setStatus(STATUS_UPLOADING);
@@ -223,7 +223,7 @@ CURL *UploadJob::curlInit(char *szUrl, struct curl_slist *headerList) {
m_hCurl = curl_easy_init();
if (!m_hCurl)
- return NULL;
+ return nullptr;
Utils::curlSetOpt(m_hCurl, m_ftp, szUrl, headerList, m_szError);
@@ -267,12 +267,12 @@ void UploadJob::upload() refreshTab(true);
m_fp = _wfopen(m_tszFilePath, L"rb");
- if (m_fp == NULL) {
+ if (m_fp == nullptr) {
Utils::msgBox(TranslateT("Error occurred when opening local file.\nAborting file upload..."), MB_OK | MB_ICONERROR);
return;
}
- curl_slist *headerList = NULL;
+ curl_slist *headerList = nullptr;
if (m_ftp->m_szChmod[0])
headerList = curl_slist_append(headerList, getChmodString());
@@ -288,7 +288,7 @@ void UploadJob::upload() bool uploadFile = true;
if (fileExistsOnServer()) {
- int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FILEEXISTS), 0, DlgProcFileExists, (LPARAM)m_szSafeFileName);
+ int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FILEEXISTS), nullptr, DlgProcFileExists, (LPARAM)m_szSafeFileName);
if (res == IDC_RENAME) {
if (Utils::setFileNameDlgA(m_szSafeFileName) == true)
curl_easy_setopt(hCurl, CURLOPT_URL, getUrlString());
@@ -306,7 +306,7 @@ void UploadJob::upload() if (uploadFile) {
curl_easy_setopt(m_hCurl, CURLOPT_UPLOAD, 1L);
setStatus(STATUS_CONNECTING);
- m_startTS = time(NULL);
+ m_startTS = time(nullptr);
int result = curl_easy_perform(hCurl);
curl_slist_free_all(headerList);
@@ -379,8 +379,8 @@ size_t UploadJob::ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg) void UploadJob::updateStats()
{
- if (m_uiSent && (time(NULL) > m_startTS)) {
- double speed = ((double)m_uiSent / 1024) / (time(NULL) - m_startTS);
+ if (m_uiSent && (time(nullptr) > m_startTS)) {
+ double speed = ((double)m_uiSent / 1024) / (time(nullptr) - m_startTS);
m_avgSpeed = speed;
for (int i = 0; i < _countof(m_lastSpeed); i++) {
m_avgSpeed += (m_lastSpeed[i] == 0 ? speed : m_lastSpeed[i]);
diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index c77cd62fc2..7d793f5959 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "options.h"
#include "utils.h"
-Manager *manDlg = NULL;
-Manager *Manager::instance = NULL;
+Manager *manDlg = nullptr;
+Manager *Manager::instance = nullptr;
extern Options &opt;
extern ServerList &ftpList;
@@ -44,15 +44,15 @@ Manager::~Manager() ImageList_Destroy(m_himlStates);
DBEntry::cleanupDB();
- instance = NULL;
- manDlg = NULL;
+ instance = nullptr;
+ manDlg = nullptr;
}
void Manager::init()
{
ServerList::FTP *ftp = ftpList.getSelected();
if (ftp->m_bEnabled) {
- m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_MANAGER), NULL, Manager::ManagerDlgProc);
+ m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_MANAGER), nullptr, Manager::ManagerDlgProc);
m_hwndFileTree = GetDlgItem(m_hwnd, IDC_FILELIST);
initImageList();
fillTree();
@@ -91,7 +91,7 @@ void Manager::initImageList() void Manager::initRootItems()
{
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK | TVIS_EXPANDED | TVIS_BOLD;
@@ -110,7 +110,7 @@ void Manager::fillTree() {
initRootItems();
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -119,7 +119,7 @@ void Manager::fillTree() mir_cslock lock(DBEntry::mutexDB);
DBEntry *entry = DBEntry::getFirst();
- while (entry != NULL) {
+ while (entry != nullptr) {
if ((UINT)entry->m_iFtpNum < m_rootItems.size()) {
tvi.item.pszText = mir_a2u(entry->m_szFileName);
tvi.hParent = m_rootItems[entry->m_iFtpNum]->m_handle;
@@ -154,7 +154,7 @@ Manager::TreeItem *Manager::getItem(HTREEITEM handle) return m_items[i];
}
- return NULL;
+ return nullptr;
}
Manager::TreeItem::TreeItem(HTREEITEM _handle, HTREEITEM _parent, int _id) :
@@ -214,7 +214,7 @@ void Manager::TreeItem::remove() bool Manager::TreeItem::isRoot()
{
- return (m_parent != NULL) ? false : true;
+ return (m_parent != nullptr) ? false : true;
}
@@ -338,7 +338,7 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (hMenu) {
HMENU hPopupMenu = GetSubMenu(hMenu, 0);
TranslateMenu(hPopupMenu);
- int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr);
switch (command) {
case IDM_DELETEFROMLIST:
item->remove();
@@ -361,7 +361,7 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (command == IDM_COPYLINK)
Utils::copyToClipboard(buff);
else
- ShellExecuteA(NULL, "open", buff, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecuteA(nullptr, "open", buff, nullptr, nullptr, SW_SHOWNORMAL);
}
break;
}
diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index 00edede2ee..6008f80bab 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-Options *Options::instance = NULL;
+Options *Options::instance = nullptr;
Options &opt = Options::getInstance();
extern DeleteTimer &deleteTimer;
@@ -162,7 +162,7 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa GetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->m_szChmod, _countof(ftp->m_szChmod));
ftp->m_ftpProto = (ServerList::FTP::EProtoType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PROTOLIST));
- ftp->m_iPort = GetDlgItemInt(hwndDlg, IDC_PORT, 0, 0);
+ ftp->m_iPort = GetDlgItemInt(hwndDlg, IDC_PORT, nullptr, 0);
ftp->m_bPassive = IsDlgButtonChecked(hwndDlg, IDC_PASSIVE) ? true : false;
ftp->m_bEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLED) ? true : false;
@@ -227,9 +227,9 @@ INT_PTR CALLBACK Options::DlgProcOptsAdvanced(HWND hwndDlg, UINT msg, WPARAM wPa opt.bHideInactive = IsDlgButtonChecked(hwndDlg, IDC_HIDEINACTIVE) ? true : false;
opt.bCloseDlg = IsDlgButtonChecked(hwndDlg, IDC_CLOSEDLG) ? true : false;
opt.bAutoDelete = IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE) ? true : false;
- opt.iCompressionLevel = GetDlgItemInt(hwndDlg, IDC_LEVEL, 0, FALSE);
+ opt.iCompressionLevel = GetDlgItemInt(hwndDlg, IDC_LEVEL, nullptr, FALSE);
opt.bSetZipName = IsDlgButtonChecked(hwndDlg, IDC_SETZIPNAME) ? true : false;
- opt.iDeleteTime = GetDlgItemInt(hwndDlg, IDC_DELETETIME, 0, FALSE);
+ opt.iDeleteTime = GetDlgItemInt(hwndDlg, IDC_DELETETIME, nullptr, FALSE);
opt.timeRange = (Options::ETimeRange)SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_GETCURSEL, 0, 0);
opt.saveOptions();
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index b4a854b3d1..fbbd700fac 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-ServerList *ServerList::instance = NULL;
+ServerList *ServerList::instance = nullptr;
ServerList &ftpList = ServerList::getInstance();
extern Options &opt;
@@ -97,5 +97,5 @@ char* ServerList::FTP::getProtoString() const case FT_SSH: return "sftp://";
}
- return NULL;
+ return nullptr;
}
diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index eb2c8a2dc1..70ed92deaf 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -34,13 +34,13 @@ int Utils::getDeleteTimeMin() int Utils::msgBox(wchar_t *stzMsg, UINT uType)
{
- HWND hwnd = (uDlg != NULL) ? uDlg->m_hwnd : 0;
+ HWND hwnd = (uDlg != nullptr) ? uDlg->m_hwnd : nullptr;
return MessageBox(hwnd, stzMsg, TranslateT("FTP File"), uType);
}
int Utils::msgBoxA(char *szMsg, UINT uType)
{
- HWND hwnd = (uDlg != NULL) ? uDlg->m_hwnd : 0;
+ HWND hwnd = (uDlg != nullptr) ? uDlg->m_hwnd : nullptr;
return MessageBoxA(hwnd, szMsg, Translate("FTP File"), uType);
}
@@ -80,7 +80,7 @@ wchar_t* Utils::getTextFragment(wchar_t *stzText, size_t length, wchar_t *buff) void Utils::copyToClipboard(char *szText)
{
if (szText) {
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
EmptyClipboard();
HGLOBAL hClipboardData = GlobalAlloc(GMEM_DDESHARE, 1024);
char *pchData = (char *)GlobalLock(hClipboardData);
@@ -191,7 +191,7 @@ INT_PTR CALLBACK Utils::DlgProcSetFileName(HWND hwndDlg, UINT msg, WPARAM wParam bool Utils::setFileNameDlg(wchar_t *nameBuff)
{
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_NAME), 0, DlgProcSetFileName, (LPARAM)nameBuff) == IDOK)
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_NAME), nullptr, DlgProcSetFileName, (LPARAM)nameBuff) == IDOK)
return true;
else
return false;
|