summaryrefslogtreecommitdiff
path: root/plugins/SplashScreen/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/SplashScreen/src
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/SplashScreen/src')
-rw-r--r--plugins/SplashScreen/src/bitmap_funcs.cpp40
-rw-r--r--plugins/SplashScreen/src/main.cpp14
-rw-r--r--plugins/SplashScreen/src/options.cpp8
-rw-r--r--plugins/SplashScreen/src/services.cpp2
-rw-r--r--plugins/SplashScreen/src/splash.cpp40
5 files changed, 52 insertions, 52 deletions
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp
index 0c45210801..b5d1738832 100644
--- a/plugins/SplashScreen/src/bitmap_funcs.cpp
+++ b/plugins/SplashScreen/src/bitmap_funcs.cpp
@@ -21,30 +21,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MyBitmap::MyBitmap()
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
}
MyBitmap::MyBitmap(int w, int h)
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
allocate(w, h);
}
MyBitmap::MyBitmap(wchar_t *fn)
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
loadFromFile(fn);
}
@@ -115,7 +115,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h)
}
delete[] bitsSave;
- bitsSave = 0;
+ bitsSave = nullptr;
}
void MyBitmap::DrawText(wchar_t *str, int x, int y)
@@ -140,10 +140,10 @@ bool MyBitmap::loadFromFile(wchar_t *fn)
}
BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm);
- SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, NULL);
+ SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr);
SIZE sz;
- HDC dcTmp = CreateCompatibleDC(0);
+ HDC dcTmp = CreateCompatibleDC(nullptr);
GetBitmapDimensionEx(hBmpLoaded, &sz);
HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded);
@@ -180,8 +180,8 @@ void MyBitmap::allocate(int w, int h)
DeleteDC(dcBmp);
}
- hBmp = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void**)&bits, 0, 0);
- dcBmp = CreateCompatibleDC(0);
+ hBmp = (HBITMAP)CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, (void**)&bits, nullptr, 0);
+ dcBmp = CreateCompatibleDC(nullptr);
hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmp);
}
@@ -190,9 +190,9 @@ void MyBitmap::free()
DeleteObject(SelectObject(dcBmp, hBmpSave));
DeleteDC(dcBmp);
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
}
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp
index 4b0203cf0e..3b453000be 100644
--- a/plugins/SplashScreen/src/main.cpp
+++ b/plugins/SplashScreen/src/main.cpp
@@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "stdafx.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hInst = 0;
+HINSTANCE hInst = nullptr;
int hLangpack;
-static HMODULE hAdvaimg = NULL;
+static HMODULE hAdvaimg = nullptr;
BOOL bstartup = true; // startup?
BOOL bserviceinvoked = false;
@@ -100,9 +100,9 @@ void SplashMain()
ExpandEnvironmentStrings(inBuf, szExpandedSplashFile, _countof(szExpandedSplashFile));
mir_wstrcpy(inBuf, szExpandedSplashFile);
- wchar_t *pos3 = 0;
+ wchar_t *pos3 = nullptr;
pos3 = wcsrchr(inBuf, ':');
- if (pos3 == NULL)
+ if (pos3 == nullptr)
mir_snwprintf(szSplashFile, L"%s\\%s", szMirDir, inBuf);
else
mir_wstrcpy(szSplashFile, inBuf);
@@ -119,7 +119,7 @@ void SplashMain()
wchar_t *pos2;
pos2 = wcschr(inBuf, ':');
- if (pos2 == NULL)
+ if (pos2 == nullptr)
mir_snwprintf(szSoundFile, L"%s\\%s", szMirDir, inBuf);
else
mir_wstrcpy(szSoundFile, inBuf);
@@ -134,7 +134,7 @@ void SplashMain()
{
int filescount = 0;
wchar_t szSplashDir[MAX_PATH] = { 0 }, szSearch[MAX_PATH] = { 0 };
- wchar_t *p = 0;
+ wchar_t *p = nullptr;
wchar_t files[255][50]; //TODO: make memory allocation dynamic
mir_wstrcpy(szSplashDir, szSplashFile);
@@ -173,7 +173,7 @@ void SplashMain()
} //if
} while (FindNextFile(hFind, &ffd));
- srand((unsigned)time(NULL));
+ srand((unsigned)time(nullptr));
int r = 0;
if (filescount) r = (rand() % filescount) + 1;
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp
index b4c51f74a8..52ee655d78 100644
--- a/plugins/SplashScreen/src/options.cpp
+++ b/plugins/SplashScreen/src/options.cpp
@@ -171,7 +171,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (Exists(szSplashFile)) {
mir_wstrcpy(initDir, szSplashFile);
wchar_t *pos = wcsrchr(initDir, '\\');
- if (pos != NULL)
+ if (pos != nullptr)
*pos = 0;
}
else {
@@ -205,7 +205,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (result && mir_wstrlen(szPath2Spash) > 0) {
if (options.random) {
wchar_t *pos = wcsrchr(szPath2Spash, '\\');
- if (pos != NULL) {
+ if (pos != nullptr) {
*pos = 0;
mir_wstrcat(szPath2Spash, L"\\");
}
@@ -228,7 +228,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (Exists(szSoundFile)) {
mir_wstrcpy(initDir, szSoundFile);
pos = wcsrchr(initDir, '\\');
- if (pos != NULL) *pos = 0;
+ if (pos != nullptr) *pos = 0;
}
else {
szMirDir = Utils_ReplaceVarsW(L"%miranda_path%");
@@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
wchar_t tmp[MAX_PATH];
mir_snwprintf(tmp, L"%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c", TranslateT("Sound Files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = szTempPath;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
diff --git a/plugins/SplashScreen/src/services.cpp b/plugins/SplashScreen/src/services.cpp
index 8b9f6e4caf..efc798ba46 100644
--- a/plugins/SplashScreen/src/services.cpp
+++ b/plugins/SplashScreen/src/services.cpp
@@ -30,7 +30,7 @@ INT_PTR ShowSplashService(WPARAM wparam, LPARAM lparam)
options.showtime = timetoshow;
wchar_t *pos = wcsrchr(filename, ':');
- if (pos == NULL)
+ if (pos == nullptr)
mir_snwprintf(szSplashFile, L"%s\\%s", szMirDir, filename);
else
mir_wstrcpy(szSplashFile, filename);
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp
index fa5f838ab2..c8f8c874ba 100644
--- a/plugins/SplashScreen/src/splash.cpp
+++ b/plugins/SplashScreen/src/splash.cpp
@@ -31,7 +31,7 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
#endif
if (!options.showtime)
- SetTimer(hwnd, 7, 2000, 0);
+ SetTimer(hwnd, 7, 2000, nullptr);
break;
case WM_LBUTTONDOWN:
@@ -90,7 +90,7 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
int i;
for (i = 255; i >= 0; i -= options.fosteps) {
blend.SourceConstantAlpha = i;
- UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ UpdateLayeredWindow(hwndSplash, nullptr, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
Sleep(1);
}
}
@@ -121,21 +121,21 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
void __cdecl SplashThread(void *arg)
{
- IGraphBuilder *pGraph = NULL;
- IMediaControl *pControl = NULL;
+ IGraphBuilder *pGraph = nullptr;
+ IMediaControl *pControl = nullptr;
if (options.playsnd) {
// Initialize the COM library.
- CoInitialize(NULL);
+ CoInitialize(nullptr);
// Create the filter graph manager and query for interfaces.
- CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
+ CoCreateInstance(CLSID_FilterGraph, nullptr, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
// Get MediaControl Interface
pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
// Build the graph. IMPORTANT: Change this string to a file on your system.
- pGraph->RenderFile(szSoundFile, NULL);
+ pGraph->RenderFile(szSoundFile, nullptr);
// Run the graph.
pControl->Run();
@@ -148,12 +148,12 @@ void __cdecl SplashThread(void *arg)
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hInstance = hInst;
- wcl.hIcon = NULL;
- wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcl.hIcon = nullptr;
+ wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
- wcl.lpszMenuName = NULL;
+ wcl.lpszMenuName = nullptr;
wcl.lpszClassName = SPLASH_CLASS;
- wcl.hIconSm = NULL;
+ wcl.hIconSm = nullptr;
RegisterClassEx(&wcl);
RECT DesktopRect;
@@ -173,16 +173,16 @@ void __cdecl SplashThread(void *arg)
hwndSplash = CreateWindowEx(
WS_EX_TOOLWINDOW | WS_EX_TOPMOST,//dwStyleEx
SPLASH_CLASS, //Class name
- NULL, //Title
+ nullptr, //Title
DS_SETFONT | DS_FIXEDSYS | WS_POPUP, //dwStyle
WindowRect.left, // x
WindowRect.top, // y
SplashBmp->getWidth(), // Width
SplashBmp->getHeight(), // Height
HWND_DESKTOP, //Parent
- NULL, //menu handle
+ nullptr, //menu handle
hInst, //Instance
- NULL);
+ nullptr);
RECT rc; GetWindowRect(hwndSplash, &rc);
POINT ptDst = { rc.left, rc.top };
@@ -248,7 +248,7 @@ void __cdecl SplashThread(void *arg)
}
SetWindowLongPtr(hwndSplash, GWL_EXSTYLE, GetWindowLongPtr(hwndSplash, GWL_EXSTYLE) | WS_EX_LAYERED);
- UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ UpdateLayeredWindow(hwndSplash, nullptr, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
ShowWindow(hwndSplash, SW_SHOWNORMAL);
@@ -256,15 +256,15 @@ void __cdecl SplashThread(void *arg)
// Fade in
for (int i = 0; i < 255; i += options.fisteps) {
blend.SourceConstantAlpha = i;
- UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ UpdateLayeredWindow(hwndSplash, nullptr, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
Sleep(1);
}
}
blend.SourceConstantAlpha = 255;
- UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ UpdateLayeredWindow(hwndSplash, nullptr, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
if (DWORD_PTR(arg) > 0) {
- if (SetTimer(hwndSplash, 6, DWORD_PTR(arg), 0)) {
+ if (SetTimer(hwndSplash, 6, DWORD_PTR(arg), nullptr)) {
#ifdef _DEBUG
logMessage(L"Timer TimeToShow", L"set");
#endif
@@ -272,7 +272,7 @@ void __cdecl SplashThread(void *arg)
}
else
if (bmodulesloaded) {
- if (SetTimer(hwndSplash, 8, 2000, 0)) {
+ if (SetTimer(hwndSplash, 8, 2000, nullptr)) {
#ifdef _DEBUG
logMessage(L"Timer Modules loaded", L"set");
#endif
@@ -281,7 +281,7 @@ void __cdecl SplashThread(void *arg)
// The Message Pump
MSG msg;
- while (GetMessage(&msg, NULL, 0, 0) == TRUE) //NULL means every window in the thread; == TRUE means a safe pump.
+ while (GetMessage(&msg, nullptr, 0, 0) == TRUE) //NULL means every window in the thread; == TRUE means a safe pump.
{
TranslateMessage(&msg);
DispatchMessage(&msg);