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/IEHistory | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/IEHistory')
-rw-r--r-- | plugins/IEHistory/src/IEHistory.cpp | 8 | ||||
-rw-r--r-- | plugins/IEHistory/src/dlgHandlers.cpp | 18 | ||||
-rw-r--r-- | plugins/IEHistory/src/services.cpp | 6 | ||||
-rw-r--r-- | plugins/IEHistory/src/utils.cpp | 8 |
4 files changed, 20 insertions, 20 deletions
diff --git a/plugins/IEHistory/src/IEHistory.cpp b/plugins/IEHistory/src/IEHistory.cpp index 2697d2309a..2096b2d701 100644 --- a/plugins/IEHistory/src/IEHistory.cpp +++ b/plugins/IEHistory/src/IEHistory.cpp @@ -25,10 +25,10 @@ int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_g char ModuleName[] = "IEHistory"; HICON hIcon; HINSTANCE hInstance; -MWindowList hOpenWindowsList = NULL; +MWindowList hOpenWindowsList = nullptr; -HMODULE hUxTheme = 0; -BOOL(WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = NULL; +HMODULE hUxTheme = nullptr; +BOOL(WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = nullptr; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -65,7 +65,7 @@ extern "C" int __declspec(dllexport) Load(void) InitCommonControlsEx(&icex); - if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != 0) + if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != nullptr) MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); /// all initialization here diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 3b15a902f1..1bb009e1b5 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -162,18 +162,18 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) int cLoad = LOAD_COUNT;
int i;
IEVIEWEVENTDATA ieData[LOAD_COUNT] = { 0 };
- PBYTE messages[LOAD_COUNT] = { 0 };
+ PBYTE messages[LOAD_COUNT] = {};
MEVENT dbEvent = data->ieEvent.hDbEventFirst;
for (i = 0; i < LOAD_COUNT; i++) {
ieData[i].cbSize = sizeof(IEVIEWEVENTDATA); //set the cbsize here, no need to do it every time
ieData[i].next = &ieData[i + 1]; //it's a vector, so v[i]'s next element is v[i + 1]
}
- ieData[LOAD_COUNT - 1].next = NULL;
+ ieData[LOAD_COUNT - 1].next = nullptr;
IEVIEWEVENT ieEvent = data->ieEvent;
ieEvent.iType = IEE_LOG_MEM_EVENTS;
ieEvent.eventData = ieData;
DBEVENTINFO dbInfo = {};
- PBYTE buffer = NULL;
+ PBYTE buffer = nullptr;
int newSize, oldSize = 0;
while (count < target) {
cLoad = (count + LOAD_COUNT > target) ? target - count : LOAD_COUNT;
@@ -195,7 +195,7 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) //FillIEViewEventData(&ieData[i], dbEvent);
dbEvent = db_event_next(0, dbEvent);
}
- ieData[cLoad - 1].next = NULL; //cLoad < LOAD_COUNT will only happen once, at the end
+ ieData[cLoad - 1].next = nullptr; //cLoad < LOAD_COUNT will only happen once, at the end
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent);
count += cLoad;
}
@@ -336,7 +336,7 @@ int ScrollToBottom(HWND hWnd) void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOWPOS *wndPos, int anchors)
{
- if (NULL == window) /* Wine fix. */
+ if (nullptr == window) /* Wine fix. */
return;
RECT rChild = AnchorCalcPos(window, rParent, wndPos, anchors);
hdWnds = DeferWindowPos(hdWnds, window, HWND_NOTOPMOST, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, SWP_NOZORDER);
@@ -375,7 +375,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara hWnd, //parent
(HMENU)IDC_STATUSBAR, //menu
hInstance, //instance
- NULL); //lpParam
+ nullptr); //lpParam
int x;
int widths[] = { x = 50, x += 50, x += 150, -1 };
int count = sizeof(widths) / sizeof(widths[0]);
@@ -465,10 +465,10 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case IDC_SEARCH:
HWND hSearch = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_SEARCH), hWnd, SearchDlgProc);
- if (hSearch == NULL) {
+ if (hSearch == nullptr) {
char buffer[1024];
sprintf(buffer, "Error #%d", GetLastError());
- MessageBoxA(0, buffer, "Error", MB_OK);
+ MessageBoxA(nullptr, buffer, "Error", MB_OK);
}
SearchWindowData *searchData = (SearchWindowData *)malloc(sizeof(SearchWindowData));
searchData->contact = data->contact;
@@ -663,7 +663,7 @@ INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam data->index += (direction == DIRECTION_BACK) ? -searchResult.index : searchResult.index;
LoadPage(data->hHistoryWindow, searchResult.hEvent, data->index, histData->itemsPerPage / 2, histData->itemsPerPage, DIRECTION_BACK);
}
- else MessageBox(0, TranslateT("Search finished. No more entries..."), TranslateT("Information"), MB_OK | MB_ICONINFORMATION);
+ else MessageBox(nullptr, TranslateT("Search finished. No more entries..."), TranslateT("Information"), MB_OK | MB_ICONINFORMATION);
data->hLastFoundEvent = searchResult.hEvent;
break;
diff --git a/plugins/IEHistory/src/services.cpp b/plugins/IEHistory/src/services.cpp index 7197f2a4d5..1556b08363 100644 --- a/plugins/IEHistory/src/services.cpp +++ b/plugins/IEHistory/src/services.cpp @@ -31,15 +31,15 @@ INT_PTR ShowContactHistoryService(WPARAM wParam, LPARAM) { Log("%s", "Entering function " __FUNCTION__); HWND historyDlg; - HWND parent = NULL; + HWND parent = nullptr; historyDlg = WindowList_Find(hOpenWindowsList, (MCONTACT)wParam); - if (historyDlg == NULL){ + if (historyDlg == nullptr){ int count = db_get_dw(NULL, ModuleName, "EventsToLoad", 0); int loadInBackground = db_get_b(NULL, ModuleName, "UseWorkerThread", 0); HistoryWindowData *data; data = (HistoryWindowData *)malloc(sizeof(HistoryWindowData)); data->contact = (MCONTACT)wParam; - data->hIEView = NULL; + data->hIEView = nullptr; data->itemsPerPage = count; data->index = 0; data->count = 0; diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index 125f861aba..ed3936781f 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -71,7 +71,7 @@ int Info(char *title, char *format, ...) str[tBytes] = 0; } va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); + return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION); } /* @@ -81,7 +81,7 @@ returns the name of a contact wchar_t* GetContactName(MCONTACT contact) { ptrW name(Contact_GetInfo(CNF_DISPLAY, contact)); - return (name) ? wcsdup(name) : NULL; + return (name) ? wcsdup(name) : nullptr; } /* @@ -182,7 +182,7 @@ void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst) SYSTEMTIME st; UnixTimeToFileTime(t, &ft); FileTimeToSystemTime(&ft, &st); - SystemTimeToTzSpecificLocalTime(NULL, &st, pst); + SystemTimeToTzSpecificLocalTime(nullptr, &st, pst); } MEVENT GetNeededEvent(MEVENT hEvent, int num, int direction) @@ -210,7 +210,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat } int index = 0; MEVENT hEvent = hFirstEvent; - void *buffer = NULL; + void *buffer = nullptr; wchar_t *search; bool found = false; int oldSize, newSize; |